summaryrefslogtreecommitdiffstats
path: root/dom/tests
diff options
context:
space:
mode:
Diffstat (limited to 'dom/tests')
-rw-r--r--dom/tests/browser/.eslintrc.js12
-rw-r--r--dom/tests/browser/beforeunload_test_page.html92
-rw-r--r--dom/tests/browser/browser.ini140
-rw-r--r--dom/tests/browser/browser_ConsoleAPI_originAttributes.js108
-rw-r--r--dom/tests/browser/browser_ConsoleStorageAPITests.js108
-rw-r--r--dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js93
-rw-r--r--dom/tests/browser/browser_autofocus_background.js59
-rw-r--r--dom/tests/browser/browser_autofocus_preference.js16
-rw-r--r--dom/tests/browser/browser_beforeunload_between_chrome_content.js152
-rw-r--r--dom/tests/browser/browser_bug1004814.js46
-rw-r--r--dom/tests/browser/browser_bug1008941_dismissGeolocationHanger.js39
-rw-r--r--dom/tests/browser/browser_bug1236512.js116
-rw-r--r--dom/tests/browser/browser_bug1238427.js40
-rw-r--r--dom/tests/browser/browser_bug1316330.js52
-rw-r--r--dom/tests/browser/browser_bug1563629.js79
-rw-r--r--dom/tests/browser/browser_bug1685807.js78
-rw-r--r--dom/tests/browser/browser_bug1709346.js48
-rw-r--r--dom/tests/browser/browser_bug396843.js337
-rw-r--r--dom/tests/browser/browser_bytecode_cache_asm_js.js31
-rw-r--r--dom/tests/browser/browser_cancel_keydown_keypress_event.js41
-rw-r--r--dom/tests/browser/browser_data_document_crossOriginIsolated.js68
-rw-r--r--dom/tests/browser/browser_focus_steal_from_chrome.js214
-rw-r--r--dom/tests/browser/browser_focus_steal_from_chrome_during_mousedown.js76
-rw-r--r--dom/tests/browser/browser_form_associated_custom_elements_validity.js111
-rw-r--r--dom/tests/browser/browser_frame_elements.html15
-rw-r--r--dom/tests/browser/browser_frame_elements.js74
-rw-r--r--dom/tests/browser/browser_hasActivePeerConnections.js134
-rw-r--r--dom/tests/browser/browser_hasbeforeunload.js875
-rw-r--r--dom/tests/browser/browser_keypressTelemetry.js69
-rw-r--r--dom/tests/browser/browser_localStorage_e10s.js284
-rw-r--r--dom/tests/browser/browser_localStorage_fis.js529
-rw-r--r--dom/tests/browser/browser_localStorage_privatestorageevent.js87
-rw-r--r--dom/tests/browser/browser_localStorage_snapshotting.js774
-rw-r--r--dom/tests/browser/browser_navigate_replace_browsingcontext.js23
-rw-r--r--dom/tests/browser/browser_noopener.js182
-rw-r--r--dom/tests/browser/browser_noopener_null_uri.js15
-rw-r--r--dom/tests/browser/browser_persist_cookies.js128
-rw-r--r--dom/tests/browser/browser_persist_cross_origin_iframe.js198
-rw-r--r--dom/tests/browser/browser_persist_image_accept.js140
-rw-r--r--dom/tests/browser/browser_persist_mixed_content_image.js109
-rw-r--r--dom/tests/browser/browser_pointerlock_warning.js129
-rw-r--r--dom/tests/browser/browser_sessionStorage_navigation.js271
-rw-r--r--dom/tests/browser/browser_test_focus_after_modal_state.js71
-rw-r--r--dom/tests/browser/browser_test_new_window_from_content.js221
-rw-r--r--dom/tests/browser/browser_test_toolbars_visibility.js323
-rw-r--r--dom/tests/browser/browser_unlinkable_about_page_can_load_module_scripts.js83
-rw-r--r--dom/tests/browser/browser_wakelock.js40
-rw-r--r--dom/tests/browser/browser_windowProxy_transplant.js215
-rw-r--r--dom/tests/browser/browser_xhr_sandbox.js62
-rw-r--r--dom/tests/browser/create_webrtc_peer_connection.html28
-rw-r--r--dom/tests/browser/dummy.html13
-rw-r--r--dom/tests/browser/dummy.pngbin0 -> 703 bytes
-rw-r--r--dom/tests/browser/file_bug1685807.html12
-rw-r--r--dom/tests/browser/file_coop_coep.html6
-rw-r--r--dom/tests/browser/file_coop_coep.html^headers^2
-rw-r--r--dom/tests/browser/file_empty.html0
-rw-r--r--dom/tests/browser/file_empty_cross_site_frame.html2
-rw-r--r--dom/tests/browser/file_load_module_script.html8
-rw-r--r--dom/tests/browser/file_module_loaded.js6
-rw-r--r--dom/tests/browser/file_module_loaded2.js3
-rw-r--r--dom/tests/browser/file_postMessage_parent.html48
-rw-r--r--dom/tests/browser/focus_after_prompt.html18
-rw-r--r--dom/tests/browser/geo_leak_test.html17
-rw-r--r--dom/tests/browser/helper_localStorage.js302
-rw-r--r--dom/tests/browser/image.html2
-rw-r--r--dom/tests/browser/load_forever.sjs15
-rw-r--r--dom/tests/browser/mimeme.sjs32
-rw-r--r--dom/tests/browser/page_bytecode_cache_asm_js.html10
-rw-r--r--dom/tests/browser/page_bytecode_cache_asm_js.js30
-rw-r--r--dom/tests/browser/page_localStorage.js127
-rw-r--r--dom/tests/browser/page_localstorage.html8
-rw-r--r--dom/tests/browser/page_localstorage_coop+coep.html8
-rw-r--r--dom/tests/browser/page_localstorage_coop+coep.html^headers^2
-rw-r--r--dom/tests/browser/page_localstorage_snapshotting.html68
-rw-r--r--dom/tests/browser/page_privatestorageevent.html5
-rw-r--r--dom/tests/browser/perfmetrics/browser.ini21
-rw-r--r--dom/tests/browser/perfmetrics/browser_test_performance_metrics.js201
-rw-r--r--dom/tests/browser/perfmetrics/browser_test_unresponsive.js31
-rw-r--r--dom/tests/browser/perfmetrics/dummy.html13
-rw-r--r--dom/tests/browser/perfmetrics/hello.oggbin0 -> 11328 bytes
-rw-r--r--dom/tests/browser/perfmetrics/ping_worker.html26
-rw-r--r--dom/tests/browser/perfmetrics/ping_worker.js11
-rw-r--r--dom/tests/browser/perfmetrics/ping_worker2.html20
-rw-r--r--dom/tests/browser/perfmetrics/setinterval.html19
-rw-r--r--dom/tests/browser/perfmetrics/settimeout.html17
-rw-r--r--dom/tests/browser/perfmetrics/shared_worker.js7
-rw-r--r--dom/tests/browser/perfmetrics/sound.html14
-rw-r--r--dom/tests/browser/perfmetrics/unresponsive.html21
-rw-r--r--dom/tests/browser/position.html31
-rw-r--r--dom/tests/browser/prevent_return_key.html34
-rw-r--r--dom/tests/browser/set-samesite-cookies-and-redirect.sjs43
-rw-r--r--dom/tests/browser/test-console-api.html78
-rw-r--r--dom/tests/browser/test_bug1004814.html8
-rw-r--r--dom/tests/browser/test_mixed_content_image.html1
-rw-r--r--dom/tests/browser/test_new_window_from_content_child.html25
-rw-r--r--dom/tests/browser/test_noopener_source.html15
-rw-r--r--dom/tests/browser/test_noopener_target.html9
-rw-r--r--dom/tests/browser/worker_bug1004814.js6
-rw-r--r--dom/tests/mochitest/ajax/jquery/ChangeLog.txt98
-rw-r--r--dom/tests/mochitest/ajax/jquery/GPL-LICENSE.txt278
-rw-r--r--dom/tests/mochitest/ajax/jquery/MIT-LICENSE.txt20
-rw-r--r--dom/tests/mochitest/ajax/jquery/dist/jquery.js3549
-rw-r--r--dom/tests/mochitest/ajax/jquery/manifest.json1
-rw-r--r--dom/tests/mochitest/ajax/jquery/mochitest.ini37
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/cow.jpgbin0 -> 1635 bytes
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/dashboard.xml11
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/iframe.html8
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/json_assigned_obj.js1
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/json_obj.js1
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/name.html1
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/offset/absolute.html39
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/offset/fixed.html33
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html31
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/offset/scroll.html39
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/offset/static.html31
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/offset/table.html43
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/test.html7
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/test.js3
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/test2.html5
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/test3.html3
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/testrunner.js334
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/testsuite.css117
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/data/with_fries.xml25
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/fix.html48
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/index.html187
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/offset.html27
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/test.js41
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/unit/ajax.js837
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/unit/core.js1700
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/unit/dimensions.js86
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/unit/event.js348
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/unit/fx.js435
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/unit/offset.js164
-rw-r--r--dom/tests/mochitest/ajax/jquery/test/unit/selector.js224
-rw-r--r--dom/tests/mochitest/ajax/jquery/test_jQuery.html24
-rw-r--r--dom/tests/mochitest/ajax/jquery/version.txt1
-rw-r--r--dom/tests/mochitest/ajax/lib/AJAX_setup.js35
-rw-r--r--dom/tests/mochitest/ajax/lib/test.css28
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Async.js699
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Base.js1412
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Color.js902
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Controls.js1388
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/DOM.js1276
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/DateTime.js216
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/DragAndDrop.js824
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Format.js304
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Iter.js851
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Logging.js321
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/LoggingPane.js374
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/MochiKit.js154
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/MockDOM.js115
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Position.js258
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Selector.js431
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Signal.js899
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Sortable.js589
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Style.js445
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Test.js181
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/Visual.js1981
-rw-r--r--dom/tests/mochitest/ajax/mochikit/MochiKit/__package__.js18
-rw-r--r--dom/tests/mochitest/ajax/mochikit/manifest.json1
-rw-r--r--dom/tests/mochitest/ajax/mochikit/mochitest.ini26
-rw-r--r--dom/tests/mochitest/ajax/mochikit/test_Mochikit.html15
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/FakeJSAN.js40
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Async.html408
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Base.html34
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Color.html84
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DOM.html316
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DateTime.html39
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DragAndDrop.html54
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Format.html39
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Iter.html38
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-JSAN.html32
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Logging.html40
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-MochiKit.html18
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Selector.html274
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Signal.html43
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Style.html141
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Visual.html190
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/SimpleTest.js473
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/TestRunner.js177
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/test.css28
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/cli.js6
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/index.html25
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/standalone.js16
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_Base.js509
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_Color.js137
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_DateTime.js45
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_DragAndDrop.js30
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_Format.js80
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_Iter.js176
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_Logging.js75
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_MochiKit-Async.json1
-rw-r--r--dom/tests/mochitest/ajax/mochikit/tests/test_Signal.js441
-rw-r--r--dom/tests/mochitest/ajax/prototype/dist/prototype.js4681
-rw-r--r--dom/tests/mochitest/ajax/prototype/dist/prototype_update_helper.js417
-rw-r--r--dom/tests/mochitest/ajax/prototype/manifest.json1
-rw-r--r--dom/tests/mochitest/ajax/prototype/mochitest.ini67
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/browser.html229
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/console.html110
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/functional/event.html243
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/lib/unittest.js602
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/test.css50
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/ajax_test.js286
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/array_test.js190
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/base_test.js511
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/dom_test.js1404
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/element_mixins_test.js32
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/enumerable_test.js263
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/event_test.js286
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.html2
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.js42
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/array.html1
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.html6
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.js106
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/content.html1
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/data.json1
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.css85
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.html285
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.js17
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.html4
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.js2
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.html0
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.js1
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.html8
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.js23
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/event.html4
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/form.html112
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hash.js25
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hello.js1
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/logo.gifbin0 -> 3502 bytes
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/position.html9
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/selector.html69
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/string.js8
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/fixtures/unittest.html18
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/form_test.js384
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/hash_test.js178
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/number_test.js44
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/position_test.js44
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/range_test.js58
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/selector_test.js377
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/string_test.js540
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/ajax_test.html42
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/array_test.html39
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/base_test.html45
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/dom_test.html326
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/element_mixins_test.html43
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/enumerable_test.html48
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/event_test.html42
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/form_test.html150
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/hash_test.html40
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/number_test.html38
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/position_test.html47
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/range_test.html38
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/selector_test.html107
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/string_test.html40
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/tmp/unit_test.html56
-rw-r--r--dom/tests/mochitest/ajax/prototype/test/unit/unittest_test.js143
-rw-r--r--dom/tests/mochitest/ajax/prototype/test_Prototype.html15
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/lib/prototype.js3271
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/manifest.json1
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/mochitest.ini33
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/builder.js136
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/controls.js875
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/dragdrop.js970
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/effects.js1094
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/scriptaculous.js58
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/slider.js277
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/sound.js60
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/src/unittest.js586
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_result.html1
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_text.html1
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_updater_result.html20
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result.html11
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result_nobr.html1
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_autocompleter_test.html232
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_inplaceeditor_test.html152
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/bdd_test.html138
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/builder_test.html258
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html131
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/effects_test.html250
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/element_test.html104
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/icon.pngbin0 -> 281 bytes
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/loading_test.html41
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/position_clone_test.html312
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/slider_test.html438
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/sortable_test.html205
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html67
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test/unit/unit_test.html154
-rw-r--r--dom/tests/mochitest/ajax/scriptaculous/test_Scriptaculous.html15
-rw-r--r--dom/tests/mochitest/beacon/beacon-frame.html24
-rw-r--r--dom/tests/mochitest/beacon/beacon-handler.sjs149
-rw-r--r--dom/tests/mochitest/beacon/beacon-originheader-handler.sjs45
-rw-r--r--dom/tests/mochitest/beacon/beacon-preflight-handler.sjs38
-rw-r--r--dom/tests/mochitest/beacon/beacon-redirect-handler.sjs46
-rw-r--r--dom/tests/mochitest/beacon/beacon-set-cookie.sjs10
-rw-r--r--dom/tests/mochitest/beacon/chrome.ini10
-rw-r--r--dom/tests/mochitest/beacon/file_beaconCookies.html8
-rw-r--r--dom/tests/mochitest/beacon/file_beaconSafelist.html11
-rw-r--r--dom/tests/mochitest/beacon/mochitest.ini22
-rw-r--r--dom/tests/mochitest/beacon/test_beacon.html60
-rw-r--r--dom/tests/mochitest/beacon/test_beaconContentPolicy.html103
-rw-r--r--dom/tests/mochitest/beacon/test_beaconCookies.html82
-rw-r--r--dom/tests/mochitest/beacon/test_beaconFrame.html118
-rw-r--r--dom/tests/mochitest/beacon/test_beaconOriginHeader.html66
-rw-r--r--dom/tests/mochitest/beacon/test_beaconPreflightWithCustomContentType.html57
-rw-r--r--dom/tests/mochitest/beacon/test_beaconRedirect.html57
-rw-r--r--dom/tests/mochitest/beacon/test_beaconWithSafelistedContentType.html102
-rw-r--r--dom/tests/mochitest/bugs/bug289714.sjs16
-rw-r--r--dom/tests/mochitest/bugs/bug346659-echoer.html4
-rw-r--r--dom/tests/mochitest/bugs/bug346659-opener-echoer.html6
-rw-r--r--dom/tests/mochitest/bugs/bug346659-opener.html9
-rw-r--r--dom/tests/mochitest/bugs/bug346659-parent-echoer.html5
-rw-r--r--dom/tests/mochitest/bugs/bug346659-parent.html11
-rw-r--r--dom/tests/mochitest/bugs/bug458091_child.html13
-rw-r--r--dom/tests/mochitest/bugs/child_bug260264.html11
-rw-r--r--dom/tests/mochitest/bugs/devicemotion_inner.html10
-rw-r--r--dom/tests/mochitest/bugs/devicemotion_outer.html19
-rw-r--r--dom/tests/mochitest/bugs/file1_bug414291.html1
-rw-r--r--dom/tests/mochitest/bugs/file2_bug414291.html1
-rw-r--r--dom/tests/mochitest/bugs/file3_bug414291.html1
-rw-r--r--dom/tests/mochitest/bugs/file_bug593174_1.html5
-rw-r--r--dom/tests/mochitest/bugs/file_bug593174_2.html30
-rw-r--r--dom/tests/mochitest/bugs/file_bug809290_b1.html14
-rw-r--r--dom/tests/mochitest/bugs/file_bug809290_b2.html14
-rw-r--r--dom/tests/mochitest/bugs/file_bug809290_c.html10
-rw-r--r--dom/tests/mochitest/bugs/file_bug873229.js6
-rw-r--r--dom/tests/mochitest/bugs/file_bug927901.html18
-rw-r--r--dom/tests/mochitest/bugs/file_cookieOutputter.html13
-rw-r--r--dom/tests/mochitest/bugs/file_empty.html2
-rw-r--r--dom/tests/mochitest/bugs/file_prime_cookie.html14
-rw-r--r--dom/tests/mochitest/bugs/file_redirector.sjs9
-rw-r--r--dom/tests/mochitest/bugs/file_resize_move_windows_1.html20
-rw-r--r--dom/tests/mochitest/bugs/file_resize_move_windows_2.html13
-rw-r--r--dom/tests/mochitest/bugs/file_window_bar.html7
-rw-r--r--dom/tests/mochitest/bugs/grandchild_bug260264.html18
-rw-r--r--dom/tests/mochitest/bugs/iframe_bug304459-1.html12
-rw-r--r--dom/tests/mochitest/bugs/iframe_bug304459-2.html18
-rw-r--r--dom/tests/mochitest/bugs/iframe_bug430276-2.html23
-rw-r--r--dom/tests/mochitest/bugs/iframe_bug430276.html21
-rw-r--r--dom/tests/mochitest/bugs/iframe_bug440572.html23
-rw-r--r--dom/tests/mochitest/bugs/iframe_bug49312.html7
-rw-r--r--dom/tests/mochitest/bugs/iframe_domparser_after_blank.html22
-rw-r--r--dom/tests/mochitest/bugs/mochitest.ini192
-rw-r--r--dom/tests/mochitest/bugs/test1_bug369306.html1
-rw-r--r--dom/tests/mochitest/bugs/test1_bug622361.html1
-rw-r--r--dom/tests/mochitest/bugs/test2_bug369306.html1
-rw-r--r--dom/tests/mochitest/bugs/test2_bug622361.html1
-rw-r--r--dom/tests/mochitest/bugs/test_DOMWindowCreated_chromeonly.html15
-rw-r--r--dom/tests/mochitest/bugs/test_bug1022869.html39
-rw-r--r--dom/tests/mochitest/bugs/test_bug1112040.html32
-rw-r--r--dom/tests/mochitest/bugs/test_bug1160342_marquee.html288
-rw-r--r--dom/tests/mochitest/bugs/test_bug1171215.html66
-rw-r--r--dom/tests/mochitest/bugs/test_bug132255.html39
-rw-r--r--dom/tests/mochitest/bugs/test_bug1530292.html47
-rw-r--r--dom/tests/mochitest/bugs/test_bug1551425_reference_to_childnodes_nodelist_keeps_childnodes_alive.html37
-rw-r--r--dom/tests/mochitest/bugs/test_bug159849.html44
-rw-r--r--dom/tests/mochitest/bugs/test_bug1774135.html114
-rw-r--r--dom/tests/mochitest/bugs/test_bug260264.html198
-rw-r--r--dom/tests/mochitest/bugs/test_bug260264_nested.html138
-rw-r--r--dom/tests/mochitest/bugs/test_bug265203.html108
-rw-r--r--dom/tests/mochitest/bugs/test_bug289714.html44
-rw-r--r--dom/tests/mochitest/bugs/test_bug291377.html40
-rw-r--r--dom/tests/mochitest/bugs/test_bug304459.html47
-rw-r--r--dom/tests/mochitest/bugs/test_bug308856.html42
-rw-r--r--dom/tests/mochitest/bugs/test_bug327891.html33
-rw-r--r--dom/tests/mochitest/bugs/test_bug333983.html35
-rw-r--r--dom/tests/mochitest/bugs/test_bug335976.xhtml68
-rw-r--r--dom/tests/mochitest/bugs/test_bug342448.html36
-rw-r--r--dom/tests/mochitest/bugs/test_bug345521.html36
-rw-r--r--dom/tests/mochitest/bugs/test_bug346659.html207
-rw-r--r--dom/tests/mochitest/bugs/test_bug369306.html137
-rw-r--r--dom/tests/mochitest/bugs/test_bug370098.html50
-rw-r--r--dom/tests/mochitest/bugs/test_bug377539.html55
-rw-r--r--dom/tests/mochitest/bugs/test_bug384122.html32
-rw-r--r--dom/tests/mochitest/bugs/test_bug389366.html65
-rw-r--r--dom/tests/mochitest/bugs/test_bug393974.html68
-rw-r--r--dom/tests/mochitest/bugs/test_bug394769.html42
-rw-r--r--dom/tests/mochitest/bugs/test_bug396843.html240
-rw-r--r--dom/tests/mochitest/bugs/test_bug400204.html64
-rw-r--r--dom/tests/mochitest/bugs/test_bug404748.html31
-rw-r--r--dom/tests/mochitest/bugs/test_bug414291.html28
-rw-r--r--dom/tests/mochitest/bugs/test_bug42976.html81
-rw-r--r--dom/tests/mochitest/bugs/test_bug430276.html41
-rw-r--r--dom/tests/mochitest/bugs/test_bug440572.html54
-rw-r--r--dom/tests/mochitest/bugs/test_bug456151.html73
-rw-r--r--dom/tests/mochitest/bugs/test_bug458091.html100
-rw-r--r--dom/tests/mochitest/bugs/test_bug459848.html60
-rw-r--r--dom/tests/mochitest/bugs/test_bug465263.html49
-rw-r--r--dom/tests/mochitest/bugs/test_bug484775.html55
-rw-r--r--dom/tests/mochitest/bugs/test_bug492925.html45
-rw-r--r--dom/tests/mochitest/bugs/test_bug49312.html47
-rw-r--r--dom/tests/mochitest/bugs/test_bug495219.html27
-rw-r--r--dom/tests/mochitest/bugs/test_bug529328.html122
-rw-r--r--dom/tests/mochitest/bugs/test_bug531176.html66
-rw-r--r--dom/tests/mochitest/bugs/test_bug531542.html40
-rw-r--r--dom/tests/mochitest/bugs/test_bug534149.html85
-rw-r--r--dom/tests/mochitest/bugs/test_bug541530.html92
-rw-r--r--dom/tests/mochitest/bugs/test_bug545314.html29
-rw-r--r--dom/tests/mochitest/bugs/test_bug548828.html37
-rw-r--r--dom/tests/mochitest/bugs/test_bug558973.html42
-rw-r--r--dom/tests/mochitest/bugs/test_bug562433.html35
-rw-r--r--dom/tests/mochitest/bugs/test_bug563487.html34
-rw-r--r--dom/tests/mochitest/bugs/test_bug581072.html47
-rw-r--r--dom/tests/mochitest/bugs/test_bug583225.html41
-rw-r--r--dom/tests/mochitest/bugs/test_bug585240.html33
-rw-r--r--dom/tests/mochitest/bugs/test_bug585819.html38
-rw-r--r--dom/tests/mochitest/bugs/test_bug593174.html85
-rw-r--r--dom/tests/mochitest/bugs/test_bug61098.html370
-rw-r--r--dom/tests/mochitest/bugs/test_bug612267.html27
-rw-r--r--dom/tests/mochitest/bugs/test_bug617296.html27
-rw-r--r--dom/tests/mochitest/bugs/test_bug620947.html31
-rw-r--r--dom/tests/mochitest/bugs/test_bug622361.html53
-rw-r--r--dom/tests/mochitest/bugs/test_bug633133.html47
-rw-r--r--dom/tests/mochitest/bugs/test_bug642026.html56
-rw-r--r--dom/tests/mochitest/bugs/test_bug648465.html33
-rw-r--r--dom/tests/mochitest/bugs/test_bug654137.html25
-rw-r--r--dom/tests/mochitest/bugs/test_bug664737.html39
-rw-r--r--dom/tests/mochitest/bugs/test_bug665548.html28
-rw-r--r--dom/tests/mochitest/bugs/test_bug684544.html54
-rw-r--r--dom/tests/mochitest/bugs/test_bug691707.html36
-rw-r--r--dom/tests/mochitest/bugs/test_bug698061.html40
-rw-r--r--dom/tests/mochitest/bugs/test_bug698551.html39
-rw-r--r--dom/tests/mochitest/bugs/test_bug707749.html34
-rw-r--r--dom/tests/mochitest/bugs/test_bug739038.html44
-rw-r--r--dom/tests/mochitest/bugs/test_bug740811.html27
-rw-r--r--dom/tests/mochitest/bugs/test_bug743615.html83
-rw-r--r--dom/tests/mochitest/bugs/test_bug755320.html30
-rw-r--r--dom/tests/mochitest/bugs/test_bug777628.html42
-rw-r--r--dom/tests/mochitest/bugs/test_bug809290.html54
-rw-r--r--dom/tests/mochitest/bugs/test_bug817476.html45
-rw-r--r--dom/tests/mochitest/bugs/test_bug823173.html30
-rw-r--r--dom/tests/mochitest/bugs/test_bug848088.html48
-rw-r--r--dom/tests/mochitest/bugs/test_bug850517.html47
-rw-r--r--dom/tests/mochitest/bugs/test_bug857555.html33
-rw-r--r--dom/tests/mochitest/bugs/test_bug862540.html31
-rw-r--r--dom/tests/mochitest/bugs/test_bug873229.html83
-rw-r--r--dom/tests/mochitest/bugs/test_bug876098.html52
-rw-r--r--dom/tests/mochitest/bugs/test_bug927901.html40
-rw-r--r--dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html35
-rw-r--r--dom/tests/mochitest/bugs/test_domparser_after_blank.html33
-rw-r--r--dom/tests/mochitest/bugs/test_errorReporting.html72
-rw-r--r--dom/tests/mochitest/bugs/test_instanceof_error_message.html111
-rw-r--r--dom/tests/mochitest/bugs/test_navigator_buildID.html93
-rw-r--r--dom/tests/mochitest/bugs/test_no_find_showDialog.html88
-rw-r--r--dom/tests/mochitest/bugs/test_onerror_message.html97
-rw-r--r--dom/tests/mochitest/bugs/test_postmessage.html65
-rw-r--r--dom/tests/mochitest/bugs/test_protochains.html59
-rw-r--r--dom/tests/mochitest/bugs/test_resize_move_windows.html349
-rw-r--r--dom/tests/mochitest/bugs/test_sizetocontent_clamp.html75
-rw-r--r--dom/tests/mochitest/bugs/test_toJSON.html71
-rw-r--r--dom/tests/mochitest/bugs/test_window_bar.html151
-rw-r--r--dom/tests/mochitest/bugs/utils_bug260264.js69
-rw-r--r--dom/tests/mochitest/bugs/utils_bug743615.js30
-rw-r--r--dom/tests/mochitest/bugs/window_bug1171215.html86
-rw-r--r--dom/tests/mochitest/bugs/worker_bug743615.js44
-rw-r--r--dom/tests/mochitest/chrome/489127.html268
-rw-r--r--dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xhtml33
-rw-r--r--dom/tests/mochitest/chrome/DOMWindowCreated_content.html9
-rw-r--r--dom/tests/mochitest/chrome/child_focus_frame.html57
-rw-r--r--dom/tests/mochitest/chrome/chrome.ini91
-rw-r--r--dom/tests/mochitest/chrome/file_DOM_element_instanceof.xhtml32
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-1_modal.xhtml34
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xhtml28
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-2_modal.xhtml36
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xhtml42
-rw-r--r--dom/tests/mochitest/chrome/file_bug800817.xhtml79
-rw-r--r--dom/tests/mochitest/chrome/file_bug830858.xhtml66
-rw-r--r--dom/tests/mochitest/chrome/file_clipboard_events_chrome.html1
-rw-r--r--dom/tests/mochitest/chrome/file_popup_blocker_chrome.html6
-rw-r--r--dom/tests/mochitest/chrome/file_resize_move_windows_1.html19
-rw-r--r--dom/tests/mochitest/chrome/file_resize_move_windows_2.html8
-rw-r--r--dom/tests/mochitest/chrome/file_subscript_bindings.js1
-rw-r--r--dom/tests/mochitest/chrome/focus_dialog.xhtml71
-rw-r--r--dom/tests/mochitest/chrome/focus_frameset.html25
-rw-r--r--dom/tests/mochitest/chrome/focus_window2.xhtml26
-rw-r--r--dom/tests/mochitest/chrome/queryCaretRectUnix.html209
-rw-r--r--dom/tests/mochitest/chrome/queryCaretRectWin.html218
-rw-r--r--dom/tests/mochitest/chrome/selectAtPoint-innerframe.html6
-rw-r--r--dom/tests/mochitest/chrome/selectAtPoint.html278
-rw-r--r--dom/tests/mochitest/chrome/sizemode_attribute.xhtml87
-rw-r--r--dom/tests/mochitest/chrome/test_DOMWindowCreated.xhtml29
-rw-r--r--dom/tests/mochitest/chrome/test_DOM_element_instanceof.xhtml34
-rw-r--r--dom/tests/mochitest/chrome/test_activation.xhtml42
-rw-r--r--dom/tests/mochitest/chrome/test_bug1224790-1.xhtml69
-rw-r--r--dom/tests/mochitest/chrome/test_bug1224790-2.xhtml70
-rw-r--r--dom/tests/mochitest/chrome/test_bug800817.xhtml43
-rw-r--r--dom/tests/mochitest/chrome/test_bug830858.xhtml36
-rw-r--r--dom/tests/mochitest/chrome/test_callback_wrapping.xhtml22
-rw-r--r--dom/tests/mochitest/chrome/test_clipboard_events_chrome.html60
-rw-r--r--dom/tests/mochitest/chrome/test_clonewrapper.xhtml117
-rw-r--r--dom/tests/mochitest/chrome/test_cyclecollector.xhtml54
-rw-r--r--dom/tests/mochitest/chrome/test_docshell_swap.xhtml71
-rw-r--r--dom/tests/mochitest/chrome/test_elements_proto.xhtml29
-rw-r--r--dom/tests/mochitest/chrome/test_focus.xhtml32
-rw-r--r--dom/tests/mochitest/chrome/test_focus_dialog.xhtml33
-rw-r--r--dom/tests/mochitest/chrome/test_focus_docnav.xhtml27
-rw-r--r--dom/tests/mochitest/chrome/test_focused_link_scroll.xhtml46
-rw-r--r--dom/tests/mochitest/chrome/test_geolocation.xhtml54
-rw-r--r--dom/tests/mochitest/chrome/test_getTransformTo.html117
-rw-r--r--dom/tests/mochitest/chrome/test_indexedSetter.html38
-rw-r--r--dom/tests/mochitest/chrome/test_intlUtils_getDisplayNames.html351
-rw-r--r--dom/tests/mochitest/chrome/test_intlUtils_isAppLocaleRTL.html37
-rw-r--r--dom/tests/mochitest/chrome/test_moving_nodeList.xhtml44
-rw-r--r--dom/tests/mochitest/chrome/test_moving_xhr.xhtml40
-rw-r--r--dom/tests/mochitest/chrome/test_nodesFromPoint.html119
-rw-r--r--dom/tests/mochitest/chrome/test_nodesFromRect.html21
-rw-r--r--dom/tests/mochitest/chrome/test_parsingMode.html72
-rw-r--r--dom/tests/mochitest/chrome/test_popup_blocker_chrome.xhtml66
-rw-r--r--dom/tests/mochitest/chrome/test_queryCaretRect.html22
-rw-r--r--dom/tests/mochitest/chrome/test_resize_move_windows.xhtml249
-rw-r--r--dom/tests/mochitest/chrome/test_sandbox_bindings.xhtml317
-rw-r--r--dom/tests/mochitest/chrome/test_sandbox_eventhandler.xhtml37
-rw-r--r--dom/tests/mochitest/chrome/test_sandbox_image.xhtml37
-rw-r--r--dom/tests/mochitest/chrome/test_sandbox_postMessage.html36
-rw-r--r--dom/tests/mochitest/chrome/test_selectAtPoint.html21
-rw-r--r--dom/tests/mochitest/chrome/test_sizemode_attribute.xhtml26
-rw-r--r--dom/tests/mochitest/chrome/test_subscript_bindings.xhtml44
-rw-r--r--dom/tests/mochitest/chrome/test_window_getRegionalPrefsLocales.html28
-rw-r--r--dom/tests/mochitest/chrome/test_xray_event_constructor.xhtml35
-rw-r--r--dom/tests/mochitest/chrome/window_activation.xhtml37
-rw-r--r--dom/tests/mochitest/chrome/window_callback_wrapping.xhtml21
-rw-r--r--dom/tests/mochitest/chrome/window_docshell_swap.xhtml8
-rw-r--r--dom/tests/mochitest/chrome/window_focus.xhtml1699
-rw-r--r--dom/tests/mochitest/chrome/window_focus_docnav.xhtml124
-rw-r--r--dom/tests/mochitest/chrome/window_focus_inner.xhtml12
-rw-r--r--dom/tests/mochitest/crypto/mochitest.ini1
-rw-r--r--dom/tests/mochitest/crypto/test_getRandomValues.html211
-rw-r--r--dom/tests/mochitest/dom-level0/child_ip_address.html39
-rw-r--r--dom/tests/mochitest/dom-level0/file_crossdomainprops_inner.html11
-rw-r--r--dom/tests/mochitest/dom-level0/file_location.html10
-rw-r--r--dom/tests/mochitest/dom-level0/file_separate_post_message_queue.html39
-rw-r--r--dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html19
-rw-r--r--dom/tests/mochitest/dom-level0/framed_location.html11
-rw-r--r--dom/tests/mochitest/dom-level0/idn_child.html97
-rw-r--r--dom/tests/mochitest/dom-level0/iframe1_location_setters.html1
-rw-r--r--dom/tests/mochitest/dom-level0/iframe2_location_setters.html1
-rw-r--r--dom/tests/mochitest/dom-level0/iframe3_location_setters.html1
-rw-r--r--dom/tests/mochitest/dom-level0/innerWidthHeight_script.html31
-rw-r--r--dom/tests/mochitest/dom-level0/mochitest.ini43
-rw-r--r--dom/tests/mochitest/dom-level0/test_background_loading_iframes.html69
-rw-r--r--dom/tests/mochitest/dom-level0/test_crossdomainprops.html36
-rw-r--r--dom/tests/mochitest/dom-level0/test_innerWidthHeight_script.html35
-rw-r--r--dom/tests/mochitest/dom-level0/test_location.html73
-rw-r--r--dom/tests/mochitest/dom-level0/test_location_framed.html31
-rw-r--r--dom/tests/mochitest/dom-level0/test_location_getters.html29
-rw-r--r--dom/tests/mochitest/dom-level0/test_location_sandboxed.html33
-rw-r--r--dom/tests/mochitest/dom-level0/test_location_setters.html79
-rw-r--r--dom/tests/mochitest/dom-level0/test_separate_post_message_queue.html31
-rw-r--r--dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html153
-rw-r--r--dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html43
-rw-r--r--dom/tests/mochitest/dom-level1-core/DOMTestCase.js699
-rw-r--r--dom/tests/mochitest/dom-level1-core/activity-home.css127
-rw-r--r--dom/tests/mochitest/dom-level1-core/exclusions.js97
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.html10
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.svg10
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xhtml10
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xml10
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_staff.html48
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_staff.svg72
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_staff.xhtml60
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/hc_staff.xml60
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/staff.dtd17
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/staff.svg72
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/staff.xml57
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/svgtest.js0
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/svgunit.js0
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/xhtml-lat1.ent196
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/xhtml-special.ent80
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/xhtml-symbol.ent237
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/xhtml1-frameset.dtd1235
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/xhtml1-strict.dtd65
-rw-r--r--dom/tests/mochitest/dom-level1-core/files/xhtml1-transitional.dtd1201
-rw-r--r--dom/tests/mochitest/dom-level1-core/mochitest.ini552
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_PIsetdatanomodificationallowederrEE.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrcreatedocumentfragment.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode2.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrdefaultvalue.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attreffectivevalue.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrentityreplacement.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrname.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrnextsiblingnull.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrnotspecifiedvalue.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrparentnodenull.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrprevioussiblingnull.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrremovechild1.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrreplacechild1.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederr.html175
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederrEE.html170
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalue.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrspecifiedvaluechanged.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalueremove.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_cdatasectiongetdata.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_cdatasectionnormalize.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataappenddata.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataappenddatagetdata.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederr.html162
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederrEE.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatabegining.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataend.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataexceedslength.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatagetlengthanddata.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatamiddle.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederr.html162
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederrEE.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatagetdata.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatagetlength.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedatacountnegative.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetgreater.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetnegative.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetgreater.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetnegative.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedatacountnegative.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetgreater.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetnegative.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringcountnegative.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringnegativeoffset.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringoffsetgreater.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatabeginning.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatainsertdataend.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatamiddle.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederr.html162
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederrEE.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatabegining.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataend.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofarg.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofdata.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatamiddle.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederr.html163
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederrEE.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederr.html163
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederrEE.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatasetnodevalue.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatasubstringexceedsvalue.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_characterdatasubstringvalue.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_commentgetcomment.html150
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreateattribute.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreatecdatasection.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreatecomment.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreatedocumentfragment.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreateelement.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreateelementcasesensitive.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreateelementdefaultattr.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreateentityreference.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreateentityreferenceknown.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreateprocessinginstruction.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentcreatetextnode.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentgetdoctype.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentgetdoctypenodtd.html126
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamelength.html125
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnametotallength.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamevalue.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentgetimplementation.html126
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentgetrootnode.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateattribute.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateelement.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref.html159
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref1.html156
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi.html159
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi1.html156
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documenttypegetdoctype.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documenttypegetentities.html171
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documenttypegetentitieslength.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documenttypegetentitiestype.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documenttypegetnotations.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_documenttypegetnotationstype.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenoversion.html122
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenull.html125
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturexml.html121
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementaddnewattribute.html131
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementassociatedattribute.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementchangeattributevalue.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementcreatenewattribute.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgetattributenode.html132
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgetattributenodenull.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgetelementempty.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagname.html127
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnameaccessnodelist.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamenomatch.html125
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamespecialvalue.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementgettagname.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementinuseattributeerr.html153
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementinvalidcharacterexception.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementnormalize.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementnotfounderr.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattribute.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattributeaftercreate.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattributenode.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederr.html170
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederrEE.html158
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederr.html164
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederrEE.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementremoveattributerestoredefaultvalue.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementreplaceattributewithself.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattribute.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattributegevalue.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementretrieveallattributes.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementretrieveattrvalue.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementretrievetagname.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederr.html163
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederrEE.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenull.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederr.html150
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederrEE.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_elementwrongdocumenterr.html174
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_entitygetentityname.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_entitygetpublicid.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_entitygetpublicidnull.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild1.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild3.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild4.html168
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild5.html159
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild6.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes1.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes2.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrclonenode1.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrcreatedocumentfragment.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode2.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attreffectivevalue.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrfirstchild.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue1.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue2.html162
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrhaschildnodes.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore1.html156
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore2.html157
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore3.html162
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore4.html163
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore5.html169
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore6.html160
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore7.html176
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrlastchild.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrname.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrnextsiblingnull.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrnormalize.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrparentnodenull.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrprevioussiblingnull.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild1.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild2.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild1.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild2.html157
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue1.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue2.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvalue.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvaluechanged.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddata.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddatagetdata.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatabegining.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataend.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataexceedslength.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatagetlengthanddata.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatamiddle.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetdata.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetlength.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedatacountnegative.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedatacountnegative.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringcountnegative.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringnegativeoffset.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringoffsetgreater.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatabeginning.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdataend.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatamiddle.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatabegining.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataend.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofarg.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofdata.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatamiddle.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatasetnodevalue.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringexceedsvalue.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringvalue.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_commentgetcomment.html160
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentcreateattribute.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentcreatecomment.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentcreatedocumentfragment.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelement.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelementcasesensitive.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentcreatetextnode.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentgetdoctype.html166
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamelength.html126
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnametotallength.html237
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamevalue.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentgetimplementation.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentgetrootnode.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute1.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement1.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenoversion.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenull.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturexml.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementaddnewattribute.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementassociatedattribute.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementchangeattributevalue.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementcreatenewattribute.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenode.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenodenull.html131
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementempty.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagname.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnameaccessnodelist.html160
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamenomatch.html126
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamespecialvalue.html150
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementgettagname.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementinuseattributeerr.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception1.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize2.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementnotfounderr.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattribute.html129
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributeaftercreate.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributenode.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceattributewithself.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattribute.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattributegevalue.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveallattributes.html160
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveattrvalue.html129
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementretrievetagname.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementsetattributenodenull.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_elementwrongdocumenterr.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_entitiesremovenameditem1.html153
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_entitiessetnameditem1.html164
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapchildnoderange.html157
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapgetnameditem.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapinuseattributeerr.html155
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnotfounderr.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnumberofnodes.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapremovenameditem.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnattrnode.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnfirstitem.html166
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnlastitem.html168
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnnull.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditem.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemreturnvalue.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemthatexists.html150
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemwithnewvalue.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_namednodemapwrongdocumenterr.html167
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchild.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildchildexists.html176
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchilddocfragment.html174
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildgetnodename.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildinvalidnodetype.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnewchilddiffdocument.html162
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnodeancestor.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodeattribute.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodename.html131
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodetype.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodevalue.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodes.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesappendchild.html175
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesempty.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodecloneattributescopied.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeclonefalsenocopytext.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeclonegetparentnull.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodefalse.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodetrue.html161
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeclonetruecopytext.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodeattributes.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodename.html150
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodetype.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodevalue.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodename.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodetype.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodevalue.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodeattribute.html127
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodename.html127
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodetype.html126
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodevalue.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodeattributes.html161
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodename.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodetype.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodevalue.html125
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchild.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchildnull.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchild.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchildnull.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsibling.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsiblingnull.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocument.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocumentnull.html131
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussibling.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussiblingnull.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodes.html129
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodesfalse.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbefore.html169
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforedocfragment.html157
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforeinvalidnodetype.html152
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchilddiffdocument.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchildexists.html167
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodeancestor.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodename.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnonexistent.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnull.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexequalzero.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlength.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlengthofemptylist.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexnotzero.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnfirstitem.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnlastitem.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodelisttraverselist.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnode.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnodenull.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_noderemovechild.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildgetnodename.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildnode.html176
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildoldchildnonexistent.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechild.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildinvalidnodetype.html152
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchilddiffdocument.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchildexists.html171
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodeancestor.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodename.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildoldchildnonexistent.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodeattribute.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodename.html129
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodetype.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodevalue.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue01.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue02.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue03.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue04.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue05.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue06.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue07.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_nodevalue08.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_notationsremovenameditem1.html153
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_notationssetnameditem1.html164
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerrnegativeoffset.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerroffsetoutofbounds.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textparseintolistofelements.html185
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textsplittextfour.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textsplittextone.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textsplittextthree.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textsplittexttwo.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_hc_textwithnomarkup.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapchildnoderange.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapgetnameditem.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapinuseattributeerr.html154
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapnotfounderr.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapnumberofnodes.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditem.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemgetvalue.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemreturnnodevalue.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapreturnattrnode.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapreturnfirstitem.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapreturnlastitem.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapreturnnull.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditem.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemreturnvalue.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemthatexists.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemwithnewvalue.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_namednodemapwrongdocumenterr.html163
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchild.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchildchildexists.html161
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchilddocfragment.html168
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchildgetnodename.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchildinvalidnodetype.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchildnewchilddiffdocument.html159
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchildnodeancestor.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederr.html163
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederrEE.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeattributenodeattribute.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeattributenodename.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeattributenodetype.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeattributenodevalue.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodeattribute.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodename.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodetype.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodevalue.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodechildnodes.html152
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodechildnodesappendchild.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodechildnodesempty.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecloneattributescopied.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeclonefalsenocopytext.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeclonegetparentnull.html132
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeclonenodefalse.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeclonenodetrue.html185
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeclonetruecopytext.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecommentnodeattributes.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecommentnodename.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecommentnodetype.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodecommentnodevalue.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodename.html129
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodetype.html129
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodevalue.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumentnodeattribute.html122
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumentnodename.html126
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumentnodetype.html125
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumentnodevalue.html127
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodename.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodetype.html125
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodevalue.html124
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeelementnodeattributes.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeelementnodename.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeelementnodetype.html127
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeelementnodevalue.html124
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentitynodeattributes.html132
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentitynodename.html131
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentitynodetype.html132
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentitynodevalue.html132
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodeattributes.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodename.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodetype.html142
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodevalue.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeentitysetnodevalue.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetfirstchild.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetfirstchildnull.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetlastchild.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetlastchildnull.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetnextsibling.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetnextsiblingnull.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetownerdocument.html150
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetownerdocumentnull.html121
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetprevioussibling.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodegetprevioussiblingnull.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodehaschildnodes.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodehaschildnodesfalse.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbefore.html189
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforedocfragment.html155
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforeinvalidnodetype.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchilddiffdocument.html161
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchildexists.html191
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodeancestor.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodename.html140
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederr.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederrEE.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnonexistent.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnull.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodelistindexequalzero.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlength.html132
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlengthofemptylist.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodelistindexnotzero.html148
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodelistreturnfirstitem.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodelistreturnlastitem.html147
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodelisttraverselist.html177
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodenotationnodeattributes.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodenotationnodename.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodenotationnodetype.html136
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodenotationnodevalue.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeparentnode.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeparentnodenull.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodeattributes.html135
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodename.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodetype.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodevalue.html131
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionsetnodevalue.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_noderemovechild.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_noderemovechildgetnodename.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_noderemovechildnode.html156
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederr.html161
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederrEE.html143
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_noderemovechildoldchildnonexistent.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechild.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildinvalidnodetype.html149
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchilddiffdocument.html161
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchildexists.html188
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodeancestor.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodename.html152
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederr.html162
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederrEE.html144
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodereplacechildoldchildnonexistent.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederr.html166
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederrEE.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodetextnodeattribute.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodetextnodename.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodetextnodetype.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodetextnodevalue.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue01.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue02.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue03.html129
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue04.html130
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue05.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue06.html126
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue07.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue08.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_nodevalue09.html128
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_notationgetnotationname.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_notationgetpublicid.html132
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_notationgetpublicidnull.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_notationgetsystemid.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_notationgetsystemidnull.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_processinginstructiongetdata.html134
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_processinginstructiongettarget.html133
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_processinginstructionsetdatanomodificationallowederr.html151
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textindexsizeerrnegativeoffset.html145
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textindexsizeerroffsetoutofbounds.html146
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textparseintolistofelements.html184
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textsplittextfour.html137
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederr.html165
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederrEE.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textsplittextone.html141
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textsplittextthree.html139
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textsplittexttwo.html138
-rw-r--r--dom/tests/mochitest/dom-level1-core/test_textwithnomarkup.html137
-rw-r--r--dom/tests/mochitest/dom-level2-core/DOMTestCase.js710
-rw-r--r--dom/tests/mochitest/dom-level2-core/exclusions.js50
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/hc_staff.html48
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/hc_staff.svg72
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/hc_staff.xhtml60
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/hc_staff.xml60
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/internalSubset01.js0
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/nodtdstaff.svg11
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/nodtdstaff.xml11
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staff.dtd17
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staff.svg72
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staff.xml57
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staff2.dtd24
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staff2.svg13
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staff2.xml13
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staffNS.dtd45
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staffNS.svg73
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/staffNS.xml59
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/svgtest.js0
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/svgunit.js0
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/xhtml-lat1.ent196
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/xhtml-special.ent80
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/xhtml-symbol.ent237
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/xhtml1-frameset.dtd1235
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/xhtml1-strict.dtd65
-rw-r--r--dom/tests/mochitest/dom-level2-core/files/xhtml1-transitional.dtd1201
-rw-r--r--dom/tests/mochitest/dom-level2-core/mochitest.ini270
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_attrgetownerelement01.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_attrgetownerelement02.html127
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_attrgetownerelement03.html119
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_attrgetownerelement04.html140
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_attrgetownerelement05.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createAttributeNS02.html131
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createAttributeNS03.html164
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createAttributeNS04.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createAttributeNS05.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createAttributeNS06.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocument01.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocument02.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocument03.html141
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocument04.html152
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocument05.html169
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocument06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocument07.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocumentType01.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocumentType02.html168
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createDocumentType03.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createElementNS01.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createElementNS02.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createElementNS03.html166
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createElementNS04.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createElementNS05.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_createElementNS06.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS01.html127
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS02.html151
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS03.html144
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS07.html129
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS02.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS05.html129
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS06.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentgetelementbyid01.html118
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS01.html127
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS02.html129
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS03.html118
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS04.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS05.html120
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode02.html156
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html140
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html147
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode05.html152
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode06.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode08.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode09.html131
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode10.html131
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode11.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode12.html137
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode13.html131
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode14.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode15.html139
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode17.html139
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode18.html143
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode19.html175
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode20.html168
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html178
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documentimportnode22.html181
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documenttypepublicid01.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_documenttypesystemid01.html124
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument03.html140
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument04.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument05.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.html130
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype01.html144
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype02.html148
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype04.html150
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturecore.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturexmlversion2.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_domimplementationhasfeature01.html148
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens01.html146
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens02.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens03.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementgetattributens02.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens02.html120
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens04.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens05.html121
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementhasattribute01.html118
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementhasattribute02.html121
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementhasattribute03.html125
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementhasattribute04.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementhasattributens01.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementhasattributens02.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementhasattributens03.html130
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementremoveattributens01.html124
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens01.html147
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens02.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens03.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens04.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens05.html144
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens06.html142
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributens01.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributens02.html129
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributens03.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributens04.html142
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributens05.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributens08.html140
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_elementsetattributensurinull.html142
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getAttributeNS01.html127
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getAttributeNS02.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getAttributeNS03.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getAttributeNS04.html131
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getAttributeNS05.html124
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS01.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS02.html127
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementById01.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementById02.html118
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS01.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS02.html131
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS03.html148
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS05.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS06.html121
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS07.html121
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS08.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS10.html153
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS11.html143
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS12.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS13.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS14.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getNamedItemNS01.html130
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getNamedItemNS02.html130
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getNamedItemNS03.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_getNamedItemNS04.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttribute01.html120
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttribute02.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttribute03.html120
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttribute04.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttributeNS01.html125
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttributeNS02.html124
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttributeNS03.html125
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttributeNS04.html127
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttributeNS05.html125
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttributes01.html120
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hasAttributes02.html120
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hc_namednodemapinvalidtype1.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize1.html130
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize2.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode01.html181
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode02.html148
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode03.html149
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode04.html149
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode05.html155
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode06.html151
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode07.html154
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode08.html148
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode09.html166
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode10.html153
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode11.html149
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode12.html162
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode13.html158
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode14.html154
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode15.html149
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode16.html149
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_importNode17.html143
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_localName01.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_localName02.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_localName04.html124
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns01.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns02.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns03.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns04.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns05.html125
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns06.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns01.html124
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns02.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns03.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns04.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns05.html167
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns06.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns07.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns08.html137
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns09.html129
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns01.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns02.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns03.html163
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns04.html147
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns05.html155
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns06.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns07.html144
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns08.html141
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns09.html148
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns10.html146
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns11.html147
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namespaceURI01.html128
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namespaceURI02.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namespaceURI03.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_namespaceURI04.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodegetlocalname03.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodegetnamespaceuri03.html142
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument01.html126
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument02.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodegetprefix03.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodehasattributes01.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodehasattributes02.html118
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodehasattributes03.html119
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodehasattributes04.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_nodenormalize01.html238
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_normalize01.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_ownerDocument01.html117
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_ownerElement01.html129
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_ownerElement02.html120
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_prefix01.html122
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_prefix03.html123
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_prefix04.html121
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_publicId01.html121
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_removeAttributeNS01.html155
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_removeAttributeNS02.html146
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS01.html131
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS02.html141
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS03.html163
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS01.html134
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.html133
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS03.html158
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS04.html144
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS05.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS07.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS09.html144
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNS10.html129
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS01.html149
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS02.html160
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS03.html130
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS04.html132
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS05.html155
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setNamedItemNS01.html146
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setNamedItemNS02.html157
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setNamedItemNS03.html138
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setNamedItemNS04.html165
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_setNamedItemNS05.html136
-rw-r--r--dom/tests/mochitest/dom-level2-core/test_systemId01.html122
-rw-r--r--dom/tests/mochitest/dom-level2-html/DOMTestCase.js718
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/anchor.html12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/anchor.xhtml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/anchor.xml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/anchor2.html13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/anchor2.xhtml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/anchor2.xml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applet.html12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applet.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applet.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applet2.class14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applet2.html12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applet2.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applet2.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/applets/org/w3c/domts/DOMTSApplet.classbin0 -> 1584 bytes
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/area.html14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/area.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/area.xml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/area2.html15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/area2.xhtml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/area2.xml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/base.html11
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/base.xhtml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/base.xml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/base2.html15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/base2.xhtml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/base2.xml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/body.html10
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/body.xhtml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/body.xml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/br.html12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/br.xhtml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/br.xml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/button.html21
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/button.xhtml24
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/button.xml24
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/collection.html79
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/collection.xhtml82
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/collection.xml82
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/directory.html14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/directory.xhtml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/directory.xml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/div.html10
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/div.xhtml12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/div.xml12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/dl.html15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/dl.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/dl.xml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/document-with-applet.html36
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/document.html34
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/document.xhtml39
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/document.xml39
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/element.html81
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/element.xhtml83
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/element.xml83
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/fieldset.html23
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/fieldset.xhtml25
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/fieldset.xml25
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/font.html10
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/font.xhtml12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/font.xml12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form.html17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form.xhtml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form.xml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form2.html17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form2.xhtml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form2.xml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form3.html17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form3.xhtml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/form3.xml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frame.html14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frame.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frame.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frame2.html16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frame2.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frame2.xml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frameset.html14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frameset.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/frameset.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/heading.html16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/heading.xhtml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/heading.xml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/hr.html11
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/hr.xhtml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/hr.xml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/html.html12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/html.xhtml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/html.xml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/iframe.html10
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/iframe.xhtml12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/iframe.xml12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/iframe2.html13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/iframe2.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/iframe2.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/img.html13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/img.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/img.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/index.html216
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/input.html60
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/input.xhtml62
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/input.xml62
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/isindex.html14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/isindex.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/isindex.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/label.html21
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/label.xhtml22
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/label.xml22
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/legend.html22
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/legend.xhtml23
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/legend.xml23
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/li.html23
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/li.xhtml25
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/li.xml25
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/link.html15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/link.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/link.xml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/link2.html15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/link2.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/link2.xml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/map.html16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/map.xhtml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/map.xml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/menu.html15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/menu.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/menu.xml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/meta.html13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/meta.xhtml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/meta.xml16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/mod.html15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/mod.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/mod.xml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/object.html18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/object.xhtml20
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/object.xml20
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/object2.html17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/object2.xhtml20
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/object2.xml20
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/olist.html32
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/olist.xhtml34
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/olist.xml34
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/optgroup.html25
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/optgroup.xhtml27
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/optgroup.xml27
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/option.html36
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/option.xhtml33
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/option.xml33
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/optionscollection.html36
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/optionscollection.xhtml33
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/optionscollection.xml33
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/paragraph.html13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/paragraph.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/paragraph.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/param.html14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/param.xhtml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/param.xml17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/pre.html17
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/pre.xhtml19
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/pre.xml19
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/quote.html16
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/quote.xhtml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/quote.xml18
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/right.pngbin0 -> 137 bytes
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/script.html11
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/script.xhtml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/script.xml13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/select.html44
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/select.xhtml41
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/select.xml41
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/style.html12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/style.xhtml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/style.xml14
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/table.html78
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/table.xhtml81
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/table.xml81
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/table1.html12
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/table1.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/table1.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecaption.html25
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecaption.xhtml21
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecaption.xml21
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecell.html23
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecell.xhtml26
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecell.xml26
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecol.html35
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecol.xhtml29
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablecol.xml29
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablerow.html59
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablerow.xhtml62
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablerow.xml62
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablesection.html62
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablesection.xhtml65
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/tablesection.xml65
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/textarea.html26
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/textarea.xhtml27
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/textarea.xml27
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/title.html13
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/title.xhtml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/title.xml15
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/ulist.html36
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/ulist.xhtml38
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/ulist.xml38
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/w3c_main.pngbin0 -> 5904 bytes
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/xhtml-lat1.ent196
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/xhtml-special.ent80
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/xhtml-symbol.ent237
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/xhtml1-frameset.dtd1235
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/xhtml1-strict.dtd978
-rw-r--r--dom/tests/mochitest/dom-level2-html/files/xhtml1-transitional.dtd1201
-rw-r--r--dom/tests/mochitest/dom-level2-html/mochitest.ini863
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement08.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement09.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement10.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement11.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement12.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement13.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement14.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement07.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement08.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBRElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement02.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement06.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement01.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement05.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement06.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement08.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection01.html146
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection02.html146
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection03.html146
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection04.html158
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection05.html142
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection06.html148
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection07.html146
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection08.html146
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection09.html142
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection10.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection11.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLCollection12.html149
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDirectoryElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDivElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDlistElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument01.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument02.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument03.html134
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument04.html132
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument05.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument10.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument11.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument12.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument13.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument14.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument15.html142
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument16.html142
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument17.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument18.html123
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument19.html152
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument20.html152
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLDocument21.html162
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement08.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement09.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement10.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement100.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement101.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement102.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement103.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement104.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement105.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement106.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement107.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement108.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement109.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement11.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement110.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement111.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement112.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement113.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement114.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement115.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement116.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement117.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement118.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement119.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement12.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement120.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement121.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement122.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement123.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement124.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement125.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement126.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement127.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement128.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement129.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement13.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement130.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement131.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement132.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement133.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement134.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement135.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement136.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement137.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement138.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement139.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement14.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement140.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement141.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement142.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement143.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement144.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement145.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement15.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement16.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement17.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement18.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement19.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement20.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement21.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement22.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement23.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement24.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement25.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement26.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement27.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement28.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement29.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement30.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement31.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement32.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement33.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement34.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement35.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement36.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement37.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement38.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement39.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement40.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement41.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement42.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement43.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement44.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement45.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement46.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement47.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement48.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement49.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement50.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement51.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement52.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement53.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement54.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement55.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement56.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement57.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement58.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement59.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement60.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement61.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement62.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement63.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement64.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement65.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement66.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement67.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement68.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement69.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement70.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement71.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement72.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement73.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement74.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement75.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement76.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement77.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement78.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement79.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement80.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement81.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement82.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement83.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement84.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement85.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement86.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement87.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement88.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement89.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement90.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement91.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement92.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement93.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement94.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement95.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement96.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement97.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement98.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLElement99.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement01.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFontElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFontElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFontElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement01.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement08.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement09.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFormElement10.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement01.html141
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement05.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement08.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement09.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHRElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHRElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHRElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHRElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLHtmlElement01.html149
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement02.html141
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement05.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement06.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement08.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement10.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement11.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement06.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement08.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement09.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement10.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement11.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLImageElement12.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement03.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement05.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement08.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement11.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement12.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement13.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement14.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement15.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement16.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement17.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement18.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement19.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement20.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement21.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLInputElement22.html127
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLIElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLIElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement01.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement01.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement07.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement08.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement09.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLMapElement01.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLMapElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLMenuElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLModElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLModElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLModElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLModElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOListElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOListElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOListElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement01.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement03.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement05.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement08.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement09.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement11.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement12.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement13.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement14.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement15.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement16.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement17.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement18.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement19.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement20.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement01.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement03.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement05.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement08.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection01.html144
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection02.html157
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection03.html158
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection04.html158
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection05.html160
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection06.html153
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection07.html157
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLParagraphElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLParamElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLParamElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLParamElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLParamElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLPreElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement05.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement06.html128
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement07.html128
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement03.html146
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement05.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement06.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement08.html158
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement09.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement11.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement12.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement13.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement14.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement15.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement16.html134
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement17.html134
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement18.html152
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement19.html156
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement20.html153
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCaptionElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement03.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement04.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement05.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement08.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement09.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement11.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement12.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement13.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement14.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement15.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement16.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement17.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement18.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement19.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement20.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement21.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement22.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement23.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement24.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement25.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement26.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement27.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement28.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement29.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement30.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement03.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement05.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement06.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement08.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement09.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement11.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement12.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement01.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement03.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement05.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement07.html156
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement08.html153
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement09.html157
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement11.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement12.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement13.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement14.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement15.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement16.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement17.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement18.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement19.html149
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement20.html148
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement21.html164
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement22.html149
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement23.html148
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement24.html164
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement25.html145
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement26.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement27.html141
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement28.html159
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement29.html163
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement30.html171
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement31.html169
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement32.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement33.html148
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement34.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement35.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement36.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement37.html152
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement38.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement39.html177
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableElement40.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement01.html143
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement03.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement05.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement07.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement08.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement11.html173
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement12.html171
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement13.html172
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement14.html172
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement15.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement16.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement17.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement18.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement19.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement20.html177
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement21.html176
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement02.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement03.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement05.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement07.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement08.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement11.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement12.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement13.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement14.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement15.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement16.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement17.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement18.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement19.html153
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement20.html153
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement21.html155
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement22.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement23.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement24.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement25.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement26.html151
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement27.html152
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement28.html152
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement29.html150
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement30.html159
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement31.html156
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement01.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement02.html140
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement03.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement04.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement05.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement06.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement08.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement10.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement11.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement12.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement13.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement14.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement15.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLTitleElement01.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLUListElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLUListElement02.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_alltests.html3933
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_anchor01.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_anchor02.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_anchor03.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_anchor04.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_anchor05.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_anchor06.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_area01.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_area02.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_area03.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_area04.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_body01.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button01.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button02.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button03.html138
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button04.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button05.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button06.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button07.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button08.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_button09.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_dlist01.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_doc01.html126
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_hasFeature01.html113
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_hasFeature02.html112
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_hasFeature03.html115
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_hasFeature04.html114
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_hasFeature05.html113
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_hasFeature06.html112
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object01.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object02.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object03.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object04.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object05.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object06.html134
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object07.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object08.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object09.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object10.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object11.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object12.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object13.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object14.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_object15.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table01.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table02.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table03.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table04.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table06.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table07.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table08.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table09.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table10.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table12.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table15.html139
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table17.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table18.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table19.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table20.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table21.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table22.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table23.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table24.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table25.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table26.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table27.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table28.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table29.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table30.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table31.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table32.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table33.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table34.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table35.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table36.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table37.html131
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table38.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table39.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table40.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table41.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table42.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table43.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table44.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table45.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table46.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table47.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table48.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table49.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table50.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table51.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table52.html133
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_table53.html133
-rw-r--r--dom/tests/mochitest/fetch/common_readableStreams.js414
-rw-r--r--dom/tests/mochitest/fetch/common_temporaryFileBlob.js146
-rw-r--r--dom/tests/mochitest/fetch/empty.js0
-rw-r--r--dom/tests/mochitest/fetch/empty.js^headers^1
-rw-r--r--dom/tests/mochitest/fetch/fetch_test_framework.js165
-rw-r--r--dom/tests/mochitest/fetch/file_fetch_cached_redirect.html1
-rw-r--r--dom/tests/mochitest/fetch/file_fetch_cached_redirect.html^headers^3
-rw-r--r--dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html13
-rw-r--r--dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html^headers^2
-rw-r--r--dom/tests/mochitest/fetch/file_fetch_observer.html146
-rw-r--r--dom/tests/mochitest/fetch/iframe_readableStreams.html4
-rw-r--r--dom/tests/mochitest/fetch/message_receiver.html6
-rw-r--r--dom/tests/mochitest/fetch/mochitest.ini92
-rw-r--r--dom/tests/mochitest/fetch/nested_worker_wrapper.js32
-rw-r--r--dom/tests/mochitest/fetch/reroute.html18
-rw-r--r--dom/tests/mochitest/fetch/reroute.js27
-rw-r--r--dom/tests/mochitest/fetch/reroute.js^headers^1
-rw-r--r--dom/tests/mochitest/fetch/slow.sjs15
-rw-r--r--dom/tests/mochitest/fetch/sw_reroute.js43
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic.js179
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http.js268
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http_sw_empty_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http_sw_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_sw_empty_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_sw_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cached_redirect.html22
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cached_redirect.js17
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors.js1883
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors_sw_empty_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors_sw_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_csp_block.html50
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_observer.html40
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_user_control_rp.html103
-rw-r--r--dom/tests/mochitest/fetch/test_formdataparsing.html23
-rw-r--r--dom/tests/mochitest/fetch/test_formdataparsing.js368
-rw-r--r--dom/tests/mochitest/fetch/test_formdataparsing_sw_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_headers.html17
-rw-r--r--dom/tests/mochitest/fetch/test_headers_common.js327
-rw-r--r--dom/tests/mochitest/fetch/test_headers_mainthread.html155
-rw-r--r--dom/tests/mochitest/fetch/test_headers_sw_reroute.html17
-rw-r--r--dom/tests/mochitest/fetch/test_readableStreams.html86
-rw-r--r--dom/tests/mochitest/fetch/test_request.html23
-rw-r--r--dom/tests/mochitest/fetch/test_request.js744
-rw-r--r--dom/tests/mochitest/fetch/test_request_context.html19
-rw-r--r--dom/tests/mochitest/fetch/test_request_sw_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_response.html23
-rw-r--r--dom/tests/mochitest/fetch/test_response.js346
-rw-r--r--dom/tests/mochitest/fetch/test_responseReadyForWasm.html44
-rw-r--r--dom/tests/mochitest/fetch/test_response_sw_reroute.html23
-rw-r--r--dom/tests/mochitest/fetch/test_temporaryFileBlob.html41
-rw-r--r--dom/tests/mochitest/fetch/test_webassembly_streaming.html22
-rw-r--r--dom/tests/mochitest/fetch/utils.js51
-rw-r--r--dom/tests/mochitest/fetch/worker_readableStreams.js26
-rw-r--r--dom/tests/mochitest/fetch/worker_temporaryFileBlob.js31
-rw-r--r--dom/tests/mochitest/fetch/worker_wrapper.js85
-rw-r--r--dom/tests/mochitest/fs/chrome.ini5
-rw-r--r--dom/tests/mochitest/fs/page_blank.html6
-rw-r--r--dom/tests/mochitest/fs/test_privateWin.html56
-rw-r--r--dom/tests/mochitest/gamepad/gamepad_frame.html22
-rw-r--r--dom/tests/mochitest/gamepad/gamepad_frame_state.html16
-rw-r--r--dom/tests/mochitest/gamepad/mochitest.ini23
-rw-r--r--dom/tests/mochitest/gamepad/mock_gamepad.js19
-rw-r--r--dom/tests/mochitest/gamepad/test_check_timestamp.html20
-rw-r--r--dom/tests/mochitest/gamepad/test_check_timestamp_iframe.html71
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad.html20
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_connect_events.html22
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_connect_events_iframe.html83
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_extensions.html19
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_extensions_iframe.html179
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html19
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync_iframe.html113
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html19
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_hidden_frame_iframe.html81
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_iframe.html81
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin.html20
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin_iframe.html256
-rw-r--r--dom/tests/mochitest/gamepad/test_navigator_gamepads.html19
-rw-r--r--dom/tests/mochitest/gamepad/test_navigator_gamepads_iframe.html123
-rw-r--r--dom/tests/mochitest/general/497633.html35
-rw-r--r--dom/tests/mochitest/general/chrome.ini12
-rw-r--r--dom/tests/mochitest/general/cssA.css0
-rw-r--r--dom/tests/mochitest/general/cssB.css2
-rw-r--r--dom/tests/mochitest/general/cssC.css0
-rw-r--r--dom/tests/mochitest/general/embed_navigate.html1
-rw-r--r--dom/tests/mochitest/general/emptyCssFile2.css1
-rw-r--r--dom/tests/mochitest/general/fail.pngbin0 -> 91 bytes
-rw-r--r--dom/tests/mochitest/general/file_bug628069.html16
-rw-r--r--dom/tests/mochitest/general/file_clonewrapper.html35
-rw-r--r--dom/tests/mochitest/general/file_domWindowUtils_scrollbarSize.html7
-rw-r--r--dom/tests/mochitest/general/file_focusrings.html5
-rw-r--r--dom/tests/mochitest/general/file_frameElementWrapping.html32
-rw-r--r--dom/tests/mochitest/general/file_moving_nodeList.html31
-rw-r--r--dom/tests/mochitest/general/file_moving_xhr.html28
-rw-r--r--dom/tests/mochitest/general/file_resource_timing_nocors.html191
-rw-r--r--dom/tests/mochitest/general/frameSelectEvents.html929
-rw-r--r--dom/tests/mochitest/general/frameStorageAllowed.html22
-rw-r--r--dom/tests/mochitest/general/frameStorageChrome.html20
-rw-r--r--dom/tests/mochitest/general/frameStorageNullprincipal.sjs40
-rw-r--r--dom/tests/mochitest/general/frameStoragePrevented.html47
-rw-r--r--dom/tests/mochitest/general/generateCss.sjs42
-rw-r--r--dom/tests/mochitest/general/historyframes.html179
-rw-r--r--dom/tests/mochitest/general/image_100.pngbin0 -> 91 bytes
-rw-r--r--dom/tests/mochitest/general/image_200.pngbin0 -> 100 bytes
-rw-r--r--dom/tests/mochitest/general/image_50.pngbin0 -> 85 bytes
-rw-r--r--dom/tests/mochitest/general/importsSameAndCrossOrigin.css3
-rw-r--r--dom/tests/mochitest/general/mochitest.ini182
-rw-r--r--dom/tests/mochitest/general/navigation_timing.html100
-rw-r--r--dom/tests/mochitest/general/pass.apngbin0 -> 188 bytes
-rw-r--r--dom/tests/mochitest/general/performance_timeline_main_test.html106
-rw-r--r--dom/tests/mochitest/general/postback.html16
-rw-r--r--dom/tests/mochitest/general/res0.resource0
-rw-r--r--dom/tests/mochitest/general/res1.resource0
-rw-r--r--dom/tests/mochitest/general/res1.resource^headers^2
-rw-r--r--dom/tests/mochitest/general/res2.resource0
-rw-r--r--dom/tests/mochitest/general/res2.resource^headers^2
-rw-r--r--dom/tests/mochitest/general/res3.resource0
-rw-r--r--dom/tests/mochitest/general/res3.resource^headers^2
-rw-r--r--dom/tests/mochitest/general/res4.resource0
-rw-r--r--dom/tests/mochitest/general/res4.resource^headers^3
-rw-r--r--dom/tests/mochitest/general/res5.resource0
-rw-r--r--dom/tests/mochitest/general/res5.resource^headers^2
-rw-r--r--dom/tests/mochitest/general/res6.resource0
-rw-r--r--dom/tests/mochitest/general/res6.resource^headers^2
-rw-r--r--dom/tests/mochitest/general/res7.resource0
-rw-r--r--dom/tests/mochitest/general/res7.resource^headers^2
-rw-r--r--dom/tests/mochitest/general/res8.resource0
-rw-r--r--dom/tests/mochitest/general/res8.resource^headers^2
-rw-r--r--dom/tests/mochitest/general/resource_timing.js0
-rw-r--r--dom/tests/mochitest/general/resource_timing_cross_origin.html191
-rw-r--r--dom/tests/mochitest/general/resource_timing_iframe.html50
-rw-r--r--dom/tests/mochitest/general/resource_timing_location_navigate.html3
-rw-r--r--dom/tests/mochitest/general/resource_timing_main_test.html290
-rw-r--r--dom/tests/mochitest/general/resource_timing_meta_refresh.html10
-rw-r--r--dom/tests/mochitest/general/resource_timing_nocors.html88
-rw-r--r--dom/tests/mochitest/general/resource_timing_redirect.html11
-rw-r--r--dom/tests/mochitest/general/resource_timing_redirect.html^headers^2
-rw-r--r--dom/tests/mochitest/general/start_historyframe.html1
-rw-r--r--dom/tests/mochitest/general/storagePermissionsUtils.js282
-rw-r--r--dom/tests/mochitest/general/test-data.json1
-rw-r--r--dom/tests/mochitest/general/test-data2.json1
-rw-r--r--dom/tests/mochitest/general/test_497898.html41
-rw-r--r--dom/tests/mochitest/general/test_CCW_optimization.html50
-rw-r--r--dom/tests/mochitest/general/test_DOMMatrix.html717
-rw-r--r--dom/tests/mochitest/general/test_WebKitCSSMatrix.html339
-rw-r--r--dom/tests/mochitest/general/test_bug1161721.html32
-rw-r--r--dom/tests/mochitest/general/test_bug1170911.html90
-rw-r--r--dom/tests/mochitest/general/test_bug1208217.html31
-rw-r--r--dom/tests/mochitest/general/test_bug1313753.html63
-rw-r--r--dom/tests/mochitest/general/test_bug1434273.html36
-rw-r--r--dom/tests/mochitest/general/test_bug504220.html65
-rw-r--r--dom/tests/mochitest/general/test_bug628069_1.html50
-rw-r--r--dom/tests/mochitest/general/test_bug628069_2.html41
-rw-r--r--dom/tests/mochitest/general/test_bug631440.html39
-rw-r--r--dom/tests/mochitest/general/test_bug653364.html39
-rw-r--r--dom/tests/mochitest/general/test_bug861217.html115
-rw-r--r--dom/tests/mochitest/general/test_clientRects.html127
-rw-r--r--dom/tests/mochitest/general/test_clipboard_disallowed.html69
-rw-r--r--dom/tests/mochitest/general/test_clipboard_events.html37
-rw-r--r--dom/tests/mochitest/general/test_consoleAPI.html66
-rw-r--r--dom/tests/mochitest/general/test_contentViewer_overrideDPPX.html428
-rw-r--r--dom/tests/mochitest/general/test_devicePixelRatio_with_zoom.html84
-rw-r--r--dom/tests/mochitest/general/test_domWindowUtils.html183
-rw-r--r--dom/tests/mochitest/general/test_domWindowUtils_scrollXY.html90
-rw-r--r--dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html65
-rw-r--r--dom/tests/mochitest/general/test_donottrack.html72
-rw-r--r--dom/tests/mochitest/general/test_focus_legend_noparent.html36
-rw-r--r--dom/tests/mochitest/general/test_focus_scrollchildframe.html24
-rw-r--r--dom/tests/mochitest/general/test_focusrings.xhtml217
-rw-r--r--dom/tests/mochitest/general/test_for_of.html25
-rw-r--r--dom/tests/mochitest/general/test_frameElementWrapping.html44
-rw-r--r--dom/tests/mochitest/general/test_framedhistoryframes.html31
-rw-r--r--dom/tests/mochitest/general/test_img_mutations.html236
-rw-r--r--dom/tests/mochitest/general/test_innerScreen.xhtml83
-rw-r--r--dom/tests/mochitest/general/test_interfaces.html28
-rw-r--r--dom/tests/mochitest/general/test_interfaces.js2049
-rw-r--r--dom/tests/mochitest/general/test_interfaces_secureContext.html28
-rw-r--r--dom/tests/mochitest/general/test_media_queries_with_zoom.html52
-rw-r--r--dom/tests/mochitest/general/test_navigation_timing.html36
-rw-r--r--dom/tests/mochitest/general/test_network_events.html72
-rw-r--r--dom/tests/mochitest/general/test_nodeAdoption_chrome_boundary.xhtml28
-rw-r--r--dom/tests/mochitest/general/test_offsets.css3
-rw-r--r--dom/tests/mochitest/general/test_offsets.html100
-rw-r--r--dom/tests/mochitest/general/test_offsets.js332
-rw-r--r--dom/tests/mochitest/general/test_offsets.xhtml98
-rw-r--r--dom/tests/mochitest/general/test_outerHTML.html74
-rw-r--r--dom/tests/mochitest/general/test_outerHTML.xhtml75
-rw-r--r--dom/tests/mochitest/general/test_paste_selection.html122
-rw-r--r--dom/tests/mochitest/general/test_performance_nav_timing_before_onload.html30
-rw-r--r--dom/tests/mochitest/general/test_performance_now.html60
-rw-r--r--dom/tests/mochitest/general/test_performance_timeline.html35
-rw-r--r--dom/tests/mochitest/general/test_picture_apng.html77
-rw-r--r--dom/tests/mochitest/general/test_picture_mutations.html311
-rw-r--r--dom/tests/mochitest/general/test_pointerPreserves3D.html25
-rw-r--r--dom/tests/mochitest/general/test_pointerPreserves3DClip.html55
-rw-r--r--dom/tests/mochitest/general/test_pointerPreserves3DPerspective.html29
-rw-r--r--dom/tests/mochitest/general/test_resizeby.html64
-rw-r--r--dom/tests/mochitest/general/test_resource_timing.html40
-rw-r--r--dom/tests/mochitest/general/test_resource_timing_cross_origin.html47
-rw-r--r--dom/tests/mochitest/general/test_resource_timing_cross_origin_navigate.html73
-rw-r--r--dom/tests/mochitest/general/test_resource_timing_frameset.html29
-rw-r--r--dom/tests/mochitest/general/test_resource_timing_nocors.html37
-rw-r--r--dom/tests/mochitest/general/test_selectevents.html31
-rw-r--r--dom/tests/mochitest/general/test_showModalDialog_removed.html31
-rw-r--r--dom/tests/mochitest/general/test_spacetopagedown.html75
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsAccept.html44
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsLimitForeign.html46
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsReject.html44
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsRejectForeign.html44
-rw-r--r--dom/tests/mochitest/general/test_stylesheetPI.html37
-rw-r--r--dom/tests/mochitest/general/test_toggling_performance_navigation_timing.html47
-rw-r--r--dom/tests/mochitest/general/test_vibrator.html148
-rw-r--r--dom/tests/mochitest/general/test_windowProperties.html28
-rw-r--r--dom/tests/mochitest/general/test_windowedhistoryframes.html32
-rw-r--r--dom/tests/mochitest/general/url1_historyframe.html1
-rw-r--r--dom/tests/mochitest/general/url2_historyframe.html1
-rw-r--r--dom/tests/mochitest/general/window_clipboard_events.html1239
-rw-r--r--dom/tests/mochitest/general/window_storagePermissions.html38
-rw-r--r--dom/tests/mochitest/general/workerStorageAllowed.js78
-rw-r--r--dom/tests/mochitest/general/workerStoragePrevented.js75
-rw-r--r--dom/tests/mochitest/geolocation/chrome.ini6
-rw-r--r--dom/tests/mochitest/geolocation/crossorigin_iframe.html33
-rw-r--r--dom/tests/mochitest/geolocation/file_featurePolicy.html47
-rw-r--r--dom/tests/mochitest/geolocation/geolocation.html13
-rw-r--r--dom/tests/mochitest/geolocation/geolocation_common.js154
-rw-r--r--dom/tests/mochitest/geolocation/mochitest.ini82
-rw-r--r--dom/tests/mochitest/geolocation/network_geolocation.sjs81
-rw-r--r--dom/tests/mochitest/geolocation/popup.html19
-rw-r--r--dom/tests/mochitest/geolocation/test_allowCurrent.html41
-rw-r--r--dom/tests/mochitest/geolocation/test_allowWatch.html44
-rw-r--r--dom/tests/mochitest/geolocation/test_cachedPosition.html83
-rw-r--r--dom/tests/mochitest/geolocation/test_cancelCurrent.html45
-rw-r--r--dom/tests/mochitest/geolocation/test_cancelWatch.html49
-rw-r--r--dom/tests/mochitest/geolocation/test_clearWatch.html76
-rw-r--r--dom/tests/mochitest/geolocation/test_clearWatchBeforeAllowing.html62
-rw-r--r--dom/tests/mochitest/geolocation/test_clearWatch_invalid.html47
-rw-r--r--dom/tests/mochitest/geolocation/test_crossorigin_iframe.html61
-rw-r--r--dom/tests/mochitest/geolocation/test_enableHighAccuracy.html73
-rw-r--r--dom/tests/mochitest/geolocation/test_errorcheck.html52
-rw-r--r--dom/tests/mochitest/geolocation/test_featurePolicy.html51
-rw-r--r--dom/tests/mochitest/geolocation/test_garbageWatch.html56
-rw-r--r--dom/tests/mochitest/geolocation/test_geoGetCurrentPositionBlockedInInsecureContext.html47
-rw-r--r--dom/tests/mochitest/geolocation/test_geoWatchPositionBlockedInInsecureContext.html51
-rw-r--r--dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html36
-rw-r--r--dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off_iframe.html28
-rw-r--r--dom/tests/mochitest/geolocation/test_handlerSpinsEventLoop.html70
-rw-r--r--dom/tests/mochitest/geolocation/test_hidden.html110
-rw-r--r--dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html60
-rw-r--r--dom/tests/mochitest/geolocation/test_manyCurrentSerial.html47
-rw-r--r--dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html60
-rw-r--r--dom/tests/mochitest/geolocation/test_manyWatchSerial.html56
-rw-r--r--dom/tests/mochitest/geolocation/test_manyWindows.html67
-rw-r--r--dom/tests/mochitest/geolocation/test_native_provider.html70
-rw-r--r--dom/tests/mochitest/geolocation/test_not_fully_active.html93
-rw-r--r--dom/tests/mochitest/geolocation/test_optional_api_params.html126
-rw-r--r--dom/tests/mochitest/geolocation/test_shutdown.html63
-rw-r--r--dom/tests/mochitest/geolocation/test_timeoutCurrent.html56
-rw-r--r--dom/tests/mochitest/geolocation/test_timeoutWatch.html65
-rw-r--r--dom/tests/mochitest/geolocation/test_timerRestartWatch.html75
-rw-r--r--dom/tests/mochitest/geolocation/test_windowClose.html36
-rw-r--r--dom/tests/mochitest/geolocation/test_worseAccuracyDoesNotBlockCallback.html51
-rw-r--r--dom/tests/mochitest/geolocation/windowTest.html44
-rw-r--r--dom/tests/mochitest/integer-gemm/mochitest.ini3
-rw-r--r--dom/tests/mochitest/integer-gemm/test_unavailable_for_webpage.html29
-rw-r--r--dom/tests/mochitest/keyhandling/browsertest.html108
-rw-r--r--dom/tests/mochitest/keyhandling/chrome.ini19
-rw-r--r--dom/tests/mochitest/keyhandling/mochitest.ini10
-rw-r--r--dom/tests/mochitest/keyhandling/test_browser.xhtml252
-rw-r--r--dom/tests/mochitest/keyhandling/test_editor.xhtml268
-rw-r--r--dom/tests/mochitest/keyhandling/test_input.html226
-rw-r--r--dom/tests/mochitest/keyhandling/test_textarea.html226
-rw-r--r--dom/tests/mochitest/keyhandling/test_windowed.xhtml33
-rw-r--r--dom/tests/mochitest/localstorage/chrome.ini11
-rw-r--r--dom/tests/mochitest/localstorage/file_tryAccessSessionStorage.html10
-rw-r--r--dom/tests/mochitest/localstorage/frameChromeSlave.html9
-rw-r--r--dom/tests/mochitest/localstorage/frameKeySync.html51
-rw-r--r--dom/tests/mochitest/localstorage/frameLocalStorageCookieSettings.html26
-rw-r--r--dom/tests/mochitest/localstorage/frameLocalStorageSessionOnly.html8
-rw-r--r--dom/tests/mochitest/localstorage/frameMasterEqual.html56
-rw-r--r--dom/tests/mochitest/localstorage/frameMasterNotEqual.html47
-rw-r--r--dom/tests/mochitest/localstorage/frameOrder.html27
-rw-r--r--dom/tests/mochitest/localstorage/frameReplace.html72
-rw-r--r--dom/tests/mochitest/localstorage/frameSlaveEqual.html51
-rw-r--r--dom/tests/mochitest/localstorage/frameSlaveNotEqual.html44
-rw-r--r--dom/tests/mochitest/localstorage/interOriginFrame.js53
-rw-r--r--dom/tests/mochitest/localstorage/interOriginTest.js41
-rw-r--r--dom/tests/mochitest/localstorage/interOriginTest2.js53
-rw-r--r--dom/tests/mochitest/localstorage/localStorageCommon.js131
-rw-r--r--dom/tests/mochitest/localstorage/mochitest.ini63
-rw-r--r--dom/tests/mochitest/localstorage/page_blank.html6
-rw-r--r--dom/tests/mochitest/localstorage/test_brokenUTF-16.html100
-rw-r--r--dom/tests/mochitest/localstorage/test_bug600307-DBOps.html178
-rw-r--r--dom/tests/mochitest/localstorage/test_bug746272-1.html32
-rw-r--r--dom/tests/mochitest/localstorage/test_bug746272-2.html31
-rw-r--r--dom/tests/mochitest/localstorage/test_cookieBlock.html53
-rw-r--r--dom/tests/mochitest/localstorage/test_embededNulls.html40
-rw-r--r--dom/tests/mochitest/localstorage/test_keySync.html33
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageBase.html247
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageBasePrivateBrowsing_perwindowpb.html256
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageBaseSessionOnly.html211
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html75
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageEnablePref.html65
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml60
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageKeyOrder.html73
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageOriginsDiff.html41
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageOriginsDomainDiffs.html41
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageOriginsEquals.html42
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageOriginsPortDiffs.html41
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageOriginsSchemaDiffs.html41
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuota.html136
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html189
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html134
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html98
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageReplace.html80
-rw-r--r--dom/tests/mochitest/localstorage/test_storageConstructor.html35
-rw-r--r--dom/tests/mochitest/localstorage/windowProxy.html3
-rw-r--r--dom/tests/mochitest/orientation/bug507902-frame.html30
-rw-r--r--dom/tests/mochitest/orientation/mochitest.ini4
-rw-r--r--dom/tests/mochitest/orientation/test_bug507902.html36
-rw-r--r--dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html96
-rw-r--r--dom/tests/mochitest/pointerlock/file_changeLockElement.html115
-rw-r--r--dom/tests/mochitest/pointerlock/file_childIframe.html134
-rw-r--r--dom/tests/mochitest/pointerlock/file_doubleLock.html64
-rw-r--r--dom/tests/mochitest/pointerlock/file_escapeKey.html77
-rw-r--r--dom/tests/mochitest/pointerlock/file_infiniteMovement.html114
-rw-r--r--dom/tests/mochitest/pointerlock/file_locksvgelement.html62
-rw-r--r--dom/tests/mochitest/pointerlock/file_movementXY.html106
-rw-r--r--dom/tests/mochitest/pointerlock/file_nestedFullScreen.html76
-rw-r--r--dom/tests/mochitest/pointerlock/file_pointerLockPref.html75
-rw-r--r--dom/tests/mochitest/pointerlock/file_pointerlock-api-with-shadow.html110
-rw-r--r--dom/tests/mochitest/pointerlock/file_pointerlock-api.html104
-rw-r--r--dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe.html125
-rw-r--r--dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_no_user_gesture.html95
-rw-r--r--dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_not_focused.html112
-rw-r--r--dom/tests/mochitest/pointerlock/file_pointerlockerror.html41
-rw-r--r--dom/tests/mochitest/pointerlock/file_removedFromDOM.html95
-rw-r--r--dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html212
-rw-r--r--dom/tests/mochitest/pointerlock/file_screenClientXYConst.html143
-rw-r--r--dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html158
-rw-r--r--dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html69
-rw-r--r--dom/tests/mochitest/pointerlock/file_withoutDOM.html54
-rw-r--r--dom/tests/mochitest/pointerlock/iframe_differentDOM.html7
-rw-r--r--dom/tests/mochitest/pointerlock/mochitest.ini37
-rw-r--r--dom/tests/mochitest/pointerlock/pointerlock_utils.js99
-rw-r--r--dom/tests/mochitest/pointerlock/test_closewindow-with-pointerlock.html51
-rw-r--r--dom/tests/mochitest/pointerlock/test_pointerlock-api.html113
-rw-r--r--dom/tests/mochitest/pointerlock/test_pointerlock_focus.html111
-rw-r--r--dom/tests/mochitest/pointerlock/test_pointerlock_target_not_in_active_document.html77
-rw-r--r--dom/tests/mochitest/pointerlock/test_pointerlock_xorigin_iframe.html59
-rw-r--r--dom/tests/mochitest/script/bug1656248_frame.html11
-rw-r--r--dom/tests/mochitest/script/file_blocked_script.sjs70
-rw-r--r--dom/tests/mochitest/script/mochitest.ini15
-rw-r--r--dom/tests/mochitest/script/slow.sjs15
-rw-r--r--dom/tests/mochitest/script/subdir/.eslintrc.js11
-rw-r--r--dom/tests/mochitest/script/subdir/bug1656248_import.js1
-rw-r--r--dom/tests/mochitest/script/subdir/bug1656248_script.js18
-rw-r--r--dom/tests/mochitest/script/test_bug1053321.html50
-rw-r--r--dom/tests/mochitest/script/test_bug1656248.html93
-rw-r--r--dom/tests/mochitest/script/test_bug1788532.html21
-rw-r--r--dom/tests/mochitest/script/test_bug1788532_moduleA.mjs15
-rw-r--r--dom/tests/mochitest/script/test_bug1788532_moduleB.mjs2
-rw-r--r--dom/tests/mochitest/script/test_whitespace.html31
-rw-r--r--dom/tests/mochitest/sessionstorage/chrome.ini3
-rw-r--r--dom/tests/mochitest/sessionstorage/file_http.html40
-rw-r--r--dom/tests/mochitest/sessionstorage/file_https.html15
-rw-r--r--dom/tests/mochitest/sessionstorage/frameEqual.html47
-rw-r--r--dom/tests/mochitest/sessionstorage/frameNotEqual.html49
-rw-r--r--dom/tests/mochitest/sessionstorage/frameReplace.html75
-rw-r--r--dom/tests/mochitest/sessionstorage/interOriginSlave.js40
-rw-r--r--dom/tests/mochitest/sessionstorage/interOriginTest.js43
-rw-r--r--dom/tests/mochitest/sessionstorage/mochitest.ini28
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageBase.html180
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageBaseSessionOnly.html231
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageClone.html112
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned.html110
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned_exempted.html110
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageFromChrome.xhtml34
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageHttpHttps.html59
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageReplace.html78
-rw-r--r--dom/tests/mochitest/sessionstorage/test_sessionStorageUsage.html53
-rw-r--r--dom/tests/mochitest/storageevent/frameLocalStorageMaster.html63
-rw-r--r--dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html55
-rw-r--r--dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html39
-rw-r--r--dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html67
-rw-r--r--dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html70
-rw-r--r--dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html59
-rw-r--r--dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html39
-rw-r--r--dom/tests/mochitest/storageevent/interOriginFrame.js63
-rw-r--r--dom/tests/mochitest/storageevent/interOriginTest2.js60
-rw-r--r--dom/tests/mochitest/storageevent/mochitest.ini25
-rw-r--r--dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckNoPropagation.html43
-rw-r--r--dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckPropagation.html43
-rw-r--r--dom/tests/mochitest/storageevent/test_storageNotifications.html130
-rw-r--r--dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckNoPropagation.html43
-rw-r--r--dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckPropagation.html43
-rw-r--r--dom/tests/mochitest/webcomponents/chrome.ini17
-rw-r--r--dom/tests/mochitest/webcomponents/dummy_page.html10
-rw-r--r--dom/tests/mochitest/webcomponents/head.js26
-rw-r--r--dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js107
-rw-r--r--dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js282
-rw-r--r--dom/tests/mochitest/webcomponents/inert_style.css10
-rw-r--r--dom/tests/mochitest/webcomponents/mochitest.ini50
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug1017896.html32
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug1269155.html95
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug1276240.html44
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug900724.html32
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html43
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_define.html129
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html61
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html55
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_get.html31
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html42
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html40
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html129
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html432
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_namespace.html95
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml104
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html159
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_stack.html138
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_template.html33
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html66
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html37
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html41
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html43
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html140
-rw-r--r--dom/tests/mochitest/webcomponents/test_detached_style.html35
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_adoptnode.html42
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_importnode.html42
-rw-r--r--dom/tests/mochitest/webcomponents/test_event_composed.html72
-rw-r--r--dom/tests/mochitest/webcomponents/test_event_retarget.html153
-rw-r--r--dom/tests/mochitest/webcomponents/test_event_stopping.html174
-rw-r--r--dom/tests/mochitest/webcomponents/test_link_prefetch.html110
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html62
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowdom_ime.html59
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot.html77
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html46
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html30
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_style.html85
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html52
-rw-r--r--dom/tests/mochitest/webcomponents/test_style_fallback_content.html39
-rw-r--r--dom/tests/mochitest/webcomponents/test_template.html153
-rw-r--r--dom/tests/mochitest/webcomponents/test_template_xhtml.html46
-rw-r--r--dom/tests/mochitest/webcomponents/test_upgrade_page.html11
-rw-r--r--dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml386
-rw-r--r--dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml60
-rw-r--r--dom/tests/mochitest/webcomponents/upgrade_tests.js128
-rw-r--r--dom/tests/mochitest/whatwg/chrome.ini3
-rw-r--r--dom/tests/mochitest/whatwg/file_bug500328_1.html51
-rw-r--r--dom/tests/mochitest/whatwg/file_bug500328_2.html17
-rw-r--r--dom/tests/mochitest/whatwg/mochitest.ini68
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_chrome_helper.html49
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_closed_helper.html26
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_hash.html31
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_helper.html103
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_idn_helper.html41
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_joined_helper.html85
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_joined_helper2.html71
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_onOther.html109
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml42
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_override_helper.html37
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html106
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.js62
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_throw_helper.html24
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_transfer_helper.html15
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_userpass_helper.html34
-rw-r--r--dom/tests/mochitest/whatwg/test_MessageEvent.html102
-rw-r--r--dom/tests/mochitest/whatwg/test_MessageEvent_dispatchToOther.html59
-rw-r--r--dom/tests/mochitest/whatwg/test_bug477323.html64
-rw-r--r--dom/tests/mochitest/whatwg/test_bug500328.html769
-rw-r--r--dom/tests/mochitest/whatwg/test_document_scripts.html55
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage.html161
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_basehref.html45
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_chrome.html114
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_closed.html77
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_hash.html44
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml66
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_joined.html53
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_onOther.html51
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml465
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_override.html47
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_special.xhtml304
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html70
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_throw.html74
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_transfer.html61
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_userpass.html46
-rw-r--r--dom/tests/moz.build235
-rw-r--r--dom/tests/reftest/bug1389406-01.xsl15
-rw-r--r--dom/tests/reftest/bug1389406-02.xsl15
-rw-r--r--dom/tests/reftest/bug1389406-ref.xml2
-rw-r--r--dom/tests/reftest/bug1389406.xml3
-rw-r--r--dom/tests/reftest/bug427779-ref.xml3
-rw-r--r--dom/tests/reftest/bug427779.xml4
-rw-r--r--dom/tests/reftest/bug439965-ref.html20
-rw-r--r--dom/tests/reftest/bug439965.html21
-rw-r--r--dom/tests/reftest/bug453105-ref.html7
-rw-r--r--dom/tests/reftest/bug453105.html9
-rw-r--r--dom/tests/reftest/bug456008-ref.html10
-rw-r--r--dom/tests/reftest/bug456008.xhtml11
-rw-r--r--dom/tests/reftest/bug559996-iframe.html7
-rw-r--r--dom/tests/reftest/bug559996-ref-iframe.html8
-rw-r--r--dom/tests/reftest/bug559996-ref.html16
-rw-r--r--dom/tests/reftest/bug559996.html16
-rw-r--r--dom/tests/reftest/bug591981-1.html32
-rw-r--r--dom/tests/reftest/bug591981-2.html32
-rw-r--r--dom/tests/reftest/bug591981-ref.html9
-rw-r--r--dom/tests/reftest/bug591981-script.js1
-rw-r--r--dom/tests/reftest/bug592366-1.html7
-rw-r--r--dom/tests/reftest/bug592366-1.xhtml6
-rw-r--r--dom/tests/reftest/bug592366-2.html7
-rw-r--r--dom/tests/reftest/bug592366-2.xhtml6
-rw-r--r--dom/tests/reftest/bug592366-ref.html9
-rw-r--r--dom/tests/reftest/bug592366-ref.xhtml9
-rw-r--r--dom/tests/reftest/bug798068-ref.xhtml18
-rw-r--r--dom/tests/reftest/bug798068.xhtml19
-rw-r--r--dom/tests/reftest/child592366-1.html19
-rw-r--r--dom/tests/reftest/child592366-1.xhtml18
-rw-r--r--dom/tests/reftest/child592366-2.html17
-rw-r--r--dom/tests/reftest/child592366-2.xhtml16
-rw-r--r--dom/tests/reftest/optiontext-ref.html8
-rw-r--r--dom/tests/reftest/optiontext.html8
-rw-r--r--dom/tests/reftest/reftest.list14
-rw-r--r--dom/tests/reftest/script592366-2.js2
-rw-r--r--dom/tests/reftest/xml-stylesheet/css_relative_href.xml2
-rw-r--r--dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml2
-rw-r--r--dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml^headers^1
-rw-r--r--dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml2
-rw-r--r--dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml^headers^1
-rw-r--r--dom/tests/reftest/xml-stylesheet/embedded_dtd_id.svg20
-rw-r--r--dom/tests/reftest/xml-stylesheet/error_no_href.svg8
-rw-r--r--dom/tests/reftest/xml-stylesheet/fail.svg4
-rw-r--r--dom/tests/reftest/xml-stylesheet/failer.css1
-rw-r--r--dom/tests/reftest/xml-stylesheet/lreas_selflink_dtd_id.svg9
-rw-r--r--dom/tests/reftest/xml-stylesheet/lreas_selflink_empty_href.svg8
-rw-r--r--dom/tests/reftest/xml-stylesheet/lreas_selflink_relative_href.svg9
-rw-r--r--dom/tests/reftest/xml-stylesheet/pass.svg4
-rw-r--r--dom/tests/reftest/xml-stylesheet/passer.css1
-rw-r--r--dom/tests/reftest/xml-stylesheet/passer_override.css1
-rw-r--r--dom/tests/reftest/xml-stylesheet/reftest.list12
-rw-r--r--dom/tests/reftest/xml-stylesheet/svg_passer.xslt11
-rw-r--r--dom/tests/reftest/xml-stylesheet/xslt_relative_href.svg4
-rw-r--r--dom/tests/reftest/xml-stylesheet/xslt_selflink_dtd_id.xml11
-rw-r--r--dom/tests/reftest/xml-stylesheet/xslt_selflink_empty_href.xml10
-rw-r--r--dom/tests/reftest/xml-stylesheet/xslt_selflink_relative_href.xml11
-rw-r--r--dom/tests/unit/test_Fetch.js366
-rw-r--r--dom/tests/unit/test_PromiseDebugging.js21
-rw-r--r--dom/tests/unit/test_bug319968.js19
-rw-r--r--dom/tests/unit/test_bug465752.js26
-rw-r--r--dom/tests/unit/test_geolocation_monitor.js97
-rw-r--r--dom/tests/unit/test_geolocation_position_unavailable.js28
-rw-r--r--dom/tests/unit/test_geolocation_position_unavailable_wrap.js6
-rw-r--r--dom/tests/unit/test_geolocation_provider.js83
-rw-r--r--dom/tests/unit/test_geolocation_provider_timeout.js43
-rw-r--r--dom/tests/unit/test_geolocation_reset_accuracy.js93
-rw-r--r--dom/tests/unit/test_geolocation_reset_accuracy_wrap.js61
-rw-r--r--dom/tests/unit/test_geolocation_timeout.js59
-rw-r--r--dom/tests/unit/test_geolocation_timeout_wrap.js15
-rw-r--r--dom/tests/unit/test_xhr_init.js13
-rw-r--r--dom/tests/unit/xpcshell.ini24
2789 files changed, 338904 insertions, 0 deletions
diff --git a/dom/tests/browser/.eslintrc.js b/dom/tests/browser/.eslintrc.js
new file mode 100644
index 0000000000..e247fd78e9
--- /dev/null
+++ b/dom/tests/browser/.eslintrc.js
@@ -0,0 +1,12 @@
+"use strict";
+
+module.exports = {
+ overrides: [
+ {
+ files: ["file_module_loaded.js", "file_module_loaded2.js"],
+ parserOptions: {
+ sourceType: "module",
+ },
+ },
+ ],
+};
diff --git a/dom/tests/browser/beforeunload_test_page.html b/dom/tests/browser/beforeunload_test_page.html
new file mode 100644
index 0000000000..12dc636e23
--- /dev/null
+++ b/dom/tests/browser/beforeunload_test_page.html
@@ -0,0 +1,92 @@
+<!doctype html>
+<html>
+<body>
+
+<p>
+ There are currently <span id="totalInnerHandlers">0</span> beforeunload handlers registered in this frame.
+</p>
+<p>
+ There are currently <span id="totalOuterHandlers">0</span> beforeunload handlers registered on my subframe.
+</p>
+
+<iframe src="about:blank" id="subframe"></iframe>
+
+<script>
+ this.BeforeUnloader = {
+ _innerEventHandlers: [],
+ _outerEventHandlers: [],
+
+ get $totalInner() {
+ delete this.$totalInner;
+ return this.$totalInner = document.getElementById("totalInnerHandlers");
+ },
+
+ get $totalOuter() {
+ delete this.$totalOuter;
+ return this.$totalOuter = document.getElementById("totalOuterHandlers");
+ },
+
+ get $subframe() {
+ delete this.$subframe;
+ return this.$subframe = document.getElementById("subframe");
+ },
+
+ pushInner(howMany) {
+ for (let i = 0; i < howMany; ++i) {
+ let func = () => {};
+ this._innerEventHandlers.push(func);
+ addEventListener("beforeunload", func);
+ }
+
+ this.$totalInner.textContent = this._innerEventHandlers.length;
+ },
+
+ popInner(howMany) {
+ for (let i = 0; i < howMany; ++i) {
+ let func = this._innerEventHandlers.pop();
+ if (func) {
+ removeEventListener("beforeunload", func);
+ }
+ }
+
+ this.$totalInner.textContent = this._innerEventHandlers.length;
+ },
+
+ pushOuter(howMany) {
+ if (!this.$subframe.parentNode) {
+ throw new Error("Subframe I'm holding a reference to detached!");
+ }
+
+ for (let i = 0; i < howMany; ++i) {
+ let func = () => {};
+ this._outerEventHandlers.push(func);
+ this.$subframe.contentWindow.addEventListener("beforeunload", func);
+ }
+
+ this.$totalOuter.textContent = this._outerEventHandlers.length;
+ },
+
+ popOuter(howMany) {
+ if (!this.$subframe.parentNode) {
+ throw new Error("Subframe I'm holding a reference to detached!");
+ }
+
+ for (let i = 0; i < howMany; ++i) {
+ let func = this._outerEventHandlers.pop();
+ if (func) {
+ this.$subframe.contentWindow.removeEventListener("beforeunload", func);
+ }
+ }
+
+ this.$totalOuter.textContent = this._outerEventHandlers.length;
+ },
+
+ reset() {
+ this.popInner(this._innerEventHandlers.length);
+ this.popOuter(this._outerEventHandlers.length);
+ },
+ };
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/browser/browser.ini b/dom/tests/browser/browser.ini
new file mode 100644
index 0000000000..2fae2c0f4a
--- /dev/null
+++ b/dom/tests/browser/browser.ini
@@ -0,0 +1,140 @@
+[DEFAULT]
+support-files =
+ browser_frame_elements.html
+ page_privatestorageevent.html
+ page_localStorage.js
+ page_localstorage.html
+ page_localstorage_coop+coep.html
+ page_localstorage_coop+coep.html^headers^
+ page_localstorage_snapshotting.html
+ position.html
+ test-console-api.html
+ test_bug1004814.html
+ worker_bug1004814.js
+ geo_leak_test.html
+ dummy.html
+ dummy.png
+ helper_localStorage.js
+ !/dom/tests/mochitest/geolocation/network_geolocation.sjs
+
+[browser_autofocus_background.js]
+[browser_autofocus_preference.js]
+[browser_beforeunload_between_chrome_content.js]
+https_first_disabled = true
+[browser_bug396843.js]
+[browser_bug1004814.js]
+[browser_bug1008941_dismissGeolocationHanger.js]
+tags = geolocation
+[browser_bug1236512.js]
+skip-if = os != "mac"
+[browser_bug1238427.js]
+[browser_bug1316330.js]
+[browser_bug1563629.js]
+support-files =
+ file_postMessage_parent.html
+[browser_bug1685807.js]
+support-files =
+ file_bug1685807.html
+skip-if =
+ os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
+[browser_cancel_keydown_keypress_event.js]
+support-files =
+ prevent_return_key.html
+[browser_ConsoleAPI_originAttributes.js]
+[browser_ConsoleStorageAPITests.js]
+[browser_ConsoleStoragePBTest_perwindowpb.js]
+[browser_data_document_crossOriginIsolated.js]
+[browser_focus_steal_from_chrome.js]
+[browser_focus_steal_from_chrome_during_mousedown.js]
+[browser_form_associated_custom_elements_validity.js]
+support-files =
+ file_empty.html
+[browser_frame_elements.js]
+[browser_hasbeforeunload.js]
+https_first_disabled = true
+support-files =
+ beforeunload_test_page.html
+[browser_hasActivePeerConnections.js]
+support-files =
+ create_webrtc_peer_connection.html
+skip-if =
+ os == "linux" && bits == 64 # Bug 1742012
+ os == "win" && debug # Bug 1742012
+ os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
+[browser_localStorage_e10s.js]
+https_first_disabled = true
+fail-if = fission
+skip-if =
+ verify
+ tsan # Times out on TSan intermittently.
+[browser_localStorage_fis.js]
+skip-if =
+ verify
+ tsan
+ !fission
+[browser_localStorage_privatestorageevent.js]
+[browser_localStorage_snapshotting.js]
+[browser_persist_cookies.js]
+support-files =
+ set-samesite-cookies-and-redirect.sjs
+ mimeme.sjs
+[browser_persist_image_accept.js]
+[browser_persist_mixed_content_image.js]
+support-files =
+ test_mixed_content_image.html
+[browser_pointerlock_warning.js]
+[browser_sessionStorage_navigation.js]
+skip-if =
+ os == "linux" && bits == 64 && !debug # Bug 1712961
+support-files =
+ file_empty.html
+ file_coop_coep.html
+ file_coop_coep.html^headers^
+[browser_test_focus_after_modal_state.js]
+skip-if = verify
+support-files =
+ focus_after_prompt.html
+[browser_test_new_window_from_content.js]
+tags = openwindow
+skip-if = toolkit == 'android'
+ (os == "linux" && debug) # see bug 1261495 for Linux debug time outs
+support-files =
+ test_new_window_from_content_child.html
+[browser_test_toolbars_visibility.js]
+https_first_disabled = true
+support-files =
+ test_new_window_from_content_child.html
+skip-if =
+ os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
+[browser_unlinkable_about_page_can_load_module_scripts.js]
+support-files =
+ file_load_module_script.html
+ file_module_loaded.js
+ file_module_loaded2.js
+[browser_xhr_sandbox.js]
+[browser_noopener.js]
+skip-if = verify && debug && (os == 'linux')
+support-files =
+ test_noopener_source.html
+ test_noopener_target.html
+[browser_noopener_null_uri.js]
+[browser_wakelock.js]
+[browser_keypressTelemetry.js]
+skip-if = true
+[browser_windowProxy_transplant.js]
+support-files =
+ file_postMessage_parent.html
+[browser_navigate_replace_browsingcontext.js]
+[browser_persist_cross_origin_iframe.js]
+skip-if =
+ os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
+support-files =
+ image.html
+[browser_bytecode_cache_asm_js.js]
+support-files =
+ page_bytecode_cache_asm_js.html
+ page_bytecode_cache_asm_js.js
+[browser_bug1709346.js]
+support-files =
+ load_forever.sjs
+ file_empty_cross_site_frame.html
diff --git a/dom/tests/browser/browser_ConsoleAPI_originAttributes.js b/dom/tests/browser/browser_ConsoleAPI_originAttributes.js
new file mode 100644
index 0000000000..9e96dba728
--- /dev/null
+++ b/dom/tests/browser/browser_ConsoleAPI_originAttributes.js
@@ -0,0 +1,108 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
+ Ci.nsIConsoleAPIStorage
+);
+
+const { WebExtensionPolicy } = Cu.getGlobalForObject(
+ ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs")
+);
+
+const FAKE_ADDON_ID = "test-webext-addon@mozilla.org";
+const EXPECTED_CONSOLE_ID = `addon/${FAKE_ADDON_ID}`;
+const EXPECTED_CONSOLE_MESSAGE_CONTENT = "fake-webext-addon-test-log-message";
+
+const ConsoleObserver = {
+ init() {
+ ConsoleAPIStorage.addLogEventListener(
+ this.observe,
+ Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal)
+ );
+ },
+
+ uninit() {
+ ConsoleAPIStorage.removeLogEventListener(this.observe);
+ },
+
+ observe(aSubject) {
+ let consoleAPIMessage = aSubject.wrappedJSObject;
+
+ is(
+ consoleAPIMessage.arguments[0],
+ EXPECTED_CONSOLE_MESSAGE_CONTENT,
+ "the consoleAPIMessage contains the expected message"
+ );
+
+ is(
+ consoleAPIMessage.addonId,
+ FAKE_ADDON_ID,
+ "the consoleAPImessage originAttributes contains the expected addonId"
+ );
+
+ let cachedMessages = ConsoleAPIStorage.getEvents().filter(msg => {
+ return msg.addonId == FAKE_ADDON_ID;
+ });
+
+ is(
+ cachedMessages.length,
+ 1,
+ "found the expected cached console messages from the addon"
+ );
+ is(
+ cachedMessages[0] && cachedMessages[0].addonId,
+ FAKE_ADDON_ID,
+ "the cached message originAttributes contains the expected addonId"
+ );
+
+ finish();
+ },
+};
+
+function test() {
+ ConsoleObserver.init();
+
+ waitForExplicitFinish();
+
+ let uuidGenerator = Services.uuid;
+ let uuid = uuidGenerator.generateUUID().number;
+ uuid = uuid.slice(1, -1); // Strip { and } off the UUID.
+
+ const url = `moz-extension://${uuid}/`;
+ let policy = new WebExtensionPolicy({
+ id: FAKE_ADDON_ID,
+ mozExtensionHostname: uuid,
+ baseURL: "file:///",
+ allowedOrigins: new MatchPatternSet([]),
+ localizeCallback() {},
+ });
+ policy.active = true;
+
+ let baseURI = Services.io.newURI(url);
+ let principal = Services.scriptSecurityManager.createContentPrincipal(
+ baseURI,
+ {}
+ );
+
+ let chromeWebNav = Services.appShell.createWindowlessBrowser(true);
+ let docShell = chromeWebNav.docShell;
+ docShell.createAboutBlankContentViewer(principal, principal);
+
+ info("fake webextension docShell created");
+
+ registerCleanupFunction(function () {
+ policy.active = false;
+ if (chromeWebNav) {
+ chromeWebNav.close();
+ chromeWebNav = null;
+ }
+ ConsoleObserver.uninit();
+ });
+
+ let window = docShell.contentViewer.DOMDocument.defaultView;
+ window.eval(`console.log("${EXPECTED_CONSOLE_MESSAGE_CONTENT}");`);
+ chromeWebNav.close();
+ chromeWebNav = null;
+
+ info("fake webextension page logged a console api message");
+}
diff --git a/dom/tests/browser/browser_ConsoleStorageAPITests.js b/dom/tests/browser/browser_ConsoleStorageAPITests.js
new file mode 100644
index 0000000000..f28db48a91
--- /dev/null
+++ b/dom/tests/browser/browser_ConsoleStorageAPITests.js
@@ -0,0 +1,108 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const TEST_URI =
+ "http://example.com/browser/dom/tests/browser/test-console-api.html";
+
+function tearDown() {
+ while (gBrowser.tabs.length > 1) {
+ gBrowser.removeCurrentTab();
+ }
+}
+
+add_task(async function () {
+ // Don't cache removed tabs, so "clear console cache on tab close" triggers.
+ await SpecialPowers.pushPrefEnv({ set: [["browser.tabs.max_tabs_undo", 0]] });
+
+ registerCleanupFunction(tearDown);
+
+ info(
+ "Open a keepalive tab in the background to make sure we don't accidentally kill the content process"
+ );
+ var keepaliveTab = await BrowserTestUtils.addTab(
+ gBrowser,
+ "data:text/html,<meta charset=utf8>Keep Alive Tab"
+ );
+
+ info("Open the main tab to run the test in");
+ var tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URI);
+ var browser = gBrowser.selectedBrowser;
+
+ const windowId = await ContentTask.spawn(browser, null, async function (opt) {
+ let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
+ Ci.nsIConsoleAPIStorage
+ );
+
+ let observerPromise = new Promise(resolve => {
+ let apiCallCount = 0;
+ function observe(aSubject) {
+ apiCallCount++;
+ info(`Received ${apiCallCount} console log events`);
+ if (apiCallCount == 4) {
+ ConsoleAPIStorage.removeLogEventListener(observe);
+ resolve();
+ }
+ }
+
+ info("Setting up observer");
+ ConsoleAPIStorage.addLogEventListener(
+ observe,
+ Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal)
+ );
+ });
+
+ info("Emit a few console API logs");
+ content.console.log("this", "is", "a", "log", "message");
+ content.console.info("this", "is", "a", "info", "message");
+ content.console.warn("this", "is", "a", "warn", "message");
+ content.console.error("this", "is", "a", "error", "message");
+
+ info("Wait for the corresponding log event");
+ await observerPromise;
+
+ const innerWindowId = content.windowGlobalChild.innerWindowId;
+ const events = ConsoleAPIStorage.getEvents(innerWindowId).filter(
+ message =>
+ message.arguments[0] === "this" &&
+ message.arguments[1] === "is" &&
+ message.arguments[2] === "a" &&
+ message.arguments[4] === "message"
+ );
+ is(events.length, 4, "The storage service got the messages we emitted");
+
+ info("Ensure clearEvents does remove the events from storage");
+ ConsoleAPIStorage.clearEvents();
+ is(ConsoleAPIStorage.getEvents(innerWindowId).length, 0, "Cleared Storage");
+
+ return content.windowGlobalChild.innerWindowId;
+ });
+
+ await SpecialPowers.spawn(browser, [], function () {
+ // make sure a closed window's events are in fact removed from
+ // the storage cache
+ content.console.log("adding a new event");
+ });
+
+ info("Close the window");
+ gBrowser.removeTab(tab, { animate: false });
+ // Ensure actual window destruction is not delayed (too long).
+ SpecialPowers.DOMWindowUtils.garbageCollect();
+
+ // Spawn the check in the keepaliveTab, so that we can read the ConsoleAPIStorage correctly
+ gBrowser.selectedTab = keepaliveTab;
+ browser = gBrowser.selectedBrowser;
+
+ // Spin the event loop to make sure everything is cleared.
+ await SpecialPowers.spawn(browser, [], () => {});
+
+ await SpecialPowers.spawn(browser, [windowId], function (windowId) {
+ var ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
+ Ci.nsIConsoleAPIStorage
+ );
+ is(
+ ConsoleAPIStorage.getEvents(windowId).length,
+ 0,
+ "tab close is clearing the cache"
+ );
+ });
+});
diff --git a/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js
new file mode 100644
index 0000000000..79b5a820ff
--- /dev/null
+++ b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js
@@ -0,0 +1,93 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+function test() {
+ // initialization
+ waitForExplicitFinish();
+ let windowsToClose = [];
+ let innerID;
+ let beforeEvents;
+ let afterEvents;
+ let storageShouldOccur;
+ let testURI =
+ "http://example.com/browser/dom/tests/browser/test-console-api.html";
+ let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
+ Ci.nsIConsoleAPIStorage
+ );
+
+ function getInnerWindowId(aWindow) {
+ return aWindow.windowGlobalChild.innerWindowId;
+ }
+
+ function whenNewWindowLoaded(aOptions, aCallback) {
+ let win = OpenBrowserWindow(aOptions);
+ win.addEventListener(
+ "load",
+ function () {
+ aCallback(win);
+ },
+ { once: true }
+ );
+ }
+
+ function doTest(aIsPrivateMode, aWindow, aCallback) {
+ BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser).then(
+ () => {
+ function observe(aSubject) {
+ afterEvents = ConsoleAPIStorage.getEvents(innerID);
+ is(
+ beforeEvents.length == afterEvents.length - 1,
+ storageShouldOccur,
+ "storage should" + (storageShouldOccur ? "" : " not") + " occur"
+ );
+
+ executeSoon(function () {
+ ConsoleAPIStorage.removeLogEventListener(observe);
+ aCallback();
+ });
+ }
+
+ ConsoleAPIStorage.addLogEventListener(
+ observe,
+ aWindow.document.nodePrincipal
+ );
+ aWindow.nativeConsole.log(
+ "foo bar baz (private: " + aIsPrivateMode + ")"
+ );
+ }
+ );
+
+ // We expect that console API messages are always stored.
+ storageShouldOccur = true;
+ innerID = getInnerWindowId(aWindow);
+ beforeEvents = ConsoleAPIStorage.getEvents(innerID);
+ BrowserTestUtils.loadURIString(aWindow.gBrowser.selectedBrowser, testURI);
+ }
+
+ function testOnWindow(aOptions, aCallback) {
+ whenNewWindowLoaded(aOptions, function (aWin) {
+ windowsToClose.push(aWin);
+ // execute should only be called when need, like when you are opening
+ // web pages on the test. If calling executeSoon() is not necesary, then
+ // call whenNewWindowLoaded() instead of testOnWindow() on your test.
+ executeSoon(() => aCallback(aWin));
+ });
+ }
+
+ // this function is called after calling finish() on the test.
+ registerCleanupFunction(function () {
+ windowsToClose.forEach(function (aWin) {
+ aWin.close();
+ });
+ });
+
+ // test first when not on private mode
+ testOnWindow({}, function (aWin) {
+ doTest(false, aWin, function () {
+ // then test when on private mode
+ testOnWindow({ private: true }, function (aWin) {
+ doTest(true, aWin, finish);
+ });
+ });
+ });
+}
diff --git a/dom/tests/browser/browser_autofocus_background.js b/dom/tests/browser/browser_autofocus_background.js
new file mode 100644
index 0000000000..ecac9a9a98
--- /dev/null
+++ b/dom/tests/browser/browser_autofocus_background.js
@@ -0,0 +1,59 @@
+add_task(async function () {
+ const URL =
+ "data:text/html,<!DOCTYPE html><html><body><input autofocus id='target'></body></html>";
+ const foregroundTab = gBrowser.selectedTab;
+ const backgroundTab = BrowserTestUtils.addTab(gBrowser);
+
+ // Ensure tab is still in the foreground.
+ is(
+ gBrowser.selectedTab,
+ foregroundTab,
+ "foregroundTab should still be selected"
+ );
+
+ // Load the second tab in the background.
+ const loadedPromise = BrowserTestUtils.browserLoaded(
+ backgroundTab.linkedBrowser,
+ /* includesubframes */ false,
+ URL
+ );
+ BrowserTestUtils.loadURIString(backgroundTab.linkedBrowser, URL);
+ await loadedPromise;
+
+ // Get active element in the tab.
+ let tagName = await SpecialPowers.spawn(
+ backgroundTab.linkedBrowser,
+ [],
+ async function () {
+ // Spec asks us to flush autofocus candidates in the
+ // `update-the-rendering` step, so we need to wait
+ // for a rAF to ensure autofocus candidates are
+ // flushed.
+ await new Promise(r => {
+ content.requestAnimationFrame(r);
+ });
+ return content.document.activeElement.tagName;
+ }
+ );
+
+ is(
+ tagName,
+ "INPUT",
+ "The background tab's focused element should be the <input>"
+ );
+
+ is(
+ gBrowser.selectedTab,
+ foregroundTab,
+ "foregroundTab tab should still be selected, shouldn't cause a tab switch"
+ );
+
+ is(
+ document.activeElement,
+ foregroundTab.linkedBrowser,
+ "The background tab's focused element should not cause the tab to be selected"
+ );
+
+ // Cleaning up.
+ BrowserTestUtils.removeTab(backgroundTab);
+});
diff --git a/dom/tests/browser/browser_autofocus_preference.js b/dom/tests/browser/browser_autofocus_preference.js
new file mode 100644
index 0000000000..fc8b318a17
--- /dev/null
+++ b/dom/tests/browser/browser_autofocus_preference.js
@@ -0,0 +1,16 @@
+add_task(async function () {
+ await SpecialPowers.pushPrefEnv({ set: [["browser.autofocus", false]] });
+
+ const url =
+ "data:text/html,<!DOCTYPE html><html><body><input autofocus><button autofocus></button><textarea autofocus></textarea><select autofocus></select></body></html>";
+
+ let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
+ BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
+ await loadedPromise;
+
+ await new Promise(resolve => executeSoon(resolve));
+
+ await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
+ is(content.document.activeElement, content.document.body, "body focused");
+ });
+});
diff --git a/dom/tests/browser/browser_beforeunload_between_chrome_content.js b/dom/tests/browser/browser_beforeunload_between_chrome_content.js
new file mode 100644
index 0000000000..67579592ed
--- /dev/null
+++ b/dom/tests/browser/browser_beforeunload_between_chrome_content.js
@@ -0,0 +1,152 @@
+const TEST_URL = "http://www.example.com/browser/dom/tests/browser/dummy.html";
+
+const { PromptTestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/PromptTestUtils.sys.mjs"
+);
+
+function pageScript() {
+ window.addEventListener(
+ "beforeunload",
+ function (event) {
+ var str = "Leaving?";
+ event.returnValue = str;
+ return str;
+ },
+ true
+ );
+}
+
+function injectBeforeUnload(browser) {
+ return ContentTask.spawn(browser, null, async function () {
+ content.window.addEventListener(
+ "beforeunload",
+ function (event) {
+ sendAsyncMessage("Test:OnBeforeUnloadReceived");
+ var str = "Leaving?";
+ event.returnValue = str;
+ return str;
+ },
+ true
+ );
+ });
+}
+
+// Wait for onbeforeunload dialog, and dismiss it immediately.
+function awaitAndCloseBeforeUnloadDialog(browser, doStayOnPage) {
+ return PromptTestUtils.handleNextPrompt(
+ browser,
+ { modalType: Services.prompt.MODAL_TYPE_CONTENT, promptType: "confirmEx" },
+ { buttonNumClick: doStayOnPage ? 1 : 0 }
+ );
+}
+
+SpecialPowers.pushPrefEnv({
+ set: [["dom.require_user_interaction_for_beforeunload", false]],
+});
+
+/**
+ * Test navigation from a content page to a chrome page. Also check that only
+ * one beforeunload event is fired.
+ */
+/* global messageManager */
+add_task(async function () {
+ let beforeUnloadCount = 0;
+ messageManager.addMessageListener("Test:OnBeforeUnloadReceived", function () {
+ beforeUnloadCount++;
+ });
+
+ // Open a content page.
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
+ let browser = tab.linkedBrowser;
+
+ ok(browser.isRemoteBrowser, "Browser should be remote.");
+
+ await injectBeforeUnload(browser);
+ // Navigate to a chrome page.
+ let dialogShown1 = awaitAndCloseBeforeUnloadDialog(browser, false);
+ BrowserTestUtils.loadURIString(browser, "about:support");
+ await Promise.all([dialogShown1, BrowserTestUtils.browserLoaded(browser)]);
+
+ is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
+ ok(!browser.isRemoteBrowser, "Browser should not be remote.");
+
+ // Go back to content page.
+ ok(gBrowser.webNavigation.canGoBack, "Should be able to go back.");
+ gBrowser.goBack();
+ await BrowserTestUtils.browserLoaded(browser);
+ await injectBeforeUnload(browser);
+
+ // Test that going forward triggers beforeunload prompt as well.
+ ok(gBrowser.webNavigation.canGoForward, "Should be able to go forward.");
+ let dialogShown2 = awaitAndCloseBeforeUnloadDialog(false);
+ gBrowser.goForward();
+ await Promise.all([dialogShown2, BrowserTestUtils.browserLoaded(browser)]);
+ is(beforeUnloadCount, 2, "Should have received two beforeunload events.");
+
+ BrowserTestUtils.removeTab(tab);
+});
+
+/**
+ * Test navigation from a chrome page to a content page. Also check that only
+ * one beforeunload event is fired.
+ */
+add_task(async function () {
+ let beforeUnloadCount = 0;
+ messageManager.addMessageListener("Test:OnBeforeUnloadReceived", function () {
+ beforeUnloadCount++;
+ });
+
+ // Open a chrome page.
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "about:support"
+ );
+ let browser = tab.linkedBrowser;
+
+ ok(!browser.isRemoteBrowser, "Browser should not be remote.");
+ await ContentTask.spawn(browser, null, async function () {
+ content.window.addEventListener(
+ "beforeunload",
+ function (event) {
+ sendAsyncMessage("Test:OnBeforeUnloadReceived");
+ var str = "Leaving?";
+ event.returnValue = str;
+ return str;
+ },
+ true
+ );
+ });
+
+ // Navigate to a content page.
+ let dialogShown1 = awaitAndCloseBeforeUnloadDialog(false);
+ BrowserTestUtils.loadURIString(browser, TEST_URL);
+ await Promise.all([dialogShown1, BrowserTestUtils.browserLoaded(browser)]);
+ is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
+ ok(browser.isRemoteBrowser, "Browser should be remote.");
+
+ // Go back to chrome page.
+ ok(gBrowser.webNavigation.canGoBack, "Should be able to go back.");
+ gBrowser.goBack();
+ await BrowserTestUtils.browserLoaded(browser);
+ await ContentTask.spawn(browser, null, async function () {
+ content.window.addEventListener(
+ "beforeunload",
+ function (event) {
+ sendAsyncMessage("Test:OnBeforeUnloadReceived");
+ var str = "Leaving?";
+ event.returnValue = str;
+ return str;
+ },
+ true
+ );
+ });
+
+ // Test that going forward triggers beforeunload prompt as well.
+ ok(gBrowser.webNavigation.canGoForward, "Should be able to go forward.");
+ let dialogShown2 = awaitAndCloseBeforeUnloadDialog(false);
+ gBrowser.goForward();
+ await Promise.all([dialogShown2, BrowserTestUtils.browserLoaded(browser)]);
+ is(beforeUnloadCount, 2, "Should have received two beforeunload events.");
+
+ BrowserTestUtils.removeTab(tab);
+});
diff --git a/dom/tests/browser/browser_bug1004814.js b/dom/tests/browser/browser_bug1004814.js
new file mode 100644
index 0000000000..efe3bd44f9
--- /dev/null
+++ b/dom/tests/browser/browser_bug1004814.js
@@ -0,0 +1,46 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+add_task(async function () {
+ const TEST_URI =
+ "http://example.com/browser/dom/tests/browser/test_bug1004814.html";
+
+ await BrowserTestUtils.withNewTab(TEST_URI, async aBrowser => {
+ let duration = await SpecialPowers.spawn(aBrowser, [], function (opts) {
+ const ConsoleAPIStorage = Cc[
+ "@mozilla.org/consoleAPI-storage;1"
+ ].getService(Ci.nsIConsoleAPIStorage);
+
+ return new Promise(resolve => {
+ function observe(aSubject) {
+ var obj = aSubject.wrappedJSObject;
+ if (
+ obj.arguments.length != 1 ||
+ obj.arguments[0] != "bug1004814" ||
+ obj.level != "timeEnd"
+ ) {
+ return;
+ }
+
+ ConsoleAPIStorage.removeLogEventListener(observe);
+ resolve(obj.timer.duration);
+ }
+
+ ConsoleAPIStorage.addLogEventListener(
+ observe,
+ Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal)
+ );
+
+ var w = new content.Worker("worker_bug1004814.js");
+ w.postMessage(true);
+ });
+ });
+
+ ok(
+ duration > 0,
+ "ConsoleEvent.timer.duration > 0: " + duration + " ~ 200ms"
+ );
+ });
+});
diff --git a/dom/tests/browser/browser_bug1008941_dismissGeolocationHanger.js b/dom/tests/browser/browser_bug1008941_dismissGeolocationHanger.js
new file mode 100644
index 0000000000..21f03721c5
--- /dev/null
+++ b/dom/tests/browser/browser_bug1008941_dismissGeolocationHanger.js
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+"use strict";
+
+const TEST_URI =
+ // eslint-disable-next-line no-useless-concat
+ "https://example.com/" + "browser/dom/tests/browser/position.html";
+
+add_task(async function testDismissHanger() {
+ info(
+ "Check that location is not shared when dismissing the geolocation hanger"
+ );
+
+ let promisePanelShown = BrowserTestUtils.waitForEvent(
+ PopupNotifications.panel,
+ "popupshown",
+ true
+ );
+ await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URI);
+ await promisePanelShown;
+
+ // click outside the Geolocation hanger to dismiss it
+ window.document.getElementById("nav-bar").click();
+ info("Clicked outside the Geolocation panel to dismiss it");
+
+ let hasLocation = await SpecialPowers.spawn(
+ gBrowser.selectedBrowser,
+ [],
+ async function () {
+ return content.document.body.innerHTML.includes("location...");
+ }
+ );
+
+ ok(hasLocation, "Location is not shared");
+
+ BrowserTestUtils.removeTab(gBrowser.selectedTab);
+});
diff --git a/dom/tests/browser/browser_bug1236512.js b/dom/tests/browser/browser_bug1236512.js
new file mode 100644
index 0000000000..18c92e9609
--- /dev/null
+++ b/dom/tests/browser/browser_bug1236512.js
@@ -0,0 +1,116 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+"use strict";
+
+const testPageURL =
+ "http://mochi.test:8888/browser/dom/tests/browser/dummy.html";
+
+async function testContentVisibilityState(aIsHidden, aBrowser) {
+ await SpecialPowers.spawn(
+ aBrowser.selectedBrowser,
+ [aIsHidden],
+ aExpectedResult => {
+ is(content.document.hidden, aExpectedResult, "document.hidden");
+ is(
+ content.document.visibilityState,
+ aExpectedResult ? "hidden" : "visible",
+ "document.visibilityState"
+ );
+ }
+ );
+}
+
+async function waitContentVisibilityChange(aIsHidden, aBrowser) {
+ await SpecialPowers.spawn(
+ aBrowser.selectedBrowser,
+ [aIsHidden],
+ async function (aExpectedResult) {
+ let visibilityState = aExpectedResult ? "hidden" : "visible";
+ if (
+ content.document.hidden === aExpectedResult &&
+ content.document.visibilityState === visibilityState
+ ) {
+ ok(true, "already changed to expected visibility state");
+ return;
+ }
+
+ info("wait visibilitychange event");
+ await ContentTaskUtils.waitForEvent(
+ content.document,
+ "visibilitychange",
+ true /* capture */,
+ aEvent => {
+ info(
+ `visibilitychange: ${content.document.hidden} ${content.document.visibilityState}`
+ );
+ return (
+ content.document.hidden === aExpectedResult &&
+ content.document.visibilityState === visibilityState
+ );
+ }
+ );
+ }
+ );
+}
+
+/**
+ * This test is to test the visibility state will change to "hidden" when browser
+ * window is fully covered by another non-translucent application. Note that we
+ * only support this on Mac for now, other platforms don't support reporting
+ * occlusion state.
+ */
+add_task(async function () {
+ info("creating test window");
+ let winTest = await BrowserTestUtils.openNewBrowserWindow();
+ // Specify the width, height, left and top, so that the new window can be
+ // fully covered by "window".
+ let resizePromise = BrowserTestUtils.waitForEvent(
+ winTest,
+ "resize",
+ false,
+ e => {
+ return winTest.innerHeight <= 500 && winTest.innerWidth <= 500;
+ }
+ );
+ winTest.moveTo(200, 200);
+ winTest.resizeTo(500, 500);
+ await resizePromise;
+
+ let browserTest = winTest.gBrowser;
+
+ info(`loading test page: ${testPageURL}`);
+ BrowserTestUtils.loadURIString(browserTest.selectedBrowser, testPageURL);
+ await BrowserTestUtils.browserLoaded(browserTest.selectedBrowser);
+
+ info("test init visibility state");
+ await testContentVisibilityState(false /* isHidden */, browserTest);
+
+ info(
+ "test window should report 'hidden' if it is fully covered by another " +
+ "window"
+ );
+ await new Promise(resolve => waitForFocus(resolve, window));
+ await waitContentVisibilityChange(true /* isHidden */, browserTest);
+
+ info(
+ "test window should still report 'hidden' since it is still fully covered " +
+ "by another window"
+ );
+ let tab = BrowserTestUtils.addTab(browserTest);
+ await BrowserTestUtils.switchTab(browserTest, tab);
+ BrowserTestUtils.removeTab(browserTest.selectedTab);
+ await testContentVisibilityState(true /* isHidden */, browserTest);
+
+ info(
+ "test window should report 'visible' if it is not fully covered by " +
+ "another window"
+ );
+ await new Promise(resolve => waitForFocus(resolve, winTest));
+ await waitContentVisibilityChange(false /* isHidden */, browserTest);
+
+ info("closing test window");
+ await BrowserTestUtils.closeWindow(winTest);
+});
diff --git a/dom/tests/browser/browser_bug1238427.js b/dom/tests/browser/browser_bug1238427.js
new file mode 100644
index 0000000000..60cb383e03
--- /dev/null
+++ b/dom/tests/browser/browser_bug1238427.js
@@ -0,0 +1,40 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+"use strict";
+
+const TEST_URI =
+ // eslint-disable-next-line no-useless-concat
+ "http://example.com/" + "browser/dom/tests/browser/geo_leak_test.html";
+
+const BASE_GEO_URL =
+ "http://mochi.test:8888/tests/dom/tests/mochitest/geolocation/network_geolocation.sjs";
+
+add_task(async function () {
+ Services.prefs.setBoolPref("geo.prompt.testing", true);
+ Services.prefs.setBoolPref("geo.prompt.testing.allow", true);
+
+ // Make the geolocation provider responder very slowly to ensure that
+ // it does not reply before we close the tab.
+ Services.prefs.setCharPref(
+ "geo.provider.network.url",
+ BASE_GEO_URL + "?delay=100000"
+ );
+
+ // Open the test URI and close it. The test harness will make sure that the
+ // page is cleaned up after some GCs. If geolocation is not shut down properly,
+ // it will show up as a non-shutdown leak.
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: TEST_URI,
+ },
+ function (browser) {
+ /* ... */
+ }
+ );
+
+ ok(true, "Need to do something in this test");
+});
diff --git a/dom/tests/browser/browser_bug1316330.js b/dom/tests/browser/browser_bug1316330.js
new file mode 100644
index 0000000000..c81d489cf7
--- /dev/null
+++ b/dom/tests/browser/browser_bug1316330.js
@@ -0,0 +1,52 @@
+const URL =
+ "data:text/html,<script>" +
+ "window.focus();" +
+ "var down = 0; var press = 0;" +
+ "onkeydown = function(e) {" +
+ " var startTime = Date.now();" +
+ " document.body.setAttribute('data-down', ++down);" +
+ " if (e.keyCode == KeyboardEvent.DOM_VK_D) while (Date.now() - startTime < 500) {}" +
+ "};" +
+ "onkeypress = function(e) {" +
+ " var startTime = Date.now();" +
+ " document.body.setAttribute('data-press', ++press);" +
+ " if (e.charCode == 'p'.charCodeAt(0)) while (Date.now() - startTime < 500) {}" +
+ "};" +
+ "</script>";
+
+add_task(async function () {
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+ let browser = tab.linkedBrowser;
+
+ await EventUtils.synthesizeAndWaitKey("d", { repeat: 3 });
+
+ await SpecialPowers.spawn(browser, [], async function () {
+ is(
+ content.document.body.getAttribute("data-down"),
+ "2",
+ "Correct number of events"
+ );
+ is(
+ content.document.body.getAttribute("data-press"),
+ "2",
+ "Correct number of events"
+ );
+ });
+
+ await EventUtils.synthesizeAndWaitKey("p", { repeat: 3 });
+
+ await SpecialPowers.spawn(browser, [], async function () {
+ is(
+ content.document.body.getAttribute("data-down"),
+ "4",
+ "Correct number of events"
+ );
+ is(
+ content.document.body.getAttribute("data-press"),
+ "4",
+ "Correct number of events"
+ );
+ });
+
+ gBrowser.removeCurrentTab();
+});
diff --git a/dom/tests/browser/browser_bug1563629.js b/dom/tests/browser/browser_bug1563629.js
new file mode 100644
index 0000000000..2ccbaced1c
--- /dev/null
+++ b/dom/tests/browser/browser_bug1563629.js
@@ -0,0 +1,79 @@
+"use strict";
+
+const DIRPATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content/",
+ ""
+);
+const PATH = DIRPATH + "file_postMessage_parent.html";
+
+const URL1 = `https://example.com/${PATH}`;
+const URL2 = `https://example.org/${PATH}`;
+
+function listenForCrash(win) {
+ function listener(event) {
+ ok(false, "a crash occurred");
+ }
+
+ win.addEventListener("oop-browser-crashed", listener);
+ registerCleanupFunction(() => {
+ win.removeEventListener("oop-browser-crashed", listener);
+ });
+}
+
+add_task(async function () {
+ let win = await BrowserTestUtils.openNewBrowserWindow({
+ fission: true,
+ private: true,
+ remote: true,
+ });
+
+ listenForCrash(win);
+
+ try {
+ let tab = win.gBrowser.selectedTab;
+ let browser = tab.linkedBrowser;
+
+ BrowserTestUtils.loadURIString(browser, URL1);
+ await BrowserTestUtils.browserLoaded(browser, false, URL1);
+
+ async function loadURL(url) {
+ let iframe = content.document.createElement("iframe");
+ content.document.body.appendChild(iframe);
+
+ iframe.contentWindow.location = url;
+ await new Promise(resolve =>
+ iframe.addEventListener("load", resolve, { once: true })
+ );
+
+ return iframe.browsingContext;
+ }
+
+ function length() {
+ return content.length;
+ }
+
+ let outer = await SpecialPowers.spawn(browser, [URL2], loadURL);
+ let inner = await SpecialPowers.spawn(outer, [URL2], loadURL);
+
+ is(await SpecialPowers.spawn(outer, [], length), 1, "have 1 inner frame");
+ is(await SpecialPowers.spawn(browser, [], length), 1, "have 1 outer frame");
+
+ // Send a message from the outer iframe to the inner one.
+ //
+ // This would've previously crashed the content process that URL2 is running
+ // in.
+ await SpecialPowers.spawn(outer, [], () => {
+ content.frames[0].postMessage("foo", "*");
+ });
+
+ // Now send a message from the inner frame to the outer one.
+ await SpecialPowers.spawn(inner, [], () => {
+ content.parent.postMessage("bar", "*");
+ });
+
+ // Assert we've made it this far.
+ ok(true, "didn't crash");
+ } finally {
+ await BrowserTestUtils.closeWindow(win);
+ }
+});
diff --git a/dom/tests/browser/browser_bug1685807.js b/dom/tests/browser/browser_bug1685807.js
new file mode 100644
index 0000000000..0e0dae2b16
--- /dev/null
+++ b/dom/tests/browser/browser_bug1685807.js
@@ -0,0 +1,78 @@
+/**
+ * Bug 1685807 - Testing that the window.name won't be reset when loading an
+ * about:blank page to a window which had loaded non-about:blank
+ * page. And other case that window.name should be reset if
+ * the document.domain has changed.
+ */
+
+"use strict";
+
+const EMPTY_URI =
+ "https://test1.example.com/browser/dom/tests/browser/file_empty.html";
+const TEST_URI =
+ "https://test1.example.com/browser/dom/tests/browser/file_bug1685807.html";
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [["privacy.window.name.update.enabled", true]],
+ });
+});
+
+add_task(async function doTests() {
+ for (let testDocDomain of [false, true]) {
+ // Open an empty tab.
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, EMPTY_URI);
+ let browser = tab.linkedBrowser;
+
+ // Create a promise in order to wait loading of the about:blank page.
+ let loadedPromise = BrowserTestUtils.browserLoaded(
+ browser,
+ false,
+ "about:blank"
+ );
+
+ // Set the window.name and document.domain.
+ SpecialPowers.spawn(
+ browser,
+ [TEST_URI, testDocDomain],
+ (aTestURI, aTestDocDomain) => {
+ content.name = "Test";
+
+ if (aTestDocDomain) {
+ content.document.domain = "example.com";
+ }
+
+ // Open the page which will trigger the loading of the about:blank page.
+ content.open(aTestURI);
+ }
+ );
+
+ // Wait until the about:blank page is loaded.
+ await loadedPromise;
+
+ // Check the window.name.
+ await SpecialPowers.spawn(browser, [testDocDomain], aTestDocDomain => {
+ if (aTestDocDomain) {
+ // The window.name should be reset if the document.domain was set to a
+ // cross-origin.
+ is(content.name, "", "The window.name should be reset.");
+ } else {
+ is(content.name, "Test", "The window.name shouldn't be reset.");
+ }
+ });
+
+ let awaitPageShow = BrowserTestUtils.waitForContentEvent(
+ browser,
+ "pageshow"
+ );
+ browser.goBack();
+ await awaitPageShow;
+
+ // Check the window.name.
+ await SpecialPowers.spawn(browser, [], () => {
+ is(content.name, "Test", "The window.name is correct.");
+ });
+
+ BrowserTestUtils.removeTab(tab);
+ }
+});
diff --git a/dom/tests/browser/browser_bug1709346.js b/dom/tests/browser/browser_bug1709346.js
new file mode 100644
index 0000000000..bcfe456196
--- /dev/null
+++ b/dom/tests/browser/browser_bug1709346.js
@@ -0,0 +1,48 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+add_task(async function remove_subframe_in_cross_site_frame() {
+ await BrowserTestUtils.withNewTab(
+ "http://mochi.test:8888/browser/dom/tests/browser/file_empty_cross_site_frame.html",
+ async browser => {
+ await TestUtils.waitForCondition(
+ () => !XULBrowserWindow.isBusy,
+ "browser is not busy after the tab finishes loading"
+ );
+
+ // Spawn into the cross-site subframe, and begin loading a slow network
+ // connection. We'll cancel the load before this navigation completes.
+ await SpecialPowers.spawn(
+ browser.browsingContext.children[0],
+ [],
+ async () => {
+ let frame = content.document.createElement("iframe");
+ frame.src = "load_forever.sjs";
+ content.document.body.appendChild(frame);
+
+ frame.addEventListener("load", function () {
+ ok(false, "load should not finish before the frame is removed");
+ });
+ }
+ );
+
+ is(
+ XULBrowserWindow.isBusy,
+ true,
+ "browser should be busy after the load starts"
+ );
+
+ // Remove the outer iframe, ending the load within this frame's subframe
+ // early.
+ await SpecialPowers.spawn(browser, [], async () => {
+ content.document.querySelector("iframe").remove();
+ });
+
+ await TestUtils.waitForCondition(
+ () => !XULBrowserWindow.isBusy,
+ "Browser should no longer be busy after the frame is removed"
+ );
+ }
+ );
+});
diff --git a/dom/tests/browser/browser_bug396843.js b/dom/tests/browser/browser_bug396843.js
new file mode 100644
index 0000000000..ea25bd10b6
--- /dev/null
+++ b/dom/tests/browser/browser_bug396843.js
@@ -0,0 +1,337 @@
+/** Test for Bug 396843 **/
+
+function testInDocument(doc, documentID) {
+ var allNodes = [];
+ var XMLNodes = [];
+
+ // HTML
+ function HTML_TAG(name) {
+ allNodes.push(doc.createElementNS("http://www.w3.org/1999/xhtml", name));
+ }
+
+ /* List copy/pasted from nsHTMLTagList.h */
+ HTML_TAG("a", "Anchor");
+ HTML_TAG("abbr", "Span");
+ HTML_TAG("acronym", "Span");
+ HTML_TAG("address", "Span");
+ HTML_TAG("applet", "Unknown");
+ HTML_TAG("area", "Area");
+ HTML_TAG("b", "Span");
+ HTML_TAG("base", "Shared");
+ HTML_TAG("basefont", "Span");
+ HTML_TAG("bdi", "");
+ HTML_TAG("bdo", "Span");
+ HTML_TAG("bgsound", "Span");
+ HTML_TAG("big", "Span");
+ HTML_TAG("blockquote", "Shared");
+ HTML_TAG("body", "Body");
+ HTML_TAG("br", "BR");
+ HTML_TAG("button", "Button");
+ HTML_TAG("canvas", "Canvas");
+ HTML_TAG("caption", "TableCaption");
+ HTML_TAG("center", "Span");
+ HTML_TAG("cite", "Span");
+ HTML_TAG("code", "Span");
+ HTML_TAG("col", "TableCol");
+ HTML_TAG("colgroup", "TableCol");
+ HTML_TAG("dd", "Span");
+ HTML_TAG("del", "Mod");
+ HTML_TAG("dfn", "Span");
+ HTML_TAG("dir", "Shared");
+ HTML_TAG("div", "Div");
+ HTML_TAG("dl", "SharedList");
+ HTML_TAG("dt", "Span");
+ HTML_TAG("em", "Span");
+ HTML_TAG("embed", "Embed");
+ HTML_TAG("fieldset", "FieldSet");
+ HTML_TAG("font", "Font");
+ HTML_TAG("form", "Form");
+ HTML_TAG("frame", "Frame");
+ HTML_TAG("frameset", "FrameSet");
+ HTML_TAG("h1", "Heading");
+ HTML_TAG("h2", "Heading");
+ HTML_TAG("h3", "Heading");
+ HTML_TAG("h4", "Heading");
+ HTML_TAG("h5", "Heading");
+ HTML_TAG("h6", "Heading");
+ HTML_TAG("head", "Head");
+ HTML_TAG("hr", "HR");
+ HTML_TAG("html", "Html");
+ HTML_TAG("i", "Span");
+ HTML_TAG("iframe", "IFrame");
+ HTML_TAG("image", "");
+ HTML_TAG("img", "Image");
+ HTML_TAG("input", "Input");
+ HTML_TAG("ins", "Mod");
+ HTML_TAG("isindex", "Unknown");
+ HTML_TAG("kbd", "Span");
+ HTML_TAG("keygen", "Span");
+ HTML_TAG("label", "Label");
+ HTML_TAG("legend", "Legend");
+ HTML_TAG("li", "LI");
+ HTML_TAG("link", "Link");
+ HTML_TAG("listing", "Span");
+ HTML_TAG("map", "Map");
+ HTML_TAG("marquee", "Div");
+ HTML_TAG("menu", "Shared");
+ HTML_TAG("meta", "Meta");
+ HTML_TAG("multicol", "Unknown");
+ HTML_TAG("nobr", "Span");
+ HTML_TAG("noembed", "Div");
+ HTML_TAG("noframes", "Div");
+ HTML_TAG("noscript", "Div");
+ HTML_TAG("object", "Object");
+ HTML_TAG("ol", "SharedList");
+ HTML_TAG("optgroup", "OptGroup");
+ HTML_TAG("option", "Option");
+ HTML_TAG("p", "Paragraph");
+ HTML_TAG("param", "Shared");
+ HTML_TAG("plaintext", "Span");
+ HTML_TAG("pre", "Pre");
+ HTML_TAG("q", "Shared");
+ HTML_TAG("s", "Span");
+ HTML_TAG("samp", "Span");
+ HTML_TAG("script", "Script");
+ HTML_TAG("select", "Select");
+ HTML_TAG("small", "Span");
+ HTML_TAG("spacer", "Unknown");
+ HTML_TAG("span", "Span");
+ HTML_TAG("strike", "Span");
+ HTML_TAG("strong", "Span");
+ HTML_TAG("style", "Style");
+ HTML_TAG("sub", "Span");
+ HTML_TAG("sup", "Span");
+ HTML_TAG("table", "Table");
+ HTML_TAG("tbody", "TableSection");
+ HTML_TAG("td", "TableCell");
+ HTML_TAG("textarea", "TextArea");
+ HTML_TAG("tfoot", "TableSection");
+ HTML_TAG("th", "TableCell");
+ HTML_TAG("thead", "TableSection");
+ HTML_TAG("template", "Template");
+ HTML_TAG("title", "Title");
+ HTML_TAG("tr", "TableRow");
+ HTML_TAG("tt", "Span");
+ HTML_TAG("u", "Span");
+ HTML_TAG("ul", "SharedList");
+ HTML_TAG("var", "Span");
+ HTML_TAG("wbr", "Shared");
+ HTML_TAG("xmp", "Span");
+
+ function SVG_TAG(name) {
+ allNodes.push(doc.createElementNS("http://www.w3.org/2000/svg", name));
+ }
+
+ // List sorta stolen from SVG element factory.
+ SVG_TAG("a");
+ SVG_TAG("polyline");
+ SVG_TAG("polygon");
+ SVG_TAG("circle");
+ SVG_TAG("ellipse");
+ SVG_TAG("line");
+ SVG_TAG("rect");
+ SVG_TAG("svg");
+ SVG_TAG("g");
+ SVG_TAG("foreignObject");
+ SVG_TAG("path");
+ SVG_TAG("text");
+ SVG_TAG("tspan");
+ SVG_TAG("image");
+ SVG_TAG("style");
+ SVG_TAG("linearGradient");
+ SVG_TAG("metadata");
+ SVG_TAG("radialGradient");
+ SVG_TAG("stop");
+ SVG_TAG("defs");
+ SVG_TAG("desc");
+ SVG_TAG("script");
+ SVG_TAG("use");
+ SVG_TAG("symbol");
+ SVG_TAG("marker");
+ SVG_TAG("title");
+ SVG_TAG("clipPath");
+ SVG_TAG("textPath");
+ SVG_TAG("filter");
+ SVG_TAG("feBlend");
+ SVG_TAG("feColorMatrix");
+ SVG_TAG("feComponentTransfer");
+ SVG_TAG("feComposite");
+ SVG_TAG("feFuncR");
+ SVG_TAG("feFuncG");
+ SVG_TAG("feFuncB");
+ SVG_TAG("feFuncA");
+ SVG_TAG("feGaussianBlur");
+ SVG_TAG("feMerge");
+ SVG_TAG("feMergeNode");
+ SVG_TAG("feMorphology");
+ SVG_TAG("feOffset");
+ SVG_TAG("feFlood");
+ SVG_TAG("feTile");
+ SVG_TAG("feTurbulence");
+ SVG_TAG("feConvolveMatrix");
+ SVG_TAG("feDistantLight");
+ SVG_TAG("fePointLight");
+ SVG_TAG("feSpotLight");
+ SVG_TAG("feDiffuseLighting");
+ SVG_TAG("feSpecularLighting");
+ SVG_TAG("feDisplacementMap");
+ SVG_TAG("feImage");
+ SVG_TAG("pattern");
+ SVG_TAG("mask");
+ SVG_TAG("svgSwitch");
+
+ // Toss in some other namespaced stuff too, for good measure
+ // XUL stuff might not be creatable in content documents
+ try {
+ allNodes.push(
+ doc.createElementNS(
+ "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
+ "window"
+ )
+ );
+ } catch (e) {}
+ allNodes.push(
+ doc.createElementNS("http://www.w3.org/1998/Math/MathML", "math")
+ );
+ allNodes.push(
+ doc.createElementNS("http://www.w3.org/2001/xml-events", "testname")
+ );
+ allNodes.push(doc.createElementNS("bogus.namespace", "testname"));
+
+ var XMLDoc = doc.implementation.createDocument("", "", null);
+
+ // And non-elements
+ allNodes.push(doc.createTextNode("some text"));
+ allNodes.push(doc.createComment("some text"));
+ allNodes.push(doc.createDocumentFragment());
+ XMLNodes.push(XMLDoc.createCDATASection("some text"));
+ XMLNodes.push(XMLDoc.createProcessingInstruction("PI", "data"));
+
+ function runTestUnwrapped() {
+ if (!("wrappedJSObject" in doc)) {
+ return;
+ }
+ ok(
+ doc.wrappedJSObject.nodePrincipal === undefined,
+ "Must not have document principal for " + documentID
+ );
+ ok(
+ doc.wrappedJSObject.baseURIObject === undefined,
+ "Must not have document base URI for " + documentID
+ );
+ ok(
+ doc.wrappedJSObject.documentURIObject === undefined,
+ "Must not have document URI for " + documentID
+ );
+
+ for (var i = 0; i < allNodes.length; ++i) {
+ ok(
+ allNodes[i].wrappedJSObject.nodePrincipal === undefined,
+ "Unexpected principal appears for " +
+ allNodes[i].nodeName +
+ " in " +
+ documentID
+ );
+ ok(
+ allNodes[i].wrappedJSObject.baseURIObject === undefined,
+ "Unexpected base URI appears for " +
+ allNodes[i].nodeName +
+ " in " +
+ documentID
+ );
+ }
+ }
+
+ function runTestProps() {
+ isnot(
+ doc.nodePrincipal,
+ null,
+ "Must have document principal in " + documentID
+ );
+ is(
+ doc.nodePrincipal instanceof Ci.nsIPrincipal,
+ true,
+ "document principal must be a principal in " + documentID
+ );
+ isnot(
+ doc.baseURIObject,
+ null,
+ "Must have document base URI in" + documentID
+ );
+ is(
+ doc.baseURIObject instanceof Ci.nsIURI,
+ true,
+ "document base URI must be a URI in " + documentID
+ );
+ isnot(doc.documentURIObject, null, "Must have document URI " + documentID);
+ is(
+ doc.documentURIObject instanceof Ci.nsIURI,
+ true,
+ "document URI must be a URI in " + documentID
+ );
+ is(
+ doc.documentURIObject.spec,
+ doc.documentURI,
+ "document URI must be the right URI in " + documentID
+ );
+
+ for (var i = 0; i < allNodes.length; ++i) {
+ is(
+ allNodes[i].nodePrincipal,
+ doc.nodePrincipal,
+ "Unexpected principal for " + allNodes[i].nodeName + " in " + documentID
+ );
+ is(
+ allNodes[i].baseURIObject,
+ doc.baseURIObject,
+ "Unexpected base URI for " + allNodes[i].nodeName + " in " + documentID
+ );
+ }
+
+ for (i = 0; i < XMLNodes.length; ++i) {
+ is(
+ XMLNodes[i].nodePrincipal,
+ doc.nodePrincipal,
+ "Unexpected principal for " + XMLNodes[i].nodeName + " in " + documentID
+ );
+ is(
+ XMLNodes[i].baseURIObject.spec,
+ "about:blank",
+ "Unexpected base URI for " + XMLNodes[i].nodeName + " in " + documentID
+ );
+ }
+ }
+
+ runTestUnwrapped();
+ runTestProps();
+ runTestUnwrapped();
+}
+
+add_task(async function test1() {
+ testInDocument(document, "browser window");
+});
+
+async function newTabTest(location) {
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: location },
+ async function (browser) {
+ await SpecialPowers.spawn(
+ browser,
+ [{ location, testInDocument_: testInDocument.toSource() }],
+ async function ({ location, testInDocument_ }) {
+ // eslint-disable-next-line no-eval
+ let testInDocument = eval(`(() => (${testInDocument_}))()`);
+ testInDocument(content.document, location);
+ }
+ );
+ }
+ );
+}
+
+add_task(async function test2() {
+ await newTabTest("about:blank");
+});
+
+add_task(async function test3() {
+ await newTabTest("about:config");
+});
diff --git a/dom/tests/browser/browser_bytecode_cache_asm_js.js b/dom/tests/browser/browser_bytecode_cache_asm_js.js
new file mode 100644
index 0000000000..74dcdf3b72
--- /dev/null
+++ b/dom/tests/browser/browser_bytecode_cache_asm_js.js
@@ -0,0 +1,31 @@
+"use strict";
+
+const PAGE_URL =
+ "http://example.com/browser/dom/tests/browser/page_bytecode_cache_asm_js.html";
+
+add_task(async function () {
+ // Eagerly generate bytecode cache.
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["dom.script_loader.bytecode_cache.enabled", true],
+ ["dom.script_loader.bytecode_cache.strategy", -1],
+ ],
+ });
+
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: PAGE_URL,
+ waitForLoad: true,
+ },
+ async browser => {
+ let result = await SpecialPowers.spawn(browser, [], () => {
+ return content.document.getElementById("result").textContent;
+ });
+ // No error shoud be caught by content.
+ is(result, "ok");
+ }
+ );
+
+ await SpecialPowers.popPrefEnv();
+});
diff --git a/dom/tests/browser/browser_cancel_keydown_keypress_event.js b/dom/tests/browser/browser_cancel_keydown_keypress_event.js
new file mode 100644
index 0000000000..de08aa17e9
--- /dev/null
+++ b/dom/tests/browser/browser_cancel_keydown_keypress_event.js
@@ -0,0 +1,41 @@
+const URL =
+ "https://example.com/browser/dom/tests/browser/prevent_return_key.html";
+
+const { PromptTestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/PromptTestUtils.sys.mjs"
+);
+
+// Wait for alert dialog and dismiss it immediately.
+function awaitAndCloseAlertDialog(browser) {
+ return PromptTestUtils.handleNextPrompt(
+ browser,
+ { modalType: Services.prompt.MODAL_TYPE_CONTENT, promptType: "alert" },
+ { buttonNumClick: 0 }
+ );
+}
+
+add_task(async function () {
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+ let browser = tab.linkedBrowser;
+
+ // Focus and enter random text on input.
+ await SpecialPowers.spawn(browser, [], async function () {
+ let input = content.document.getElementById("input");
+ input.focus();
+ input.value = "abcd";
+ });
+
+ // Send return key (cross process) to submit the form implicitly.
+ let dialogShown = awaitAndCloseAlertDialog(browser);
+ EventUtils.synthesizeKey("KEY_Enter");
+ await dialogShown;
+
+ // Check that the form should not have been submitted.
+ await SpecialPowers.spawn(browser, [], async function () {
+ let result = content.document.getElementById("result").innerHTML;
+ info("submit result: " + result);
+ is(result, "not submitted", "form should not have submitted");
+ });
+
+ gBrowser.removeCurrentTab();
+});
diff --git a/dom/tests/browser/browser_data_document_crossOriginIsolated.js b/dom/tests/browser/browser_data_document_crossOriginIsolated.js
new file mode 100644
index 0000000000..d38eda3f0a
--- /dev/null
+++ b/dom/tests/browser/browser_data_document_crossOriginIsolated.js
@@ -0,0 +1,68 @@
+"use strict";
+
+const DIRPATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content/",
+ ""
+);
+const PATH = DIRPATH + "file_coop_coep.html";
+
+const ORIGIN = "https://test1.example.com";
+const URL = `${ORIGIN}/${PATH}`;
+
+add_task(async function () {
+ await BrowserTestUtils.withNewTab(URL, async function (browser) {
+ BrowserTestUtils.loadURIString(browser, URL);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(browser, [ORIGIN], async origin => {
+ is(
+ content.window.origin,
+ origin,
+ `Opened a tab and navigated to ${origin}`
+ );
+
+ ok(
+ content.window.crossOriginIsolated,
+ `Should have been cross-origin-isolated env`
+ );
+
+ let hostIds = [];
+ function createShadowDOMAndTriggerSlotChange(host) {
+ var shadow = host.attachShadow({ mode: "closed" });
+
+ let promise = new Promise(resolve => {
+ shadow.addEventListener("slotchange", function () {
+ hostIds.push(host.id);
+ resolve();
+ });
+ });
+
+ shadow.innerHTML = "<slot></slot>";
+
+ host.appendChild(host.ownerDocument.createElement("span"));
+
+ return promise;
+ }
+
+ let host1 = content.document.getElementById("host1");
+
+ let dataDoc = content.document.implementation.createHTMLDocument();
+ dataDoc.body.innerHTML = "<div id='host2'></div>";
+ let host2 = dataDoc.body.firstChild;
+
+ let host3 = content.document.getElementById("host3");
+
+ let promises = [];
+ promises.push(createShadowDOMAndTriggerSlotChange(host1));
+ promises.push(createShadowDOMAndTriggerSlotChange(host2));
+ promises.push(createShadowDOMAndTriggerSlotChange(host3));
+
+ await Promise.all(promises);
+
+ is(hostIds.length, 3, `Got 3 slot change events`);
+ is(hostIds[0], "host1", `The first one was host1`);
+ is(hostIds[1], "host2", `The second one was host2`);
+ is(hostIds[2], "host3", `The third one was host3`);
+ });
+ });
+});
diff --git a/dom/tests/browser/browser_focus_steal_from_chrome.js b/dom/tests/browser/browser_focus_steal_from_chrome.js
new file mode 100644
index 0000000000..ead2fa0ba1
--- /dev/null
+++ b/dom/tests/browser/browser_focus_steal_from_chrome.js
@@ -0,0 +1,214 @@
+add_task(async function () {
+ requestLongerTimeout(2);
+
+ let testingList = [
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><input id='target'></body>",
+ tagName: "INPUT",
+ methodName: "focus",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').select(); }, 10);\"><input id='target'></body>",
+ tagName: "INPUT",
+ methodName: "select",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><a href='about:blank' id='target'>anchor</a></body>",
+ tagName: "A",
+ methodName: "focus",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><button id='target'>button</button></body>",
+ tagName: "BUTTON",
+ methodName: "focus",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><select id='target'><option>item1</option></select></body>",
+ tagName: "SELECT",
+ methodName: "focus",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><textarea id='target'>textarea</textarea></body>",
+ tagName: "TEXTAREA",
+ methodName: "focus",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').select(); }, 10);\"><textarea id='target'>textarea</textarea></body>",
+ tagName: "TEXTAREA",
+ methodName: "select",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><label id='target'><input></label></body>",
+ tagName: "INPUT",
+ methodName: "focus of label element",
+ },
+ {
+ uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><fieldset><legend id='target'>legend</legend><input></fieldset></body>",
+ tagName: "INPUT",
+ methodName: "focus of legend element",
+ },
+ {
+ uri:
+ 'data:text/html,<body onload="setTimeout(function () {' +
+ " var element = document.getElementById('target');" +
+ " var event = document.createEvent('MouseEvent');" +
+ " event.initMouseEvent('click', true, true, window," +
+ " 1, 0, 0, 0, 0, false, false, false, false, 0, element);" +
+ ' element.dispatchEvent(event); }, 10);">' +
+ "<label id='target'><input></label></body>",
+ tagName: "INPUT",
+ methodName: "click event on the label element",
+ },
+ ];
+
+ await BrowserTestUtils.withNewTab("about:blank", async function (bg) {
+ await BrowserTestUtils.withNewTab("about:blank", async function (fg) {
+ for (let test of testingList) {
+ // Focus the foreground tab's content
+ fg.focus();
+
+ // Load the URIs.
+ BrowserTestUtils.loadURIString(bg, test.uri);
+ await BrowserTestUtils.browserLoaded(bg);
+ BrowserTestUtils.loadURIString(fg, test.uri);
+ await BrowserTestUtils.browserLoaded(fg);
+
+ ok(true, "Test1: Both of the tabs are loaded");
+
+ // Confirm that the contents should be able to steal focus from content.
+ await SpecialPowers.spawn(fg, [test], test => {
+ return new Promise(res => {
+ function f() {
+ let e = content.document.activeElement;
+ if (e.tagName != test.tagName) {
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
+ content.setTimeout(f, 10);
+ } else {
+ is(
+ Services.focus.focusedElement,
+ e,
+ "the foreground tab's " +
+ test.tagName +
+ " element isn't focused by the " +
+ test.methodName +
+ " (Test1: content can steal focus)"
+ );
+ res();
+ }
+ }
+ f();
+ });
+ });
+
+ await SpecialPowers.spawn(bg, [test], test => {
+ return new Promise(res => {
+ function f() {
+ let e = content.document.activeElement;
+ if (e.tagName != test.tagName) {
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
+ content.setTimeout(f, 10);
+ } else {
+ isnot(
+ Services.focus.focusedElement,
+ e,
+ "the background tab's " +
+ test.tagName +
+ " element is focused by the " +
+ test.methodName +
+ " (Test1: content can steal focus)"
+ );
+ res();
+ }
+ }
+ f();
+ });
+ });
+
+ if (fg.isRemoteBrowser) {
+ is(
+ Services.focus.focusedElement,
+ fg,
+ "Focus should be on the content in the parent process"
+ );
+ }
+
+ // Focus chrome
+ gURLBar.focus();
+ let originalFocus = Services.focus.focusedElement;
+
+ // Load about:blank just to make sure that everything works nicely
+ BrowserTestUtils.loadURIString(bg, "about:blank");
+ await BrowserTestUtils.browserLoaded(bg);
+ BrowserTestUtils.loadURIString(fg, "about:blank");
+ await BrowserTestUtils.browserLoaded(fg);
+
+ // Load the URIs.
+ BrowserTestUtils.loadURIString(bg, test.uri);
+ await BrowserTestUtils.browserLoaded(bg);
+ BrowserTestUtils.loadURIString(fg, test.uri);
+ await BrowserTestUtils.browserLoaded(fg);
+
+ ok(true, "Test2: Both of the tabs are loaded");
+
+ // Confirm that the contents should be able to steal focus from content.
+ await SpecialPowers.spawn(fg, [test], test => {
+ return new Promise(res => {
+ function f() {
+ let e = content.document.activeElement;
+ if (e.tagName != test.tagName) {
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
+ content.setTimeout(f, 10);
+ } else {
+ isnot(
+ Services.focus.focusedElement,
+ e,
+ "the foreground tab's " +
+ test.tagName +
+ " element is focused by the " +
+ test.methodName +
+ " (Test2: content can NOT steal focus)"
+ );
+ res();
+ }
+ }
+ f();
+ });
+ });
+
+ await SpecialPowers.spawn(bg, [test], test => {
+ return new Promise(res => {
+ function f() {
+ let e = content.document.activeElement;
+ if (e.tagName != test.tagName) {
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
+ content.setTimeout(f, 10);
+ } else {
+ isnot(
+ Services.focus.focusedElement,
+ e,
+ "the background tab's " +
+ test.tagName +
+ " element is focused by the " +
+ test.methodName +
+ " (Test2: content can NOT steal focus)"
+ );
+ res();
+ }
+ }
+ f();
+ });
+ });
+
+ is(
+ Services.focus.focusedElement,
+ originalFocus,
+ "The parent process's focus has shifted " +
+ "(methodName = " +
+ test.methodName +
+ ")" +
+ " (Test2: content can NOT steal focus)"
+ );
+ }
+ });
+ });
+});
diff --git a/dom/tests/browser/browser_focus_steal_from_chrome_during_mousedown.js b/dom/tests/browser/browser_focus_steal_from_chrome_during_mousedown.js
new file mode 100644
index 0000000000..61c36f2436
--- /dev/null
+++ b/dom/tests/browser/browser_focus_steal_from_chrome_during_mousedown.js
@@ -0,0 +1,76 @@
+add_task(async function test() {
+ const kTestURI =
+ "data:text/html," +
+ '<script type="text/javascript">' +
+ " function onMouseDown(aEvent) {" +
+ " document.getElementById('willBeFocused').focus();" +
+ " aEvent.preventDefault();" +
+ " }" +
+ "</script>" +
+ '<body id="body">' +
+ '<button onmousedown="onMouseDown(event);" style="width: 100px; height: 100px;">click here</button>' +
+ '<input id="willBeFocused"></body>';
+
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, kTestURI);
+
+ let fm = Services.focus;
+
+ for (var button = 0; button < 3; button++) {
+ // Set focus to a chrome element before synthesizing a mouse down event.
+ gURLBar.focus();
+
+ is(
+ fm.focusedElement,
+ gURLBar.inputField,
+ "Failed to move focus to search bar: button=" + button
+ );
+
+ // Synthesize mouse down event on browser object over the button, such that
+ // the event propagates through both processes.
+ EventUtils.synthesizeMouse(tab.linkedBrowser, 20, 20, { button });
+
+ isnot(
+ fm.focusedElement,
+ gURLBar.inputField,
+ "Failed to move focus away from search bar: button=" + button
+ );
+
+ await SpecialPowers.spawn(
+ tab.linkedBrowser,
+ [button],
+ async function (button) {
+ let fm = Services.focus;
+
+ let attempts = 10;
+ await new Promise(resolve => {
+ function check() {
+ if (
+ attempts > 0 &&
+ content.document.activeElement.id != "willBeFocused"
+ ) {
+ attempts--;
+ content.window.setTimeout(check, 100);
+ return;
+ }
+
+ Assert.equal(
+ content.document.activeElement.id,
+ "willBeFocused",
+ "The input element isn't active element: button=" + button
+ );
+ Assert.equal(
+ fm.focusedElement,
+ content.document.activeElement,
+ "The active element isn't focused element in App level: button=" +
+ button
+ );
+ resolve();
+ }
+ check();
+ });
+ }
+ );
+ }
+
+ gBrowser.removeTab(tab);
+});
diff --git a/dom/tests/browser/browser_form_associated_custom_elements_validity.js b/dom/tests/browser/browser_form_associated_custom_elements_validity.js
new file mode 100644
index 0000000000..3765405735
--- /dev/null
+++ b/dom/tests/browser/browser_form_associated_custom_elements_validity.js
@@ -0,0 +1,111 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+"use strict";
+
+add_task(async function report_validity() {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: `data:text/html,<my-control></my-control>`,
+ },
+ async function (aBrowser) {
+ let promisePopupShown = BrowserTestUtils.waitForEvent(
+ window,
+ "popupshown"
+ );
+
+ let message = "valueMissing message";
+ await SpecialPowers.spawn(aBrowser, [message], function (aMessage) {
+ class MyControl extends content.HTMLElement {
+ static get formAssociated() {
+ return true;
+ }
+ constructor() {
+ super();
+ let shadow = this.attachShadow({ mode: "open" });
+ let input = content.document.createElement("input");
+ shadow.appendChild(input);
+
+ let internals = this.attachInternals();
+ internals.setValidity({ valueMissing: true }, aMessage, input);
+ internals.reportValidity();
+ }
+ }
+ content.customElements.define("my-control", MyControl);
+
+ let myControl = content.document.querySelector("my-control");
+ content.customElements.upgrade(myControl);
+ });
+ await promisePopupShown;
+
+ let invalidFormPopup =
+ window.document.getElementById("invalid-form-popup");
+ is(invalidFormPopup.state, "open", "invalid-form-popup should be opened");
+ is(invalidFormPopup.firstChild.textContent, message, "check message");
+
+ let promisePopupHidden = BrowserTestUtils.waitForEvent(
+ invalidFormPopup,
+ "popuphidden"
+ );
+ invalidFormPopup.hidePopup();
+ await promisePopupHidden;
+ }
+ );
+});
+
+add_task(async function form_report_validity() {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: `data:text/html,<form><my-control></my-control></form>`,
+ },
+ async function (aBrowser) {
+ let promisePopupShown = BrowserTestUtils.waitForEvent(
+ window,
+ "popupshown"
+ );
+
+ let message = "valueMissing message";
+ await SpecialPowers.spawn(aBrowser, [message], function (aMessage) {
+ class MyControl extends content.HTMLElement {
+ static get formAssociated() {
+ return true;
+ }
+ constructor() {
+ super();
+ let shadow = this.attachShadow({ mode: "open" });
+ let input = content.document.createElement("input");
+ shadow.appendChild(input);
+
+ let internals = this.attachInternals();
+ internals.setValidity({ valueMissing: true }, aMessage, input);
+ }
+ }
+ content.customElements.define("my-control", MyControl);
+
+ let myControl = content.document.querySelector("my-control");
+ content.customElements.upgrade(myControl);
+
+ let form = content.document.querySelector("form");
+ is(form.length, "1", "check form.length");
+ form.reportValidity();
+ });
+ await promisePopupShown;
+
+ let invalidFormPopup =
+ window.document.getElementById("invalid-form-popup");
+ is(invalidFormPopup.state, "open", "invalid-form-popup should be opened");
+ is(invalidFormPopup.firstChild.textContent, message, "check message");
+
+ let promisePopupHidden = BrowserTestUtils.waitForEvent(
+ invalidFormPopup,
+ "popuphidden"
+ );
+ invalidFormPopup.hidePopup();
+ await promisePopupHidden;
+ }
+ );
+});
diff --git a/dom/tests/browser/browser_frame_elements.html b/dom/tests/browser/browser_frame_elements.html
new file mode 100644
index 0000000000..4843173f57
--- /dev/null
+++ b/dom/tests/browser/browser_frame_elements.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <title>Frame Element Tests</title>
+</head>
+<body>
+ <h1>Frame Element Tests</h1>
+
+ <iframe id="iframe-blank" src="about:blank"></iframe>
+
+ <iframe id="iframe-data-url" src="data:text/html;charset=utf-8,%3Chtml%3E%3Cbody%3Eiframe%3C/body%3E%3C/html%3E"></iframe>
+
+ <object id="object-data-url" type="text/html" data="data:text/html;charset=utf-8,%3Chtml%3E%3Cbody%3Eobject%3C/body%3E%3C/html%3E"></object>
+
+</body>
diff --git a/dom/tests/browser/browser_frame_elements.js b/dom/tests/browser/browser_frame_elements.js
new file mode 100644
index 0000000000..13f79edbfd
--- /dev/null
+++ b/dom/tests/browser/browser_frame_elements.js
@@ -0,0 +1,74 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const TEST_URI =
+ "http://example.com/browser/dom/tests/browser/browser_frame_elements.html";
+
+add_task(async function test() {
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: TEST_URI },
+ async function (browser) {
+ // Confirm its embedder is the browser:
+ is(
+ browser.browsingContext.embedderElement,
+ browser,
+ "Embedder element for main window is xul:browser"
+ );
+
+ await SpecialPowers.spawn(browser, [], startTests);
+ }
+ );
+});
+
+function startTests() {
+ info("Frame tests started");
+
+ info("Checking top window");
+ let gWindow = content;
+ Assert.equal(gWindow.top, gWindow, "gWindow is top");
+ Assert.equal(gWindow.parent, gWindow, "gWindow is parent");
+
+ info("Checking about:blank iframe");
+ let iframeBlank = gWindow.document.querySelector("#iframe-blank");
+ Assert.ok(iframeBlank, "Iframe exists on page");
+ Assert.equal(
+ iframeBlank.browsingContext.embedderElement,
+ iframeBlank,
+ "Embedder element for iframe window is iframe"
+ );
+ Assert.equal(iframeBlank.contentWindow.top, gWindow, "gWindow is top");
+ Assert.equal(iframeBlank.contentWindow.parent, gWindow, "gWindow is parent");
+
+ info("Checking iframe with data url src");
+ let iframeDataUrl = gWindow.document.querySelector("#iframe-data-url");
+ Assert.ok(iframeDataUrl, "Iframe exists on page");
+ Assert.equal(
+ iframeDataUrl.browsingContext.embedderElement,
+ iframeDataUrl,
+ "Embedder element for iframe window is iframe"
+ );
+ Assert.equal(iframeDataUrl.contentWindow.top, gWindow, "gWindow is top");
+ Assert.equal(
+ iframeDataUrl.contentWindow.parent,
+ gWindow,
+ "gWindow is parent"
+ );
+
+ info("Checking object with data url data attribute");
+ let objectDataUrl = gWindow.document.querySelector("#object-data-url");
+ Assert.ok(objectDataUrl, "Object exists on page");
+ Assert.equal(
+ objectDataUrl.browsingContext.embedderElement,
+ objectDataUrl,
+ "Embedder element for object window is the object"
+ );
+ Assert.equal(objectDataUrl.contentWindow.top, gWindow, "gWindow is top");
+ Assert.equal(
+ objectDataUrl.contentWindow.parent,
+ gWindow,
+ "gWindow is parent"
+ );
+}
diff --git a/dom/tests/browser/browser_hasActivePeerConnections.js b/dom/tests/browser/browser_hasActivePeerConnections.js
new file mode 100644
index 0000000000..91d51efbfc
--- /dev/null
+++ b/dom/tests/browser/browser_hasActivePeerConnections.js
@@ -0,0 +1,134 @@
+const TEST_URI1 =
+ "http://mochi.test:8888/browser/dom/tests/browser/" +
+ "create_webrtc_peer_connection.html";
+
+const TEST_URI2 =
+ "https://example.com/browser/dom/tests/browser/" +
+ "create_webrtc_peer_connection.html";
+
+add_task(async () => {
+ await BrowserTestUtils.withNewTab(TEST_URI1, async browser => {
+ const windowGlobal = browser.browsingContext.currentWindowGlobal;
+ Assert.ok(windowGlobal);
+
+ Assert.strictEqual(
+ windowGlobal.hasActivePeerConnections(),
+ false,
+ "No active connections at the beginning"
+ );
+
+ await SpecialPowers.spawn(browser, [], async () => {
+ content.postMessage("push-peer-connection", "*");
+ return new Promise(resolve =>
+ content.addEventListener("message", function onMessage(event) {
+ if (event.data == "ack") {
+ content.removeEventListener(event.type, onMessage);
+ resolve();
+ }
+ })
+ );
+ });
+
+ Assert.strictEqual(
+ windowGlobal.hasActivePeerConnections(),
+ true,
+ "One connection in the top window"
+ );
+
+ await SpecialPowers.spawn(browser, [], async () => {
+ content.postMessage("pop-peer-connection", "*");
+ return new Promise(resolve =>
+ content.addEventListener("message", function onMessage(event) {
+ if (event.data == "ack") {
+ content.removeEventListener(event.type, onMessage);
+ resolve();
+ }
+ })
+ );
+ });
+
+ Assert.strictEqual(
+ windowGlobal.hasActivePeerConnections(),
+ false,
+ "All connections have been closed"
+ );
+
+ await SpecialPowers.spawn(
+ browser,
+ [TEST_URI1, TEST_URI2],
+ async (TEST_URI1, TEST_URI2) => {
+ // Create a promise that is fulfilled when the "ack" message is received
+ // |targetCount| times.
+ const createWaitForAckPromise = (eventTarget, targetCount) => {
+ let counter = 0;
+ return new Promise(resolve => {
+ eventTarget.addEventListener("message", function onMsg(event) {
+ if (event.data == "ack") {
+ ++counter;
+ if (counter == targetCount) {
+ eventTarget.removeEventListener(event.type, onMsg);
+ resolve();
+ }
+ }
+ });
+ });
+ };
+
+ const addFrame = (id, url) => {
+ const iframe = content.document.createElement("iframe");
+ iframe.id = id;
+ iframe.src = url;
+ content.document.body.appendChild(iframe);
+ return iframe;
+ };
+
+ // Create two iframes hosting a same-origin page and a cross-origin page
+ const iframe1 = addFrame("iframe-same-origin", TEST_URI1);
+ const iframe2 = addFrame("iframe-cross-origin", TEST_URI2);
+ await ContentTaskUtils.waitForEvent(iframe1, "load");
+ await ContentTaskUtils.waitForEvent(iframe2, "load");
+
+ // Make sure the counter is not messed up after successive push/pop
+ // messages
+ const kLoopCount = 100;
+ for (let i = 0; i < kLoopCount; ++i) {
+ content.postMessage("push-peer-connection", "*");
+ iframe1.contentWindow.postMessage("push-peer-connection", "*");
+ iframe2.contentWindow.postMessage("push-peer-connection", "*");
+ iframe1.contentWindow.postMessage("pop-peer-connection", "*");
+ iframe2.contentWindow.postMessage("pop-peer-connection", "*");
+ content.postMessage("pop-peer-connection", "*");
+ }
+ iframe2.contentWindow.postMessage("push-peer-connection", "*");
+
+ return createWaitForAckPromise(content, kLoopCount * 6 + 1);
+ }
+ );
+
+ Assert.strictEqual(
+ windowGlobal.hasActivePeerConnections(),
+ true,
+ "#iframe-cross-origin still has an active connection"
+ );
+
+ await SpecialPowers.spawn(browser, [], async () => {
+ content.document
+ .getElementById("iframe-cross-origin")
+ .contentWindow.postMessage("pop-peer-connection", "*");
+ return new Promise(resolve =>
+ content.addEventListener("message", function onMessage(event) {
+ if (event.data == "ack") {
+ content.removeEventListener(event.type, onMessage);
+ resolve();
+ }
+ })
+ );
+ });
+
+ Assert.strictEqual(
+ windowGlobal.hasActivePeerConnections(),
+ false,
+ "All connections have been closed"
+ );
+ });
+});
diff --git a/dom/tests/browser/browser_hasbeforeunload.js b/dom/tests/browser/browser_hasbeforeunload.js
new file mode 100644
index 0000000000..1ffc06656e
--- /dev/null
+++ b/dom/tests/browser/browser_hasbeforeunload.js
@@ -0,0 +1,875 @@
+"use strict";
+
+const PAGE_URL =
+ "http://example.com/browser/dom/tests/browser/beforeunload_test_page.html";
+
+/**
+ * Adds 1 or more inert beforeunload event listeners in this browser.
+ * By default, will target the top-level content window, but callers
+ * can specify the index of a subframe to target. See prepareSubframes
+ * for an idea of how the subframes are structured.
+ *
+ * @param {<xul:browser>} browser
+ * The browser to add the beforeunload event listener in.
+ * @param {int} howMany
+ * How many beforeunload event listeners to add. Note that these
+ * beforeunload event listeners are inert and will not actually
+ * prevent the host window from navigating.
+ * @param {optional int} frameDepth
+ * The depth of the frame to add the event listener to. Defaults
+ * to 0, which is the top-level content window.
+ * @return {Promise}
+ */
+function addBeforeUnloadListeners(browser, howMany = 1, frameDepth = 0) {
+ return controlFrameAt(browser, frameDepth, {
+ name: "AddBeforeUnload",
+ howMany,
+ });
+}
+
+/**
+ * Adds 1 or more inert beforeunload event listeners in this browser on
+ * a particular subframe. By default, this will target the first subframe
+ * under the top-level content window, but callers can specify the index
+ * of a subframe to target. See prepareSubframes for an idea of how the
+ * subframes are structured.
+ *
+ * Note that this adds the beforeunload event listener on the "outer" window,
+ * by doing:
+ *
+ * iframe.addEventListener("beforeunload", ...);
+ *
+ * @param {<xul:browser>} browser
+ * The browser to add the beforeunload event listener in.
+ * @param {int} howMany
+ * How many beforeunload event listeners to add. Note that these
+ * beforeunload event listeners are inert and will not actually
+ * prevent the host window from navigating.
+ * @param {optional int} frameDepth
+ * The depth of the frame to add the event listener to. Defaults
+ * to 1, which is the first subframe inside the top-level content
+ * window. Setting this to 0 will throw.
+ * @return {Promise}
+ */
+function addOuterBeforeUnloadListeners(browser, howMany = 1, frameDepth = 1) {
+ if (frameDepth == 0) {
+ throw new Error(
+ "When adding a beforeunload listener on an outer " +
+ "window, the frame you're targeting needs to be at " +
+ "depth > 0."
+ );
+ }
+
+ return controlFrameAt(browser, frameDepth, {
+ name: "AddOuterBeforeUnload",
+ howMany,
+ });
+}
+
+/**
+ * Removes 1 or more inert beforeunload event listeners in this browser.
+ * This assumes that addBeforeUnloadListeners has been called previously
+ * for the target frame.
+ *
+ * By default, will target the top-level content window, but callers
+ * can specify the index of a subframe to target. See prepareSubframes
+ * for an idea of how the subframes are structured.
+ *
+ * @param {<xul:browser>} browser
+ * The browser to remove the beforeunload event listener from.
+ * @param {int} howMany
+ * How many beforeunload event listeners to remove.
+ * @param {optional int} frameDepth
+ * The depth of the frame to remove the event listener from. Defaults
+ * to 0, which is the top-level content window.
+ * @return {Promise}
+ */
+function removeBeforeUnloadListeners(browser, howMany = 1, frameDepth = 0) {
+ return controlFrameAt(browser, frameDepth, {
+ name: "RemoveBeforeUnload",
+ howMany,
+ });
+}
+
+/**
+ * Removes 1 or more inert beforeunload event listeners in this browser on
+ * a particular subframe. By default, this will target the first subframe
+ * under the top-level content window, but callers can specify the index
+ * of a subframe to target. See prepareSubframes for an idea of how the
+ * subframes are structured.
+ *
+ * Note that this removes the beforeunload event listener on the "outer" window,
+ * by doing:
+ *
+ * iframe.removeEventListener("beforeunload", ...);
+ *
+ * @param {<xul:browser>} browser
+ * The browser to remove the beforeunload event listener from.
+ * @param {int} howMany
+ * How many beforeunload event listeners to remove.
+ * @param {optional int} frameDepth
+ * The depth of the frame to remove the event listener from. Defaults
+ * to 1, which is the first subframe inside the top-level content
+ * window. Setting this to 0 will throw.
+ * @return {Promise}
+ */
+function removeOuterBeforeUnloadListeners(
+ browser,
+ howMany = 1,
+ frameDepth = 1
+) {
+ if (frameDepth == 0) {
+ throw new Error(
+ "When removing a beforeunload listener from an outer " +
+ "window, the frame you're targeting needs to be at " +
+ "depth > 0."
+ );
+ }
+
+ return controlFrameAt(browser, frameDepth, {
+ name: "RemoveOuterBeforeUnload",
+ howMany,
+ });
+}
+
+/**
+ * Navigates a content window to a particular URL and waits for it to
+ * finish loading that URL.
+ *
+ * By default, will target the top-level content window, but callers
+ * can specify the index of a subframe to target. See prepareSubframes
+ * for an idea of how the subframes are structured.
+ *
+ * @param {<xul:browser>} browser
+ * The browser that will have the navigation occur within it.
+ * @param {string} url
+ * The URL to send the content window to.
+ * @param {optional int} frameDepth
+ * The depth of the frame to navigate. Defaults to 0, which is
+ * the top-level content window.
+ * @return {Promise}
+ */
+function navigateSubframe(browser, url, frameDepth = 0) {
+ let navigatePromise = controlFrameAt(browser, frameDepth, {
+ name: "Navigate",
+ url,
+ });
+ let subframeLoad = BrowserTestUtils.browserLoaded(browser, true);
+ return Promise.all([navigatePromise, subframeLoad]);
+}
+
+/**
+ * Removes the <iframe> from a content window pointed at PAGE_URL.
+ *
+ * By default, will target the top-level content window, but callers
+ * can specify the index of a subframe to target. See prepareSubframes
+ * for an idea of how the subframes are structured.
+ *
+ * @param {<xul:browser>} browser
+ * The browser that will have removal occur within it.
+ * @param {optional int} frameDepth
+ * The depth of the frame that will have the removal occur within
+ * it. Defaults to 0, which is the top-level content window, meaning
+ * that the first subframe will be removed.
+ * @return {Promise}
+ */
+function removeSubframeFrom(browser, frameDepth = 0) {
+ return controlFrameAt(browser, frameDepth, {
+ name: "RemoveSubframe",
+ });
+}
+
+/**
+ * Sends a command to a frame pointed at PAGE_URL. There are utility
+ * functions defined in this file that call this function. You should
+ * use those instead.
+ *
+ * @param {<xul:browser>} browser
+ * The browser to send the command to.
+ * @param {int} frameDepth
+ * The depth of the frame that we'll send the command to. 0 means
+ * sending it to the top-level content window.
+ * @param {object} command
+ * An object with the following structure:
+ *
+ * {
+ * name: (string),
+ * <arbitrary arguments to send with the command>
+ * }
+ *
+ * Here are the commands that can be sent:
+ *
+ * AddBeforeUnload
+ * {int} howMany
+ * How many beforeunload event listeners to add.
+ *
+ * AddOuterBeforeUnload
+ * {int} howMany
+ * How many beforeunload event listeners to add to
+ * the iframe in the document at this depth.
+ *
+ * RemoveBeforeUnload
+ * {int} howMany
+ * How many beforeunload event listeners to remove.
+ *
+ * RemoveOuterBeforeUnload
+ * {int} howMany
+ * How many beforeunload event listeners to remove from
+ * the iframe in the document at this depth.
+ *
+ * Navigate
+ * {string} url
+ * The URL to send the frame to.
+ *
+ * RemoveSubframe
+ *
+ * @return {Promise}
+ */
+function controlFrameAt(browser, frameDepth, command) {
+ return SpecialPowers.spawn(
+ browser,
+ [{ frameDepth, command }],
+ async function (args) {
+ const { TestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/TestUtils.sys.mjs"
+ );
+
+ let { command: contentCommand, frameDepth: contentFrameDepth } = args;
+
+ let targetContent = content;
+ let targetSubframe = content.document.getElementById("subframe");
+
+ // We want to not only find the frame that maps to the
+ // target frame depth that we've been given, but we also want
+ // to count the total depth so that if a middle frame is removed
+ // or navigated, then we know how many outer-window-destroyed
+ // observer notifications to expect.
+ let currentContent = targetContent;
+ let currentSubframe = targetSubframe;
+
+ let depth = 0;
+
+ do {
+ currentContent = currentSubframe.contentWindow;
+ currentSubframe = currentContent.document.getElementById("subframe");
+ depth++;
+ if (depth == contentFrameDepth) {
+ targetContent = currentContent;
+ targetSubframe = currentSubframe;
+ }
+ } while (currentSubframe);
+
+ switch (contentCommand.name) {
+ case "AddBeforeUnload": {
+ let BeforeUnloader = targetContent.wrappedJSObject.BeforeUnloader;
+ Assert.ok(BeforeUnloader, "Found BeforeUnloader in the test page.");
+ BeforeUnloader.pushInner(contentCommand.howMany);
+ break;
+ }
+ case "AddOuterBeforeUnload": {
+ let BeforeUnloader = targetContent.wrappedJSObject.BeforeUnloader;
+ Assert.ok(BeforeUnloader, "Found BeforeUnloader in the test page.");
+ BeforeUnloader.pushOuter(contentCommand.howMany);
+ break;
+ }
+ case "RemoveBeforeUnload": {
+ let BeforeUnloader = targetContent.wrappedJSObject.BeforeUnloader;
+ Assert.ok(BeforeUnloader, "Found BeforeUnloader in the test page.");
+ BeforeUnloader.popInner(contentCommand.howMany);
+ break;
+ }
+ case "RemoveOuterBeforeUnload": {
+ let BeforeUnloader = targetContent.wrappedJSObject.BeforeUnloader;
+ Assert.ok(BeforeUnloader, "Found BeforeUnloader in the test page.");
+ BeforeUnloader.popOuter(contentCommand.howMany);
+ break;
+ }
+ case "Navigate": {
+ // How many frames are going to be destroyed when we do this? We
+ // need to wait for that many window destroyed notifications.
+ targetContent.location = contentCommand.url;
+
+ let destroyedOuterWindows = depth - contentFrameDepth;
+ if (destroyedOuterWindows) {
+ await TestUtils.topicObserved("outer-window-destroyed", () => {
+ destroyedOuterWindows--;
+ return !destroyedOuterWindows;
+ });
+ }
+ break;
+ }
+ case "RemoveSubframe": {
+ let subframe = targetContent.document.getElementById("subframe");
+ Assert.ok(
+ subframe,
+ "Found subframe at frame depth of " + contentFrameDepth
+ );
+ subframe.remove();
+
+ let destroyedOuterWindows = depth - contentFrameDepth;
+ if (destroyedOuterWindows) {
+ await TestUtils.topicObserved("outer-window-destroyed", () => {
+ destroyedOuterWindows--;
+ return !destroyedOuterWindows;
+ });
+ }
+ break;
+ }
+ }
+ }
+ ).catch(console.error);
+}
+
+/**
+ * Sets up a structure where a page at PAGE_URL will host an
+ * <iframe> also pointed at PAGE_URL, and does this repeatedly
+ * until we've achieved the desired frame depth. Note that this
+ * will cause the top-level browser to reload, and wipe out any
+ * previous changes to the DOM under it.
+ *
+ * @param {<xul:browser>} browser
+ * The browser in which we'll load our structure at the
+ * top level.
+ * @param {Array<object>} options
+ * Set-up options for each subframe. The following properties
+ * are accepted:
+ *
+ * {string} sandboxAttributes
+ * The value to set the sandbox attribute to. If null, no sandbox
+ * attribute will be set (and any pre-existing sandbox attributes)
+ * on the <iframe> will be removed.
+ *
+ * The number of entries on the options Array corresponds to how many
+ * subframes are under the top-level content window.
+ *
+ * Example:
+ *
+ * yield prepareSubframes(browser, [
+ * { sandboxAttributes: null },
+ * { sandboxAttributes: "allow-modals" },
+ * ]);
+ *
+ * This would create the following structure:
+ *
+ * <top-level content window at PAGE_URL>
+ * |
+ * |--> <iframe at PAGE_URL, no sandbox attributes>
+ * |
+ * |--> <iframe at PAGE_URL, sandbox="allow-modals">
+ *
+ * @return {Promise}
+ */
+async function prepareSubframes(browser, options) {
+ browser.reload();
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [{ options, PAGE_URL }],
+ async function (args) {
+ let { options: allSubframeOptions, PAGE_URL: contentPageURL } = args;
+ function loadBeforeUnloadHelper(doc, subframeOptions) {
+ let subframe = doc.getElementById("subframe");
+ subframe.remove();
+ if (subframeOptions.sandboxAttributes === null) {
+ subframe.removeAttribute("sandbox");
+ } else {
+ subframe.setAttribute("sandbox", subframeOptions.sandboxAttributes);
+ }
+ doc.body.appendChild(subframe);
+ subframe.contentWindow.location = contentPageURL;
+ return ContentTaskUtils.waitForEvent(subframe, "load").then(() => {
+ return subframe.contentDocument;
+ });
+ }
+
+ let currentDoc = content.document;
+ for (let subframeOptions of allSubframeOptions) {
+ currentDoc = await loadBeforeUnloadHelper(currentDoc, subframeOptions);
+ }
+ }
+ );
+}
+
+/**
+ * Ensures that a browser's nsIRemoteTab hasBeforeUnload attribute
+ * is set to the expected value.
+ *
+ * @param {<xul:browser>} browser
+ * The browser whose nsIRemoteTab we will check.
+ * @param {bool} expected
+ * True if hasBeforeUnload is expected to be true.
+ */
+function assertHasBeforeUnload(browser, expected) {
+ Assert.equal(browser.hasBeforeUnload, expected);
+}
+
+/**
+ * Tests that the MozBrowser hasBeforeUnload property works under
+ * a number of different scenarios on inner windows. At a high-level,
+ * we test that hasBeforeUnload works properly during page / iframe
+ * navigation, or when an <iframe> with a beforeunload listener on its
+ * inner window is removed from the DOM.
+ */
+add_task(async function test_inner_window_scenarios() {
+ // Turn this off because the test expects the page to be not bfcached.
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["docshell.shistory.bfcache.ship_allow_beforeunload_listeners", false],
+ ],
+ });
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: PAGE_URL,
+ },
+ async function (browser) {
+ Assert.ok(
+ browser.isRemoteBrowser,
+ "This test only makes sense with out of process browsers."
+ );
+ assertHasBeforeUnload(browser, false);
+
+ // Test the simple case on the top-level window by adding a single
+ // beforeunload event listener on the inner window and then removing
+ // it.
+ await addBeforeUnloadListeners(browser);
+ assertHasBeforeUnload(browser, true);
+ await removeBeforeUnloadListeners(browser);
+ assertHasBeforeUnload(browser, false);
+
+ // Now let's add several beforeunload listeners, and
+ // ensure that we only set hasBeforeUnload to false once
+ // the last listener is removed.
+ await addBeforeUnloadListeners(browser, 3);
+ assertHasBeforeUnload(browser, true);
+ await removeBeforeUnloadListeners(browser); // 2 left...
+ assertHasBeforeUnload(browser, true);
+ await removeBeforeUnloadListeners(browser); // 1 left...
+ assertHasBeforeUnload(browser, true);
+ await removeBeforeUnloadListeners(browser); // None left!
+
+ assertHasBeforeUnload(browser, false);
+
+ // Now let's have the top-level content window navigate
+ // away with a beforeunload listener set, and ensure
+ // that we clear the hasBeforeUnload value.
+ await addBeforeUnloadListeners(browser, 5);
+ await navigateSubframe(browser, "http://example.com");
+ assertHasBeforeUnload(browser, false);
+
+ // Now send the page back to the test page for
+ // the next few tests.
+ BrowserTestUtils.loadURIString(browser, PAGE_URL);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ // We want to test hasBeforeUnload works properly with
+ // beforeunload event listeners in <iframe> elements too.
+ // We prepare a structure like this with 3 content windows
+ // to exercise:
+ //
+ // <top-level content window at PAGE_URL> (TOP)
+ // |
+ // |--> <iframe at PAGE_URL> (MIDDLE)
+ // |
+ // |--> <iframe at PAGE_URL> (BOTTOM)
+ //
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+ // These constants are just to make it easier to know which
+ // frame we're referring to without having to remember the
+ // exact indices.
+ const TOP = 0;
+ const MIDDLE = 1;
+ const BOTTOM = 2;
+
+ // We should initially start with hasBeforeUnload set to false.
+ assertHasBeforeUnload(browser, false);
+
+ // Tests that if there are beforeunload event listeners on
+ // all levels of our window structure, that we only set
+ // hasBeforeUnload to false once the last beforeunload
+ // listener has been unset.
+ await addBeforeUnloadListeners(browser, 2, MIDDLE);
+ assertHasBeforeUnload(browser, true);
+ await addBeforeUnloadListeners(browser, 1, TOP);
+ assertHasBeforeUnload(browser, true);
+ await addBeforeUnloadListeners(browser, 5, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await removeBeforeUnloadListeners(browser, 1, TOP);
+ assertHasBeforeUnload(browser, true);
+ await removeBeforeUnloadListeners(browser, 5, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeBeforeUnloadListeners(browser, 2, MIDDLE);
+ assertHasBeforeUnload(browser, false);
+
+ // Tests that if a beforeunload event listener is set on
+ // an iframe that navigates away to a page without a
+ // beforeunload listener, that hasBeforeUnload is set
+ // to false.
+ await addBeforeUnloadListeners(browser, 5, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await navigateSubframe(browser, "http://example.com", BOTTOM);
+ assertHasBeforeUnload(browser, false);
+
+ // Reset our window structure now.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+
+ // This time, add beforeunload event listeners to both the
+ // MIDDLE and BOTTOM frame, and then navigate the MIDDLE
+ // away. This should set hasBeforeUnload to false.
+ await addBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await navigateSubframe(browser, "http://example.com", MIDDLE);
+ assertHasBeforeUnload(browser, false);
+
+ // Tests that if the MIDDLE and BOTTOM frames have beforeunload
+ // event listeners, and if we remove the BOTTOM <iframe> and the
+ // MIDDLE <iframe>, that hasBeforeUnload is set to false.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+ await addBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeSubframeFrom(browser, MIDDLE);
+ assertHasBeforeUnload(browser, true);
+ await removeSubframeFrom(browser, TOP);
+ assertHasBeforeUnload(browser, false);
+
+ // Tests that if the MIDDLE and BOTTOM frames have beforeunload
+ // event listeners, and if we remove just the MIDDLE <iframe>, that
+ // hasBeforeUnload is set to false.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+ await addBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeSubframeFrom(browser, TOP);
+ assertHasBeforeUnload(browser, false);
+
+ // Test that two sandboxed iframes, _without_ the allow-modals
+ // permission, do not result in the hasBeforeUnload attribute
+ // being set to true when beforeunload event listeners are added.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: "allow-scripts" },
+ { sandboxAttributes: "allow-scripts" },
+ ]);
+
+ await addBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, false);
+
+ await removeBeforeUnloadListeners(browser, 3, MIDDLE);
+ await removeBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, false);
+
+ // Test that two sandboxed iframes, both with the allow-modals
+ // permission, cause the hasBeforeUnload attribute to be set
+ // to true when beforeunload event listeners are added.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: "allow-scripts allow-modals" },
+ { sandboxAttributes: "allow-scripts allow-modals" },
+ ]);
+
+ await addBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await removeBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeBeforeUnloadListeners(browser, 3, MIDDLE);
+ assertHasBeforeUnload(browser, false);
+ }
+ );
+});
+
+/**
+ * Tests that the nsIRemoteTab hasBeforeUnload attribute works under
+ * a number of different scenarios on outer windows. Very similar to
+ * the above set of tests, except that we add the beforeunload listeners
+ * to the iframe DOM nodes instead of the inner windows.
+ */
+add_task(async function test_outer_window_scenarios() {
+ // Turn this off because the test expects the page to be not bfcached.
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["docshell.shistory.bfcache.ship_allow_beforeunload_listeners", false],
+ ],
+ });
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: PAGE_URL,
+ },
+ async function (browser) {
+ Assert.ok(
+ browser.isRemoteBrowser,
+ "This test only makes sense with out of process browsers."
+ );
+ assertHasBeforeUnload(browser, false);
+
+ // We want to test hasBeforeUnload works properly with
+ // beforeunload event listeners in <iframe> elements.
+ // We prepare a structure like this with 3 content windows
+ // to exercise:
+ //
+ // <top-level content window at PAGE_URL> (TOP)
+ // |
+ // |--> <iframe at PAGE_URL> (MIDDLE)
+ // |
+ // |--> <iframe at PAGE_URL> (BOTTOM)
+ //
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+
+ // These constants are just to make it easier to know which
+ // frame we're referring to without having to remember the
+ // exact indices.
+ const TOP = 0;
+ const MIDDLE = 1;
+ const BOTTOM = 2;
+
+ // Test the simple case on the top-level window by adding a single
+ // beforeunload event listener on the outer window of the iframe
+ // in the TOP document.
+ await addOuterBeforeUnloadListeners(browser);
+ assertHasBeforeUnload(browser, true);
+
+ await removeOuterBeforeUnloadListeners(browser);
+ assertHasBeforeUnload(browser, false);
+
+ // Now let's add several beforeunload listeners, and
+ // ensure that we only set hasBeforeUnload to false once
+ // the last listener is removed.
+ await addOuterBeforeUnloadListeners(browser, 3);
+ assertHasBeforeUnload(browser, true);
+ await removeOuterBeforeUnloadListeners(browser); // 2 left...
+ assertHasBeforeUnload(browser, true);
+ await removeOuterBeforeUnloadListeners(browser); // 1 left...
+ assertHasBeforeUnload(browser, true);
+ await removeOuterBeforeUnloadListeners(browser); // None left!
+
+ assertHasBeforeUnload(browser, false);
+
+ // Now let's have the top-level content window navigate away
+ // with a beforeunload listener set on the outer window of the
+ // iframe inside it, and ensure that we clear the hasBeforeUnload
+ // value.
+ await addOuterBeforeUnloadListeners(browser, 5);
+ await navigateSubframe(browser, "http://example.com", TOP);
+ assertHasBeforeUnload(browser, false);
+
+ // Now send the page back to the test page for
+ // the next few tests.
+ BrowserTestUtils.loadURIString(browser, PAGE_URL);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ // We should initially start with hasBeforeUnload set to false.
+ assertHasBeforeUnload(browser, false);
+
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+
+ // Tests that if there are beforeunload event listeners on
+ // all levels of our window structure, that we only set
+ // hasBeforeUnload to false once the last beforeunload
+ // listener has been unset.
+ await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ assertHasBeforeUnload(browser, true);
+ await addOuterBeforeUnloadListeners(browser, 7, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await removeOuterBeforeUnloadListeners(browser, 7, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ assertHasBeforeUnload(browser, false);
+
+ // Tests that if a beforeunload event listener is set on
+ // an iframe that navigates away to a page without a
+ // beforeunload listener, that hasBeforeUnload is set
+ // to false. We're setting the event listener on the
+ // outer window on the <iframe> in the MIDDLE, which
+ // itself contains the BOTTOM frame it our structure.
+ await addOuterBeforeUnloadListeners(browser, 5, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ // Now navigate that BOTTOM frame.
+ await navigateSubframe(browser, "http://example.com", BOTTOM);
+ assertHasBeforeUnload(browser, false);
+
+ // Reset our window structure now.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+
+ // This time, add beforeunload event listeners to the outer
+ // windows for MIDDLE and BOTTOM. Then navigate the MIDDLE
+ // frame. This should set hasBeforeUnload to false.
+ await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addOuterBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await navigateSubframe(browser, "http://example.com", MIDDLE);
+ assertHasBeforeUnload(browser, false);
+
+ // Adds beforeunload event listeners to the outer windows of
+ // MIDDLE and BOTOTM, and then removes those iframes. Removing
+ // both iframes should set hasBeforeUnload to false.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+ await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addOuterBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeSubframeFrom(browser, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeSubframeFrom(browser, MIDDLE);
+ assertHasBeforeUnload(browser, false);
+
+ // Adds beforeunload event listeners to the outer windows of MIDDLE
+ // and BOTTOM, and then removes just the MIDDLE iframe (which will
+ // take the bottom one with it). This should set hasBeforeUnload to
+ // false.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+ await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addOuterBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeSubframeFrom(browser, TOP);
+ assertHasBeforeUnload(browser, false);
+
+ // Test that two sandboxed iframes, _without_ the allow-modals
+ // permission, do not result in the hasBeforeUnload attribute
+ // being set to true when beforeunload event listeners are added
+ // to the outer windows. Note that this requires the
+ // allow-same-origin permission, otherwise a cross-origin
+ // security exception is thrown.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: "allow-same-origin allow-scripts" },
+ { sandboxAttributes: "allow-same-origin allow-scripts" },
+ ]);
+
+ await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addOuterBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, false);
+
+ await removeOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ await removeOuterBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, false);
+
+ // Test that two sandboxed iframes, both with the allow-modals
+ // permission, cause the hasBeforeUnload attribute to be set
+ // to true when beforeunload event listeners are added. Note
+ // that this requires the allow-same-origin permission,
+ // otherwise a cross-origin security exception is thrown.
+ await prepareSubframes(browser, [
+ { sandboxAttributes: "allow-same-origin allow-scripts allow-modals" },
+ { sandboxAttributes: "allow-same-origin allow-scripts allow-modals" },
+ ]);
+
+ await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ await addOuterBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await removeOuterBeforeUnloadListeners(browser, 1, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+ await removeOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ assertHasBeforeUnload(browser, false);
+ }
+ );
+});
+
+/**
+ * Tests hasBeforeUnload behaviour when beforeunload event listeners
+ * are added on both inner and outer windows.
+ */
+add_task(async function test_mixed_inner_and_outer_window_scenarios() {
+ // Turn this off because the test expects the page to be not bfcached.
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["docshell.shistory.bfcache.ship_allow_beforeunload_listeners", false],
+ ],
+ });
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: PAGE_URL,
+ },
+ async function (browser) {
+ Assert.ok(
+ browser.isRemoteBrowser,
+ "This test only makes sense with out of process browsers."
+ );
+ assertHasBeforeUnload(browser, false);
+
+ // We want to test hasBeforeUnload works properly with
+ // beforeunload event listeners in <iframe> elements.
+ // We prepare a structure like this with 3 content windows
+ // to exercise:
+ //
+ // <top-level content window at PAGE_URL> (TOP)
+ // |
+ // |--> <iframe at PAGE_URL> (MIDDLE)
+ // |
+ // |--> <iframe at PAGE_URL> (BOTTOM)
+ //
+ await prepareSubframes(browser, [
+ { sandboxAttributes: null },
+ { sandboxAttributes: null },
+ ]);
+
+ // These constants are just to make it easier to know which
+ // frame we're referring to without having to remember the
+ // exact indices.
+ const TOP = 0;
+ const MIDDLE = 1;
+ const BOTTOM = 2;
+
+ await addBeforeUnloadListeners(browser, 1, TOP);
+ assertHasBeforeUnload(browser, true);
+ await addBeforeUnloadListeners(browser, 2, MIDDLE);
+ assertHasBeforeUnload(browser, true);
+ await addBeforeUnloadListeners(browser, 5, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await addOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ assertHasBeforeUnload(browser, true);
+ await addOuterBeforeUnloadListeners(browser, 7, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await removeBeforeUnloadListeners(browser, 5, BOTTOM);
+ assertHasBeforeUnload(browser, true);
+
+ await removeBeforeUnloadListeners(browser, 2, MIDDLE);
+ assertHasBeforeUnload(browser, true);
+
+ await removeOuterBeforeUnloadListeners(browser, 3, MIDDLE);
+ assertHasBeforeUnload(browser, true);
+
+ await removeBeforeUnloadListeners(browser, 1, TOP);
+ assertHasBeforeUnload(browser, true);
+
+ await removeOuterBeforeUnloadListeners(browser, 7, BOTTOM);
+ assertHasBeforeUnload(browser, false);
+ }
+ );
+});
diff --git a/dom/tests/browser/browser_keypressTelemetry.js b/dom/tests/browser/browser_keypressTelemetry.js
new file mode 100644
index 0000000000..02d5ddfe19
--- /dev/null
+++ b/dom/tests/browser/browser_keypressTelemetry.js
@@ -0,0 +1,69 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var EventUtils = {};
+var PaintListener = {};
+Services.scriptloader.loadSubScript(
+ "chrome://mochikit/content/tests/SimpleTest/EventUtils.js",
+ EventUtils
+);
+
+function getRecordedKeypressCount() {
+ let snapshot = Services.telemetry.getSnapshotForHistograms("main", false);
+
+ var totalCount = 0;
+ for (var prop in snapshot) {
+ if (snapshot[prop].KEYPRESS_PRESENT_LATENCY) {
+ dump("found snapshot");
+ totalCount += Object.values(
+ snapshot[prop].KEYPRESS_PRESENT_LATENCY.values
+ ).reduce((a, b) => a + b, 0);
+ }
+ }
+
+ return totalCount;
+}
+
+add_task(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [["toolkit.telemetry.ipcBatchTimeout", 10]],
+ });
+ let histogram = Services.telemetry.getHistogramById(
+ "KEYPRESS_PRESENT_LATENCY"
+ );
+ histogram.clear();
+
+ waitForExplicitFinish();
+
+ gURLBar.focus();
+ await SimpleTest.promiseFocus(window);
+ EventUtils.sendChar("x");
+
+ await ContentTaskUtils.waitForCondition(
+ () => {
+ return getRecordedKeypressCount() > 0;
+ },
+ "waiting for telemetry",
+ 200,
+ 600
+ );
+ let result = getRecordedKeypressCount();
+ ok(result == 1, "One keypress recorded");
+
+ gURLBar.focus();
+ await SimpleTest.promiseFocus(window);
+ EventUtils.sendChar("x");
+
+ await ContentTaskUtils.waitForCondition(
+ () => {
+ return getRecordedKeypressCount() > 1;
+ },
+ "waiting for telemetry",
+ 200,
+ 600
+ );
+ result = getRecordedKeypressCount();
+ ok(result == 2, "Two keypresses recorded");
+});
diff --git a/dom/tests/browser/browser_localStorage_e10s.js b/dom/tests/browser/browser_localStorage_e10s.js
new file mode 100644
index 0000000000..0ecc49fe49
--- /dev/null
+++ b/dom/tests/browser/browser_localStorage_e10s.js
@@ -0,0 +1,284 @@
+const HELPER_PAGE_URL =
+ "http://example.com/browser/dom/tests/browser/page_localstorage.html";
+const HELPER_PAGE_ORIGIN = "http://example.com/";
+
+let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
+Services.scriptloader.loadSubScript(testDir + "/helper_localStorage.js", this);
+
+/* import-globals-from helper_localStorage.js */
+
+// We spin up a ton of child processes.
+requestLongerTimeout(4);
+
+/**
+ * Verify the basics of our multi-e10s localStorage support. We are focused on
+ * whitebox testing two things. When this is being written, broadcast filtering
+ * is not in place, but the test is intended to attempt to verify that its
+ * implementation does not break things.
+ *
+ * 1) That pages see the same localStorage state in a timely fashion when
+ * engaging in non-conflicting operations. We are not testing races or
+ * conflict resolution; the spec does not cover that.
+ *
+ * 2) That there are no edge-cases related to when the Storage instance is
+ * created for the page or the StorageCache for the origin. (StorageCache is
+ * what actually backs the Storage binding exposed to the page.) This
+ * matters because the following reasons can exist for them to be created:
+ * - Preload, on the basis of knowing the origin uses localStorage. The
+ * interesting edge case is when we have the same origin open in different
+ * processes and the origin starts using localStorage when it did not
+ * before. Preload will not have instantiated bindings, which could impact
+ * correctness.
+ * - The page accessing localStorage for read or write purposes. This is the
+ * obvious, boring one.
+ * - The page adding a "storage" listener. This is less obvious and
+ * interacts with the preload edge-case mentioned above. The page needs to
+ * hear "storage" events even if the page has not touched localStorage
+ * itself and its origin had nothing stored in localStorage when the page
+ * was created.
+ *
+ * We use the same simple child page in all tabs that:
+ * - can be instructed to listen for and record "storage" events
+ * - can be instructed to issue a series of localStorage writes
+ * - can be instructed to return the current entire localStorage contents
+ *
+ * We open the 5 following tabs:
+ * - Open a "writer" tab that does not listen for "storage" events and will
+ * issue only writes.
+ * - Open a "listener" tab instructed to listen for "storage" events
+ * immediately. We expect it to capture all events.
+ * - Open an "reader" tab that does not listen for "storage" events and will
+ * only issue reads when instructed.
+ * - Open a "lateWriteThenListen" tab that initially does nothing. We will
+ * later tell it to issue a write and then listen for events to make sure it
+ * captures the later events.
+ * - Open "lateOpenSeesPreload" tab after we've done everything and ensure that
+ * it preloads/precaches the data without us having touched localStorage or
+ * added an event listener.
+ */
+add_task(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // Stop the preallocated process manager from speculatively creating
+ // processes. Our test explicitly asserts on whether preload happened or
+ // not for each tab's process. This information is loaded and latched by
+ // the StorageDBParent constructor which the child process's
+ // LocalStorageManager() constructor causes to be created via a call to
+ // LocalStorageCache::StartDatabase(). Although the service is lazily
+ // created and should not have been created prior to our opening the tab,
+ // it's safest to ensure the process simply didn't exist before we ask for
+ // it.
+ //
+ // This is done in conjunction with our use of forceNewProcess when
+ // opening tabs. There would be no point if we weren't also requesting a
+ // new process.
+ ["dom.ipc.processPrelaunch.enabled", false],
+ // Enable LocalStorage's testing API so we can explicitly trigger a flush
+ // when needed.
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data or potential false positives for
+ // localstorage preloads by forcing the origin to be cleared prior to the
+ // start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Make sure mOriginsHavingData gets updated.
+ await triggerAndWaitForLocalStorageFlush();
+
+ // - Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer",
+ knownTabs,
+ true
+ );
+ const listenerTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "listener",
+ knownTabs,
+ true
+ );
+ const readerTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "reader",
+ knownTabs,
+ true
+ );
+ const lateWriteThenListenTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "lateWriteThenListen",
+ knownTabs,
+ true
+ );
+
+ // Sanity check that preloading did not occur in the tabs.
+ await verifyTabPreload(writerTab, false, HELPER_PAGE_ORIGIN);
+ await verifyTabPreload(listenerTab, false, HELPER_PAGE_ORIGIN);
+ await verifyTabPreload(readerTab, false, HELPER_PAGE_ORIGIN);
+
+ // - Configure the tabs.
+ const initialSentinel = "initial";
+ const noSentinelCheck = null;
+ await recordTabStorageEvents(listenerTab, initialSentinel);
+
+ // - Issue the initial batch of writes and verify.
+ info("initial writes");
+ const initialWriteMutations = [
+ // [key (null=clear), newValue (null=delete), oldValue (verification)]
+ ["getsCleared", "1", null],
+ ["alsoGetsCleared", "2", null],
+ [null, null, null],
+ ["stays", "3", null],
+ ["clobbered", "pre", null],
+ ["getsDeletedLater", "4", null],
+ ["getsDeletedImmediately", "5", null],
+ ["getsDeletedImmediately", null, "5"],
+ ["alsoStays", "6", null],
+ ["getsDeletedLater", null, "4"],
+ ["clobbered", "post", "pre"],
+ ];
+ const initialWriteState = {
+ stays: "3",
+ clobbered: "post",
+ alsoStays: "6",
+ };
+
+ await mutateTabStorage(writerTab, initialWriteMutations, initialSentinel);
+
+ // We expect the writer tab to have the correct state because it just did the
+ // writes. We do not perform a sentinel-check because the writes should be
+ // locally available and consistent.
+ await verifyTabStorageState(writerTab, initialWriteState, noSentinelCheck);
+ // We expect the listener tab to have heard all events despite preload not
+ // having occurred and despite not issuing any reads or writes itself. We
+ // intentionally check the events before the state because we're most
+ // interested in adding the listener having had a side-effect of subscribing
+ // to changes for the process.
+ //
+ // We ensure it had a chance to hear all of the events because we told
+ // recordTabStorageEvents to listen for the given sentinel. The state check
+ // then does not need to do a sentinel check.
+ await verifyTabStorageEvents(
+ listenerTab,
+ initialWriteMutations,
+ initialSentinel
+ );
+ await verifyTabStorageState(listenerTab, initialWriteState, noSentinelCheck);
+ // We expect the reader tab to retrieve the current localStorage state from
+ // the database. Because of the above checks, we are confident that the
+ // writes have hit PBackground and therefore that the (synchronous) state
+ // retrieval contains all the data we need. No sentinel-check is required.
+ await verifyTabStorageState(readerTab, initialWriteState, noSentinelCheck);
+
+ // - Issue second set of writes from lateWriteThenListen
+ // This tests that our new tab that begins by issuing only writes is building
+ // on top of the existing state (although we don't verify that until after the
+ // next set of mutations). We also verify that the initial "writerTab" that
+ // was our first tab and started with only writes sees the writes, even though
+ // it did not add an event listener.
+
+ info("late writes");
+ const lateWriteSentinel = "lateWrite";
+ const lateWriteMutations = [
+ ["lateStays", "10", null],
+ ["lateClobbered", "latePre", null],
+ ["lateDeleted", "11", null],
+ ["lateClobbered", "lastPost", "latePre"],
+ ["lateDeleted", null, "11"],
+ ];
+ const lateWriteState = Object.assign({}, initialWriteState, {
+ lateStays: "10",
+ lateClobbered: "lastPost",
+ });
+
+ await recordTabStorageEvents(listenerTab, lateWriteSentinel);
+
+ await mutateTabStorage(
+ lateWriteThenListenTab,
+ lateWriteMutations,
+ lateWriteSentinel
+ );
+
+ // Verify the writer tab saw the writes. It has to wait for the sentinel to
+ // appear before checking.
+ await verifyTabStorageState(writerTab, lateWriteState, lateWriteSentinel);
+ // Wait for the sentinel event before checking the events and then the state.
+ await verifyTabStorageEvents(
+ listenerTab,
+ lateWriteMutations,
+ lateWriteSentinel
+ );
+ await verifyTabStorageState(listenerTab, lateWriteState, noSentinelCheck);
+ // We need to wait for the sentinel to show up for the reader.
+ await verifyTabStorageState(readerTab, lateWriteState, lateWriteSentinel);
+
+ // - Issue last set of writes from writerTab.
+ info("last set of writes");
+ const lastWriteSentinel = "lastWrite";
+ const lastWriteMutations = [
+ ["lastStays", "20", null],
+ ["lastDeleted", "21", null],
+ ["lastClobbered", "lastPre", null],
+ ["lastClobbered", "lastPost", "lastPre"],
+ ["lastDeleted", null, "21"],
+ ];
+ const lastWriteState = Object.assign({}, lateWriteState, {
+ lastStays: "20",
+ lastClobbered: "lastPost",
+ });
+
+ await recordTabStorageEvents(listenerTab, lastWriteSentinel);
+ await recordTabStorageEvents(lateWriteThenListenTab, lastWriteSentinel);
+
+ await mutateTabStorage(writerTab, lastWriteMutations, lastWriteSentinel);
+
+ // The writer performed the writes, no need to wait for the sentinel.
+ await verifyTabStorageState(writerTab, lastWriteState, noSentinelCheck);
+ // Wait for the sentinel event to be received, then check.
+ await verifyTabStorageEvents(
+ listenerTab,
+ lastWriteMutations,
+ lastWriteSentinel
+ );
+ await verifyTabStorageState(listenerTab, lastWriteState, noSentinelCheck);
+ // We need to wait for the sentinel to show up for the reader.
+ await verifyTabStorageState(readerTab, lastWriteState, lastWriteSentinel);
+ // Wait for the sentinel event to be received, then check.
+ await verifyTabStorageEvents(
+ lateWriteThenListenTab,
+ lastWriteMutations,
+ lastWriteSentinel
+ );
+ await verifyTabStorageState(
+ lateWriteThenListenTab,
+ lastWriteState,
+ noSentinelCheck
+ );
+
+ // - Force a LocalStorage DB flush so mOriginsHavingData is updated.
+ // mOriginsHavingData is only updated when the storage thread runs its
+ // accumulated operations during the flush. If we don't initiate and ensure
+ // that a flush has occurred before moving on to the next step,
+ // mOriginsHavingData may not include our origin when it's sent down to the
+ // child process.
+ info("flush to make preload check work");
+ await triggerAndWaitForLocalStorageFlush();
+
+ // - Open a fresh tab and make sure it sees the precache/preload
+ info("late open preload check");
+ const lateOpenSeesPreload = await openTestTab(
+ HELPER_PAGE_URL,
+ "lateOpenSeesPreload",
+ knownTabs,
+ true
+ );
+ await verifyTabPreload(lateOpenSeesPreload, true, HELPER_PAGE_ORIGIN);
+
+ // - Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
diff --git a/dom/tests/browser/browser_localStorage_fis.js b/dom/tests/browser/browser_localStorage_fis.js
new file mode 100644
index 0000000000..5db8ec5eb5
--- /dev/null
+++ b/dom/tests/browser/browser_localStorage_fis.js
@@ -0,0 +1,529 @@
+const HELPER_PAGE_URL =
+ "https://example.com/browser/dom/tests/browser/page_localstorage.html";
+const HELPER_PAGE_COOP_COEP_URL =
+ "https://example.com/browser/dom/tests/browser/page_localstorage_coop+coep.html";
+const HELPER_PAGE_ORIGIN = "https://example.com/";
+
+let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
+Services.scriptloader.loadSubScript(testDir + "/helper_localStorage.js", this);
+
+/* import-globals-from helper_localStorage.js */
+
+// We spin up a ton of child processes.
+requestLongerTimeout(4);
+
+/**
+ * Verify the basics of our multi-e10s localStorage support with fission.
+ * We are focused on whitebox testing two things.
+ * When this is being written, broadcast filtering is not in place, but the test
+ * is intended to attempt to verify that its implementation does not break things.
+ *
+ * 1) That pages see the same localStorage state in a timely fashion when
+ * engaging in non-conflicting operations. We are not testing races or
+ * conflict resolution; the spec does not cover that.
+ *
+ * 2) That there are no edge-cases related to when the Storage instance is
+ * created for the page or the StorageCache for the origin. (StorageCache is
+ * what actually backs the Storage binding exposed to the page.) This
+ * matters because the following reasons can exist for them to be created:
+ * - Preload, on the basis of knowing the origin uses localStorage. The
+ * interesting edge case is when we have the same origin open in different
+ * processes and the origin starts using localStorage when it did not
+ * before. Preload will not have instantiated bindings, which could impact
+ * correctness.
+ * - The page accessing localStorage for read or write purposes. This is the
+ * obvious, boring one.
+ * - The page adding a "storage" listener. This is less obvious and
+ * interacts with the preload edge-case mentioned above. The page needs to
+ * hear "storage" events even if the page has not touched localStorage
+ * itself and its origin had nothing stored in localStorage when the page
+ * was created.
+ *
+ * According to current fission implementation, same origin pages will be loaded
+ * by the same process, which process type is webIsolated=. And thanks to
+ * Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers support,
+ * it is possible to load the same origin page by a special process, which type
+ * is webCOOP+COEP=. These are the only two processes can be used to test
+ * localStroage consistency between tabs in different tabs.
+ *
+ * We use the two child pages for testing, page_localstorage.html and
+ * page_localstorage_coop+coep.html. Their content are the same, but
+ * page_localstorage_coop+coep.html will be loaded with its ^headers^ file.
+ * These pages provide followings
+ * - can be instructed to listen for and record "storage" events
+ * - can be instructed to issue a series of localStorage writes
+ * - can be instructed to return the current entire localStorage contents
+ *
+ * To test localStorage consistency, four subtests are used.
+ * Test case 1: one writer tab and one reader tab
+ * The writer tab issues a series of write operations, then verify the
+ * localStorage contents from the reader tab.
+ *
+ * Test case 2: one writer tab and one listener tab
+ * The writer tab issues a series of write operations, then verify the recorded
+ * storage events from the listener tab.
+ *
+ * Test case 3: one writeThenRead tab and one readThenWrite tab
+ * The writeThenRead first issues a series write of operations, and then verify
+ * the recorded storage events and localStorage contents from readThenWrite
+ * tab. After that readThenWrite tab issues a series of write operations, then
+ * verify the results from writeThenRead tab.
+ *
+ * Test case 4: one writer tab and one lateOpenSeesPreload tab
+ * The writer tab issues a series write of operations. Then open the
+ * lateOpenSeesPreload tab to make sure preloads exists.
+ */
+
+/**
+ * Shared constants for test cases
+ */
+const noSentinelCheck = null;
+const initialSentinel = "initial";
+const initialWriteMutations = [
+ // [key (null=clear), newValue (null=delete), oldValue (verification)]
+ ["getsCleared", "1", null],
+ ["alsoGetsCleared", "2", null],
+ [null, null, null],
+ ["stays", "3", null],
+ ["clobbered", "pre", null],
+ ["getsDeletedLater", "4", null],
+ ["getsDeletedImmediately", "5", null],
+ ["getsDeletedImmediately", null, "5"],
+ ["alsoStays", "6", null],
+ ["getsDeletedLater", null, "4"],
+ ["clobbered", "post", "pre"],
+];
+const initialWriteState = {
+ stays: "3",
+ clobbered: "post",
+ alsoStays: "6",
+};
+
+const lastWriteSentinel = "lastWrite";
+const lastWriteMutations = [
+ ["lastStays", "20", null],
+ ["lastDeleted", "21", null],
+ ["lastClobbered", "lastPre", null],
+ ["lastClobbered", "lastPost", "lastPre"],
+ ["lastDeleted", null, "21"],
+];
+const lastWriteState = Object.assign({}, initialWriteState, {
+ lastStays: "20",
+ lastClobbered: "lastPost",
+});
+
+/**
+ * Test case 1: one writer tab and one reader tab
+ * Test steps
+ * 1. Clear origin storage to make sure no data and preloads.
+ * 2. Open the writer and reader tabs and verify preloads do not exist.
+ * Open writer tab in webIsolated= process
+ * Open reader tab in webCOOP+COEP= process
+ * 3. Issue a series write operations in the writer tab, and then verify the
+ * storage state on the tab.
+ * 4. Verify the storage state on the reader tab.
+ * 5. Issue another series write operations in the writer tab, and then verify
+ * the storage state on the tab.
+ * 6. Verify the storage state on the reader tab.
+ * 7. Close tabs and clear origin storage.
+ */
+add_task(async function () {
+ if (!Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is not enabled.");
+ return;
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // Stop the preallocated process manager from speculatively creating
+ // processes. Our test explicitly asserts on whether preload happened or
+ // not for each tab's process. This information is loaded and latched by
+ // the StorageDBParent constructor which the child process's
+ // LocalStorageManager() constructor causes to be created via a call to
+ // LocalStorageCache::StartDatabase(). Although the service is lazily
+ // created and should not have been created prior to our opening the tab,
+ // it's safest to ensure the process simply didn't exist before we ask for
+ // it.
+ //
+ // This is done in conjunction with our use of forceNewProcess when
+ // opening tabs. There would be no point if we weren't also requesting a
+ // new process.
+ ["dom.ipc.processPrelaunch.enabled", false],
+ // Enable LocalStorage's testing API so we can explicitly trigger a flush
+ // when needed.
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data or potential false positives for
+ // localstorage preloads by forcing the origin to be cleared prior to the
+ // start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Make sure mOriginsHavingData gets updated.
+ await triggerAndWaitForLocalStorageFlush();
+
+ // - Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer",
+ knownTabs,
+ true
+ );
+ const readerTab = await openTestTab(
+ HELPER_PAGE_COOP_COEP_URL,
+ "reader",
+ knownTabs,
+ true
+ );
+ // Sanity check that preloading did not occur in the tabs.
+ await verifyTabPreload(writerTab, false, HELPER_PAGE_ORIGIN);
+ await verifyTabPreload(readerTab, false, HELPER_PAGE_ORIGIN);
+
+ // - Issue the initial batch of writes and verify.
+ info("initial writes");
+ await mutateTabStorage(writerTab, initialWriteMutations, initialSentinel);
+
+ // We expect the writer tab to have the correct state because it just did the
+ // writes. We do not perform a sentinel-check because the writes should be
+ // locally available and consistent.
+ await verifyTabStorageState(writerTab, initialWriteState, noSentinelCheck);
+ // We expect the reader tab to retrieve the current localStorage state from
+ // the database.
+ await verifyTabStorageState(readerTab, initialWriteState, initialSentinel);
+
+ // - Issue last set of writes from writerTab.
+ info("last set of writes");
+ await mutateTabStorage(writerTab, lastWriteMutations, lastWriteSentinel);
+
+ // The writer performed the writes, no need to wait for the sentinel.
+ await verifyTabStorageState(writerTab, lastWriteState, noSentinelCheck);
+ // We need to wait for the sentinel to show up for the reader.
+ await verifyTabStorageState(readerTab, lastWriteState, lastWriteSentinel);
+
+ // - Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
+
+/**
+ * Test case 2: one writer tab and one linsener tab
+ * Test steps
+ * 1. Clear origin storage to make sure no data and preloads.
+ * 2. Open the writer and listener tabs and verify preloads do not exist.
+ * Open writer tab in webIsolated= process
+ * Open listener tab in webCOOP+COEP= process
+ * 3. Ask the listener tab to listen and record storage events.
+ * 4. Issue a series write operations in the writer tab, and then verify the
+ * storage state on the tab.
+ * 5. Verify the storage events record from the listener tab is as expected.
+ * 6. Verify the storage state on the listener tab.
+ * 7. Ask the listener tab to listen and record storage events.
+ * 8. Issue another series write operations in the writer tab, and then verify
+ * the storage state on the tab.
+ * 9. Verify the storage events record from the listener tab is as expected.
+ * 10. Verify the storage state on the listener tab.
+ * 11. Close tabs and clear origin storage.
+ */
+add_task(async function () {
+ if (!Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is not enabled.");
+ return;
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["dom.ipc.processPrelaunch.enabled", false],
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data or potential false positives for
+ // localstorage preloads by forcing the origin to be cleared prior to the
+ // start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Make sure mOriginsHavingData gets updated.
+ await triggerAndWaitForLocalStorageFlush();
+
+ // - Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer",
+ knownTabs,
+ true
+ );
+ const listenerTab = await openTestTab(
+ HELPER_PAGE_COOP_COEP_URL,
+ "listener",
+ knownTabs,
+ true
+ );
+ // Sanity check that preloading did not occur in the tabs.
+ await verifyTabPreload(writerTab, false, HELPER_PAGE_ORIGIN);
+ await verifyTabPreload(listenerTab, false, HELPER_PAGE_ORIGIN);
+
+ // - Ask the listener tab to listen and record the storage events..
+ await recordTabStorageEvents(listenerTab, initialSentinel);
+
+ // - Issue the initial batch of writes and verify.
+ info("initial writes");
+ await mutateTabStorage(writerTab, initialWriteMutations, initialSentinel);
+
+ // We expect the writer tab to have the correct state because it just did the
+ // writes. We do not perform a sentinel-check because the writes should be
+ // locally available and consistent.
+ await verifyTabStorageState(writerTab, initialWriteState, noSentinelCheck);
+ // We expect the listener tab to have heard all events despite preload not
+ // having occurred and despite not issuing any reads or writes itself. We
+ // intentionally check the events before the state because we're most
+ // interested in adding the listener having had a side-effect of subscribing
+ // to changes for the process.
+ //
+ // We ensure it had a chance to hear all of the events because we told
+ // recordTabStorageEvents to listen for the given sentinel. The state check
+ // then does not need to do a sentinel check.
+ await verifyTabStorageEvents(
+ listenerTab,
+ initialWriteMutations,
+ initialSentinel
+ );
+ await verifyTabStorageState(listenerTab, initialWriteState, noSentinelCheck);
+
+ // - Ask the listener tab to listen and record the storage events.
+ await recordTabStorageEvents(listenerTab, lastWriteSentinel);
+
+ // - Issue last set of writes from writerTab.
+ info("last set of writes");
+ await mutateTabStorage(writerTab, lastWriteMutations, lastWriteSentinel);
+
+ // The writer performed the writes, no need to wait for the sentinel.
+ await verifyTabStorageState(writerTab, lastWriteState, noSentinelCheck);
+ // Wait for the sentinel event to be received, then check.
+ await verifyTabStorageEvents(
+ listenerTab,
+ lastWriteMutations,
+ lastWriteSentinel
+ );
+ await verifyTabStorageState(listenerTab, lastWriteState, noSentinelCheck);
+
+ // - Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
+
+/**
+ * Test case 3: one writeThenRead tab and one readThenWrite tab
+ * Test steps
+ * 1. Clear origin storage to make sure no data and preloads.
+ * 2. Open the writeThenRead and readThenWrite tabs and verify preloads do not
+ * exist.
+ * Open writeThenRead tab in webIsolated= process
+ * Open readThenWrite tab in webCOOP+COEP= process
+ * 3. Ask the readThenWrite tab to listen and record storage events.
+ * 4. Issue a series write operations in the writeThenRead tab, and then verify
+ * the storage state on the tab.
+ * 5. Verify the storage events record from the readThenWrite tab is as
+ * expected.
+ * 6. Verify the storage state on the readThenWrite tab.
+ * 7. Ask the writeThenRead tab to listen and record storage events.
+ * 8. Issue another series write operations in the readThenWrite tab, and then
+ * verify the storage state on the tab.
+ * 9. Verify the storage events record from the writeThenRead tab is as
+ * expected.
+ * 10. Verify the storage state on the writeThenRead tab.
+ * 11. Close tabs and clear origin storage.
+ **/
+add_task(async function () {
+ if (!Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is not enabled.");
+ return;
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["dom.ipc.processPrelaunch.enabled", false],
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data or potential false positives for
+ // localstorage preloads by forcing the origin to be cleared prior to the
+ // start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Make sure mOriginsHavingData gets updated.
+ await triggerAndWaitForLocalStorageFlush();
+
+ // - Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writeThenReadTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "writerthenread",
+ knownTabs,
+ true
+ );
+ const readThenWriteTab = await openTestTab(
+ HELPER_PAGE_COOP_COEP_URL,
+ "readthenwrite",
+ knownTabs,
+ true
+ );
+ // Sanity check that preloading did not occur in the tabs.
+ await verifyTabPreload(writeThenReadTab, false, HELPER_PAGE_ORIGIN);
+ await verifyTabPreload(readThenWriteTab, false, HELPER_PAGE_ORIGIN);
+
+ // - Ask readThenWrite tab to listen and record storageEvents.
+ await recordTabStorageEvents(readThenWriteTab, initialSentinel);
+
+ // - Issue the initial batch of writes and verify.
+ info("initial writes");
+ await mutateTabStorage(
+ writeThenReadTab,
+ initialWriteMutations,
+ initialSentinel
+ );
+
+ // We expect the writer tab to have the correct state because it just did the
+ // writes. We do not perform a sentinel-check because the writes should be
+ // locally available and consistent.
+ await verifyTabStorageState(
+ writeThenReadTab,
+ initialWriteState,
+ noSentinelCheck
+ );
+
+ // We expect the listener tab to have heard all events despite preload not
+ // having occurred and despite not issuing any reads or writes itself. We
+ // intentionally check the events before the state because we're most
+ // interested in adding the listener having had a side-effect of subscribing
+ // to changes for the process.
+ //
+ // We ensure it had a chance to hear all of the events because we told
+ // recordTabStorageEvents to listen for the given sentinel. The state check
+ // then does not need to do a sentinel check.
+ await verifyTabStorageEvents(
+ readThenWriteTab,
+ initialWriteMutations,
+ initialSentinel
+ );
+ await verifyTabStorageState(
+ readThenWriteTab,
+ initialWriteState,
+ noSentinelCheck
+ );
+
+ // - Issue last set of writes from writerTab.
+ info("last set of writes");
+ await recordTabStorageEvents(writeThenReadTab, lastWriteSentinel);
+
+ await mutateTabStorage(
+ readThenWriteTab,
+ lastWriteMutations,
+ lastWriteSentinel
+ );
+
+ // The writer performed the writes, no need to wait for the sentinel.
+ await verifyTabStorageState(
+ readThenWriteTab,
+ lastWriteState,
+ noSentinelCheck
+ );
+ // Wait for the sentinel event to be received, then check.
+ await verifyTabStorageEvents(
+ writeThenReadTab,
+ lastWriteMutations,
+ lastWriteSentinel
+ );
+ await verifyTabStorageState(
+ writeThenReadTab,
+ lastWriteState,
+ noSentinelCheck
+ );
+
+ // - Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
+
+/**
+ * Test case 4: one writerRead tab and one lateOpenSeesPreload tab
+ * Test steps
+ * 1. Clear origin storage to make sure no data and preloads.
+ * 2. Open the writer tab and verify preloads do not exist.
+ * Open writer tab in webIsolated= process
+ * 3. Issue a series write operations in the writer tab, and then verify the
+ * storage state on the tab.
+ * 4. Issue another series write operations in the writer tab, and then verify
+ * the storage state on the tab.
+ * 5. Open lateOpenSeesPreload tab in webCOOP+COEP process
+ * 6. Verify the preloads on the lateOpenSeesPreload tab
+ * 7. Close tabs and clear origin storage.
+ */
+add_task(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["dom.ipc.processPrelaunch.enabled", false],
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data or potential false positives for
+ // localstorage preloads by forcing the origin to be cleared prior to the
+ // start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Make sure mOriginsHavingData gets updated.
+ await triggerAndWaitForLocalStorageFlush();
+
+ // - Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer",
+ knownTabs,
+ true
+ );
+ // Sanity check that preloading did not occur in the tabs.
+ await verifyTabPreload(writerTab, false, HELPER_PAGE_ORIGIN);
+
+ // - Configure the tabs.
+
+ // - Issue the initial batch of writes and verify.
+ info("initial writes");
+ await mutateTabStorage(writerTab, initialWriteMutations, initialSentinel);
+
+ // We expect the writer tab to have the correct state because it just did the
+ // writes. We do not perform a sentinel-check because the writes should be
+ // locally available and consistent.
+ await verifyTabStorageState(writerTab, initialWriteState, noSentinelCheck);
+
+ // - Force a LocalStorage DB flush so mOriginsHavingData is updated.
+ // mOriginsHavingData is only updated when the storage thread runs its
+ // accumulated operations during the flush. If we don't initiate and ensure
+ // that a flush has occurred before moving on to the next step,
+ // mOriginsHavingData may not include our origin when it's sent down to the
+ // child process.
+ info("flush to make preload check work");
+ await triggerAndWaitForLocalStorageFlush();
+
+ // - Open a fresh tab and make sure it sees the precache/preload
+ info("late open preload check");
+ const lateOpenSeesPreload = await openTestTab(
+ HELPER_PAGE_COOP_COEP_URL,
+ "lateOpenSeesPreload",
+ knownTabs,
+ true
+ );
+ await verifyTabPreload(lateOpenSeesPreload, true, HELPER_PAGE_ORIGIN);
+
+ // - Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
diff --git a/dom/tests/browser/browser_localStorage_privatestorageevent.js b/dom/tests/browser/browser_localStorage_privatestorageevent.js
new file mode 100644
index 0000000000..7c81fadf2d
--- /dev/null
+++ b/dom/tests/browser/browser_localStorage_privatestorageevent.js
@@ -0,0 +1,87 @@
+add_task(async function () {
+ var privWin = OpenBrowserWindow({ private: true });
+ await new privWin.Promise(resolve => {
+ privWin.addEventListener(
+ "load",
+ function () {
+ resolve();
+ },
+ { once: true }
+ );
+ });
+
+ var pubWin = OpenBrowserWindow({ private: false });
+ await new pubWin.Promise(resolve => {
+ pubWin.addEventListener(
+ "load",
+ function () {
+ resolve();
+ },
+ { once: true }
+ );
+ });
+
+ var URL =
+ "http://mochi.test:8888/browser/dom/tests/browser/page_privatestorageevent.html";
+
+ var privTab = BrowserTestUtils.addTab(privWin.gBrowser, URL);
+ await BrowserTestUtils.browserLoaded(
+ privWin.gBrowser.getBrowserForTab(privTab)
+ );
+ var privBrowser = gBrowser.getBrowserForTab(privTab);
+
+ var pubTab = BrowserTestUtils.addTab(pubWin.gBrowser, URL);
+ await BrowserTestUtils.browserLoaded(
+ pubWin.gBrowser.getBrowserForTab(pubTab)
+ );
+ var pubBrowser = gBrowser.getBrowserForTab(pubTab);
+
+ // Check if pubWin can see privWin's storage events
+ await SpecialPowers.spawn(pubBrowser, [], function (opts) {
+ content.window.gotStorageEvent = false;
+ content.window.addEventListener("storage", ev => {
+ content.window.gotStorageEvent = true;
+ });
+ });
+
+ await SpecialPowers.spawn(privBrowser, [], function (opts) {
+ content.window.localStorage.key = "ablooabloo";
+ });
+
+ let pubSaw = await SpecialPowers.spawn(pubBrowser, [], function (opts) {
+ return content.window.gotStorageEvent;
+ });
+
+ ok(!pubSaw, "pubWin shouldn't be able to see privWin's storage events");
+
+ await SpecialPowers.spawn(privBrowser, [], function (opts) {
+ content.window.gotStorageEvent = false;
+ content.window.addEventListener("storage", ev => {
+ content.window.gotStorageEvent = true;
+ });
+ });
+
+ // Check if privWin can see pubWin's storage events
+ await SpecialPowers.spawn(privBrowser, [], function (opts) {
+ content.window.gotStorageEvent = false;
+ content.window.addEventListener("storage", ev => {
+ content.window.gotStorageEvent = true;
+ });
+ });
+
+ await SpecialPowers.spawn(pubBrowser, [], function (opts) {
+ content.window.localStorage.key = "ablooabloo";
+ });
+
+ let privSaw = await SpecialPowers.spawn(privBrowser, [], function (opts) {
+ return content.window.gotStorageEvent;
+ });
+
+ ok(!privSaw, "privWin shouldn't be able to see pubWin's storage events");
+
+ BrowserTestUtils.removeTab(privTab);
+ await BrowserTestUtils.closeWindow(privWin);
+
+ BrowserTestUtils.removeTab(pubTab);
+ await BrowserTestUtils.closeWindow(pubWin);
+});
diff --git a/dom/tests/browser/browser_localStorage_snapshotting.js b/dom/tests/browser/browser_localStorage_snapshotting.js
new file mode 100644
index 0000000000..f03fa187b1
--- /dev/null
+++ b/dom/tests/browser/browser_localStorage_snapshotting.js
@@ -0,0 +1,774 @@
+const HELPER_PAGE_URL =
+ "http://example.com/browser/dom/tests/browser/page_localstorage_snapshotting.html";
+const HELPER_PAGE_ORIGIN = "http://example.com/";
+
+/* import-globals-from helper_localStorage.js */
+
+let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
+Services.scriptloader.loadSubScript(testDir + "/helper_localStorage.js", this);
+
+function clearOrigin() {
+ let principal =
+ Services.scriptSecurityManager.createContentPrincipalFromOrigin(
+ HELPER_PAGE_ORIGIN
+ );
+ let request = Services.qms.clearStoragesForPrincipal(
+ principal,
+ "default",
+ "ls"
+ );
+ let promise = new Promise(resolve => {
+ request.callback = () => {
+ resolve();
+ };
+ });
+ return promise;
+}
+
+async function applyMutations(knownTab, mutations) {
+ await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [mutations],
+ function (mutations) {
+ return content.wrappedJSObject.applyMutations(
+ Cu.cloneInto(mutations, content)
+ );
+ }
+ );
+}
+
+async function verifyState(knownTab, expectedState) {
+ let actualState = await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [],
+ function () {
+ return content.wrappedJSObject.getState();
+ }
+ );
+
+ for (let [expectedKey, expectedValue] of Object.entries(expectedState)) {
+ ok(actualState.hasOwnProperty(expectedKey), "key present: " + expectedKey);
+ is(actualState[expectedKey], expectedValue, "value correct");
+ }
+ for (let actualKey of Object.keys(actualState)) {
+ if (!expectedState.hasOwnProperty(actualKey)) {
+ ok(false, "actual state has key it shouldn't have: " + actualKey);
+ }
+ }
+}
+
+async function getKeys(knownTab) {
+ let keys = await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [],
+ function () {
+ return content.wrappedJSObject.getKeys();
+ }
+ );
+ return keys;
+}
+
+async function beginExplicitSnapshot(knownTab) {
+ await SpecialPowers.spawn(knownTab.tab.linkedBrowser, [], function () {
+ return content.wrappedJSObject.beginExplicitSnapshot();
+ });
+}
+
+async function checkpointExplicitSnapshot(knownTab) {
+ await SpecialPowers.spawn(knownTab.tab.linkedBrowser, [], function () {
+ return content.wrappedJSObject.checkpointExplicitSnapshot();
+ });
+}
+
+async function endExplicitSnapshot(knownTab) {
+ await SpecialPowers.spawn(knownTab.tab.linkedBrowser, [], function () {
+ return content.wrappedJSObject.endExplicitSnapshot();
+ });
+}
+
+async function verifyHasSnapshot(knownTab, expectedHasSnapshot) {
+ let hasSnapshot = await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [],
+ function () {
+ return content.wrappedJSObject.getHasSnapshot();
+ }
+ );
+ is(hasSnapshot, expectedHasSnapshot, "Correct has snapshot");
+}
+
+async function verifySnapshotUsage(knownTab, expectedSnapshotUsage) {
+ let snapshotUsage = await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [],
+ function () {
+ return content.wrappedJSObject.getSnapshotUsage();
+ }
+ );
+ is(snapshotUsage, expectedSnapshotUsage, "Correct snapshot usage");
+}
+
+async function verifyParentState(expectedState) {
+ let principal =
+ Services.scriptSecurityManager.createContentPrincipalFromOrigin(
+ HELPER_PAGE_ORIGIN
+ );
+
+ let actualState = await Services.domStorageManager.getState(principal);
+
+ for (let [expectedKey, expectedValue] of Object.entries(expectedState)) {
+ ok(actualState.hasOwnProperty(expectedKey), "key present: " + expectedKey);
+ is(actualState[expectedKey], expectedValue, "value correct");
+ }
+ for (let actualKey of Object.keys(actualState)) {
+ if (!expectedState.hasOwnProperty(actualKey)) {
+ ok(false, "actual state has key it shouldn't have: " + actualKey);
+ }
+ }
+}
+
+// We spin up a ton of child processes.
+requestLongerTimeout(4);
+
+/**
+ * Verify snapshotting of our localStorage implementation in multi-e10s setup.
+ */
+add_task(async function () {
+ if (!Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is not enabled.");
+ return;
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // Enable LocalStorage's testing API so we can explicitly create
+ // snapshots when needed.
+ ["dom.storage.testing", true],
+ // Force multiple web and webIsolated content processes so that the
+ // multi-e10s logic works correctly.
+ ["dom.ipc.processCount", 8],
+ ["dom.ipc.processCount.webIsolated", 4],
+ ],
+ });
+
+ // Ensure that there is no localstorage data by forcing the origin to be
+ // cleared prior to the start of our test..
+ await clearOrigin();
+
+ // - Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab1 = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer1",
+ knownTabs,
+ true
+ );
+ const writerTab2 = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer2",
+ knownTabs,
+ true
+ );
+ const readerTab1 = await openTestTab(
+ HELPER_PAGE_URL,
+ "reader1",
+ knownTabs,
+ true
+ );
+ const readerTab2 = await openTestTab(
+ HELPER_PAGE_URL,
+ "reader2",
+ knownTabs,
+ true
+ );
+
+ const initialMutations = [
+ [null, null],
+ ["key1", "initial1"],
+ ["key2", "initial2"],
+ ["key3", "initial3"],
+ ["key5", "initial5"],
+ ["key6", "initial6"],
+ ["key7", "initial7"],
+ ["key8", "initial8"],
+ ];
+
+ const initialState = {
+ key1: "initial1",
+ key2: "initial2",
+ key3: "initial3",
+ key5: "initial5",
+ key6: "initial6",
+ key7: "initial7",
+ key8: "initial8",
+ };
+
+ let sizeOfOneKey;
+ let sizeOfOneValue;
+ let sizeOfOneItem;
+ let sizeOfKeys = 0;
+ let sizeOfItems = 0;
+
+ let entries = Object.entries(initialState);
+ for (let i = 0; i < entries.length; i++) {
+ let entry = entries[i];
+ let sizeOfKey = entry[0].length;
+ let sizeOfValue = entry[1].length;
+ let sizeOfItem = sizeOfKey + sizeOfValue;
+ if (i == 0) {
+ sizeOfOneKey = sizeOfKey;
+ sizeOfOneValue = sizeOfValue;
+ sizeOfOneItem = sizeOfItem;
+ }
+ sizeOfKeys += sizeOfKey;
+ sizeOfItems += sizeOfItem;
+ }
+
+ info("Size of one key is " + sizeOfOneKey);
+ info("Size of one value is " + sizeOfOneValue);
+ info("Size of one item is " + sizeOfOneItem);
+ info("Size of keys is " + sizeOfKeys);
+ info("Size of items is " + sizeOfItems);
+
+ const prefillValues = [
+ // Zero prefill (prefill disabled)
+ 0,
+ // Less than one key length prefill
+ sizeOfOneKey - 1,
+ // Greater than one key length and less than one item length prefill
+ sizeOfOneKey + 1,
+ // Precisely one item length prefill
+ sizeOfOneItem,
+ // Precisely two times one item length prefill
+ 2 * sizeOfOneItem,
+ // Precisely size of keys prefill
+ sizeOfKeys,
+ // Less than size of keys plus one value length prefill
+ sizeOfKeys + sizeOfOneValue - 1,
+ // Precisely size of keys plus one value length prefill
+ sizeOfKeys + sizeOfOneValue,
+ // Greater than size of keys plus one value length and less than size of
+ // keys plus two times one value length prefill
+ sizeOfKeys + sizeOfOneValue + 1,
+ // Precisely size of keys plus two times one value length prefill
+ sizeOfKeys + 2 * sizeOfOneValue,
+ // Precisely size of keys plus three times one value length prefill
+ sizeOfKeys + 3 * sizeOfOneValue,
+ // Precisely size of keys plus four times one value length prefill
+ sizeOfKeys + 4 * sizeOfOneValue,
+ // Precisely size of keys plus five times one value length prefill
+ sizeOfKeys + 5 * sizeOfOneValue,
+ // Precisely size of keys plus six times one value length prefill
+ sizeOfKeys + 6 * sizeOfOneValue,
+ // Precisely size of items prefill
+ sizeOfItems,
+ // Unlimited prefill
+ -1,
+ ];
+
+ for (let prefillValue of prefillValues) {
+ info("Setting prefill value to " + prefillValue);
+
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.storage.snapshot_prefill", prefillValue]],
+ });
+
+ const gradualPrefillValues = [
+ // Zero gradual prefill
+ 0,
+ // Less than one key length gradual prefill
+ sizeOfOneKey - 1,
+ // Greater than one key length and less than one item length gradual
+ // prefill
+ sizeOfOneKey + 1,
+ // Precisely one item length gradual prefill
+ sizeOfOneItem,
+ // Precisely two times one item length gradual prefill
+ 2 * sizeOfOneItem,
+ // Precisely three times one item length gradual prefill
+ 3 * sizeOfOneItem,
+ // Precisely four times one item length gradual prefill
+ 4 * sizeOfOneItem,
+ // Precisely five times one item length gradual prefill
+ 5 * sizeOfOneItem,
+ // Precisely six times one item length gradual prefill
+ 6 * sizeOfOneItem,
+ // Precisely size of items prefill
+ sizeOfItems,
+ // Unlimited gradual prefill
+ -1,
+ ];
+
+ for (let gradualPrefillValue of gradualPrefillValues) {
+ info("Setting gradual prefill value to " + gradualPrefillValue);
+
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.storage.snapshot_gradual_prefill", gradualPrefillValue]],
+ });
+
+ info("Stage 1");
+
+ const setRemoveMutations1 = [
+ ["key0", "setRemove10"],
+ ["key1", "setRemove11"],
+ ["key2", null],
+ ["key3", "setRemove13"],
+ ["key4", "setRemove14"],
+ ["key5", "setRemove15"],
+ ["key6", "setRemove16"],
+ ["key7", "setRemove17"],
+ ["key8", null],
+ ["key9", "setRemove19"],
+ ];
+
+ const setRemoveState1 = {
+ key0: "setRemove10",
+ key1: "setRemove11",
+ key3: "setRemove13",
+ key4: "setRemove14",
+ key5: "setRemove15",
+ key6: "setRemove16",
+ key7: "setRemove17",
+ key9: "setRemove19",
+ };
+
+ const setRemoveMutations2 = [
+ ["key0", "setRemove20"],
+ ["key1", null],
+ ["key2", "setRemove22"],
+ ["key3", "setRemove23"],
+ ["key4", "setRemove24"],
+ ["key5", "setRemove25"],
+ ["key6", "setRemove26"],
+ ["key7", null],
+ ["key8", "setRemove28"],
+ ["key9", "setRemove29"],
+ ];
+
+ const setRemoveState2 = {
+ key0: "setRemove20",
+ key2: "setRemove22",
+ key3: "setRemove23",
+ key4: "setRemove24",
+ key5: "setRemove25",
+ key6: "setRemove26",
+ key8: "setRemove28",
+ key9: "setRemove29",
+ };
+
+ // Apply initial mutations using an explicit snapshot. The explicit
+ // snapshot here ensures that the parent process have received the
+ // changes.
+ await beginExplicitSnapshot(writerTab1);
+ await applyMutations(writerTab1, initialMutations);
+ await endExplicitSnapshot(writerTab1);
+
+ // Begin explicit snapshots in all tabs except readerTab2. All these tabs
+ // should see the initial state regardless what other tabs are doing.
+ await beginExplicitSnapshot(writerTab1);
+ await beginExplicitSnapshot(writerTab2);
+ await beginExplicitSnapshot(readerTab1);
+
+ // Apply first array of set/remove mutations in writerTab1 and end the
+ // explicit snapshot. This will trigger saving of values in other active
+ // snapshots.
+ await applyMutations(writerTab1, setRemoveMutations1);
+ await endExplicitSnapshot(writerTab1);
+
+ // Begin an explicit snapshot in readerTab2. writerTab1 already ended its
+ // explicit snapshot, so readerTab2 should see mutations done by
+ // writerTab1.
+ await beginExplicitSnapshot(readerTab2);
+
+ // Apply second array of set/remove mutations in writerTab2 and end the
+ // explicit snapshot. This will trigger saving of values in other active
+ // snapshots, but only if they haven't been saved already.
+ await applyMutations(writerTab2, setRemoveMutations2);
+ await endExplicitSnapshot(writerTab2);
+
+ // Verify state in readerTab1, it should match the initial state.
+ await verifyState(readerTab1, initialState);
+ await endExplicitSnapshot(readerTab1);
+
+ // Verify state in readerTab2, it should match the state after the first
+ // array of set/remove mutatations have been applied and "commited".
+ await verifyState(readerTab2, setRemoveState1);
+ await endExplicitSnapshot(readerTab2);
+
+ // Verify final state, it should match the state after the second array of
+ // set/remove mutation have been applied and "commited". An explicit
+ // snapshot is used.
+ await beginExplicitSnapshot(readerTab1);
+ await verifyState(readerTab1, setRemoveState2);
+ await endExplicitSnapshot(readerTab1);
+
+ info("Stage 2");
+
+ const setRemoveClearMutations1 = [
+ ["key0", "setRemoveClear10"],
+ ["key1", null],
+ [null, null],
+ ];
+
+ const setRemoveClearState1 = {};
+
+ const setRemoveClearMutations2 = [
+ ["key8", null],
+ ["key9", "setRemoveClear29"],
+ [null, null],
+ ];
+
+ const setRemoveClearState2 = {};
+
+ // This is very similar to previous stage except that in addition to
+ // set/remove, the clear operation is involved too.
+ await beginExplicitSnapshot(writerTab1);
+ await applyMutations(writerTab1, initialMutations);
+ await endExplicitSnapshot(writerTab1);
+
+ await beginExplicitSnapshot(writerTab1);
+ await beginExplicitSnapshot(writerTab2);
+ await beginExplicitSnapshot(readerTab1);
+
+ await applyMutations(writerTab1, setRemoveClearMutations1);
+ await endExplicitSnapshot(writerTab1);
+
+ await beginExplicitSnapshot(readerTab2);
+
+ await applyMutations(writerTab2, setRemoveClearMutations2);
+ await endExplicitSnapshot(writerTab2);
+
+ await verifyState(readerTab1, initialState);
+ await endExplicitSnapshot(readerTab1);
+
+ await verifyState(readerTab2, setRemoveClearState1);
+ await endExplicitSnapshot(readerTab2);
+
+ await beginExplicitSnapshot(readerTab1);
+ await verifyState(readerTab1, setRemoveClearState2);
+ await endExplicitSnapshot(readerTab1);
+
+ info("Stage 3");
+
+ const changeOrderMutations = [
+ ["key1", null],
+ ["key2", null],
+ ["key3", null],
+ ["key5", null],
+ ["key6", null],
+ ["key7", null],
+ ["key8", null],
+ ["key8", "initial8"],
+ ["key7", "initial7"],
+ ["key6", "initial6"],
+ ["key5", "initial5"],
+ ["key3", "initial3"],
+ ["key2", "initial2"],
+ ["key1", "initial1"],
+ ];
+
+ // Apply initial mutations using an explicit snapshot. The explicit
+ // snapshot here ensures that the parent process have received the
+ // changes.
+ await beginExplicitSnapshot(writerTab1);
+ await applyMutations(writerTab1, initialMutations);
+ await endExplicitSnapshot(writerTab1);
+
+ // Begin explicit snapshots in all tabs except writerTab2 which is not
+ // used in this stage. All these tabs should see the initial order
+ // regardless what other tabs are doing.
+ await beginExplicitSnapshot(readerTab1);
+ await beginExplicitSnapshot(writerTab1);
+ await beginExplicitSnapshot(readerTab2);
+
+ // Get all keys in readerTab1 and end the explicit snapshot. No mutations
+ // have been applied yet.
+ let tab1Keys = await getKeys(readerTab1);
+ await endExplicitSnapshot(readerTab1);
+
+ // Apply mutations that change the order of keys and end the explicit
+ // snapshot. The state is unchanged. This will trigger saving of key order
+ // in other active snapshots, but only if the order hasn't been saved
+ // already.
+ await applyMutations(writerTab1, changeOrderMutations);
+ await endExplicitSnapshot(writerTab1);
+
+ // Get all keys in readerTab2 and end the explicit snapshot. Change order
+ // mutations have been applied, but the order should stay unchanged.
+ let tab2Keys = await getKeys(readerTab2);
+ await endExplicitSnapshot(readerTab2);
+
+ // Verify the key order is the same.
+ is(tab2Keys.length, tab1Keys.length, "Correct keys length");
+ for (let i = 0; i < tab2Keys.length; i++) {
+ is(tab2Keys[i], tab1Keys[i], "Correct key");
+ }
+
+ // Verify final state, it should match the initial state since applied
+ // mutations only changed the key order. An explicit snapshot is used.
+ await beginExplicitSnapshot(readerTab1);
+ await verifyState(readerTab1, initialState);
+ await endExplicitSnapshot(readerTab1);
+ }
+ }
+
+ // - Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOrigin();
+});
+
+/**
+ * Verify that snapshots are able to work with negative usage. This can happen
+ * when there's an item stored in localStorage with given size and then two
+ * snaphots (created at the same time) mutate the item. The first one replases
+ * it with something bigger and the other one removes it.
+ */
+add_task(async function () {
+ if (!Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is not enabled.");
+ return;
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // Force multiple web and webIsolated content processes so that the
+ // multi-e10s logic works correctly.
+ ["dom.ipc.processCount", 4],
+ ["dom.ipc.processCount.webIsolated", 2],
+ // Disable snapshot peak usage pre-incrementation to make the testing
+ // easier.
+ ["dom.storage.snapshot_peak_usage.initial_preincrement", 0],
+ ["dom.storage.snapshot_peak_usage.reduced_initial_preincrement", 0],
+ ["dom.storage.snapshot_peak_usage.gradual_preincrement", 0],
+ ["dom.storage.snapshot_peak_usage.reuced_gradual_preincrement", 0],
+ // Enable LocalStorage's testing API so we can explicitly create
+ // snapshots when needed.
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data by forcing the origin to be
+ // cleared prior to the start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab1 = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer1",
+ knownTabs,
+ true
+ );
+ const writerTab2 = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer2",
+ knownTabs,
+ true
+ );
+
+ // Apply the initial mutation using an explicit snapshot. The explicit
+ // snapshot here ensures that the parent process have received the changes.
+ await beginExplicitSnapshot(writerTab1);
+ await applyMutations(writerTab1, [["key", "something"]]);
+ await endExplicitSnapshot(writerTab1);
+
+ // Begin explicit snapshots in both tabs. Both tabs should see the initial
+ // state.
+ await beginExplicitSnapshot(writerTab1);
+ await beginExplicitSnapshot(writerTab2);
+
+ // Apply the first mutation in writerTab1 and end the explicit snapshot.
+ await applyMutations(writerTab1, [["key", "somethingBigger"]]);
+ await endExplicitSnapshot(writerTab1);
+
+ // Apply the second mutation in writerTab2 and end the explicit snapshot.
+ await applyMutations(writerTab2, [["key", null]]);
+ await endExplicitSnapshot(writerTab2);
+
+ // Verify the final state, it should match the state after the second
+ // mutation has been applied and "commited". An explicit snapshot is used.
+ await beginExplicitSnapshot(writerTab1);
+ await verifyState(writerTab1, {});
+ await endExplicitSnapshot(writerTab1);
+
+ // Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
+
+/**
+ * Verify that snapshot usage is correctly updated after each operation.
+ */
+add_task(async function () {
+ if (!Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is not enabled.");
+ return;
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // Force multiple web and webIsolated content processes so that the
+ // multi-e10s logic works correctly.
+ ["dom.ipc.processCount", 4],
+ ["dom.ipc.processCount.webIsolated", 2],
+ // Disable snapshot peak usage pre-incrementation to make the testing
+ // easier.
+ ["dom.storage.snapshot_peak_usage.initial_preincrement", 0],
+ ["dom.storage.snapshot_peak_usage.reduced_initial_preincrement", 0],
+ ["dom.storage.snapshot_peak_usage.gradual_preincrement", 0],
+ ["dom.storage.snapshot_peak_usage.reuced_gradual_preincrement", 0],
+ // Enable LocalStorage's testing API so we can explicitly create
+ // snapshots when needed.
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data by forcing the origin to be
+ // cleared prior to the start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab1 = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer1",
+ knownTabs,
+ true
+ );
+ const writerTab2 = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer2",
+ knownTabs,
+ true
+ );
+
+ // Apply the initial mutation using an explicit snapshot. The explicit
+ // snapshot here ensures that the parent process have received the changes.
+ await beginExplicitSnapshot(writerTab1);
+ await verifySnapshotUsage(writerTab1, 0);
+ await applyMutations(writerTab1, [["key", "something"]]);
+ await verifySnapshotUsage(writerTab1, 12);
+ await endExplicitSnapshot(writerTab1);
+ await verifyHasSnapshot(writerTab1, false);
+
+ // Begin an explicit snapshot in writerTab1 and apply the first mutatation
+ // in it.
+ await beginExplicitSnapshot(writerTab1);
+ await verifySnapshotUsage(writerTab1, 12);
+ await applyMutations(writerTab1, [["key", "somethingBigger"]]);
+ await verifySnapshotUsage(writerTab1, 18);
+
+ // Begin an explicit snapshot in writerTab2 and apply the second mutatation
+ // in it.
+ await beginExplicitSnapshot(writerTab2);
+ await verifySnapshotUsage(writerTab2, 18);
+ await applyMutations(writerTab2, [[null, null]]);
+ await verifySnapshotUsage(writerTab2, 6);
+
+ // End explicit snapshots in both tabs.
+ await endExplicitSnapshot(writerTab1);
+ await verifyHasSnapshot(writerTab1, false);
+ await endExplicitSnapshot(writerTab2);
+ await verifyHasSnapshot(writerTab2, false);
+
+ // Verify the final state, it should match the state after the second
+ // mutation has been applied and "commited". An explicit snapshot is used.
+ await beginExplicitSnapshot(writerTab1);
+ await verifySnapshotUsage(writerTab1, 0);
+ await verifyState(writerTab1, {});
+ await endExplicitSnapshot(writerTab1);
+ await verifyHasSnapshot(writerTab1, false);
+
+ // Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
+
+/**
+ * Verify that datastore in the parent is correctly updated after a checkpoint.
+ */
+add_task(async function () {
+ if (!Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is not enabled.");
+ return;
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // Force multiple web and webIsolated content processes so that the
+ // multi-e10s logic works correctly.
+ ["dom.ipc.processCount", 4],
+ ["dom.ipc.processCount.webIsolated", 2],
+ // Enable LocalStorage's testing API so we can explicitly create
+ // snapshots when needed.
+ ["dom.storage.testing", true],
+ ],
+ });
+
+ // Ensure that there is no localstorage data by forcing the origin to be
+ // cleared prior to the start of our test.
+ await clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+
+ // Open tabs. Don't configure any of them yet.
+ const knownTabs = new KnownTabs();
+ const writerTab1 = await openTestTab(
+ HELPER_PAGE_URL,
+ "writer1",
+ knownTabs,
+ true
+ );
+
+ await verifyParentState({});
+
+ // Apply the initial mutation using an explicit snapshot. The explicit
+ // snapshot here ensures that the parent process have received the changes.
+ await beginExplicitSnapshot(writerTab1);
+ await verifyParentState({});
+ await applyMutations(writerTab1, [["key", "something"]]);
+ await verifyParentState({});
+ await endExplicitSnapshot(writerTab1);
+
+ await verifyParentState({ key: "something" });
+
+ // Begin an explicit snapshot in writerTab1, apply the first mutation in
+ // writerTab1 and checkpoint the explicit snapshot.
+ await beginExplicitSnapshot(writerTab1);
+ await verifyParentState({ key: "something" });
+ await applyMutations(writerTab1, [["key", "somethingBigger"]]);
+ await verifyParentState({ key: "something" });
+ await checkpointExplicitSnapshot(writerTab1);
+
+ await verifyParentState({ key: "somethingBigger" });
+
+ // Apply the second mutation in writerTab1 and checkpoint the explicit
+ // snapshot.
+ await applyMutations(writerTab1, [["key", null]]);
+ await verifyParentState({ key: "somethingBigger" });
+ await checkpointExplicitSnapshot(writerTab1);
+
+ await verifyParentState({});
+
+ // Apply the third mutation in writerTab1 and end the explicit snapshot.
+ await applyMutations(writerTab1, [["otherKey", "something"]]);
+ await verifyParentState({});
+ await endExplicitSnapshot(writerTab1);
+
+ await verifyParentState({ otherKey: "something" });
+
+ // Verify the final state, it should match the state after the third mutation
+ // has been applied and "commited". An explicit snapshot is used.
+ await beginExplicitSnapshot(writerTab1);
+ await verifyParentState({ otherKey: "something" });
+ await verifyState(writerTab1, { otherKey: "something" });
+ await endExplicitSnapshot(writerTab1);
+
+ await verifyParentState({ otherKey: "something" });
+
+ // Clean up.
+ await cleanupTabs(knownTabs);
+
+ clearOriginStorageEnsuringNoPreload(HELPER_PAGE_ORIGIN);
+});
diff --git a/dom/tests/browser/browser_navigate_replace_browsingcontext.js b/dom/tests/browser/browser_navigate_replace_browsingcontext.js
new file mode 100644
index 0000000000..e8e0f98658
--- /dev/null
+++ b/dom/tests/browser/browser_navigate_replace_browsingcontext.js
@@ -0,0 +1,23 @@
+add_task(async function parent_to_remote() {
+ await BrowserTestUtils.withNewTab("about:mozilla", async browser => {
+ let originalBC = browser.browsingContext;
+
+ BrowserTestUtils.loadURIString(browser, "https://example.com/");
+ await BrowserTestUtils.browserLoaded(browser);
+ let newBC = browser.browsingContext;
+
+ isnot(originalBC.id, newBC.id, "Should have replaced the BrowsingContext");
+ });
+});
+
+add_task(async function remote_to_parent() {
+ await BrowserTestUtils.withNewTab("https://example.com/", async browser => {
+ let originalBC = browser.browsingContext;
+
+ BrowserTestUtils.loadURIString(browser, "about:mozilla");
+ await BrowserTestUtils.browserLoaded(browser);
+ let newBC = browser.browsingContext;
+
+ isnot(originalBC.id, newBC.id, "Should have replaced the BrowsingContext");
+ });
+});
diff --git a/dom/tests/browser/browser_noopener.js b/dom/tests/browser/browser_noopener.js
new file mode 100644
index 0000000000..d514ff2047
--- /dev/null
+++ b/dom/tests/browser/browser_noopener.js
@@ -0,0 +1,182 @@
+"use strict";
+
+const TESTS = [
+ { id: "#test1", name: "", opener: true, newWindow: false },
+ { id: "#test2", name: "", opener: false, newWindow: false },
+ { id: "#test3", name: "", opener: false, newWindow: false },
+
+ { id: "#test4", name: "uniquename1", opener: true, newWindow: false },
+ { id: "#test5", name: "uniquename2", opener: false, newWindow: false },
+ { id: "#test6", name: "uniquename3", opener: false, newWindow: false },
+
+ { id: "#test7", name: "", opener: true, newWindow: false },
+ { id: "#test8", name: "", opener: false, newWindow: false },
+ { id: "#test9", name: "", opener: false, newWindow: false },
+
+ { id: "#test10", name: "uniquename1", opener: true, newWindow: false },
+ { id: "#test11", name: "uniquename2", opener: false, newWindow: false },
+ { id: "#test12", name: "uniquename3", opener: false, newWindow: false },
+];
+
+const TEST_URL =
+ "http://mochi.test:8888/browser/dom/tests/browser/test_noopener_source.html";
+const TARGET_URL =
+ "http://mochi.test:8888/browser/dom/tests/browser/test_noopener_target.html";
+
+const OPEN_NEWWINDOW_PREF = "browser.link.open_newwindow";
+const OPEN_NEWWINDOW = 2;
+const OPEN_NEWTAB = 3;
+
+const NOOPENER_NEWPROC_PREF = "dom.noopener.newprocess.enabled";
+
+async function doTests(usePrivate, container) {
+ let alwaysNewWindow =
+ SpecialPowers.getIntPref(OPEN_NEWWINDOW_PREF) == OPEN_NEWWINDOW;
+
+ let window = await BrowserTestUtils.openNewBrowserWindow({
+ private: usePrivate,
+ });
+
+ let tabOpenOptions = {};
+ if (container) {
+ tabOpenOptions.userContextId = 1;
+ }
+
+ for (let test of TESTS) {
+ const testid = `${test.id} (private=${usePrivate}, container=${container}, alwaysNewWindow=${alwaysNewWindow})`;
+ let originalTab = BrowserTestUtils.addTab(
+ window.gBrowser,
+ TEST_URL,
+ tabOpenOptions
+ );
+ await BrowserTestUtils.browserLoaded(originalTab.linkedBrowser);
+ await BrowserTestUtils.switchTab(window.gBrowser, originalTab);
+
+ let waitFor;
+ if (test.newWindow || alwaysNewWindow) {
+ waitFor = BrowserTestUtils.waitForNewWindow({ url: TARGET_URL });
+ // Confirm that this window has private browsing set if we're doing a private browsing test
+ } else {
+ waitFor = BrowserTestUtils.waitForNewTab(
+ window.gBrowser,
+ TARGET_URL,
+ true
+ );
+ }
+
+ BrowserTestUtils.synthesizeMouseAtCenter(
+ test.id,
+ {},
+ window.gBrowser.getBrowserForTab(originalTab)
+ );
+
+ let tab;
+ if (test.newWindow || alwaysNewWindow) {
+ let window = await waitFor;
+ is(
+ PrivateBrowsingUtils.isWindowPrivate(window),
+ usePrivate,
+ "Private status should match for " + testid
+ );
+ tab = window.gBrowser.selectedTab;
+ } else {
+ tab = await waitFor;
+ }
+
+ // Check that the name matches.
+ await SpecialPowers.spawn(
+ tab.linkedBrowser,
+ [test, container, testid],
+ async (test, container, testid) => {
+ Assert.equal(
+ content.document.nodePrincipal.originAttributes.userContextId,
+ container ? 1 : 0,
+ `User context ID should match for ${testid}`
+ );
+
+ Assert.equal(
+ content.window.name,
+ test.name,
+ `Name should match for ${testid}`
+ );
+ if (test.opener) {
+ Assert.ok(
+ content.window.opener,
+ `Opener should have been set for ${testid}`
+ );
+ } else {
+ Assert.ok(
+ !content.window.opener,
+ `Opener should not have been set for ${testid}`
+ );
+ }
+ }
+ );
+
+ BrowserTestUtils.removeTab(tab);
+ BrowserTestUtils.removeTab(originalTab);
+ }
+
+ window.close();
+}
+
+async function doAllTests() {
+ // Non-private window
+ await doTests(false, false);
+
+ // Private window
+ await doTests(true, false);
+
+ // Non-private window with container
+ await doTests(false, true);
+}
+
+// This test takes a really long time, especially in debug builds, as it is
+// constant starting and stopping processes, and opens a new window ~144 times.
+requestLongerTimeout(30);
+
+add_task(async function prepare() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.window.open.noreferrer.enabled", true]],
+ });
+});
+
+add_task(async function newtab_sameproc() {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ [OPEN_NEWWINDOW_PREF, OPEN_NEWTAB],
+ [NOOPENER_NEWPROC_PREF, false],
+ ],
+ });
+ await doAllTests();
+});
+
+add_task(async function newtab_newproc() {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ [OPEN_NEWWINDOW_PREF, OPEN_NEWTAB],
+ [NOOPENER_NEWPROC_PREF, true],
+ ],
+ });
+ await doAllTests();
+});
+
+add_task(async function newwindow_sameproc() {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ [OPEN_NEWWINDOW_PREF, OPEN_NEWWINDOW],
+ [NOOPENER_NEWPROC_PREF, false],
+ ],
+ });
+ await doAllTests();
+});
+
+add_task(async function newwindow_newproc() {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ [OPEN_NEWWINDOW_PREF, OPEN_NEWWINDOW],
+ [NOOPENER_NEWPROC_PREF, true],
+ ],
+ });
+ await doAllTests();
+});
diff --git a/dom/tests/browser/browser_noopener_null_uri.js b/dom/tests/browser/browser_noopener_null_uri.js
new file mode 100644
index 0000000000..8bb706b2b2
--- /dev/null
+++ b/dom/tests/browser/browser_noopener_null_uri.js
@@ -0,0 +1,15 @@
+add_task(async function browserNoopenerNullUri() {
+ await BrowserTestUtils.withNewTab({ gBrowser }, async function (aBrowser) {
+ let numTabs = gBrowser.tabs.length;
+ await SpecialPowers.spawn(aBrowser, [], async () => {
+ ok(
+ !content.window.open(undefined, undefined, "noopener"),
+ "window.open should return null"
+ );
+ });
+ await TestUtils.waitForCondition(() => gBrowser.tabs.length == numTabs + 1);
+ // We successfully opened a tab in content process!
+ });
+ // We only have to close the tab we opened earlier
+ await BrowserTestUtils.removeTab(gBrowser.tabs[1]);
+});
diff --git a/dom/tests/browser/browser_persist_cookies.js b/dom/tests/browser/browser_persist_cookies.js
new file mode 100644
index 0000000000..d64c85eced
--- /dev/null
+++ b/dom/tests/browser/browser_persist_cookies.js
@@ -0,0 +1,128 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_PATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.org"
+);
+const TEST_PATH2 = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.com"
+);
+
+var MockFilePicker = SpecialPowers.MockFilePicker;
+MockFilePicker.init(window);
+
+registerCleanupFunction(async function () {
+ info("Running the cleanup code");
+ MockFilePicker.cleanup();
+ Services.obs.removeObserver(checkRequest, "http-on-modify-request");
+ SpecialPowers.clearUserPref("network.cookie.sameSite.laxByDefault");
+ if (gTestDir && gTestDir.exists()) {
+ // On Windows, sometimes nsIFile.remove() throws, probably because we're
+ // still writing to the directory we're trying to remove, despite
+ // waiting for the download to complete. Just retry a bit later...
+ let succeeded = false;
+ while (!succeeded) {
+ try {
+ gTestDir.remove(true);
+ succeeded = true;
+ } catch (ex) {
+ await new Promise(requestAnimationFrame);
+ }
+ }
+ }
+});
+
+let gTestDir = null;
+
+function checkRequest(subject) {
+ let httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
+ let spec = httpChannel.URI.spec;
+ // Ignore initial requests for page that sets cookies and its favicon, which may not have
+ // cookies.
+ if (
+ httpChannel.URI.host == "example.org" &&
+ !spec.endsWith("favicon.ico") &&
+ !spec.includes("redirect.sjs")
+ ) {
+ let cookie = httpChannel.getRequestHeader("cookie");
+ is(
+ cookie.trim(),
+ "normalCookie=true",
+ "Should have correct cookie in request for " + spec
+ );
+ }
+}
+
+function createTemporarySaveDirectory() {
+ var saveDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
+ saveDir.append("testsavedir");
+ if (!saveDir.exists()) {
+ info("create testsavedir!");
+ saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
+ }
+ info("return from createTempSaveDir: " + saveDir.path);
+ return saveDir;
+}
+
+add_task(async function () {
+ // Use nsICookieService.BEHAVIOR_REJECT_TRACKER to avoid cookie partitioning.
+ // In this test case, if the cookie is partitioned, there will be no cookie
+ // nsICookieServicebeing sent to compare.
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["network.cookie.cookieBehavior", 4],
+ // Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default"
+ ["network.cookie.sameSite.laxByDefault", false],
+ ],
+ });
+
+ await BrowserTestUtils.withNewTab("about:blank", async function (browser) {
+ Services.obs.addObserver(checkRequest, "http-on-modify-request");
+ BrowserTestUtils.loadURIString(
+ browser,
+ TEST_PATH + "set-samesite-cookies-and-redirect.sjs"
+ );
+ // Test that the original document load doesn't send same-site cookies.
+ await BrowserTestUtils.browserLoaded(
+ browser,
+ true,
+ TEST_PATH2 + "set-samesite-cookies-and-redirect.sjs"
+ );
+ // Now check the saved page.
+ // Create the folder the link will be saved into.
+ gTestDir = createTemporarySaveDirectory();
+ let destFile = gTestDir.clone();
+
+ MockFilePicker.displayDirectory = gTestDir;
+ let fileName;
+ MockFilePicker.showCallback = function (fp) {
+ info("showCallback");
+ fileName = fp.defaultString;
+ info("fileName: " + fileName);
+ destFile.append(fileName);
+ info("path: " + destFile.path);
+ MockFilePicker.setFiles([destFile]);
+ MockFilePicker.filterIndex = 0; // kSaveAsType_Complete
+ info("done showCallback");
+ };
+ saveBrowser(browser);
+ let dls = await Downloads.getList(Downloads.PUBLIC);
+ await new Promise((resolve, reject) => {
+ dls.addView({
+ onDownloadChanged(download) {
+ if (download.succeeded) {
+ dls.removeView(this);
+ dls.removeFinished();
+ resolve();
+ } else if (download.error) {
+ reject("Download failed");
+ }
+ },
+ });
+ });
+ });
+});
diff --git a/dom/tests/browser/browser_persist_cross_origin_iframe.js b/dom/tests/browser/browser_persist_cross_origin_iframe.js
new file mode 100644
index 0000000000..94a9a74af7
--- /dev/null
+++ b/dom/tests/browser/browser_persist_cross_origin_iframe.js
@@ -0,0 +1,198 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_PATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.org"
+);
+const TEST_PATH2 = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.com"
+);
+
+var MockFilePicker = SpecialPowers.MockFilePicker;
+MockFilePicker.init(window);
+
+registerCleanupFunction(async function () {
+ info("Running the cleanup code");
+ MockFilePicker.cleanup();
+ if (gTestDir && gTestDir.exists()) {
+ // On Windows, sometimes nsIFile.remove() throws, probably because we're
+ // still writing to the directory we're trying to remove, despite
+ // waiting for the download to complete. Just retry a bit later...
+ let succeeded = false;
+ while (!succeeded) {
+ try {
+ gTestDir.remove(true);
+ succeeded = true;
+ } catch (ex) {
+ await new Promise(requestAnimationFrame);
+ }
+ }
+ }
+});
+
+let gTestDir = null;
+
+function createTemporarySaveDirectory() {
+ var saveDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
+ saveDir.append("testsavedir");
+ if (!saveDir.exists()) {
+ saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
+ }
+ return saveDir;
+}
+
+function canonicalizeExtension(str) {
+ return str.replace(/\.htm$/, ".html");
+}
+
+function checkContents(dir, expected, str) {
+ let stack = [dir];
+ let files = [];
+ while (stack.length) {
+ for (let file of stack.pop().directoryEntries) {
+ if (file.isDirectory()) {
+ stack.push(file);
+ }
+
+ let path = canonicalizeExtension(file.getRelativePath(dir));
+ files.push(path);
+ }
+ }
+
+ SimpleTest.isDeeply(
+ files.sort(),
+ expected.sort(),
+ str + "Should contain downloaded files in correct place."
+ );
+}
+
+async function addFrame(browser, path, selector) {
+ await SpecialPowers.spawn(
+ browser,
+ [path, selector],
+ async function (path, selector) {
+ let document = content.document;
+ let target = document.querySelector(selector);
+ if (content.HTMLIFrameElement.isInstance(target)) {
+ document = target.contentDocument;
+ target = document.body;
+ }
+ let element = document.createElement("iframe");
+ element.src = path;
+ await new Promise(resolve => {
+ element.onload = resolve;
+ target.appendChild(element);
+ });
+ }
+ );
+}
+
+async function handleResult(expected, str) {
+ let dls = await Downloads.getList(Downloads.PUBLIC);
+ return new Promise((resolve, reject) => {
+ dls.addView({
+ onDownloadChanged(download) {
+ if (download.succeeded) {
+ checkContents(gTestDir, expected, str);
+
+ dls.removeView(this);
+ dls.removeFinished();
+ resolve();
+ } else if (download.error) {
+ reject("Download failed");
+ }
+ },
+ });
+ });
+}
+
+add_task(async function () {
+ await BrowserTestUtils.withNewTab(
+ TEST_PATH + "image.html",
+ async function (browser) {
+ await addFrame(browser, TEST_PATH + "image.html", "body");
+ await addFrame(browser, TEST_PATH2 + "image.html", "body>iframe");
+
+ gTestDir = createTemporarySaveDirectory();
+
+ MockFilePicker.displayDirectory = gTestDir;
+ MockFilePicker.showCallback = function (fp) {
+ let destFile = gTestDir.clone();
+ destFile.append("first.html");
+ MockFilePicker.setFiles([destFile]);
+ MockFilePicker.filterIndex = 0; // kSaveAsType_Complete
+ };
+
+ let expected = [
+ "first.html",
+ "first_files",
+ "first_files/image.html",
+ "first_files/dummy.png",
+ "first_files/image_data",
+ "first_files/image_data/image.html",
+ "first_files/image_data/image_data",
+ "first_files/image_data/image_data/dummy.png",
+ ];
+
+ // This saves the top-level document contained in `browser`
+ saveBrowser(browser);
+ await handleResult(expected, "Check toplevel: ");
+
+ // Instead of deleting previously saved files, we update our list
+ // of expected files for the next part of the test. To not clash
+ // we make sure to save to a different file name.
+ expected = expected.concat([
+ "second.html",
+ "second_files",
+ "second_files/dummy.png",
+ "second_files/image.html",
+ "second_files/image_data",
+ "second_files/image_data/dummy.png",
+ ]);
+
+ MockFilePicker.showCallback = function (fp) {
+ let destFile = gTestDir.clone();
+ destFile.append("second.html");
+ MockFilePicker.setFiles([destFile]);
+ MockFilePicker.filterIndex = 0; // kSaveAsType_Complete
+ };
+
+ // This saves the sub-document of the iframe contained in the
+ // top-level document, as indicated by passing a child browsing
+ // context as target for the save.
+ saveBrowser(browser, false, browser.browsingContext.children[0]);
+ await handleResult(expected, "Check subframe: ");
+
+ // Instead of deleting previously saved files, we update our list
+ // of expected files for the next part of the test. To not clash
+ // we make sure to save to a different file name.
+ expected = expected.concat([
+ "third.html",
+ "third_files",
+ "third_files/dummy.png",
+ ]);
+
+ MockFilePicker.showCallback = function (fp) {
+ let destFile = gTestDir.clone();
+ destFile.append("third.html");
+ MockFilePicker.setFiles([destFile]);
+ MockFilePicker.filterIndex = 0; // kSaveAsType_Complete
+ };
+
+ // This saves the sub-document of the iframe contained in the
+ // first sub-document, as indicated by passing a child browsing
+ // context as target for the save. That frame is special, because
+ // it's cross-process.
+ saveBrowser(
+ browser,
+ false,
+ browser.browsingContext.children[0].children[0]
+ );
+ await handleResult(expected, "Check subframe: ");
+ }
+ );
+});
diff --git a/dom/tests/browser/browser_persist_image_accept.js b/dom/tests/browser/browser_persist_image_accept.js
new file mode 100644
index 0000000000..ecf3b370a6
--- /dev/null
+++ b/dom/tests/browser/browser_persist_image_accept.js
@@ -0,0 +1,140 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_PATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.org"
+);
+
+var MockFilePicker = SpecialPowers.MockFilePicker;
+MockFilePicker.init(window);
+
+registerCleanupFunction(async function () {
+ info("Running the cleanup code");
+ MockFilePicker.cleanup();
+ if (gTestDir && gTestDir.exists()) {
+ // On Windows, sometimes nsIFile.remove() throws, probably because we're
+ // still writing to the directory we're trying to remove, despite
+ // waiting for the download to complete. Just retry a bit later...
+ let succeeded = false;
+ while (!succeeded) {
+ try {
+ gTestDir.remove(true);
+ succeeded = true;
+ } catch (ex) {
+ await new Promise(requestAnimationFrame);
+ }
+ }
+ }
+});
+
+let gTestDir = null;
+
+function createTemporarySaveDirectory() {
+ var saveDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
+ saveDir.append("testsavedir");
+ if (!saveDir.exists()) {
+ info("create testsavedir!");
+ saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
+ }
+ info("return from createTempSaveDir: " + saveDir.path);
+ return saveDir;
+}
+
+function expectedImageAcceptHeader() {
+ if (Services.prefs.prefHasUserValue("image.http.accept")) {
+ return Services.prefs.getCharPref("image.http.accept");
+ }
+
+ return (
+ (Services.prefs.getBoolPref("image.avif.enabled") ? "image/avif," : "") +
+ (Services.prefs.getBoolPref("image.jxl.enabled") ? "image/jxl," : "") +
+ (Services.prefs.getBoolPref("image.webp.enabled") ? "image/webp," : "") +
+ "*/*"
+ );
+}
+
+add_task(async function test_image_download() {
+ await BrowserTestUtils.withNewTab(TEST_PATH + "dummy.html", async browser => {
+ // Add the image, and wait for it to load.
+ await SpecialPowers.spawn(browser, [], async function () {
+ let loc = content.document.location.href;
+ let imgloc = new content.URL("dummy.png", loc);
+ let img = content.document.createElement("img");
+ img.src = imgloc;
+ await new Promise(resolve => {
+ img.onload = resolve;
+ content.document.body.appendChild(img);
+ });
+ });
+ gTestDir = createTemporarySaveDirectory();
+
+ let destFile = gTestDir.clone();
+
+ MockFilePicker.displayDirectory = gTestDir;
+ let fileName;
+ MockFilePicker.showCallback = function (fp) {
+ info("showCallback");
+ fileName = fp.defaultString;
+ info("fileName: " + fileName);
+ destFile.append(fileName);
+ info("path: " + destFile.path);
+ MockFilePicker.setFiles([destFile]);
+ MockFilePicker.filterIndex = 0; // just save the file
+ info("done showCallback");
+ };
+ let publicDownloads = await Downloads.getList(Downloads.PUBLIC);
+ let downloadFinishedPromise = new Promise(resolve => {
+ publicDownloads.addView({
+ onDownloadChanged(download) {
+ info("Download changed!");
+ if (download.succeeded || download.error) {
+ info("Download succeeded or errored");
+ publicDownloads.removeView(this);
+ publicDownloads.removeFinished();
+ resolve(download);
+ }
+ },
+ });
+ });
+ let httpOnModifyPromise = TestUtils.topicObserved(
+ "http-on-modify-request",
+ (s, t, d) => {
+ let channel = s.QueryInterface(Ci.nsIChannel);
+ let uri = channel.URI && channel.URI.spec;
+ if (!uri.endsWith("dummy.png")) {
+ info("Ignoring request for " + uri);
+ return false;
+ }
+ ok(channel instanceof Ci.nsIHttpChannel, "Should be HTTP channel");
+ channel.QueryInterface(Ci.nsIHttpChannel);
+ is(
+ channel.getRequestHeader("Accept"),
+ expectedImageAcceptHeader(),
+ "Header should be image header"
+ );
+ return true;
+ }
+ );
+ // open the context menu.
+ let popup = document.getElementById("contentAreaContextMenu");
+ let popupShown = BrowserTestUtils.waitForEvent(popup, "popupshown");
+ BrowserTestUtils.synthesizeMouseAtCenter(
+ "img",
+ { type: "contextmenu", button: 2 },
+ browser
+ );
+ await popupShown;
+ let popupHidden = BrowserTestUtils.waitForEvent(popup, "popuphidden");
+ popup.activateItem(popup.querySelector("#context-saveimage"));
+ await popupHidden;
+ info("Context menu hidden, waiting for download to finish");
+ let imageDownload = await downloadFinishedPromise;
+ ok(imageDownload.succeeded, "Image should have downloaded successfully");
+ info("Waiting for http request to complete.");
+ // Ensure we got the http request:
+ await httpOnModifyPromise;
+ });
+});
diff --git a/dom/tests/browser/browser_persist_mixed_content_image.js b/dom/tests/browser/browser_persist_mixed_content_image.js
new file mode 100644
index 0000000000..d84934376d
--- /dev/null
+++ b/dom/tests/browser/browser_persist_mixed_content_image.js
@@ -0,0 +1,109 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_PATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.org"
+);
+
+var MockFilePicker = SpecialPowers.MockFilePicker;
+MockFilePicker.init(window);
+
+registerCleanupFunction(async function () {
+ info("Running the cleanup code");
+ MockFilePicker.cleanup();
+ if (gTestDir && gTestDir.exists()) {
+ // On Windows, sometimes nsIFile.remove() throws, probably because we're
+ // still writing to the directory we're trying to remove, despite
+ // waiting for the download to complete. Just retry a bit later...
+ let succeeded = false;
+ while (!succeeded) {
+ try {
+ gTestDir.remove(true);
+ succeeded = true;
+ } catch (ex) {
+ await new Promise(requestAnimationFrame);
+ }
+ }
+ }
+});
+
+let gTestDir = null;
+
+function createTemporarySaveDirectory() {
+ var saveDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
+ saveDir.append("testsavedir");
+ if (!saveDir.exists()) {
+ info("create testsavedir!");
+ saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
+ }
+ info("return from createTempSaveDir: " + saveDir.path);
+ return saveDir;
+}
+
+add_task(async function test_image_download() {
+ await BrowserTestUtils.withNewTab(
+ TEST_PATH + "test_mixed_content_image.html",
+ async browser => {
+ // Add the image, and wait for it to load.
+ await SpecialPowers.spawn(browser, [], async function () {
+ let loc = content.document.location.href;
+ let httpRoot = loc.replace("https", "http");
+ let imgloc = new content.URL("dummy.png", httpRoot);
+ let img = content.document.createElement("img");
+ img.src = imgloc;
+ await new Promise(resolve => {
+ img.onload = resolve;
+ content.document.body.appendChild(img);
+ });
+ });
+ gTestDir = createTemporarySaveDirectory();
+
+ let destFile = gTestDir.clone();
+
+ MockFilePicker.displayDirectory = gTestDir;
+ let fileName;
+ MockFilePicker.showCallback = function (fp) {
+ info("showCallback");
+ fileName = fp.defaultString;
+ info("fileName: " + fileName);
+ destFile.append(fileName);
+ info("path: " + destFile.path);
+ MockFilePicker.setFiles([destFile]);
+ MockFilePicker.filterIndex = 0; // just save the file
+ info("done showCallback");
+ };
+ let publicDownloads = await Downloads.getList(Downloads.PUBLIC);
+ let downloadFinishedPromise = new Promise(resolve => {
+ publicDownloads.addView({
+ onDownloadChanged(download) {
+ info("Download changed!");
+ if (download.succeeded || download.error) {
+ info("Download succeeded or errored");
+ publicDownloads.removeView(this);
+ publicDownloads.removeFinished();
+ resolve(download);
+ }
+ },
+ });
+ });
+ // open the context menu.
+ let popup = document.getElementById("contentAreaContextMenu");
+ let popupShown = BrowserTestUtils.waitForEvent(popup, "popupshown");
+ BrowserTestUtils.synthesizeMouseAtCenter(
+ "img",
+ { type: "contextmenu", button: 2 },
+ browser
+ );
+ await popupShown;
+ let popupHidden = BrowserTestUtils.waitForEvent(popup, "popuphidden");
+ popup.activateItem(popup.querySelector("#context-saveimage"));
+ await popupHidden;
+ info("Context menu hidden, waiting for download to finish");
+ let imageDownload = await downloadFinishedPromise;
+ ok(imageDownload.succeeded, "Image should have downloaded successfully");
+ }
+ );
+});
diff --git a/dom/tests/browser/browser_pointerlock_warning.js b/dom/tests/browser/browser_pointerlock_warning.js
new file mode 100644
index 0000000000..f16778cf1f
--- /dev/null
+++ b/dom/tests/browser/browser_pointerlock_warning.js
@@ -0,0 +1,129 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+"use strict";
+
+const BODY_URL =
+ "<body onpointerdown='this.requestPointerLock()' style='width: 100px; height: 100px;'></body>";
+
+const TEST_URL = "data:text/html," + BODY_URL;
+
+const FRAME_TEST_URL =
+ 'data:text/html,<body><iframe src="http://example.org/document-builder.sjs?html=' +
+ encodeURI(BODY_URL) +
+ '"></iframe></body>';
+
+function checkWarningState(aWarningElement, aExpectedState, aMsg) {
+ ["hidden", "ontop", "onscreen"].forEach(state => {
+ is(
+ aWarningElement.hasAttribute(state),
+ state == aExpectedState,
+ `${aMsg} - check ${state} attribute.`
+ );
+ });
+}
+
+async function waitForWarningState(aWarningElement, aExpectedState) {
+ await BrowserTestUtils.waitForAttribute(aExpectedState, aWarningElement, "");
+ checkWarningState(
+ aWarningElement,
+ aExpectedState,
+ `Wait for ${aExpectedState} state`
+ );
+}
+
+// Make sure the pointerlock warning is shown and exited with the escape key
+add_task(async function show_pointerlock_warning_escape() {
+ let urls = [TEST_URL, FRAME_TEST_URL];
+ for (let url of urls) {
+ info("Pointerlock warning test for " + url);
+
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
+
+ let warning = document.getElementById("pointerlock-warning");
+ let warningShownPromise = waitForWarningState(warning, "onscreen");
+
+ let expectedWarningText;
+
+ let bc = tab.linkedBrowser.browsingContext;
+ if (bc.children.length) {
+ // use the subframe if it exists
+ bc = bc.children[0];
+ expectedWarningText = "example.org";
+ } else {
+ expectedWarningText = "This document";
+ }
+ expectedWarningText +=
+ " has control of your pointer. Press Esc to take back control.";
+
+ await BrowserTestUtils.synthesizeMouse("body", 4, 4, {}, bc);
+
+ await warningShownPromise;
+
+ ok(true, "Pointerlock warning shown");
+
+ let warningHiddenPromise = waitForWarningState(warning, "hidden");
+
+ await BrowserTestUtils.waitForCondition(
+ () => warning.innerText == expectedWarningText,
+ "Warning text"
+ );
+
+ EventUtils.synthesizeKey("KEY_Escape");
+ await warningHiddenPromise;
+
+ ok(true, "Pointerlock warning hidden");
+
+ // Pointerlock should be released after escape is pressed.
+ await SpecialPowers.spawn(tab.linkedBrowser, [], async function () {
+ Assert.equal(content.document.pointerLockElement, null);
+ });
+
+ await BrowserTestUtils.removeTab(tab);
+ }
+});
+
+/*
+// XXX Bug 1580961 - this part of the test is disabled.
+//
+// Make sure the pointerlock warning is shown, but this time escape is not pressed until after the
+// notification is closed via the timeout.
+add_task(async function show_pointerlock_warning_timeout() {
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
+
+ let warning = document.getElementById("pointerlock-warning");
+ let warningShownPromise = BrowserTestUtils.waitForAttribute(
+ "onscreen",
+ warning,
+ "true"
+ );
+ let warningHiddenPromise = BrowserTestUtils.waitForAttribute(
+ "hidden",
+ warning,
+ "true"
+ );
+ await BrowserTestUtils.synthesizeMouse("body", 4, 4, {}, tab.linkedBrowser);
+
+ await warningShownPromise;
+ ok(true, "Pointerlock warning shown");
+ await warningHiddenPromise;
+
+ // The warning closes after a few seconds, but this does not exit pointerlock mode.
+ await SpecialPowers.spawn(tab.linkedBrowser, [], async function() {
+ Assert.equal(content.document.pointerLockElement, content.document.body);
+ });
+
+ EventUtils.synthesizeKey("KEY_Escape");
+
+ ok(true, "Pointerlock warning hidden");
+
+ // Pointerlock should now be released.
+ await SpecialPowers.spawn(tab.linkedBrowser, [], async function() {
+ Assert.equal(content.document.pointerLockElement, null);
+ });
+
+ await BrowserTestUtils.removeTab(tab);
+});
+*/
diff --git a/dom/tests/browser/browser_sessionStorage_navigation.js b/dom/tests/browser/browser_sessionStorage_navigation.js
new file mode 100644
index 0000000000..094527dd44
--- /dev/null
+++ b/dom/tests/browser/browser_sessionStorage_navigation.js
@@ -0,0 +1,271 @@
+"use strict";
+
+const DIRPATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content/",
+ ""
+);
+const PATH = DIRPATH + "file_empty.html";
+
+const ORIGIN1 = "https://example.com";
+const ORIGIN2 = "https://example.org";
+const URL1 = `${ORIGIN1}/${PATH}`;
+const URL2 = `${ORIGIN2}/${PATH}`;
+const URL1_WITH_COOP_COEP = `${ORIGIN1}/${DIRPATH}file_coop_coep.html`;
+
+add_task(async function () {
+ await BrowserTestUtils.withNewTab(URL1, async function (browser) {
+ const key = "key";
+ const value = "value";
+
+ info(
+ `Verifying sessionStorage is preserved after navigating to a ` +
+ `cross-origin site and then navigating back`
+ );
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ [
+ "privacy.partition.always_partition_third_party_non_cookie_storage",
+ false,
+ ],
+ ],
+ });
+
+ BrowserTestUtils.loadURIString(browser, URL1);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [ORIGIN1, key, value],
+ async (ORIGIN, key, value) => {
+ is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`);
+
+ let value1 = content.window.sessionStorage.getItem(key);
+ is(
+ value1,
+ null,
+ `SessionStorage for ${key} in ${content.window.origin} is null ` +
+ `since it's the first visit`
+ );
+
+ content.window.sessionStorage.setItem(key, value);
+
+ let value2 = content.window.sessionStorage.getItem(key);
+ is(
+ value2,
+ value,
+ `SessionStorage for ${key} in ${content.window.origin} is set ` +
+ `correctly`
+ );
+ }
+ );
+
+ BrowserTestUtils.loadURIString(browser, URL2);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [ORIGIN2, key, value],
+ async (ORIGIN, key, value) => {
+ is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`);
+
+ let value1 = content.window.sessionStorage.getItem(key);
+ is(
+ value1,
+ null,
+ `SessionStorage for ${key} in ${content.window.origin} is null ` +
+ `since it's the first visit`
+ );
+ }
+ );
+
+ BrowserTestUtils.loadURIString(browser, URL1);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [ORIGIN1, key, value],
+ async (ORIGIN, key, value) => {
+ is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`);
+
+ let value1 = content.window.sessionStorage.getItem(key);
+ is(
+ value1,
+ value,
+ `SessionStorage for ${key} in ${content.window.origin} is preserved`
+ );
+ }
+ );
+
+ info(`Verifying sessionStorage is preserved for ${URL1} after navigating`);
+
+ BrowserTestUtils.loadURIString(browser, URL2);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [ORIGIN2, ORIGIN1, URL1, key, value],
+ async (ORIGIN, iframeORIGIN, iframeURL, key, value) => {
+ is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`);
+
+ let iframe = content.document.createElement("iframe");
+ iframe.src = iframeURL;
+ content.document.body.appendChild(iframe);
+ await ContentTaskUtils.waitForEvent(iframe, "load");
+
+ await content.SpecialPowers.spawn(
+ iframe,
+ [iframeORIGIN, key, value],
+ async function (ORIGIN, key, value) {
+ is(
+ content.window.origin,
+ ORIGIN,
+ `Navigate to ${ORIGIN} as expected`
+ );
+
+ // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
+ // Acquire storage access permission here so that the iframe has
+ // first-party access to the sessionStorage. Without this, it is
+ // isolated and this test will always fail
+ SpecialPowers.wrap(content.document).notifyUserGestureActivation();
+ await SpecialPowers.addPermission(
+ "storageAccessAPI",
+ true,
+ content.window.location.href
+ );
+ await SpecialPowers.wrap(content.document).requestStorageAccess();
+
+ let value1 = content.window.sessionStorage.getItem(key);
+ is(
+ value1,
+ value,
+ `SessionStorage for ${key} in ${content.window.origin} is ` +
+ `preserved`
+ );
+ }
+ );
+ }
+ );
+
+ info(`Verifying SSCache is loaded to the content process only once`);
+
+ BrowserTestUtils.loadURIString(browser, URL1);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [ORIGIN1, URL1, key, value],
+ async (ORIGIN, iframeURL, key, value) => {
+ is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`);
+
+ let iframe = content.document.createElement("iframe");
+ iframe.src = iframeURL;
+ content.document.body.appendChild(iframe);
+ await ContentTaskUtils.waitForEvent(iframe, "load");
+
+ await content.SpecialPowers.spawn(
+ iframe,
+ [ORIGIN, key, value],
+ async function (ORIGIN, key, value) {
+ is(
+ content.window.origin,
+ ORIGIN,
+ `Load an iframe to ${ORIGIN} as expected`
+ );
+
+ let value1 = content.window.sessionStorage.getItem(key);
+ is(
+ value1,
+ value,
+ `SessionStorage for ${key} in ${content.window.origin} is ` +
+ `preserved.`
+ );
+
+ // When we are here, it means we didn't hit the assertion for
+ // ensuring a SSCache can only be loaded on the content process
+ // once.
+ }
+ );
+ }
+ );
+
+ info(
+ `Verifying the sessionStorage for a tab shares between ` +
+ `cross-origin-isolated and non cross-origin-isolated environments`
+ );
+ const anotherKey = `anotherKey`;
+ const anotherValue = `anotherValue;`;
+
+ BrowserTestUtils.loadURIString(browser, URL1_WITH_COOP_COEP);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [ORIGIN1, key, value, anotherKey, anotherValue],
+ async (ORIGIN, key, value, anotherKey, anotherValue) => {
+ is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`);
+ ok(
+ content.window.crossOriginIsolated,
+ `The window is cross-origin-isolated.`
+ );
+
+ let value1 = content.window.sessionStorage.getItem(key);
+ is(
+ value1,
+ value,
+ `SessionStorage for ${key} in ${content.window.origin} was ` +
+ `propagated to COOP+COEP process correctly.`
+ );
+
+ let value2 = content.window.sessionStorage.getItem(anotherKey);
+ is(
+ value2,
+ null,
+ `SessionStorage for ${anotherKey} in ${content.window.origin} ` +
+ `hasn't been set yet.`
+ );
+
+ content.window.sessionStorage.setItem(anotherKey, anotherValue);
+
+ let value3 = content.window.sessionStorage.getItem(anotherKey);
+ is(
+ value3,
+ anotherValue,
+ `SessionStorage for ${anotherKey} in ${content.window.origin} ` +
+ `was set as expected.`
+ );
+ }
+ );
+
+ BrowserTestUtils.loadURIString(browser, URL1);
+ await BrowserTestUtils.browserLoaded(browser);
+
+ await SpecialPowers.spawn(
+ browser,
+ [ORIGIN1, key, value, anotherKey, anotherValue],
+ async (ORIGIN, key, value, anotherKey, anotherValue) => {
+ is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`);
+ ok(
+ !content.window.crossOriginIsolated,
+ `The window is not cross-origin-isolated.`
+ );
+
+ let value1 = content.window.sessionStorage.getItem(key);
+ is(
+ value1,
+ value,
+ `SessionStorage for ${key} in ${content.window.origin} is ` +
+ `preserved.`
+ );
+
+ let value2 = content.window.sessionStorage.getItem(anotherKey);
+ is(
+ value2,
+ anotherValue,
+ `SessionStorage for ${anotherKey} in ${content.window.origin} was ` +
+ `propagated to non-COOP+COEP process correctly.`
+ );
+ }
+ );
+ });
+});
diff --git a/dom/tests/browser/browser_test_focus_after_modal_state.js b/dom/tests/browser/browser_test_focus_after_modal_state.js
new file mode 100644
index 0000000000..2193d8fdc4
--- /dev/null
+++ b/dom/tests/browser/browser_test_focus_after_modal_state.js
@@ -0,0 +1,71 @@
+const TEST_URL =
+ "https://example.com/browser/dom/tests/browser/focus_after_prompt.html";
+
+const { PromptTestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/PromptTestUtils.sys.mjs"
+);
+
+function awaitAndClosePrompt(browser) {
+ return PromptTestUtils.handleNextPrompt(
+ browser,
+ { modalType: Services.prompt.MODAL_TYPE_CONTENT, promptType: "prompt" },
+ { buttonNumClick: 0 }
+ );
+}
+
+add_task(async function () {
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
+ let browser = tab.linkedBrowser;
+
+ // Focus on editable iframe.
+ await BrowserTestUtils.synthesizeMouseAtCenter("#edit", {}, browser);
+ await SpecialPowers.spawn(browser, [], async function () {
+ is(
+ content.document.activeElement,
+ content.document.getElementById("edit"),
+ "Focus should be on iframe element"
+ );
+ });
+
+ let focusBlurPromise = SpecialPowers.spawn(browser, [], async function () {
+ let focusOccurred = false;
+ let blurOccurred = false;
+
+ return new Promise(resolve => {
+ let doc = content.document.getElementById("edit").contentDocument;
+ doc.addEventListener("focus", function (event) {
+ focusOccurred = true;
+ if (blurOccurred) {
+ resolve(true);
+ }
+ });
+
+ doc.addEventListener("blur", function (event) {
+ blurOccurred = true;
+ if (focusOccurred) {
+ resolve(false);
+ }
+ });
+ });
+ });
+
+ // Click on div that triggers a prompt, and then check that focus is back on
+ // the editable iframe.
+ let dialogShown = awaitAndClosePrompt(browser);
+ await SpecialPowers.spawn(browser, [], async function () {
+ let div = content.document.getElementById("clickMeDiv");
+ div.click();
+ });
+ await dialogShown;
+ let blurCameFirst = await focusBlurPromise;
+ await SpecialPowers.spawn(browser, [], async function () {
+ is(
+ content.document.activeElement,
+ content.document.getElementById("edit"),
+ "Focus should be back on iframe element"
+ );
+ });
+ ok(blurCameFirst, "Should receive blur and then focus event");
+
+ BrowserTestUtils.removeTab(tab);
+});
diff --git a/dom/tests/browser/browser_test_new_window_from_content.js b/dom/tests/browser/browser_test_new_window_from_content.js
new file mode 100644
index 0000000000..e150ea3232
--- /dev/null
+++ b/dom/tests/browser/browser_test_new_window_from_content.js
@@ -0,0 +1,221 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/*
+ We have three ways for content to open new windows:
+ 1) window.open (with the default features)
+ 2) window.open (with non-default features)
+ 3) target="_blank" in <a> tags
+
+ We also have two prefs that modify our window opening behaviours:
+
+ 1) browser.link.open_newwindow
+
+ This has a numeric value that allows us to set our window-opening behaviours from
+ content in three ways:
+ 1) Open links that would normally open a new window in the current tab
+ 2) Open links that would normally open a new window in a new window
+ 3) Open links that would normally open a new window in a new tab (default)
+
+ 2) browser.link.open_newwindow.restriction
+
+ This has a numeric value that allows us to fine tune the browser.link.open_newwindow
+ pref so that it can discriminate between different techniques for opening windows.
+
+ 0) All things that open windows should behave according to browser.link.open_newwindow.
+ 1) No things that open windows should behave according to browser.link.open_newwindow
+ (essentially rendering browser.link.open_newwindow inert).
+ 2) Most things that open windows should behave according to browser.link.open_newwindow,
+ _except_ for window.open calls with the "feature" parameter. This will open in a new
+ window regardless of what browser.link.open_newwindow is set at. (default)
+
+ This file attempts to test each window opening technique against all possible settings for
+ each preference.
+*/
+
+const kContentDoc =
+ "https://www.example.com/browser/dom/tests/browser/test_new_window_from_content_child.html";
+const kNewWindowPrefKey = "browser.link.open_newwindow";
+const kNewWindowRestrictionPrefKey = "browser.link.open_newwindow.restriction";
+const kSameTab = "same tab";
+const kNewWin = "new window";
+const kNewTab = "new tab";
+
+SpecialPowers.pushPrefEnv({
+ set: [["dom.require_user_interaction_for_beforeunload", false]],
+});
+
+requestLongerTimeout(3);
+
+// The following "matrices" represent the result of content attempting to
+// open a window with window.open with the default feature set. The key of
+// the kWinOpenDefault object represents the value of browser.link.open_newwindow.
+// The value for each key is an array that represents the result (either opening
+// the link in the same tab, a new window, or a new tab), where the index of each
+// result maps to the browser.link.open_newwindow.restriction pref. I've tried
+// to illustrate this more clearly in the kWinOpenDefault object.
+const kWinOpenDefault = {
+ // open_newwindow.restriction
+ // 0 1 2
+ // open_newwindow
+ 1: [kSameTab, kNewWin, kSameTab],
+ 2: [kNewWin, kNewWin, kNewWin],
+ 3: [kNewTab, kNewWin, kNewTab],
+};
+
+const kWinOpenNonDefault = {
+ 1: [kSameTab, kNewWin, kNewWin],
+ 2: [kNewWin, kNewWin, kNewWin],
+ 3: [kNewTab, kNewWin, kNewWin],
+};
+
+const kTargetBlank = {
+ 1: [kSameTab, kSameTab, kSameTab],
+ 2: [kNewWin, kNewWin, kNewWin],
+ 3: [kNewTab, kNewTab, kNewTab],
+};
+
+// We'll be changing these preferences a lot, so we'll stash their original
+// values and make sure we restore them at the end of the test.
+var originalNewWindowPref = Services.prefs.getIntPref(kNewWindowPrefKey);
+var originalNewWindowRestrictionPref = Services.prefs.getIntPref(
+ kNewWindowRestrictionPrefKey
+);
+
+registerCleanupFunction(function () {
+ Services.prefs.setIntPref(kNewWindowPrefKey, originalNewWindowPref);
+ Services.prefs.setIntPref(
+ kNewWindowRestrictionPrefKey,
+ originalNewWindowRestrictionPref
+ );
+});
+
+/**
+ * For some expectation when a link is clicked, creates and
+ * returns a Promise that resolves when that expectation is
+ * fulfilled. For example, aExpectation might be kSameTab, which
+ * will cause this function to return a Promise that resolves when
+ * the current tab attempts to browse to about:blank.
+ *
+ * This function also takes care of cleaning up once the result has
+ * occurred - for example, if a new window was opened, this function
+ * closes it before resolving.
+ *
+ * @param aBrowser the <xul:browser> with the test document
+ * @param aExpectation one of kSameTab, kNewWin, or kNewTab.
+ * @return a Promise that resolves when the expectation is fulfilled,
+ * and cleaned up after.
+ */
+function prepareForResult(aBrowser, aExpectation) {
+ let expectedSpec = kContentDoc.replace(/[^\/]*$/, "dummy.html");
+ switch (aExpectation) {
+ case kSameTab:
+ return (async function () {
+ await BrowserTestUtils.browserLoaded(aBrowser);
+ is(aBrowser.currentURI.spec, expectedSpec, "Should be at dummy.html");
+ // Now put the browser back where it came from
+ BrowserTestUtils.loadURIString(aBrowser, kContentDoc);
+ await BrowserTestUtils.browserLoaded(aBrowser);
+ })();
+ case kNewWin:
+ return (async function () {
+ let newWin = await BrowserTestUtils.waitForNewWindow({
+ url: expectedSpec,
+ });
+ let newBrowser = newWin.gBrowser.selectedBrowser;
+ is(newBrowser.currentURI.spec, expectedSpec, "Should be at dummy.html");
+ await BrowserTestUtils.closeWindow(newWin);
+ })();
+ case kNewTab:
+ return (async function () {
+ let newTab = await BrowserTestUtils.waitForNewTab(gBrowser);
+ is(
+ newTab.linkedBrowser.currentURI.spec,
+ expectedSpec,
+ "Should be at dummy.html"
+ );
+ BrowserTestUtils.removeTab(newTab);
+ })();
+ default:
+ ok(
+ false,
+ "prepareForResult can't handle an expectation of " + aExpectation
+ );
+ return Promise.resolve();
+ }
+}
+
+/**
+ * Ensure that clicks on a link with ID aLinkID cause us to
+ * perform as specified in the supplied aMatrix (kWinOpenDefault,
+ * for example).
+ *
+ * @param aLinkSelector a selector for the link within the testing page to click.
+ * @param aMatrix a testing matrix for the
+ * browser.link.open_newwindow and browser.link.open_newwindow.restriction
+ * prefs to test against. See kWinOpenDefault for an example.
+ */
+function testLinkWithMatrix(aLinkSelector, aMatrix) {
+ return BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: kContentDoc,
+ },
+ async function (browser) {
+ // This nested for-loop is unravelling the matrix const
+ // we set up, and gives us three things through each tick
+ // of the inner loop:
+ // 1) newWindowPref: a browser.link.open_newwindow pref to try
+ // 2) newWindowRestPref: a browser.link.open_newwindow.restriction pref to try
+ // 3) expectation: what we expect the click outcome on this link to be,
+ // which will either be kSameTab, kNewWin or kNewTab.
+ for (let newWindowPref in aMatrix) {
+ let expectations = aMatrix[newWindowPref];
+ for (let i = 0; i < expectations.length; ++i) {
+ let newWindowRestPref = i;
+ let expectation = expectations[i];
+
+ Services.prefs.setIntPref(
+ "browser.link.open_newwindow",
+ newWindowPref
+ );
+ Services.prefs.setIntPref(
+ "browser.link.open_newwindow.restriction",
+ newWindowRestPref
+ );
+ info("Clicking on " + aLinkSelector);
+ info(
+ "Testing with browser.link.open_newwindow = " +
+ newWindowPref +
+ " and " +
+ "browser.link.open_newwindow.restriction = " +
+ newWindowRestPref
+ );
+ info("Expecting: " + expectation);
+ let resultPromise = prepareForResult(browser, expectation);
+ BrowserTestUtils.synthesizeMouseAtCenter(aLinkSelector, {}, browser);
+ await resultPromise;
+ info("Got expectation: " + expectation);
+ }
+ }
+ }
+ );
+}
+
+add_task(async function test_window_open_with_defaults() {
+ await testLinkWithMatrix("#winOpenDefault", kWinOpenDefault);
+});
+
+add_task(async function test_window_open_with_non_defaults() {
+ await testLinkWithMatrix("#winOpenNonDefault", kWinOpenNonDefault);
+});
+
+add_task(async function test_window_open_dialog() {
+ await testLinkWithMatrix("#winOpenDialog", kWinOpenNonDefault);
+});
+
+add_task(async function test_target__blank() {
+ await testLinkWithMatrix("#targetBlank", kTargetBlank);
+});
diff --git a/dom/tests/browser/browser_test_toolbars_visibility.js b/dom/tests/browser/browser_test_toolbars_visibility.js
new file mode 100644
index 0000000000..f313f1549f
--- /dev/null
+++ b/dom/tests/browser/browser_test_toolbars_visibility.js
@@ -0,0 +1,323 @@
+// Tests that toolbars have proper visibility when opening a new window
+// in either content or chrome context.
+
+const ROOT = "http://www.example.com/browser/dom/tests/browser/";
+const CONTENT_PAGE = ROOT + "test_new_window_from_content_child.html";
+const TARGET_PAGE = ROOT + "dummy.html";
+
+/**
+ * This function retrieves the visibility state of the toolbars of a
+ * window within the content context.
+ *
+ * @param aBrowser (<xul:browser>)
+ * The browser to query for toolbar visibility states
+ * @returns Promise
+ * A promise that resolves when the toolbar state is retrieved
+ * within the content context, which value is an object that holds
+ * the visibility state of the toolbars
+ */
+function getToolbarsFromBrowserContent(aBrowser) {
+ return SpecialPowers.spawn(aBrowser, [], async function () {
+ // This is still chrome context.
+ // Inject a script that runs on content context, and gather the result.
+
+ let script = content.document.createElement("script");
+ script.textContent = `
+let bars = [
+ "toolbar",
+ "menubar",
+ "personalbar",
+ "statusbar",
+ "scrollbars",
+ "locationbar",
+];
+
+for (let bar of bars) {
+ let node = document.createElement("span");
+ node.id = bar;
+ node.textContent = window[bar].visible;
+ document.body.appendChild(node);
+}
+`;
+ content.document.body.appendChild(script);
+
+ let result = {};
+
+ let bars = [
+ "toolbar",
+ "menubar",
+ "personalbar",
+ "statusbar",
+ "scrollbars",
+ "locationbar",
+ ];
+
+ for (let bar of bars) {
+ let node = content.document.getElementById(bar);
+ let value = node.textContent;
+ if (value !== "true" && value !== "false") {
+ throw new Error("bar visibility isn't set");
+ }
+ result[bar] = value === "true";
+ node.remove();
+ }
+
+ return result;
+ });
+}
+
+/**
+ * This function retrieves the visibility state of the toolbars of a
+ * window within the chrome context.
+ *
+ * @param win
+ * the chrome privileged window
+ * @returns object
+ * an object that holds the visibility state of the toolbars
+ */
+function getToolbarsFromWindowChrome(win) {
+ return {
+ toolbar: win.toolbar.visible,
+ menubar: win.menubar.visible,
+ personalbar: win.personalbar.visible,
+ statusbar: win.statusbar.visible,
+ scrollbars: win.scrollbars.visible,
+ locationbar: win.locationbar.visible,
+ };
+}
+
+/**
+ * Tests toolbar visibility when opening a window with default parameters.
+ *
+ * @param toolbars
+ * the visibility state of the toolbar elements
+ */
+function testDefaultToolbars(toolbars) {
+ ok(
+ toolbars.locationbar,
+ "locationbar should be visible on default window.open()"
+ );
+ ok(toolbars.menubar, "menubar be visible on default window.open()");
+ ok(
+ toolbars.personalbar,
+ "personalbar should be visible on default window.open()"
+ );
+ ok(
+ toolbars.statusbar,
+ "statusbar should be visible on default window.open()"
+ );
+ ok(
+ toolbars.scrollbars,
+ "scrollbars should be visible on default window.open()"
+ );
+ ok(toolbars.toolbar, "toolbar should be visible on default window.open()");
+}
+
+/**
+ * Tests toolbar visibility when opening a popup window on the content context,
+ * and reading the value from context context.
+ *
+ * @param toolbars
+ * the visibility state of the toolbar elements
+ */
+function testNonDefaultContentToolbarsFromContent(toolbars) {
+ // Accessing BarProp.visible from content context should return false for
+ // popup, regardless of the each feature value in window.open parameter.
+ ok(!toolbars.locationbar, "locationbar.visible should be false for popup");
+ ok(!toolbars.menubar, "menubar.visible should be false for popup");
+ ok(!toolbars.personalbar, "personalbar.visible should be false for popup");
+ ok(!toolbars.statusbar, "statusbar.visible should be false for popup");
+ ok(!toolbars.scrollbars, "scrollbars.visible should be false for popup");
+ ok(!toolbars.toolbar, "toolbar.visible should be false for popup");
+}
+
+/**
+ * Tests toolbar visibility when opening a popup window on the content context,
+ * and reading the value from chrome context.
+ *
+ * @param toolbars
+ * the visibility state of the toolbar elements
+ */
+function testNonDefaultContentToolbarsFromChrome(toolbars) {
+ // Accessing BarProp.visible from chrome context should return the
+ // actual visibility.
+
+ // Locationbar should always be visible on content context
+ ok(
+ toolbars.locationbar,
+ "locationbar should be visible even with location=no"
+ );
+ ok(!toolbars.menubar, "menubar shouldn't be visible when menubar=no");
+ ok(
+ !toolbars.personalbar,
+ "personalbar shouldn't be visible when personalbar=no"
+ );
+ // statusbar will report visible=true even when it's hidden because of bug#55820
+ todo(!toolbars.statusbar, "statusbar shouldn't be visible when status=no");
+ ok(
+ toolbars.scrollbars,
+ "scrollbars should be visible even with scrollbars=no"
+ );
+ ok(!toolbars.toolbar, "toolbar shouldn't be visible when toolbar=no");
+}
+
+/**
+ * Tests toolbar visibility when opening a window with non default parameters
+ * on the chrome context.
+ *
+ * @param toolbars
+ * the visibility state of the toolbar elements
+ */
+function testNonDefaultChromeToolbars(toolbars) {
+ // None of the toolbars should be visible if hidden with chrome privileges
+ ok(
+ !toolbars.locationbar,
+ "locationbar should not be visible with location=no"
+ );
+ ok(!toolbars.menubar, "menubar should not be visible with menubar=no");
+ ok(
+ !toolbars.personalbar,
+ "personalbar should not be visible with personalbar=no"
+ );
+ ok(!toolbars.statusbar, "statusbar should not be visible with status=no");
+ ok(
+ toolbars.scrollbars,
+ "scrollbars should be visible even with scrollbars=no"
+ );
+ ok(!toolbars.toolbar, "toolbar should not be visible with toolbar=no");
+}
+
+/**
+ * Ensure that toolbars of a window opened in the content context have the
+ * correct visibility.
+ *
+ * A window opened with default parameters should have all toolbars visible.
+ *
+ * A window opened with "location=no, personalbar=no, toolbar=no, scrollbars=no,
+ * menubar=no, status=no", should only have location visible.
+ */
+add_task(async function () {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: CONTENT_PAGE,
+ },
+ async function (browser) {
+ // First, call the default window.open() which will open a new tab
+ let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#winOpenDefault",
+ {},
+ browser
+ );
+ let tab = await newTabPromise;
+
+ // Check that all toolbars are visible
+ let toolbars = await getToolbarsFromBrowserContent(
+ gBrowser.selectedBrowser
+ );
+ testDefaultToolbars(toolbars);
+
+ // Cleanup
+ BrowserTestUtils.removeTab(tab);
+
+ // Now let's open a window with toolbars hidden
+ let winPromise = BrowserTestUtils.waitForNewWindow({ url: TARGET_PAGE });
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#winOpenNonDefault",
+ {},
+ browser
+ );
+ let popupWindow = await winPromise;
+
+ let popupBrowser = popupWindow.gBrowser.selectedBrowser;
+
+ // Test toolbars visibility value from content.
+ let popupToolbars = await getToolbarsFromBrowserContent(popupBrowser);
+ testNonDefaultContentToolbarsFromContent(popupToolbars);
+
+ // Test toolbars visibility value from chrome.
+ let chromeToolbars = getToolbarsFromWindowChrome(popupWindow);
+ testNonDefaultContentToolbarsFromChrome(chromeToolbars);
+
+ // Close the new window
+ await BrowserTestUtils.closeWindow(popupWindow);
+ }
+ );
+});
+
+/**
+ * Ensure that toolbars of a window opened to about:blank in the content context
+ * have the correct visibility.
+ *
+ * A window opened with "location=no, personalbar=no, toolbar=no, scrollbars=no,
+ * menubar=no, status=no", should only have location visible.
+ */
+add_task(async function () {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: CONTENT_PAGE,
+ },
+ async function (browser) {
+ // Open a blank window with toolbars hidden
+ let winPromise = BrowserTestUtils.waitForNewWindow();
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#winOpenNoURLNonDefault",
+ {},
+ browser
+ );
+ let popupWindow = await winPromise;
+
+ // No need to wait for this window to load, since it's loading about:blank
+ let popupBrowser = popupWindow.gBrowser.selectedBrowser;
+ let popupToolbars = await getToolbarsFromBrowserContent(popupBrowser);
+ testNonDefaultContentToolbarsFromContent(popupToolbars);
+
+ let chromeToolbars = getToolbarsFromWindowChrome(popupWindow);
+ testNonDefaultContentToolbarsFromChrome(chromeToolbars);
+
+ // Close the new window
+ await BrowserTestUtils.closeWindow(popupWindow);
+ }
+ );
+});
+
+/**
+ * Ensure that toolbars of a window opened in the chrome context have the
+ * correct visibility.
+ *
+ * A window opened with default parameters should have all toolbars visible.
+ *
+ * A window opened with "location=no, personalbar=no, toolbar=no, scrollbars=no,
+ * menubar=no, status=no", should not have any toolbar visible.
+ */
+add_task(async function () {
+ // First open a default window from this chrome context
+ let defaultWindowPromise = BrowserTestUtils.waitForNewWindow({
+ url: TARGET_PAGE,
+ });
+ window.open(TARGET_PAGE, "_blank", "noopener");
+ let defaultWindow = await defaultWindowPromise;
+
+ // Check that all toolbars are visible
+ let toolbars = getToolbarsFromWindowChrome(defaultWindow);
+ testDefaultToolbars(toolbars);
+
+ // Now lets open a window with toolbars hidden from this chrome context
+ let features =
+ "location=no, personalbar=no, toolbar=no, scrollbars=no, menubar=no, status=no, noopener";
+ let popupWindowPromise = BrowserTestUtils.waitForNewWindow({
+ url: TARGET_PAGE,
+ });
+ window.open(TARGET_PAGE, "_blank", features);
+ let popupWindow = await popupWindowPromise;
+
+ // Test none of the tooolbars are visible
+ let hiddenToolbars = getToolbarsFromWindowChrome(popupWindow);
+ testNonDefaultChromeToolbars(hiddenToolbars);
+
+ // Cleanup
+ await BrowserTestUtils.closeWindow(defaultWindow);
+ await BrowserTestUtils.closeWindow(popupWindow);
+});
diff --git a/dom/tests/browser/browser_unlinkable_about_page_can_load_module_scripts.js b/dom/tests/browser/browser_unlinkable_about_page_can_load_module_scripts.js
new file mode 100644
index 0000000000..ca4f9a7bc3
--- /dev/null
+++ b/dom/tests/browser/browser_unlinkable_about_page_can_load_module_scripts.js
@@ -0,0 +1,83 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+"use strict";
+
+const kTestPage = getRootDirectory(gTestPath) + "file_load_module_script.html";
+
+const kDefaultFlags =
+ Ci.nsIAboutModule.ALLOW_SCRIPT |
+ Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD |
+ Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
+ Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT;
+
+const kAboutPagesRegistered = Promise.all([
+ BrowserTestUtils.registerAboutPage(
+ registerCleanupFunction,
+ "test-linkable-page",
+ kTestPage,
+ kDefaultFlags | Ci.nsIAboutModule.MAKE_LINKABLE
+ ),
+ BrowserTestUtils.registerAboutPage(
+ registerCleanupFunction,
+ "test-unlinkable-page",
+ kTestPage,
+ kDefaultFlags
+ ),
+]);
+
+add_task(async function () {
+ await kAboutPagesRegistered;
+
+ let consoleListener = {
+ observe() {
+ errorCount++;
+ if (shouldHaveJSError) {
+ ok(true, "JS error is expected and received");
+ } else {
+ ok(false, "Unexpected JS error was received");
+ }
+ },
+ };
+ Services.console.registerListener(consoleListener);
+ registerCleanupFunction(() =>
+ Services.console.unregisterListener(consoleListener)
+ );
+
+ let shouldHaveJSError = true;
+ let errorCount = 0;
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: "about:test-linkable-page" },
+ async browser => {
+ await SpecialPowers.spawn(browser, [], () => {
+ isnot(
+ content.document.body.textContent,
+ "scriptLoaded",
+ "The page content shouldn't be changed on the linkable page"
+ );
+ });
+ }
+ );
+ ok(
+ errorCount > 0,
+ "Should have an error when loading test-linkable-page, got " + errorCount
+ );
+
+ shouldHaveJSError = false;
+ errorCount = 0;
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: "about:test-unlinkable-page" },
+ async browser => {
+ await SpecialPowers.spawn(browser, [], () => {
+ is(
+ content.document.body.textContent,
+ "scriptLoaded",
+ "The page content should be changed on the unlinkable page"
+ );
+ });
+ }
+ );
+ is(errorCount, 0, "Should have no errors when loading test-unlinkable-page");
+});
diff --git a/dom/tests/browser/browser_wakelock.js b/dom/tests/browser/browser_wakelock.js
new file mode 100644
index 0000000000..5cef231d07
--- /dev/null
+++ b/dom/tests/browser/browser_wakelock.js
@@ -0,0 +1,40 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+"use strict";
+
+add_task(async () => {
+ info("creating test window");
+ let win = await BrowserTestUtils.openNewBrowserWindow();
+
+ const pm = Cc["@mozilla.org/power/powermanagerservice;1"].getService(
+ Ci.nsIPowerManagerService
+ );
+
+ is(
+ pm.getWakeLockState("screen"),
+ "unlocked",
+ "Wakelock should be unlocked state"
+ );
+
+ info("aquiring wakelock");
+ const wakelock = pm.newWakeLock("screen", win);
+ isnot(
+ pm.getWakeLockState("screen"),
+ "unlocked",
+ "Wakelock shouldn't be unlocked state"
+ );
+
+ info("releasing wakelock");
+ wakelock.unlock();
+ is(
+ pm.getWakeLockState("screen"),
+ "unlocked",
+ "Wakelock should be unlocked state"
+ );
+
+ info("closing test window");
+ await BrowserTestUtils.closeWindow(win);
+});
diff --git a/dom/tests/browser/browser_windowProxy_transplant.js b/dom/tests/browser/browser_windowProxy_transplant.js
new file mode 100644
index 0000000000..9001437a2d
--- /dev/null
+++ b/dom/tests/browser/browser_windowProxy_transplant.js
@@ -0,0 +1,215 @@
+"use strict";
+
+const DIRPATH = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content/",
+ ""
+);
+const PATH = DIRPATH + "file_postMessage_parent.html";
+
+const URL1 = `http://mochi.test:8888/${PATH}`;
+const URL2 = `http://example.com/${PATH}`;
+const URL3 = `http://example.org/${PATH}`;
+
+// A bunch of boilerplate which needs to be dealt with.
+add_task(async function () {
+ // Turn on BC preservation and frameloader rebuilding to ensure that the
+ // BrowsingContext is preserved.
+ await SpecialPowers.pushPrefEnv({
+ set: [["fission.preserve_browsing_contexts", true]],
+ });
+
+ // Open a window with fission force-enabled in it.
+ let win = await BrowserTestUtils.openNewBrowserWindow({
+ fission: true,
+ remote: true,
+ });
+ try {
+ // Get the tab & browser to perform the test in.
+ let tab = win.gBrowser.selectedTab;
+ let browser = tab.linkedBrowser;
+
+ // Start loading the original URI, then wait until it is loaded.
+ BrowserTestUtils.loadURIString(browser, URL1);
+ await BrowserTestUtils.browserLoaded(browser, false, URL1);
+
+ info("Chrome script has loaded initial URI.");
+ await SpecialPowers.spawn(
+ browser,
+ [{ URL1, URL2, URL3 }],
+ async ({ URL1, URL2, URL3 }) => {
+ let iframe = content.document.createElement("iframe");
+ content.document.body.appendChild(iframe);
+
+ info("Chrome script created iframe");
+
+ // Here and below, we have to store references to things in the
+ // iframes on the content window, because all chrome references
+ // to content will be turned into dead wrappers when the iframes
+ // are closed.
+ content.win0 = iframe.contentWindow;
+ content.bc0 = iframe.browsingContext;
+
+ ok(
+ !Cu.isDeadWrapper(content.win0),
+ "win0 shouldn't be a dead wrapper before navigation"
+ );
+
+ // Helper for waiting for a load.
+ function waitLoad() {
+ return new Promise(resolve => {
+ iframe.addEventListener(
+ "load",
+ event => {
+ info("Got an iframe load event!");
+ resolve();
+ },
+ { once: true }
+ );
+ });
+ }
+
+ function askLoad(url) {
+ info("Chrome script asking for load of " + url);
+ iframe.contentWindow.postMessage(
+ {
+ action: "navigate",
+ location: url,
+ },
+ "*"
+ );
+ info("Chrome script done calling PostMessage");
+ }
+
+ // Check that BC and WindowProxy are preserved across navigations.
+ iframe.contentWindow.location = URL1;
+ await waitLoad();
+
+ content.win1 = iframe.contentWindow;
+ let chromeWin1 = iframe.contentWindow;
+ let chromeWin1x = Cu.waiveXrays(iframe.contentWindow);
+ content.win1x = Cu.waiveXrays(iframe.contentWindow);
+
+ ok(chromeWin1 != chromeWin1x, "waiving xrays creates a new thing?");
+
+ content.bc1 = iframe.browsingContext;
+
+ is(
+ content.bc0,
+ content.bc1,
+ "same to same-origin BrowsingContext match"
+ );
+ is(content.win0, content.win1, "same to same-origin WindowProxy match");
+
+ ok(
+ !Cu.isDeadWrapper(content.win1),
+ "win1 shouldn't be a dead wrapper before navigation"
+ );
+ ok(
+ !Cu.isDeadWrapper(chromeWin1),
+ "chromeWin1 shouldn't be a dead wrapper before navigation"
+ );
+
+ askLoad(URL2);
+ await waitLoad();
+
+ content.win2 = iframe.contentWindow;
+ content.bc2 = iframe.browsingContext;
+
+ // When chrome accesses a remote window proxy in content, the result
+ // should be a remote outer window proxy in the chrome compartment, not an
+ // Xray wrapper around the content remote window proxy. The former will
+ // throw a security error, because @@toPrimitive can't be called cross
+ // process, while the latter will result in an opaque wrapper, because
+ // XPConnect doesn't know what to do when trying to create an Xray wrapper
+ // around a remote outer window proxy. See bug 1556845.
+ Assert.throws(
+ () => {
+ dump("content.win1 " + content.win1 + "\n");
+ },
+ /SecurityError: Permission denied to access property Symbol.toPrimitive on cross-origin object/,
+ "Should get a remote outer window proxy when accessing old window proxy"
+ );
+ Assert.throws(
+ () => {
+ dump("content.win2 " + content.win2 + "\n");
+ },
+ /SecurityError: Permission denied to access property Symbol.toPrimitive on cross-origin object/,
+ "Should get a remote outer window proxy when accessing new window proxy"
+ );
+
+ // If we fail to transplant existing non-remote outer window proxies, then
+ // after we navigate the iframe existing chrome references to the window will
+ // become dead wrappers. Also check content.win1 for thoroughness, though
+ // we don't nuke content-content references.
+ ok(
+ !Cu.isDeadWrapper(content.win1),
+ "win1 shouldn't be a dead wrapper after navigation"
+ );
+ ok(
+ !Cu.isDeadWrapper(chromeWin1),
+ "chromeWin1 shouldn't be a dead wrapper after navigation"
+ );
+ ok(
+ Cu.isDeadWrapper(chromeWin1x),
+ "chromeWin1x should be a dead wrapper after navigation"
+ );
+ ok(
+ Cu.isDeadWrapper(content.win1x),
+ "content.win1x should be a dead wrapper after navigation"
+ );
+
+ is(
+ content.bc1,
+ content.bc2,
+ "same to cross-origin navigation BrowsingContext match"
+ );
+ is(
+ content.win1,
+ content.win2,
+ "same to cross-origin navigation WindowProxy match"
+ );
+
+ ok(
+ !Cu.isDeadWrapper(content.win1),
+ "win1 shouldn't be a dead wrapper after navigation"
+ );
+
+ askLoad(URL3);
+ await waitLoad();
+
+ content.win3 = iframe.contentWindow;
+ content.bc3 = iframe.browsingContext;
+
+ is(
+ content.bc2,
+ content.bc3,
+ "cross to cross-origin navigation BrowsingContext match"
+ );
+ is(
+ content.win2,
+ content.win3,
+ "cross to cross-origin navigation WindowProxy match"
+ );
+
+ askLoad(URL1);
+ await waitLoad();
+
+ content.win4 = iframe.contentWindow;
+ content.bc4 = iframe.browsingContext;
+
+ is(
+ content.bc3,
+ content.bc4,
+ "cross to same-origin navigation BrowsingContext match"
+ );
+ is(
+ content.win3,
+ content.win4,
+ "cross to same-origin navigation WindowProxy match"
+ );
+ }
+ );
+ } finally {
+ await BrowserTestUtils.closeWindow(win);
+ }
+});
diff --git a/dom/tests/browser/browser_xhr_sandbox.js b/dom/tests/browser/browser_xhr_sandbox.js
new file mode 100644
index 0000000000..cca69b916b
--- /dev/null
+++ b/dom/tests/browser/browser_xhr_sandbox.js
@@ -0,0 +1,62 @@
+// This code is evaluated in a sandbox courtesy of toSource();
+var sandboxCode =
+ function () {
+ let req = new XMLHttpRequest();
+ req.open("GET", "http://mochi.test:8888/browser/dom/tests/browser/", true);
+ req.onreadystatechange = function () {
+ if (req.readyState === 4) {
+ // If we get past the problem above, we end up with a req.status of zero
+ // (ie, blocked due to CORS) even though we are fetching from the same
+ // origin as the window itself.
+ let result;
+ if (req.status != 200) {
+ result = "ERROR: got request status of " + req.status;
+ } else if (!req.responseText.length) {
+ result = "ERROR: got zero byte response text";
+ } else {
+ result = "ok";
+ }
+ postMessage({ result }, "*");
+ }
+ };
+ req.send(null);
+ }.toSource() + "();";
+
+add_task(async function test() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["security.allow_unsafe_parent_loads", true]],
+ });
+
+ let newWin = await BrowserTestUtils.openNewBrowserWindow();
+
+ let frame = newWin.document.createXULElement("iframe");
+ frame.setAttribute("type", "content");
+ frame.setAttribute(
+ "src",
+ "http://mochi.test:8888/browser/dom/tests/browser/browser_xhr_sandbox.js"
+ );
+
+ newWin.document.documentElement.appendChild(frame);
+ await BrowserTestUtils.waitForEvent(frame, "load", true);
+
+ let contentWindow = frame.contentWindow;
+ let sandbox = new Cu.Sandbox(contentWindow);
+
+ // inject some functions from the window into the sandbox.
+ // postMessage so the async code in the sandbox can report a result.
+ sandbox.importFunction(
+ contentWindow.postMessage.bind(contentWindow),
+ "postMessage"
+ );
+ sandbox.importFunction(contentWindow.XMLHttpRequest, "XMLHttpRequest");
+ Cu.evalInSandbox(sandboxCode, sandbox, "1.8");
+
+ let sandboxReply = await BrowserTestUtils.waitForEvent(
+ contentWindow,
+ "message",
+ true
+ );
+ is(sandboxReply.data.result, "ok", "check the sandbox code was felipe");
+
+ await BrowserTestUtils.closeWindow(newWin);
+});
diff --git a/dom/tests/browser/create_webrtc_peer_connection.html b/dom/tests/browser/create_webrtc_peer_connection.html
new file mode 100644
index 0000000000..ee993d4892
--- /dev/null
+++ b/dom/tests/browser/create_webrtc_peer_connection.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<script>
+const gConnections = [];
+
+window.addEventListener("message", event => {
+ const ackTarget = window.parent ? window.parent : window;
+ switch (event.data) {
+ case "push-peer-connection":
+ gConnections.push(new RTCPeerConnection());
+ ackTarget.postMessage("ack", "*");
+ break;
+ case "pop-peer-connection":
+ gConnections.pop().close();
+ ackTarget.postMessage("ack", "*");
+ break;
+ }
+});
+
+window.addEventListener("DOMContentLoaded", function(ev) {
+ document.getElementById("msg").innerText = location.host;
+});
+</script>
+</head>
+<body><div id="msg"></div></body>
+</html>
diff --git a/dom/tests/browser/dummy.html b/dom/tests/browser/dummy.html
new file mode 100644
index 0000000000..6ec72c2160
--- /dev/null
+++ b/dom/tests/browser/dummy.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+<head>
+<title>Dummy test page</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
+</head>
+<body>
+<p>Dummy test page</p>
+<script>
+ localStorage.setItem("foo", "bar");
+</script>
+</body>
+</html>
diff --git a/dom/tests/browser/dummy.png b/dom/tests/browser/dummy.png
new file mode 100644
index 0000000000..a1089af09b
--- /dev/null
+++ b/dom/tests/browser/dummy.png
Binary files differ
diff --git a/dom/tests/browser/file_bug1685807.html b/dom/tests/browser/file_bug1685807.html
new file mode 100644
index 0000000000..9e35fa1730
--- /dev/null
+++ b/dom/tests/browser/file_bug1685807.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+</head>
+<body>
+<script>
+ window.onload = () => {
+ opener.location.href = "about:blank";
+ window.close();
+ };
+</script>
+</body>
+</html>
diff --git a/dom/tests/browser/file_coop_coep.html b/dom/tests/browser/file_coop_coep.html
new file mode 100644
index 0000000000..f77ef9d5f2
--- /dev/null
+++ b/dom/tests/browser/file_coop_coep.html
@@ -0,0 +1,6 @@
+<html>
+ <body>
+ <div id="host1"></div>
+ <div id="host3"></div>
+ </body>
+</html>
diff --git a/dom/tests/browser/file_coop_coep.html^headers^ b/dom/tests/browser/file_coop_coep.html^headers^
new file mode 100644
index 0000000000..63b60e490f
--- /dev/null
+++ b/dom/tests/browser/file_coop_coep.html^headers^
@@ -0,0 +1,2 @@
+Cross-Origin-Opener-Policy: same-origin
+Cross-Origin-Embedder-Policy: require-corp
diff --git a/dom/tests/browser/file_empty.html b/dom/tests/browser/file_empty.html
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/browser/file_empty.html
diff --git a/dom/tests/browser/file_empty_cross_site_frame.html b/dom/tests/browser/file_empty_cross_site_frame.html
new file mode 100644
index 0000000000..fb134786f6
--- /dev/null
+++ b/dom/tests/browser/file_empty_cross_site_frame.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<iframe src="http://example.com/browser/dom/tests/browser/file_empty.html"></iframe>
diff --git a/dom/tests/browser/file_load_module_script.html b/dom/tests/browser/file_load_module_script.html
new file mode 100644
index 0000000000..004c727bb4
--- /dev/null
+++ b/dom/tests/browser/file_load_module_script.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Security-Policy" content="default-src chrome:; object-src 'none'"/>
+ <script type="module" src="chrome://mochitests/content/browser/dom/tests/browser/file_module_loaded.js"></script>
+</head>
+<body></body>
+</html>
diff --git a/dom/tests/browser/file_module_loaded.js b/dom/tests/browser/file_module_loaded.js
new file mode 100644
index 0000000000..8763889e1f
--- /dev/null
+++ b/dom/tests/browser/file_module_loaded.js
@@ -0,0 +1,6 @@
+"use strict";
+
+import setBodyText from "chrome://mochitests/content/browser/dom/tests/browser/file_module_loaded2.js";
+document.addEventListener("DOMContentLoaded", () => {
+ setBodyText();
+});
diff --git a/dom/tests/browser/file_module_loaded2.js b/dom/tests/browser/file_module_loaded2.js
new file mode 100644
index 0000000000..28b26cd16e
--- /dev/null
+++ b/dom/tests/browser/file_module_loaded2.js
@@ -0,0 +1,3 @@
+export default function setBodyText() {
+ document.body.textContent = "scriptLoaded";
+}
diff --git a/dom/tests/browser/file_postMessage_parent.html b/dom/tests/browser/file_postMessage_parent.html
new file mode 100644
index 0000000000..f9aa63a8c7
--- /dev/null
+++ b/dom/tests/browser/file_postMessage_parent.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<script>
+ dump("Content running top level script " + window.location.href + "\n");
+
+ var winID = SpecialPowers.wrap(this).windowGlobalChild.innerWindowId;
+
+ var observer = {
+ observe(subject, topic) {
+ var currID = SpecialPowers.wrap(subject).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
+ if (currID != winID) {
+ return;
+ }
+ // We should be able to wrap the inner window when the outer
+ // window has navigated out of process.
+ SpecialPowers.Cu.getGlobalForObject({});
+
+ SpecialPowers.removeObserver(observer, "inner-window-nuked");
+ }
+ };
+ SpecialPowers.addObserver(observer, "inner-window-nuked");
+
+ // Unfortunately, we don't currently fire the onload event on a remote iframe,
+ // so we can't listen for the load event directly on the iframe. Instead, we
+ // postMessage from the iframe when the load event would be fired.
+ window.addEventListener("load", function onload() {
+ dump("Content got load of " + window.location.href + "\n");
+ if (window.parent) {
+ window.parent.postMessage({
+ event: "load",
+ location: window.location.href,
+ }, "*");
+ }
+
+ let h1 = document.createElement("h1");
+ h1.textContent = window.location.href;
+ document.body.appendChild(h1);
+ }, { once: true });
+
+ // In addition, we listen to the message event to trigger navigations of
+ // ourself when requested, as we don't fully support our embedder triggering
+ // us being navigated yet for Totally Not Buggy Reasons.
+ window.addEventListener("message", function onmessage(event) {
+ dump("Content got event " + window.location.href + " " + JSON.stringify(event.data) + "\n");
+ if (event.data.action === "navigate") {
+ window.location = event.data.location;
+ }
+ });
+</script>
diff --git a/dom/tests/browser/focus_after_prompt.html b/dom/tests/browser/focus_after_prompt.html
new file mode 100644
index 0000000000..db60d19189
--- /dev/null
+++ b/dom/tests/browser/focus_after_prompt.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Cursor should not be lost after prompt</title>
+ <script type="application/javascript">
+ function init() {
+ document.getElementById("edit").contentWindow.document.designMode = "on";
+ }
+ </script>
+</head>
+
+<body onload="init()">
+ <div id="clickMeDiv" onclick="prompt('This is a dummy prompt!');"
+ onmousedown="return false;">Click me!</div>
+ <iframe id="edit"></iframe>
+</body>
+</html>
diff --git a/dom/tests/browser/geo_leak_test.html b/dom/tests/browser/geo_leak_test.html
new file mode 100644
index 0000000000..fb3fabac40
--- /dev/null
+++ b/dom/tests/browser/geo_leak_test.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<title>Geolocation incomplete position leak test</title>
+<script type="text/javascript">
+
+function successCallback(position) {}
+function errorCallback() {}
+
+function init() {
+ navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+}
+</script>
+</head>
+<body onload="init()">
+</body>
+</html>
diff --git a/dom/tests/browser/helper_localStorage.js b/dom/tests/browser/helper_localStorage.js
new file mode 100644
index 0000000000..386d2d8b4e
--- /dev/null
+++ b/dom/tests/browser/helper_localStorage.js
@@ -0,0 +1,302 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// Simple tab wrapper abstracting our messaging mechanism;
+class KnownTab {
+ constructor(name, tab) {
+ this.name = name;
+ this.tab = tab;
+ }
+
+ cleanup() {
+ this.tab = null;
+ }
+}
+
+// Simple data structure class to help us track opened tabs and their pids.
+class KnownTabs {
+ constructor() {
+ this.byPid = new Map();
+ this.byName = new Map();
+ }
+
+ cleanup() {
+ for (let key of this.byPid.keys()) {
+ this.byPid[key] = null;
+ }
+ this.byPid = null;
+ this.byName = null;
+ }
+}
+
+/**
+ * Open our helper page in a tab in its own content process, asserting that it
+ * really is in its own process. We initially load and wait for about:blank to
+ * load, and only then loadURI to our actual page. This is to ensure that
+ * LocalStorageManager has had an opportunity to be created and populate
+ * mOriginsHavingData.
+ *
+ * (nsGlobalWindow will reliably create LocalStorageManager as a side-effect of
+ * the unconditional call to nsGlobalWindow::PreloadLocalStorage. This will
+ * reliably create the StorageDBChild instance, and its corresponding
+ * StorageDBParent will send the set of origins when it is constructed.)
+ */
+async function openTestTab(
+ helperPageUrl,
+ name,
+ knownTabs,
+ shouldLoadInNewProcess
+) {
+ let realUrl = helperPageUrl + "?" + encodeURIComponent(name);
+ // Load and wait for about:blank.
+ let tab = await BrowserTestUtils.openNewForegroundTab({
+ gBrowser,
+ opening: "about:blank",
+ forceNewProcess: true,
+ });
+ ok(!knownTabs.byName.has(name), "tab needs its own name: " + name);
+
+ let knownTab = new KnownTab(name, tab);
+ knownTabs.byName.set(name, knownTab);
+
+ // Now trigger the actual load of our page.
+ BrowserTestUtils.loadURIString(tab.linkedBrowser, realUrl);
+ await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
+
+ let pid = tab.linkedBrowser.frameLoader.remoteTab.osPid;
+ if (shouldLoadInNewProcess) {
+ ok(
+ !knownTabs.byPid.has(pid),
+ "tab should be loaded in new process, pid: " + pid
+ );
+ } else {
+ ok(
+ knownTabs.byPid.has(pid),
+ "tab should be loaded in the same process, new pid: " + pid
+ );
+ }
+
+ if (knownTabs.byPid.has(pid)) {
+ knownTabs.byPid.get(pid).set(name, knownTab);
+ } else {
+ let pidMap = new Map();
+ pidMap.set(name, knownTab);
+ knownTabs.byPid.set(pid, pidMap);
+ }
+
+ return knownTab;
+}
+
+/**
+ * Close all the tabs we opened.
+ */
+async function cleanupTabs(knownTabs) {
+ for (let knownTab of knownTabs.byName.values()) {
+ BrowserTestUtils.removeTab(knownTab.tab);
+ knownTab.cleanup();
+ }
+ knownTabs.cleanup();
+}
+
+/**
+ * Wait for a LocalStorage flush to occur. This notification can occur as a
+ * result of any of:
+ * - The normal, hardcoded 5-second flush timer.
+ * - InsertDBOp seeing a preload op for an origin with outstanding changes.
+ * - Us generating a "domstorage-test-flush-force" observer notification.
+ */
+function waitForLocalStorageFlush() {
+ if (Services.domStorageManager.nextGenLocalStorageEnabled) {
+ return new Promise(resolve => executeSoon(resolve));
+ }
+
+ return new Promise(function (resolve) {
+ let observer = {
+ observe() {
+ SpecialPowers.removeObserver(observer, "domstorage-test-flushed");
+ resolve();
+ },
+ };
+ SpecialPowers.addObserver(observer, "domstorage-test-flushed");
+ });
+}
+
+/**
+ * Trigger and wait for a flush. This is only necessary for forcing
+ * mOriginsHavingData to be updated. Normal operations exposed to content know
+ * to automatically flush when necessary for correctness.
+ *
+ * The notification we're waiting for to verify flushing is fundamentally
+ * ambiguous (see waitForLocalStorageFlush), so we actually trigger the flush
+ * twice and wait twice. In the event there was a race, there will be 3 flush
+ * notifications, but correctness is guaranteed after the second notification.
+ */
+function triggerAndWaitForLocalStorageFlush() {
+ if (Services.domStorageManager.nextGenLocalStorageEnabled) {
+ return new Promise(resolve => executeSoon(resolve));
+ }
+
+ SpecialPowers.notifyObservers(null, "domstorage-test-flush-force");
+ // This first wait is ambiguous...
+ return waitForLocalStorageFlush().then(function () {
+ // So issue a second flush and wait for that.
+ SpecialPowers.notifyObservers(null, "domstorage-test-flush-force");
+ return waitForLocalStorageFlush();
+ });
+}
+
+/**
+ * Clear the origin's storage so that "OriginsHavingData" will return false for
+ * our origin. Note that this is only the case for AsyncClear() which is
+ * explicitly issued against a cache, or AsyncClearAll() which we can trigger
+ * by wiping all storage. However, the more targeted domain clearings that
+ * we can trigger via observer, AsyncClearMatchingOrigin and
+ * AsyncClearMatchingOriginAttributes will not clear the hashtable entry for
+ * the origin.
+ *
+ * So we explicitly access the cache here in the parent for the origin and issue
+ * an explicit clear. Clearing all storage might be a little easier but seems
+ * like asking for intermittent failures.
+ */
+function clearOriginStorageEnsuringNoPreload(origin) {
+ let principal =
+ Services.scriptSecurityManager.createContentPrincipalFromOrigin(origin);
+
+ if (Services.domStorageManager.nextGenLocalStorageEnabled) {
+ let request = Services.qms.clearStoragesForPrincipal(
+ principal,
+ "default",
+ "ls"
+ );
+ let promise = new Promise(resolve => {
+ request.callback = () => {
+ resolve();
+ };
+ });
+ return promise;
+ }
+
+ // We want to use createStorage to force the cache to be created so we can
+ // issue the clear. It's possible for getStorage to return false but for the
+ // origin preload hash to still have our origin in it.
+ let storage = Services.domStorageManager.createStorage(
+ null,
+ principal,
+ principal,
+ ""
+ );
+ storage.clear();
+
+ // We also need to trigger a flush os that mOriginsHavingData gets updated.
+ // The inherent flush race is fine here because
+ return triggerAndWaitForLocalStorageFlush();
+}
+
+async function verifyTabPreload(knownTab, expectStorageExists, origin) {
+ let storageExists = await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [origin],
+ function (origin) {
+ let principal =
+ Services.scriptSecurityManager.createContentPrincipalFromOrigin(origin);
+ if (Services.domStorageManager.nextGenLocalStorageEnabled) {
+ return Services.domStorageManager.isPreloaded(principal);
+ }
+ return !!Services.domStorageManager.getStorage(
+ null,
+ principal,
+ principal
+ );
+ }
+ );
+ is(storageExists, expectStorageExists, "Storage existence === preload");
+}
+
+/**
+ * Instruct the given tab to execute the given series of mutations. For
+ * simplicity, the mutations representation matches the expected events rep.
+ */
+async function mutateTabStorage(knownTab, mutations, sentinelValue) {
+ await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [{ mutations, sentinelValue }],
+ function (args) {
+ return content.wrappedJSObject.mutateStorage(Cu.cloneInto(args, content));
+ }
+ );
+}
+
+/**
+ * Instruct the given tab to add a "storage" event listener and record all
+ * received events. verifyTabStorageEvents is the corresponding method to
+ * check and assert the recorded events.
+ */
+async function recordTabStorageEvents(knownTab, sentinelValue) {
+ await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [sentinelValue],
+ function (sentinelValue) {
+ return content.wrappedJSObject.listenForStorageEvents(sentinelValue);
+ }
+ );
+}
+
+/**
+ * Retrieve the current localStorage contents perceived by the tab and assert
+ * that they match the provided expected state.
+ *
+ * If maybeSentinel is non-null, it's assumed to be a string that identifies the
+ * value we should be waiting for the sentinel key to take on. This is
+ * necessary because we cannot make any assumptions about when state will be
+ * propagated to the given process. See the comments in
+ * page_localstorage_e10s.js for more context. In general, a sentinel value is
+ * required for correctness unless the process in question is the one where the
+ * writes were performed or verifyTabStorageEvents was used.
+ */
+async function verifyTabStorageState(knownTab, expectedState, maybeSentinel) {
+ let actualState = await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [maybeSentinel],
+ function (maybeSentinel) {
+ return content.wrappedJSObject.getStorageState(maybeSentinel);
+ }
+ );
+
+ for (let [expectedKey, expectedValue] of Object.entries(expectedState)) {
+ ok(actualState.hasOwnProperty(expectedKey), "key present: " + expectedKey);
+ is(actualState[expectedKey], expectedValue, "value correct");
+ }
+ for (let actualKey of Object.keys(actualState)) {
+ if (!expectedState.hasOwnProperty(actualKey)) {
+ ok(false, "actual state has key it shouldn't have: " + actualKey);
+ }
+ }
+}
+
+/**
+ * Retrieve and clear the storage events recorded by the tab and assert that
+ * they match the provided expected events. For simplicity, the expected events
+ * representation is the same as that used by mutateTabStorage.
+ *
+ * Note that by convention for test readability we are passed a 3rd argument of
+ * the sentinel value, but we don't actually care what it is.
+ */
+async function verifyTabStorageEvents(knownTab, expectedEvents) {
+ let actualEvents = await SpecialPowers.spawn(
+ knownTab.tab.linkedBrowser,
+ [],
+ function () {
+ return content.wrappedJSObject.returnAndClearStorageEvents();
+ }
+ );
+
+ is(actualEvents.length, expectedEvents.length, "right number of events");
+ for (let i = 0; i < actualEvents.length; i++) {
+ let [actualKey, actualNewValue, actualOldValue] = actualEvents[i];
+ let [expectedKey, expectedNewValue, expectedOldValue] = expectedEvents[i];
+ is(actualKey, expectedKey, "keys match");
+ is(actualNewValue, expectedNewValue, "new values match");
+ is(actualOldValue, expectedOldValue, "old values match");
+ }
+}
diff --git a/dom/tests/browser/image.html b/dom/tests/browser/image.html
new file mode 100644
index 0000000000..843ebfd1b5
--- /dev/null
+++ b/dom/tests/browser/image.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<img src="dummy.png"></img>
diff --git a/dom/tests/browser/load_forever.sjs b/dom/tests/browser/load_forever.sjs
new file mode 100644
index 0000000000..8f9fdd18a8
--- /dev/null
+++ b/dom/tests/browser/load_forever.sjs
@@ -0,0 +1,15 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+let gResponses = [];
+
+function handleRequest(request, response) {
+ response.seizePower();
+ response.write("HTTP/1.1 200 OK\r\n");
+ response.write("Content-Type: text/plain; charset=utf-8\r\n");
+ response.write("Cache-Control: no-cache, must-revalidate\r\n");
+ response.write("\r\n");
+
+ // Keep the response alive indefinitely.
+ gResponses.push(response);
+}
diff --git a/dom/tests/browser/mimeme.sjs b/dom/tests/browser/mimeme.sjs
new file mode 100644
index 0000000000..c3c7122979
--- /dev/null
+++ b/dom/tests/browser/mimeme.sjs
@@ -0,0 +1,32 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Small red image.
+const IMG_BYTES = atob(
+ "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12" +
+ "P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
+);
+
+function handleRequest(request, response) {
+ let mimeType = request.queryString.match(/type=([a-z]*)/)[1];
+ switch (mimeType) {
+ case "css":
+ response.setHeader("Content-Type", "text/css");
+ response.write("#hi {color: red}");
+ break;
+ case "js":
+ response.setHeader("Content-Type", "application/javascript");
+ response.write("var foo;");
+ break;
+ case "png":
+ response.setHeader("Content-Type", "image/png");
+ response.write(IMG_BYTES);
+ break;
+ case "html":
+ response.setHeader("Content-Type", "text/html");
+ response.write("<body>I am a subframe</body>");
+ break;
+ }
+}
diff --git a/dom/tests/browser/page_bytecode_cache_asm_js.html b/dom/tests/browser/page_bytecode_cache_asm_js.html
new file mode 100644
index 0000000000..018099cc6d
--- /dev/null
+++ b/dom/tests/browser/page_bytecode_cache_asm_js.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <title>asm.js test</title>
+</head>
+<body>
+ <h1>asm.js test</h1>
+ <span id="result">ok</span>
+ <script src="page_bytecode_cache_asm_js.js"></script>
+</body>
diff --git a/dom/tests/browser/page_bytecode_cache_asm_js.js b/dom/tests/browser/page_bytecode_cache_asm_js.js
new file mode 100644
index 0000000000..03f8a6c0b8
--- /dev/null
+++ b/dom/tests/browser/page_bytecode_cache_asm_js.js
@@ -0,0 +1,30 @@
+window.onerror = function (e) {
+ document.getElementById("result").textContent = e;
+};
+
+function f() {
+ "use asm";
+ function test() {
+ return 10;
+ }
+ return test;
+}
+
+var dummy = [
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+ "dummy text to exceed the minimal source length for bytecode cache",
+];
diff --git a/dom/tests/browser/page_localStorage.js b/dom/tests/browser/page_localStorage.js
new file mode 100644
index 0000000000..4fecf10bcf
--- /dev/null
+++ b/dom/tests/browser/page_localStorage.js
@@ -0,0 +1,127 @@
+/**
+ * Helper page used by browser_localStorage_xxx.js.
+ *
+ * We expose methods to be invoked by SpecialPowers.spawn() calls.
+ * SpecialPowers.spawn() uses the message manager and is PContent-based. When
+ * LocalStorage was PContent-managed, ordering was inherently ensured so we
+ * could assume each page had already received all relevant events. Now some
+ * explicit type of coordination is required.
+ *
+ * This gets complicated because:
+ * - LocalStorage is an ugly API that gives us almost unlimited implementation
+ * flexibility in the face of multiple processes. It's also an API that sites
+ * may misuse which may encourage us to leverage that flexibility in the
+ * future to improve performance at the expense of propagation latency, and
+ * possibly involving content-observable coalescing of events.
+ * - The Quantum DOM effort and its event labeling and separate task queues and
+ * green threading and current LocalStorage implementation mean that using
+ * other PBackground-based APIs such as BroadcastChannel may not provide
+ * reliable ordering guarantees. Specifically, it's hard to guarantee that
+ * a BroadcastChannel postMessage() issued after a series of LocalStorage
+ * writes won't be received by the target window before the writes are
+ * perceived. At least not without constraining the implementations of both
+ * APIs.
+ * - Some of our tests explicitly want to verify LocalStorage behavior without
+ * having a "storage" listener, so we can't add a storage listener if the test
+ * didn't already want one.
+ *
+ * We use 2 approaches for coordination:
+ * 1. If we're already listening for events, we listen for the sentinel value to
+ * be written. This is efficient and appropriate in this case.
+ * 2. If we're not listening for events, we use setTimeout(0) to poll the
+ * localStorage key and value until it changes to our expected value.
+ * setTimeout(0) eventually clamps to setTimeout(4), so in the event we are
+ * experiencing delays, we have reasonable, non-CPU-consuming back-off in
+ * place that leaves the CPU free to time out and fail our test if something
+ * broke. This is ugly but makes us less brittle.
+ *
+ * Both of these involve mutateStorage writing the sentinel value at the end of
+ * the batch. All of our result-returning methods accordingly filter out the
+ * sentinel key/value pair.
+ **/
+
+var pageName = document.location.search.substring(1);
+window.addEventListener("load", () => {
+ document.getElementById("pageNameH").textContent = pageName;
+});
+
+// Key that conveys the end of a write batch. Filtered out from state and
+// events.
+const SENTINEL_KEY = "WRITE_BATCH_SENTINEL";
+
+var storageEventsPromise = null;
+function listenForStorageEvents(sentinelValue) {
+ const recordedEvents = [];
+ storageEventsPromise = new Promise(function (resolve, reject) {
+ window.addEventListener("storage", function thisHandler(event) {
+ if (event.key === SENTINEL_KEY) {
+ // There should be no way for this to have the wrong value, but reject
+ // if it is wrong.
+ if (event.newValue === sentinelValue) {
+ window.removeEventListener("storage", thisHandler);
+ resolve(recordedEvents);
+ } else {
+ reject(event.newValue);
+ }
+ } else {
+ recordedEvents.push([event.key, event.newValue, event.oldValue]);
+ }
+ });
+ });
+}
+
+function mutateStorage({ mutations, sentinelValue }) {
+ mutations.forEach(function ([key, value]) {
+ if (key !== null) {
+ if (value === null) {
+ localStorage.removeItem(key);
+ } else {
+ localStorage.setItem(key, value);
+ }
+ } else {
+ localStorage.clear();
+ }
+ });
+ localStorage.setItem(SENTINEL_KEY, sentinelValue);
+}
+
+// Returns a promise that is resolve when the sentinel key has taken on the
+// sentinel value. Oddly structured to make sure promises don't let us
+// accidentally side-step the timeout clamping logic.
+function waitForSentinelValue(sentinelValue) {
+ return new Promise(function (resolve) {
+ function checkFunc() {
+ if (localStorage.getItem(SENTINEL_KEY) === sentinelValue) {
+ resolve();
+ } else {
+ // I believe linters will only yell at us if we use a non-zero constant.
+ // Other forms of back-off were considered, including attempting to
+ // issue a round-trip through PBackground, but that still potentially
+ // runs afoul of labeling while also making us dependent on unrelated
+ // APIs.
+ setTimeout(checkFunc, 0);
+ }
+ }
+ checkFunc();
+ });
+}
+
+async function getStorageState(maybeSentinel) {
+ if (maybeSentinel) {
+ await waitForSentinelValue(maybeSentinel);
+ }
+
+ let numKeys = localStorage.length;
+ let state = {};
+ for (var iKey = 0; iKey < numKeys; iKey++) {
+ let key = localStorage.key(iKey);
+ if (key !== SENTINEL_KEY) {
+ state[key] = localStorage.getItem(key);
+ }
+ }
+ return state;
+}
+
+function returnAndClearStorageEvents() {
+ return storageEventsPromise;
+}
diff --git a/dom/tests/browser/page_localstorage.html b/dom/tests/browser/page_localstorage.html
new file mode 100644
index 0000000000..aacb0ef6ac
--- /dev/null
+++ b/dom/tests/browser/page_localstorage.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+<script src="page_localStorage.js"></script>
+</head>
+<body><h2 id="pageNameH"></h2></body>
+</html>
diff --git a/dom/tests/browser/page_localstorage_coop+coep.html b/dom/tests/browser/page_localstorage_coop+coep.html
new file mode 100644
index 0000000000..aacb0ef6ac
--- /dev/null
+++ b/dom/tests/browser/page_localstorage_coop+coep.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+<script src="page_localStorage.js"></script>
+</head>
+<body><h2 id="pageNameH"></h2></body>
+</html>
diff --git a/dom/tests/browser/page_localstorage_coop+coep.html^headers^ b/dom/tests/browser/page_localstorage_coop+coep.html^headers^
new file mode 100644
index 0000000000..63b60e490f
--- /dev/null
+++ b/dom/tests/browser/page_localstorage_coop+coep.html^headers^
@@ -0,0 +1,2 @@
+Cross-Origin-Opener-Policy: same-origin
+Cross-Origin-Embedder-Policy: require-corp
diff --git a/dom/tests/browser/page_localstorage_snapshotting.html b/dom/tests/browser/page_localstorage_snapshotting.html
new file mode 100644
index 0000000000..b64f4b8cab
--- /dev/null
+++ b/dom/tests/browser/page_localstorage_snapshotting.html
@@ -0,0 +1,68 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+<script>
+/**
+ * Helper page used by browser_localStorage_snapshotting.js.
+ *
+ * We expose methods to be invoked by ContentTask.spawn() calls.
+ *
+ **/
+var pageName = document.location.search.substring(1);
+window.addEventListener(
+ "load",
+ () => { document.getElementById("pageNameH").textContent = pageName; });
+
+function applyMutations(mutations) {
+ mutations.forEach(function([key, value]) {
+ if (key !== null) {
+ if (value === null) {
+ localStorage.removeItem(key);
+ } else {
+ localStorage.setItem(key, value);
+ }
+ } else {
+ localStorage.clear();
+ }
+ });
+}
+
+function getState() {
+ let state = {};
+ let length = localStorage.length;
+ for (let index = 0; index < length; index++) {
+ let key = localStorage.key(index);
+ state[key] = localStorage.getItem(key);
+ }
+ return state;
+}
+
+function getKeys() {
+ return Object.keys(localStorage);
+}
+
+function beginExplicitSnapshot() {
+ localStorage.beginExplicitSnapshot();
+}
+
+function checkpointExplicitSnapshot() {
+ localStorage.checkpointExplicitSnapshot();
+}
+
+function endExplicitSnapshot() {
+ localStorage.endExplicitSnapshot();
+}
+
+function getHasSnapshot() {
+ return localStorage.hasSnapshot;
+}
+
+function getSnapshotUsage() {
+ return localStorage.snapshotUsage;
+}
+
+</script>
+</head>
+<body><h2 id="pageNameH"></h2></body>
+</html>
diff --git a/dom/tests/browser/page_privatestorageevent.html b/dom/tests/browser/page_privatestorageevent.html
new file mode 100644
index 0000000000..90c2184aee
--- /dev/null
+++ b/dom/tests/browser/page_privatestorageevent.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+la la la la
+</body>
+</html>
diff --git a/dom/tests/browser/perfmetrics/browser.ini b/dom/tests/browser/perfmetrics/browser.ini
new file mode 100644
index 0000000000..b4b1d4b63a
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/browser.ini
@@ -0,0 +1,21 @@
+[DEFAULT]
+prefs =
+ dom.performance.children_results_ipc_timeout=2000
+
+support-files =
+ dummy.html
+ ping_worker.html
+ ping_worker2.html
+ ping_worker.js
+ setinterval.html
+ settimeout.html
+ shared_worker.js
+ unresponsive.html
+ hello.ogg
+ sound.html
+
+[browser_test_performance_metrics.js]
+skip-if = verify
+
+[browser_test_unresponsive.js]
+skip-if = true # Bug 1498426
diff --git a/dom/tests/browser/perfmetrics/browser_test_performance_metrics.js b/dom/tests/browser/perfmetrics/browser_test_performance_metrics.js
new file mode 100644
index 0000000000..65a7aaaee2
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/browser_test_performance_metrics.js
@@ -0,0 +1,201 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const ROOT_URL = "http://example.com/browser/dom/tests/browser/perfmetrics";
+const DUMMY_URL = ROOT_URL + "/dummy.html";
+const WORKER_URL = ROOT_URL + "/ping_worker.html";
+const WORKER_URL2 = ROOT_URL + "/ping_worker2.html";
+const INTERVAL_URL = ROOT_URL + "/setinterval.html";
+const TIMEOUT_URL = ROOT_URL + "/settimeout.html";
+const SOUND_URL = ROOT_URL + "/sound.html";
+const CATEGORY_TIMER = 2;
+
+add_task(async function test() {
+ waitForExplicitFinish();
+
+ // Load 3 pages and wait. The 3rd one has a worker
+ let page1 = await BrowserTestUtils.openNewForegroundTab({
+ gBrowser,
+ opening: "about:about",
+ forceNewProcess: false,
+ });
+
+ let page2 = await BrowserTestUtils.openNewForegroundTab({
+ gBrowser,
+ opening: "about:memory",
+ forceNewProcess: false,
+ });
+
+ let page3 = await BrowserTestUtils.openNewForegroundTab({
+ gBrowser,
+ opening: WORKER_URL,
+ });
+ // load a 4th tab with a worker
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: WORKER_URL2 },
+ async function (browser) {
+ // grab events..
+ let workerDuration = 0;
+ let workerTotal = 0;
+ let duration = 0;
+ let total = 0;
+ let isTopLevel = false;
+ let aboutMemoryFound = false;
+ let parentProcessEvent = false;
+ let subFrameIds = [];
+ let topLevelIds = [];
+ let sharedWorker = false;
+ let counterIds = [];
+ let timerCalls = 0;
+ let heapUsage = 0;
+ let mediaMemory = 0;
+
+ function exploreResults(data, filterByWindowId) {
+ for (let entry of data) {
+ if (filterByWindowId && entry.windowId != filterByWindowId) {
+ continue;
+ }
+ if (!counterIds.includes(entry.pid + ":" + entry.counterId)) {
+ counterIds.push(entry.pid + ":" + entry.counterId);
+ }
+ sharedWorker =
+ entry.host.endsWith("shared_worker.js") || sharedWorker;
+ heapUsage += entry.memoryInfo.jsMemUsage;
+ mediaMemory +=
+ entry.memoryInfo.media.audioSize +
+ entry.memoryInfo.media.resourcesSize;
+ Assert.ok(
+ entry.host != "" || entry.windowId != 0,
+ "An entry should have a host or a windowId"
+ );
+ if (
+ entry.windowId != 0 &&
+ !entry.isToplevel &&
+ !entry.isWorker &&
+ !subFrameIds.includes(entry.windowId)
+ ) {
+ subFrameIds.push(entry.windowId);
+ }
+ if (entry.isTopLevel && !topLevelIds.includes(entry.windowId)) {
+ topLevelIds.push(entry.windowId);
+ }
+ if (entry.host == "example.com" && entry.isTopLevel) {
+ isTopLevel = true;
+ }
+ if (entry.host == "about:memory") {
+ aboutMemoryFound = true;
+ }
+ if (entry.pid == Services.appinfo.processID) {
+ parentProcessEvent = true;
+ }
+ if (entry.isWorker) {
+ workerDuration += entry.duration;
+ } else {
+ duration += entry.duration;
+ }
+ // let's look at the data we got back
+ for (let item of entry.items) {
+ Assert.ok(
+ item.count > 0,
+ "Categories with an empty count are dropped"
+ );
+ if (entry.isWorker) {
+ workerTotal += item.count;
+ } else {
+ total += item.count;
+ }
+ if (item.category == CATEGORY_TIMER) {
+ timerCalls += item.count;
+ }
+ }
+ }
+ }
+
+ // get all metrics via the promise
+ let results = await ChromeUtils.requestPerformanceMetrics();
+ exploreResults(results);
+
+ Assert.greater(workerDuration, 0, "Worker duration should be positive");
+ Assert.greater(workerTotal, 0, "Worker count should be positive");
+ Assert.greater(duration, 0, "Duration should be positive");
+ Assert.greater(total, 0, "Should get a positive count");
+ Assert.ok(parentProcessEvent, "parent process sent back some events");
+ Assert.ok(isTopLevel, "example.com as a top level window");
+ Assert.ok(aboutMemoryFound, "about:memory");
+ Assert.greater(heapUsage, 0, "got some memory value reported");
+ Assert.ok(sharedWorker, "We got some info from a shared worker");
+ let numCounters = counterIds.length;
+ Assert.ok(
+ numCounters > 5,
+ "This test generated at least " + numCounters + " unique counters"
+ );
+
+ // checking that subframes are not orphans
+ for (let frameId of subFrameIds) {
+ Assert.ok(topLevelIds.includes(frameId), "subframe is not orphan ");
+ }
+
+ // Doing a second call, we shoud get bigger values
+ let previousWorkerDuration = workerDuration;
+ let previousWorkerTotal = workerTotal;
+ let previousDuration = duration;
+ let previousTotal = total;
+
+ results = await ChromeUtils.requestPerformanceMetrics();
+ exploreResults(results);
+
+ Assert.ok(
+ workerDuration > previousWorkerDuration,
+ "Worker duration should be positive"
+ );
+ Assert.ok(
+ workerTotal > previousWorkerTotal,
+ "Worker count should be positive"
+ );
+ Assert.greater(duration, previousDuration, "Duration should be positive");
+ Assert.greater(total, previousTotal, "Should get a positive count");
+
+ // load a tab with a setInterval, we should get counters on TaskCategory::Timer
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: INTERVAL_URL },
+ async function (browser) {
+ let tabId = gBrowser.selectedBrowser.outerWindowID;
+ let previousTimerCalls = timerCalls;
+ results = await ChromeUtils.requestPerformanceMetrics();
+ exploreResults(results, tabId);
+ Assert.greater(timerCalls, previousTimerCalls, "Got timer calls");
+ }
+ );
+
+ // load a tab with a setTimeout, we should get counters on TaskCategory::Timer
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: TIMEOUT_URL },
+ async function (browser) {
+ let tabId = gBrowser.selectedBrowser.outerWindowID;
+ let previousTimerCalls = timerCalls;
+ results = await ChromeUtils.requestPerformanceMetrics();
+ exploreResults(results, tabId);
+ Assert.greater(timerCalls, previousTimerCalls, "Got timer calls");
+ }
+ );
+
+ // load a tab with a sound
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: SOUND_URL },
+ async function (browser) {
+ let tabId = gBrowser.selectedBrowser.outerWindowID;
+ results = await ChromeUtils.requestPerformanceMetrics();
+ exploreResults(results, tabId);
+ Assert.greater(mediaMemory, 0, "Got some memory used for media");
+ }
+ );
+ }
+ );
+
+ BrowserTestUtils.removeTab(page1);
+ BrowserTestUtils.removeTab(page2);
+ BrowserTestUtils.removeTab(page3);
+});
diff --git a/dom/tests/browser/perfmetrics/browser_test_unresponsive.js b/dom/tests/browser/perfmetrics/browser_test_unresponsive.js
new file mode 100644
index 0000000000..770c387e7a
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/browser_test_unresponsive.js
@@ -0,0 +1,31 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const ROOT_URL = "http://example.com/browser/dom/tests/browser/perfmetrics";
+const PAGE_URL = ROOT_URL + "/unresponsive.html";
+
+add_task(async function test() {
+ waitForExplicitFinish();
+
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: PAGE_URL },
+ async function (browser) {
+ let dataBack = 0;
+ let tabId = gBrowser.selectedBrowser.outerWindowID;
+
+ function exploreResults(data, filterByWindowId) {
+ for (let entry of data) {
+ if (entry.windowId == tabId && entry.host != "about:blank") {
+ dataBack += 1;
+ }
+ }
+ }
+ let results = await ChromeUtils.requestPerformanceMetrics();
+ exploreResults(results);
+ Assert.ok(dataBack == 0);
+ }
+ );
+});
diff --git a/dom/tests/browser/perfmetrics/dummy.html b/dom/tests/browser/perfmetrics/dummy.html
new file mode 100644
index 0000000000..6ec72c2160
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/dummy.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+<head>
+<title>Dummy test page</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
+</head>
+<body>
+<p>Dummy test page</p>
+<script>
+ localStorage.setItem("foo", "bar");
+</script>
+</body>
+</html>
diff --git a/dom/tests/browser/perfmetrics/hello.ogg b/dom/tests/browser/perfmetrics/hello.ogg
new file mode 100644
index 0000000000..7a80926065
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/hello.ogg
Binary files differ
diff --git a/dom/tests/browser/perfmetrics/ping_worker.html b/dom/tests/browser/perfmetrics/ping_worker.html
new file mode 100644
index 0000000000..c576dbcb22
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/ping_worker.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <meta charset="utf-8">
+ <script type="text/javascript">
+
+ var myWorker;
+ var shared;
+
+ function init() {
+ myWorker = new Worker("ping_worker.js");
+ for (let i = 0; i++; i < 10) myWorker.postMessage("ping");
+
+ shared = new SharedWorker("shared_worker.js");
+ shared.port.start();
+ shared.port.onmessage = function(e) {
+ console.log(e);
+ };
+ }
+
+ </script>
+</head>
+<body onload="init()">
+ <h1>A page with a worker and a shared worker</h1>
+</body>
+</html>
diff --git a/dom/tests/browser/perfmetrics/ping_worker.js b/dom/tests/browser/perfmetrics/ping_worker.js
new file mode 100644
index 0000000000..0ed6bb8ba4
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/ping_worker.js
@@ -0,0 +1,11 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+function messageListener(event) {
+ postMessage("pong");
+}
+
+addEventListener("message", { handleEvent: messageListener });
diff --git a/dom/tests/browser/perfmetrics/ping_worker2.html b/dom/tests/browser/perfmetrics/ping_worker2.html
new file mode 100644
index 0000000000..48f6658218
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/ping_worker2.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <meta charset="utf-8">
+ <script type="text/javascript">
+
+ var shared;
+
+ function init() {
+ shared = new SharedWorker("shared_worker.js");
+ shared.port.start();
+ for (let i = 0; i < 10; i++) shared.port.postMessage(["ok"]);
+ }
+
+ </script>
+</head>
+<body onload="init()">
+ <h1>A page with a shared worker</h1>
+</body>
+</html>
diff --git a/dom/tests/browser/perfmetrics/setinterval.html b/dom/tests/browser/perfmetrics/setinterval.html
new file mode 100644
index 0000000000..4c3e7264ca
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/setinterval.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <meta charset="utf-8">
+ <script type="text/javascript">
+ var interval;
+
+ function doSomething() {
+ console.log("We are doing something here");
+ clearInterval(interval);
+ }
+
+ interval = setInterval(doSomething, 1);
+ </script>
+</head>
+<body>
+ <h1>A page with a setInterval() call</h1>
+</body>
+</html>
diff --git a/dom/tests/browser/perfmetrics/settimeout.html b/dom/tests/browser/perfmetrics/settimeout.html
new file mode 100644
index 0000000000..01f632caf5
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/settimeout.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <meta charset="utf-8">
+ <script type="text/javascript">
+
+ function doSomething() {
+ console.log("We are doing something here");
+ }
+
+ setTimeout(doSomething, 1);
+ </script>
+</head>
+<body>
+ <h1>A page with a setTimeout() call</h1>
+</body>
+</html>
diff --git a/dom/tests/browser/perfmetrics/shared_worker.js b/dom/tests/browser/perfmetrics/shared_worker.js
new file mode 100644
index 0000000000..cb00bfb3eb
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/shared_worker.js
@@ -0,0 +1,7 @@
+let onconnect = function (e) {
+ var port = e.ports[0];
+
+ port.onmessage = function (e) {
+ port.postMessage(e.data[0]);
+ };
+};
diff --git a/dom/tests/browser/perfmetrics/sound.html b/dom/tests/browser/perfmetrics/sound.html
new file mode 100644
index 0000000000..e365396f31
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/sound.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<head>
+<title>Dummy test page</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
+</head>
+<body>
+<p>Page with a sound</p>
+<audio controls autoplay>
+ <source src="hello.ogg" type="audio/ogg">
+</audio>
+</script>
+</body>
+</html>
diff --git a/dom/tests/browser/perfmetrics/unresponsive.html b/dom/tests/browser/perfmetrics/unresponsive.html
new file mode 100644
index 0000000000..e139eb7f9d
--- /dev/null
+++ b/dom/tests/browser/perfmetrics/unresponsive.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <meta charset="utf-8">
+ <script type="text/javascript">
+
+ function fn() {
+ let start = Date.now();
+ while (Date.now() - start < 5000)
+ ; // do nothing
+ setTimeout(fn, 0);
+ }
+
+ setTimeout(fn, 10);
+
+ </script>
+</head>
+<body>
+ <h1>An unresponsive page</h1>
+</body>
+</html>
diff --git a/dom/tests/browser/position.html b/dom/tests/browser/position.html
new file mode 100644
index 0000000000..8fca4d6af9
--- /dev/null
+++ b/dom/tests/browser/position.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <script type="text/javascript">
+ var result = null;
+
+ function handlePosition(position) {
+ // eslint-disable-next-line no-unsanitized/property
+ result.innerHTML = position.coords.latitude + " " + position.coords.longitude;
+ }
+
+ function handleError(error) {
+ // eslint-disable-next-line no-unsanitized/property
+ result.innerHTML = error.message;
+ }
+
+ function init() {
+ result = document.getElementById("result");
+
+ if (navigator.geolocation)
+ navigator.geolocation.getCurrentPosition(handlePosition, handleError);
+ else
+ result.innerHTML = "not available";
+ }
+
+ </script>
+</head>
+<body onload="init()">
+ <p id="result">location...</p>
+</body>
+</html>
diff --git a/dom/tests/browser/prevent_return_key.html b/dom/tests/browser/prevent_return_key.html
new file mode 100644
index 0000000000..4ec846f2e0
--- /dev/null
+++ b/dom/tests/browser/prevent_return_key.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Prevent return key should not submit form</title>
+ <script type="application/javascript">
+ function init() {
+ let input = document.getElementById("input");
+ input.addEventListener("keydown", function(aEvent) {
+ if (aEvent.keyCode == 13) { // return key
+ alert("Hello!");
+ aEvent.preventDefault();
+ return false;
+ }
+ return true;
+ }, {once: true});
+
+ let form = document.getElementById("form");
+ form.addEventListener("submit", function() {
+ let result = document.getElementById("result");
+ result.innerHTML = "submitted";
+ }, {once: true});
+ }
+ </script>
+</head>
+
+<body onload="init()">
+ <form id="form">
+ <input type="text" id="input">
+ <button type="submit" id="submitBtn">Submit</button>
+ </form>
+ <p id="result">not submitted</p>
+</body>
+</html>
diff --git a/dom/tests/browser/set-samesite-cookies-and-redirect.sjs b/dom/tests/browser/set-samesite-cookies-and-redirect.sjs
new file mode 100644
index 0000000000..940b1ee845
--- /dev/null
+++ b/dom/tests/browser/set-samesite-cookies-and-redirect.sjs
@@ -0,0 +1,43 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+function handleRequest(request, response) {
+ // Set cookies and redirect for .org:
+ if (request.host.endsWith(".org")) {
+ response.setHeader("Set-Cookie", "normalCookie=true; path=/;", true);
+ response.setHeader(
+ "Set-Cookie",
+ "laxHeader=true; path=/; SameSite=Lax",
+ true
+ );
+ response.setHeader(
+ "Set-Cookie",
+ "strictHeader=true; path=/; SameSite=Strict",
+ true
+ );
+ response.write(`
+ <head>
+ <meta http-equiv='set-cookie' content='laxMeta=true; path=/; SameSite=Lax'>
+ <meta http-equiv='set-cookie' content='strictMeta=true; path=/; SameSite=Strict'>
+ </head>
+ <body>
+ <script>
+ document.cookie = 'laxScript=true; path=/; SameSite=Lax';
+ document.cookie = 'strictScript=true; path=/; SameSite=Strict';
+ location.href = location.href.replace(/\.org/, ".com");
+ </script>
+ </body>`);
+ } else {
+ let baseURI =
+ "https://example.org/" +
+ request.path.replace(/[a-z-]*\.sjs/, "mimeme.sjs?type=");
+ response.write(`
+ <link rel="stylesheet" type="text/css" href="${baseURI}css">
+ <iframe src="${baseURI}html"></iframe>
+ <script src="${baseURI}js"></script>
+ <img src="${baseURI}png">
+ `);
+ }
+}
diff --git a/dom/tests/browser/test-console-api.html b/dom/tests/browser/test-console-api.html
new file mode 100644
index 0000000000..e8da7c311e
--- /dev/null
+++ b/dom/tests/browser/test-console-api.html
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML>
+<html dir="ltr" xml:lang="en-US" lang="en-US">
+ <head>
+ <meta charset=utf8>
+ <title>Console API test page</title>
+ <script type="text/javascript">
+ window.foobar585956c = function(a) {
+ console.trace();
+ return a + "c";
+ };
+
+ /* global foobar585956c */
+ function foobar585956b(a) {
+ return foobar585956c(a + "b");
+ }
+
+ function foobar585956a(omg) {
+ return foobar585956b(omg + "a");
+ }
+
+ function foobar646025(omg) {
+ console.log(omg, "o", "d");
+ }
+
+ function startTimer(timer) {
+ console.time(timer);
+ }
+
+ function stopTimer(timer) {
+ console.timeEnd(timer);
+ }
+
+ function namelessTimer() {
+ console.time();
+ console.timeEnd();
+ }
+
+ function test() {
+ var str = "Test Message.";
+ console.foobar(str); // if this throws, we don't execute following funcs
+ console.log(str);
+ console.info(str);
+ console.warn(str);
+ console.error(str);
+ console.exception(str);
+ console.assert(false, str);
+ console.count(str);
+ }
+
+ function testGroups() {
+ console.groupCollapsed("a", "group");
+ console.group("b", "group");
+ console.groupEnd();
+ }
+
+ function nativeCallback() {
+ new Promise(function(resolve, reject) { resolve(42); }).then(console.log);
+ }
+
+ function timeStamp(val) {
+ console.timeStamp(val);
+ }
+ </script>
+ </head>
+ <body>
+ <h1>Console API Test Page</h1>
+ <button onclick="test();">Log stuff</button>
+ <button id="test-trace" onclick="foobar585956a('omg');">Test trace</button>
+ <button id="test-location" onclick="foobar646025('omg');">Test location</button>
+ <button id="test-nativeCallback" onclick="nativeCallback();">Test nativeCallback</button>
+ <button id="test-groups" onclick="testGroups();">Test groups</button>
+ <button id="test-time" onclick="startTimer('foo');">Test time</button>
+ <button id="test-timeEnd" onclick="stopTimer('foo');">Test timeEnd</button>
+ <button id="test-namelessTimer" onclick="namelessTimer();">Test namelessTimer</button>
+ <button id="test-timeStamp" onclick="timeStamp('!!!')">Test timeStamp</button>
+ <button id="test-emptyTimeStamp" onclick="timeStamp();">Test emptyTimeStamp</button>
+ </body>
+</html>
diff --git a/dom/tests/browser/test_bug1004814.html b/dom/tests/browser/test_bug1004814.html
new file mode 100644
index 0000000000..9f97e0487a
--- /dev/null
+++ b/dom/tests/browser/test_bug1004814.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Console API test bug 1004814</title>
+ </head>
+ <body>
+ </body>
+</html>
diff --git a/dom/tests/browser/test_mixed_content_image.html b/dom/tests/browser/test_mixed_content_image.html
new file mode 100644
index 0000000000..c8b7661f42
--- /dev/null
+++ b/dom/tests/browser/test_mixed_content_image.html
@@ -0,0 +1 @@
+<body></body>
diff --git a/dom/tests/browser/test_new_window_from_content_child.html b/dom/tests/browser/test_new_window_from_content_child.html
new file mode 100644
index 0000000000..9e3f7016d9
--- /dev/null
+++ b/dom/tests/browser/test_new_window_from_content_child.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <title>Test popup window opening behaviour</title>
+</head>
+<body>
+ <p><a id="winOpenDefault" href="#" onclick="return openWindow();">Open a new window via window.open with default features.</a></p>
+ <p><a id="winOpenNonDefault" href="#" onclick="return openWindow('resizable=no, location=no, personalbar=no, toolbar=no, scrollbars=no, menubar=no, status=no, directories=no, height=100, width=500');">Open a new window via window.open with non-default features.</a></p>
+ <p><a id="winOpenDialog" href="#" onclick="return openWindow('dialog=yes');">Open a new window via window.open with dialog=1.</a></p>
+ <p><a id="winOpenNoURLNonDefault" href="#" onclick="return openBlankWindow('location=no, toolbar=no, height=100, width=100');">Open a blank new window via window.open with non-default features.</a></p>
+ <p><a id="targetBlank" href="dummy.html" target="_blank" rel="opener">Open a new window via target="_blank".</a></p>
+</body>
+</html>
+
+<script>
+function openWindow(aFeatures = "") {
+ window.open("dummy.html", "_blank", aFeatures);
+ return false;
+}
+
+function openBlankWindow(aFeatures = "") {
+ window.open("", "_blank", aFeatures);
+ return false;
+}
+</script>
diff --git a/dom/tests/browser/test_noopener_source.html b/dom/tests/browser/test_noopener_source.html
new file mode 100644
index 0000000000..fbf28be260
--- /dev/null
+++ b/dom/tests/browser/test_noopener_source.html
@@ -0,0 +1,15 @@
+<a id="test1" href="test_noopener_target.html" target="_blank" rel="opener">1</a>
+<a id="test2" href="test_noopener_target.html" target="_blank" rel="noopener">2</a>
+<a id="test3" href="test_noopener_target.html" target="_blank" rel="noreferrer">3</a>
+
+<a id="test4" href="test_noopener_target.html" target="uniquename1">4</a>
+<a id="test5" href="test_noopener_target.html" target="uniquename2" rel="noopener">5</a>
+<a id="test6" href="test_noopener_target.html" target="uniquename3" rel="noreferrer">6</a>
+
+<a id="test7" onclick="window.open('test_noopener_target.html', '_blank')">7</a>
+<a id="test8" onclick="window.open('test_noopener_target.html', '_blank', 'noopener')">8</a>
+<a id="test9" onclick="window.open('test_noopener_target.html', '_blank', 'noreferrer')">9</a>
+
+<a id="test10" onclick="window.open('test_noopener_target.html', 'uniquename1')">10</a>
+<a id="test11" onclick="window.open('test_noopener_target.html', 'uniquename2', 'noopener')">11</a>
+<a id="test12" onclick="window.open('test_noopener_target.html', 'uniquename3', 'noreferrer')">12</a>
diff --git a/dom/tests/browser/test_noopener_target.html b/dom/tests/browser/test_noopener_target.html
new file mode 100644
index 0000000000..f437fc7ba5
--- /dev/null
+++ b/dom/tests/browser/test_noopener_target.html
@@ -0,0 +1,9 @@
+
+<h2>name</h2>
+<div id="window_name"></div>
+
+<script>
+ document.querySelector("#window_name").textContent =
+ window.name;
+
+</script>
diff --git a/dom/tests/browser/worker_bug1004814.js b/dom/tests/browser/worker_bug1004814.js
new file mode 100644
index 0000000000..4fb54da692
--- /dev/null
+++ b/dom/tests/browser/worker_bug1004814.js
@@ -0,0 +1,6 @@
+onmessage = function (evt) {
+ console.time("bug1004814");
+ setTimeout(function () {
+ console.timeEnd("bug1004814");
+ }, 200);
+};
diff --git a/dom/tests/mochitest/ajax/jquery/ChangeLog.txt b/dom/tests/mochitest/ajax/jquery/ChangeLog.txt
new file mode 100644
index 0000000000..6d834c1967
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/ChangeLog.txt
@@ -0,0 +1,98 @@
+== jQuery ChangeLog ==
+
+== 1.2.2 ==
+
+* show is now element aware (uses default display type instead of just forcing block)
+* New special events api: jQuery.events.special
+* ready is now a real event and can be bound, unbound and triggered.
+* mouseenter and mouseleave now work on all supported browsers
+* The hover helper method now uses the mouseenter and mouseleave events
+* New offset test suite test/offset.html (requires your pop-up blocker to be disabled)
+* Refactored the width and height methods (fixes lots of bugs)
+* Fixed event memory leaks in IE (html, remove, empty also no longer leak memory)
+* Fixed window/document width/height values
+* Fixed event.pageX and event.pageY in IE
+
+== 1.2 ==
+
+=== 1.1.3 ===
+* Always create an ActiveXObject when it is available instead of the XMLHttpRequest, even in IE7
+* Removed XMLHttpRequest shadowing, may break code that relies on existence of that function for browser checking
+* ...
+
+=== 1.1.2 ===
+
+* Event handlers (like element.onclick) are now removed when no more functions are bound to the event.
+* Fixed DOM Manipulations for form elements.
+* Fixed jQuery.isFunction to return false on nodes.
+* Fixed jQuery.className.has, escaping regex characters in className (for metadata)
+* Fixed an issue in IE where an event on a cloned element is fired during a .clone() inside of an event handler.
+* Fixed IE ID selectors selecting by the name attribute.
+* Change: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos).
+* .attr('href') is now consistent in all browsers.
+* @href is now consistent in all browsers.
+* Fixed the slideDown flickering bug.
+* Having a \r endline in $("...") caused a never-ending loop.
+* Fixed IE6 AJAX memory leak
+* Fixed bug in pushStack, reporting an element at [0] in a jQuery object with length 0
+
+=== 1.1.1 ===
+
+* Setting the numerical value of a css property failed, for example: .css("opacity",0.5) (also occurred with zIndex, fontWeight)
+* Calling $(..., jqobj) with a context of a jQuery object failed.
+* Accessing a property on an element that doesn't exist caused an error, for example: $("#foobar").attr("id")
+* Calling .load() without a callback caused an error.
+* You couldn't cancel an event that was triggered using .trigger() or .click() (for example).
+* .add()ing a single DOM element to a jQuery object was broken.
+* Passing in undefined values to a $.post() caused weird errors to occur.
+* Accessing child nodes within an xml document didn't work properly.
+* jQuery.isFunction() was unable to reliably determine a function, in a cross-browser way.
+* Triggering a .click() failed in IE.
+* Triggered click handlers were executed twice in most browsers.
+* A newline passed into $(...) caused Firefox to go into a never-ending loop.
+* Calling $.post() without any data caused an error.
+* Calling a descendant selector after a child selector caused strange results, for example: $("ul > li ul")
+* Triggered events did not occur if an event handler was not bound for that event.
+
+== 1.1 ==
+
+* Massive speed-ups (4x-10x) in the selector engine.
+* You can now unbind event handlers from within themselves
+* Added new .one( "type", fn ) method
+* text(String) now escapes HTML
+* Added attr(String,Function) to calculate the value
+* Performming .click(), .blur(), .focus(), .submit() will actually trigger the browsers default action for those events.
+* Added global settings for AJAX (in addition to timeout), use $.ajaxSetup() to modify them
+* Implemented a better error handling for ajax requests. Exceptions caused by dropping connections are now handled, too.
+* Improved event fixing (Opera provides event.srcElement, must ignore it if target is available; only create pageX if clientX is available)
+* Fixed nth-child selectors to start on the right number
+* jQuery is no longer destructive. Doing var a = $("a"); a.find("span"); does not change the original "a" variable.
+* Fixed synchronous requests
+* Fixed ID with context selectors (eg. div #id doesn't ignore "div" anymore)
+* Fixed docs for html(): Now mentions that is not available for XML documents
+* Improved AJAX docs (eg. more examples for $.ajax)
+* Documented filter(Function), a very powerful approach for custom filtering
+* Improved docs for FX module, merging method descriptions and marking optional arguments
+* Improved docs for append, prepend, before and after, merging the three pairs into one
+* Improved show/hide animations to show only hidden and hide only visible elements
+* Removed .oneEvent() and .unEvent() helper methods.
+* Removed all CSS helper methods.
+* Removed most attribute helper methods.
+* Removed the (undocumented) .find( "selector", fn ) for all destructive methods.
+* $.get, $.getIfModified, $.post, $.getScript and $.getJSON now all pass through the XMLHttpRequest as returned by $.ajax
+
+== 1.0.4 ==
+
+* Tons of bug fixes
+* Extensions to $.ajax: $.ajax accepts additonal options: beforeSend, async and processData; returns XMLHttpRequest to allow manual aborting of requests, see docs for details
+* AJAX module: the public $.ajax API is now used internally (for $.get/$.post etc.); loading scripts works now much more reliable on all browers except Safari
+* New global ajax handler: ajaxSend - called before an ajax request is sent
+* Extensions to global ajax handlers: ajaxSend, ajaxSuccess, ajaxError and ajaxComplete get XMLHttpRequest and settings passed as arguments
+* Extensions to event handling: pageX and pageY are available x-browser (IE does not provide native pageX/Y)
+* Improved docs: $(String) method has now two seperate descriptions, one for selecting elements, one for creating (html on-the-fly)
+* FX module: Most inline stlyes added by animations are now removed when the animation is complete, eg. height style when animating height (exception: display styles)
+* Added note to attr(String, Object) about issues with setting the name property on input elements
+* Seperated internal stuff from get() into set()
+* Merged the two API examples for each() into one more precise example
+* Improved docs for $.browser and added docs for $.boxModel
+* Docs for the jQuery constructor $() were improved: There is now $(String expression[, Object context]) and $(String html)
diff --git a/dom/tests/mochitest/ajax/jquery/GPL-LICENSE.txt b/dom/tests/mochitest/ajax/jquery/GPL-LICENSE.txt
new file mode 100644
index 0000000000..11dddd00ef
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/GPL-LICENSE.txt
@@ -0,0 +1,278 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
diff --git a/dom/tests/mochitest/ajax/jquery/MIT-LICENSE.txt b/dom/tests/mochitest/ajax/jquery/MIT-LICENSE.txt
new file mode 100644
index 0000000000..d4215f0e42
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/MIT-LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2008 John Resig, http://jquery.com/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/dom/tests/mochitest/ajax/jquery/dist/jquery.js b/dom/tests/mochitest/ajax/jquery/dist/jquery.js
new file mode 100644
index 0000000000..a28e7cd65c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/dist/jquery.js
@@ -0,0 +1,3549 @@
+(function(){
+/*
+ * jQuery 1.2.6 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-05-24 11:09:21 -0700 (Sat, 24 May 2008) $
+ * $Rev: 5683 $
+ */
+
+// Map over jQuery in case of overwrite
+var _jQuery = window.jQuery,
+// Map over the $ in case of overwrite
+ _$ = window.$;
+
+var jQuery = window.jQuery = window.$ = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+};
+
+// A simple way to check for HTML strings or ID strings
+// (both of which we optimize for)
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
+
+// Is it a simple selector
+ isSimple = /^.[^:#\[\.]*$/,
+
+// Will speed up references to undefined, and allows munging its name.
+ undefined;
+
+jQuery.fn = jQuery.prototype = {
+ init: function( selector, context ) {
+ // Make sure that a selection was provided
+ selector = selector || document;
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+ // Handle HTML strings
+ if ( typeof selector == "string" ) {
+ // Are we dealing with HTML string or an ID?
+ var match = quickExpr.exec( selector );
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] )
+ selector = jQuery.clean( [ match[1] ], context );
+
+ // HANDLE: $("#id")
+ else {
+ var elem = document.getElementById( match[3] );
+
+ // Make sure an element was located
+ if ( elem ){
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id != match[3] )
+ return jQuery().find( selector );
+
+ // Otherwise, we inject the element directly into the jQuery object
+ return jQuery( elem );
+ }
+ selector = [];
+ }
+
+ // HANDLE: $(expr, [context])
+ // (which is just equivalent to: $(content).find(expr)
+ } else
+ return jQuery( context ).find( selector );
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) )
+ return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
+
+ return this.setArray(jQuery.makeArray(selector));
+ },
+
+ // The current version of jQuery being used
+ jquery: "1.2.6",
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ // The number of elements contained in the matched element set
+ length: 0,
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == undefined ?
+
+ // Return a 'clean' array
+ jQuery.makeArray( this ) :
+
+ // Return just the object
+ this[ num ];
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+ // Build a new jQuery matched element set
+ var ret = jQuery( elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Force the current matched set of elements to become
+ // the specified array of elements (destroying the stack in the process)
+ // You should use pushStack() in order to do this, but maintain the stack
+ setArray: function( elems ) {
+ // Resetting the length to 0, then using the native Array push
+ // is a super-fast way to populate an object with array-like properties
+ this.length = 0;
+ Array.prototype.push.apply( this, elems );
+
+ return this;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ var ret = -1;
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem && elem.jquery ? elem[0] : elem
+ , this );
+ },
+
+ attr: function( name, value, type ) {
+ var options = name;
+
+ // Look for the case where we're accessing a style value
+ if ( name.constructor == String )
+ if ( value === undefined )
+ return this[0] && jQuery[ type || "attr" ]( this[0], name );
+
+ else {
+ options = {};
+ options[ name ] = value;
+ }
+
+ // Check to see if we're setting style values
+ return this.each(function(i){
+ // Set all the styles
+ for ( name in options )
+ jQuery.attr(
+ type ?
+ this.style :
+ this,
+ name, jQuery.prop( this, options[ name ], type, i, name )
+ );
+ });
+ },
+
+ css: function( key, value ) {
+ // ignore negative width and height values
+ if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
+ value = undefined;
+ return this.attr( key, value, "curCSS" );
+ },
+
+ text: function( text ) {
+ if ( typeof text != "object" && text != null )
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+
+ var ret = "";
+
+ jQuery.each( text || this, function(){
+ jQuery.each( this.childNodes, function(){
+ if ( this.nodeType != 8 )
+ ret += this.nodeType != 1 ?
+ this.nodeValue :
+ jQuery.fn.text( [ this ] );
+ });
+ });
+
+ return ret;
+ },
+
+ wrapAll: function( html ) {
+ if ( this[0] )
+ // The elements to wrap the target around
+ jQuery( html, this[0].ownerDocument )
+ .clone()
+ .insertBefore( this[0] )
+ .map(function(){
+ var elem = this;
+
+ while ( elem.firstChild )
+ elem = elem.firstChild;
+
+ return elem;
+ })
+ .append(this);
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ return this.each(function(){
+ jQuery( this ).contents().wrapAll( html );
+ });
+ },
+
+ wrap: function( html ) {
+ return this.each(function(){
+ jQuery( this ).wrapAll( html );
+ });
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, false, function(elem){
+ if (this.nodeType == 1)
+ this.appendChild( elem );
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, true, function(elem){
+ if (this.nodeType == 1)
+ this.insertBefore( elem, this.firstChild );
+ });
+ },
+
+ before: function() {
+ return this.domManip(arguments, false, false, function(elem){
+ this.parentNode.insertBefore( elem, this );
+ });
+ },
+
+ after: function() {
+ return this.domManip(arguments, false, true, function(elem){
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ },
+
+ end: function() {
+ return this.prevObject || jQuery( [] );
+ },
+
+ find: function( selector ) {
+ var elems = jQuery.map(this, function(elem){
+ return jQuery.find( selector, elem );
+ });
+
+ return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
+ jQuery.unique( elems ) :
+ elems );
+ },
+
+ clone: function( events ) {
+ // Do the clone
+ var ret = this.map(function(){
+ if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
+ // IE copies events bound via attachEvent when
+ // using cloneNode. Calling detachEvent on the
+ // clone will also remove the events from the orignal
+ // In order to get around this, we use innerHTML.
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
+ // as properties will not be copied (such as the
+ // the name attribute on an input).
+ var clone = this.cloneNode(true),
+ container = document.createElement("div");
+ container.appendChild(clone);
+ return jQuery.clean([container.innerHTML])[0];
+ } else
+ return this.cloneNode(true);
+ });
+
+ // Need to set the expando to null on the cloned set if it exists
+ // removeData doesn't work here, IE removes it from the original as well
+ // this is primarily for IE but the data expando shouldn't be copied over in any browser
+ var clone = ret.find("*").andSelf().each(function(){
+ if ( this[ expando ] != undefined )
+ this[ expando ] = null;
+ });
+
+ // Copy the events from the original to the clone
+ if ( events === true )
+ this.find("*").andSelf().each(function(i){
+ if (this.nodeType == 3)
+ return;
+ var events = jQuery.data( this, "events" );
+
+ for ( var type in events )
+ for ( var handler in events[ type ] )
+ jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
+ });
+
+ // Return the cloned set
+ return ret;
+ },
+
+ filter: function( selector ) {
+ return this.pushStack(
+ jQuery.isFunction( selector ) &&
+ jQuery.grep(this, function(elem, i){
+ return selector.call( elem, i );
+ }) ||
+
+ jQuery.multiFilter( selector, this ) );
+ },
+
+ not: function( selector ) {
+ if ( selector.constructor == String )
+ // test special case where just one selector is passed in
+ if ( isSimple.test( selector ) )
+ return this.pushStack( jQuery.multiFilter( selector, this, true ) );
+ else
+ selector = jQuery.multiFilter( selector, this );
+
+ var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
+ return this.filter(function() {
+ return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
+ });
+ },
+
+ add: function( selector ) {
+ return this.pushStack( jQuery.unique( jQuery.merge(
+ this.get(),
+ typeof selector == 'string' ?
+ jQuery( selector ) :
+ jQuery.makeArray( selector )
+ )));
+ },
+
+ is: function( selector ) {
+ return !!selector && jQuery.multiFilter( selector, this ).length > 0;
+ },
+
+ hasClass: function( selector ) {
+ return this.is( "." + selector );
+ },
+
+ val: function( value ) {
+ if ( value == undefined ) {
+
+ if ( this.length ) {
+ var elem = this[0];
+
+ // We need to handle select boxes special
+ if ( jQuery.nodeName( elem, "select" ) ) {
+ var index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type == "select-one";
+
+ // Nothing was selected
+ if ( index < 0 )
+ return null;
+
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
+
+ if ( option.selected ) {
+ // Get the specifc value for the option
+ value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
+
+ // We don't need an array for one selects
+ if ( one )
+ return value;
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+
+ // Everything else, we just grab the value
+ } else
+ return (this[0].value || "").replace(/\r/g, "");
+
+ }
+
+ return undefined;
+ }
+
+ if( value.constructor == Number )
+ value += '';
+
+ return this.each(function(){
+ if ( this.nodeType != 1 )
+ return;
+
+ if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
+ this.checked = (jQuery.inArray(this.value, value) >= 0 ||
+ jQuery.inArray(this.name, value) >= 0);
+
+ else if ( jQuery.nodeName( this, "select" ) ) {
+ var values = jQuery.makeArray(value);
+
+ jQuery( "option", this ).each(function(){
+ this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
+ jQuery.inArray( this.text, values ) >= 0);
+ });
+
+ if ( !values.length )
+ this.selectedIndex = -1;
+
+ } else
+ this.value = value;
+ });
+ },
+
+ html: function( value ) {
+ return value == undefined ?
+ (this[0] ?
+ this[0].innerHTML :
+ null) :
+ this.empty().append( value );
+ },
+
+ replaceWith: function( value ) {
+ return this.after( value ).remove();
+ },
+
+ eq: function( i ) {
+ return this.slice( i, i + 1 );
+ },
+
+ slice: function() {
+ return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function(elem, i){
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ },
+
+ data: function( key, value ){
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
+
+ if ( value === undefined ) {
+ var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ if ( data === undefined && this.length )
+ data = jQuery.data( this[0], key );
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ } else
+ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+ jQuery.data( this, key, value );
+ });
+ },
+
+ removeData: function( key ){
+ return this.each(function(){
+ jQuery.removeData( this, key );
+ });
+ },
+
+ domManip: function( args, table, reverse, callback ) {
+ var clone = this.length > 1, elems;
+
+ return this.each(function(){
+ if ( !elems ) {
+ elems = jQuery.clean( args, this.ownerDocument );
+
+ if ( reverse )
+ elems.reverse();
+ }
+
+ var obj = this;
+
+ if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
+ obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
+
+ var scripts = jQuery( [] );
+
+ jQuery.each(elems, function(){
+ var elem = clone ?
+ jQuery( this ).clone( true )[0] :
+ this;
+
+ // execute all scripts after the elements have been injected
+ if ( jQuery.nodeName( elem, "script" ) )
+ scripts = scripts.add( elem );
+ else {
+ // Remove any inner scripts for later evaluation
+ if ( elem.nodeType == 1 )
+ scripts = scripts.add( jQuery( "script", elem ).remove() );
+
+ // Inject the elements into the document
+ callback.call( obj, elem );
+ }
+ });
+
+ scripts.each( evalScript );
+ });
+ }
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+function evalScript( i, elem ) {
+ if ( elem.src )
+ jQuery.ajax({
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+
+ else
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+
+ if ( elem.parentNode )
+ elem.parentNode.removeChild( elem );
+}
+
+function now(){
+ return +new Date;
+}
+
+jQuery.extend = jQuery.fn.extend = function() {
+ // copy reference to target object
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+
+ // Handle a deep copy situation
+ if ( target.constructor == Boolean ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target != "object" && typeof target != "function" )
+ target = {};
+
+ // extend jQuery itself if only one argument is passed
+ if ( length == i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ )
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null )
+ // Extend the base object
+ for ( var name in options ) {
+ var src = target[ name ], copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy )
+ continue;
+
+ // Recurse if we're merging object values
+ if ( deep && copy && typeof copy == "object" && !copy.nodeType )
+ target[ name ] = jQuery.extend( deep,
+ // Never move original objects, clone them
+ src || ( copy.length != null ? [ ] : { } )
+ , copy );
+
+ // Don't bring in undefined values
+ else if ( copy !== undefined )
+ target[ name ] = copy;
+
+ }
+
+ // Return the modified object
+ return target;
+};
+
+var expando = "jQuery" + now(), uuid = 0, windowData = {},
+ // exclude the following css properties to add px
+ exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+ // cache defaultView
+ defaultView = document.defaultView || {};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep )
+ window.jQuery = _jQuery;
+
+ return jQuery;
+ },
+
+ // See test/unit/core.js for details concerning this function.
+ isFunction: function( fn ) {
+ return !!fn && typeof fn != "string" && !fn.nodeName &&
+ fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
+ },
+
+ // check if an element is in a (or is an) XML document
+ isXMLDoc: function( elem ) {
+ return elem.documentElement && !elem.body ||
+ elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+ },
+
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+ if ( jQuery.browser.msie )
+ script.text = data;
+ else
+ script.appendChild( document.createTextNode( data ) );
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+ },
+
+ cache: {},
+
+ data: function( elem, name, data ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // Compute a unique ID for the element
+ if ( !id )
+ id = elem[ expando ] = ++uuid;
+
+ // Only generate the data cache if we're
+ // trying to access or manipulate it
+ if ( name && !jQuery.cache[ id ] )
+ jQuery.cache[ id ] = {};
+
+ // Prevent overriding the named cache with undefined values
+ if ( data !== undefined )
+ jQuery.cache[ id ][ name ] = data;
+
+ // Return the named cache data, or the ID for the element
+ return name ?
+ jQuery.cache[ id ][ name ] :
+ id;
+ },
+
+ removeData: function( elem, name ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // If we want to remove a specific section of the element's data
+ if ( name ) {
+ if ( jQuery.cache[ id ] ) {
+ // Remove the section of cache data
+ delete jQuery.cache[ id ][ name ];
+
+ // If we've removed all the data, remove the element's cache
+ name = "";
+
+ for ( name in jQuery.cache[ id ] )
+ break;
+
+ if ( !name )
+ jQuery.removeData( elem );
+ }
+
+ // Otherwise, we want to remove all of the element's data
+ } else {
+ // Clean up the element expando
+ try {
+ delete elem[ expando ];
+ } catch(e){
+ // IE has trouble directly removing the expando
+ // but it's ok with using removeAttribute
+ if ( elem.removeAttribute )
+ elem.removeAttribute( expando );
+ }
+
+ // Completely remove the data cache
+ delete jQuery.cache[ id ];
+ }
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0, length = object.length;
+
+ if ( args ) {
+ if ( length == undefined ) {
+ for ( name in object )
+ if ( callback.apply( object[ name ], args ) === false )
+ break;
+ } else
+ for ( ; i < length; )
+ if ( callback.apply( object[ i++ ], args ) === false )
+ break;
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( length == undefined ) {
+ for ( name in object )
+ if ( callback.call( object[ name ], name, object[ name ] ) === false )
+ break;
+ } else
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+ }
+
+ return object;
+ },
+
+ prop: function( elem, value, type, i, name ) {
+ // Handle executable functions
+ if ( jQuery.isFunction( value ) )
+ value = value.call( elem, i );
+
+ // Handle passing in a number to a CSS property
+ return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
+ value + "px" :
+ value;
+ },
+
+ className: {
+ // internal only, use addClass("class")
+ add: function( elem, classNames ) {
+ jQuery.each((classNames || "").split(/\s+/), function(i, className){
+ if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
+ elem.className += (elem.className ? " " : "") + className;
+ });
+ },
+
+ // internal only, use removeClass("class")
+ remove: function( elem, classNames ) {
+ if (elem.nodeType == 1)
+ elem.className = classNames != undefined ?
+ jQuery.grep(elem.className.split(/\s+/), function(className){
+ return !jQuery.className.has( classNames, className );
+ }).join(" ") :
+ "";
+ },
+
+ // internal only, use hasClass("class")
+ has: function( elem, className ) {
+ return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+ }
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ callback.call( elem );
+
+ // Revert the old values
+ for ( var name in options )
+ elem.style[ name ] = old[ name ];
+ },
+
+ css: function( elem, name, force ) {
+ if ( name == "width" || name == "height" ) {
+ var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
+
+ function getWH() {
+ val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
+ var padding = 0, border = 0;
+ jQuery.each( which, function() {
+ padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ });
+ val -= Math.round(padding + border);
+ }
+
+ if ( jQuery(elem).is(":visible") )
+ getWH();
+ else
+ jQuery.swap( elem, props, getWH );
+
+ return Math.max(0, val);
+ }
+
+ return jQuery.curCSS( elem, name, force );
+ },
+
+ curCSS: function( elem, name, force ) {
+ var ret, style = elem.style;
+
+ // A helper method for determining if an element's values are broken
+ function color( elem ) {
+ if ( !jQuery.browser.safari )
+ return false;
+
+ // defaultView is cached
+ var ret = defaultView.getComputedStyle( elem, null );
+ return !ret || ret.getPropertyValue("color") == "";
+ }
+
+ // We need to handle opacity special in IE
+ if ( name == "opacity" && jQuery.browser.msie ) {
+ ret = jQuery.attr( style, "opacity" );
+
+ return ret == "" ?
+ "1" :
+ ret;
+ }
+ // Opera sometimes will give the wrong display answer, this fixes it, see #2037
+ if ( jQuery.browser.opera && name == "display" ) {
+ var save = style.outline;
+ style.outline = "0 solid black";
+ style.outline = save;
+ }
+
+ // Make sure we're using the right name for getting the float value
+ if ( name.match( /float/i ) )
+ name = styleFloat;
+
+ if ( !force && style && style[ name ] )
+ ret = style[ name ];
+
+ else if ( defaultView.getComputedStyle ) {
+
+ // Only "float" is needed here
+ if ( name.match( /float/i ) )
+ name = "float";
+
+ name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+
+ var computedStyle = defaultView.getComputedStyle( elem, null );
+
+ if ( computedStyle && !color( elem ) )
+ ret = computedStyle.getPropertyValue( name );
+
+ // If the element isn't reporting its values properly in Safari
+ // then some display: none elements are involved
+ else {
+ var swap = [], stack = [], a = elem, i = 0;
+
+ // Locate all of the parent display: none elements
+ for ( ; a && color(a); a = a.parentNode )
+ stack.unshift(a);
+
+ // Go through and make them visible, but in reverse
+ // (It would be better if we knew the exact display type that they had)
+ for ( ; i < stack.length; i++ )
+ if ( color( stack[ i ] ) ) {
+ swap[ i ] = stack[ i ].style.display;
+ stack[ i ].style.display = "block";
+ }
+
+ // Since we flip the display style, we have to handle that
+ // one special, otherwise get the value
+ ret = name == "display" && swap[ stack.length - 1 ] != null ?
+ "none" :
+ ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
+
+ // Finally, revert the display styles back
+ for ( i = 0; i < swap.length; i++ )
+ if ( swap[ i ] != null )
+ stack[ i ].style.display = swap[ i ];
+ }
+
+ // We should always get a number back from opacity
+ if ( name == "opacity" && ret == "" )
+ ret = "1";
+
+ } else if ( elem.currentStyle ) {
+ var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
+ // Remember the original values
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = ret || 0;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
+
+ return ret;
+ },
+
+ clean: function( elems, context ) {
+ var ret = [];
+ context = context || document;
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if (typeof context.createElement == 'undefined')
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+
+ jQuery.each(elems, function(i, elem){
+ if ( !elem )
+ return;
+
+ if ( elem.constructor == Number )
+ elem += '';
+
+ // Convert html string into DOM nodes
+ if ( typeof elem == "string" ) {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
+ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
+ all :
+ front + "></" + tag + ">";
+ });
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
+
+ var wrap =
+ // option or optgroup
+ !tags.indexOf("<opt") &&
+ [ 1, "<select multiple='multiple'>", "</select>" ] ||
+
+ !tags.indexOf("<leg") &&
+ [ 1, "<fieldset>", "</fieldset>" ] ||
+
+ tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
+ [ 1, "<table>", "</table>" ] ||
+
+ !tags.indexOf("<tr") &&
+ [ 2, "<table><tbody>", "</tbody></table>" ] ||
+
+ // <thead> matched above
+ (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
+ [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
+
+ !tags.indexOf("<col") &&
+ [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
+
+ // IE can't serialize <link> and <script> tags normally
+ jQuery.browser.msie &&
+ [ 1, "div<div>", "</div>" ] ||
+
+ [ 0, "", "" ];
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( wrap[0]-- )
+ div = div.lastChild;
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( jQuery.browser.msie ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
+ div.childNodes :
+ [];
+
+ for ( var j = tbody.length - 1; j >= 0 ; --j )
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( /^\s/.test( elem ) )
+ div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+
+ }
+
+ elem = jQuery.makeArray( div.childNodes );
+ }
+
+ if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
+ return;
+
+ if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
+ ret.push( elem );
+
+ else
+ ret = jQuery.merge( ret, elem );
+
+ });
+
+ return ret;
+ },
+
+ attr: function( elem, name, value ) {
+ // don't set attributes on text and comment nodes
+ if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
+ return undefined;
+
+ var notxml = !jQuery.isXMLDoc( elem ),
+ // Whether we are setting (or getting)
+ set = value !== undefined,
+ msie = jQuery.browser.msie;
+
+ // Try to normalize/fix the name
+ name = notxml && jQuery.props[ name ] || name;
+
+ // Only do all the following if this is a node (faster for style)
+ // IE elem.getAttribute passes even for style
+ if ( elem.tagName ) {
+
+ // These attributes require special treatment
+ var special = /href|src|style/.test( name );
+
+ // Safari mis-reports the default selected property of a hidden option
+ // Accessing the parent's selectedIndex property fixes it
+ if ( name == "selected" && jQuery.browser.safari )
+ elem.parentNode.selectedIndex;
+
+ // If applicable, access the attribute via the DOM 0 way
+ if ( name in elem && notxml && !special ) {
+ if ( set ){
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
+ throw "type property can't be changed";
+
+ elem[ name ] = value;
+ }
+
+ // browsers index elements by id/name on forms, give priority to attributes.
+ if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
+ return elem.getAttributeNode( name ).nodeValue;
+
+ return elem[ name ];
+ }
+
+ if ( msie && notxml && name == "style" )
+ return jQuery.attr( elem.style, "cssText", value );
+
+ if ( set )
+ // convert the value to a string (all browsers do this but IE) see #1070
+ elem.setAttribute( name, "" + value );
+
+ var attr = msie && notxml && special
+ // Some attributes require a special call on IE
+ ? elem.getAttribute( name, 2 )
+ : elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return attr === null ? undefined : attr;
+ }
+
+ // elem is actually elem.style ... set the style
+
+ // IE uses filters for opacity
+ if ( msie && name == "opacity" ) {
+ if ( set ) {
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ elem.zoom = 1;
+
+ // Set the alpha filter to set the opacity
+ elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
+ (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+ }
+
+ return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
+ "";
+ }
+
+ name = name.replace(/-([a-z])/ig, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ if ( set )
+ elem[ name ] = value;
+
+ return elem[ name ];
+ },
+
+ trim: function( text ) {
+ return (text || "").replace( /^\s+|\s+$/g, "" );
+ },
+
+ makeArray: function( array ) {
+ var ret = [];
+
+ if( array != null ){
+ var i = array.length;
+ //the window, strings and functions also have 'length'
+ if( i == null || array.split || array.setInterval || array.call )
+ ret[0] = array;
+ else
+ while( i )
+ ret[--i] = array[i];
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array ) {
+ for ( var i = 0, length = array.length; i < length; i++ )
+ // Use === because on IE, window == document
+ if ( array[ i ] === elem )
+ return i;
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ // We have to loop this way because IE & Opera overwrite the length
+ // expando of getElementsByTagName
+ var i = 0, elem, pos = first.length;
+ // Also, we need to make sure that the correct elements are being returned
+ // (IE returns comment nodes in a '*' query)
+ if ( jQuery.browser.msie ) {
+ while ( elem = second[ i++ ] )
+ if ( elem.nodeType != 8 )
+ first[ pos++ ] = elem;
+
+ } else
+ while ( elem = second[ i++ ] )
+ first[ pos++ ] = elem;
+
+ return first;
+ },
+
+ unique: function( array ) {
+ var ret = [], done = {};
+
+ try {
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ var id = jQuery.data( array[ i ] );
+
+ if ( !done[ id ] ) {
+ done[ id ] = true;
+ ret.push( array[ i ] );
+ }
+ }
+
+ } catch( e ) {
+ ret = array;
+ }
+
+ return ret;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [];
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ )
+ if ( !inv != !callback( elems[ i ], i ) )
+ ret.push( elems[ i ] );
+
+ return ret;
+ },
+
+ map: function( elems, callback ) {
+ var ret = [];
+
+ // Go through the array, translating each of the items to their
+ // new value (or values).
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ var value = callback( elems[ i ], i );
+
+ if ( value != null )
+ ret[ ret.length ] = value;
+ }
+
+ return ret.concat.apply( [], ret );
+ }
+});
+
+var userAgent = navigator.userAgent.toLowerCase();
+
+// Figure out what browser is being used
+jQuery.browser = {
+ version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
+ safari: /webkit/.test( userAgent ),
+ opera: /opera/.test( userAgent ),
+ msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
+ mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
+};
+
+var styleFloat = jQuery.browser.msie ?
+ "styleFloat" :
+ "cssFloat";
+
+jQuery.extend({
+ // Check to see if the W3C box model is being used
+ boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
+
+ props: {
+ "for": "htmlFor",
+ "class": "className",
+ "float": styleFloat,
+ cssFloat: styleFloat,
+ styleFloat: styleFloat,
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing"
+ }
+});
+
+jQuery.each({
+ parent: function(elem){return elem.parentNode;},
+ parents: function(elem){return jQuery.dir(elem,"parentNode");},
+ next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
+ prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
+ nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
+ prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
+ siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
+ children: function(elem){return jQuery.sibling(elem.firstChild);},
+ contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
+}, function(name, fn){
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = jQuery.map( this, fn );
+
+ if ( selector && typeof selector == "string" )
+ ret = jQuery.multiFilter( selector, ret );
+
+ return this.pushStack( jQuery.unique( ret ) );
+ };
+});
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function(name, original){
+ jQuery.fn[ name ] = function() {
+ var args = arguments;
+
+ return this.each(function(){
+ for ( var i = 0, length = args.length; i < length; i++ )
+ jQuery( args[ i ] )[ original ]( this );
+ });
+ };
+});
+
+jQuery.each({
+ removeAttr: function( name ) {
+ jQuery.attr( this, name, "" );
+ if (this.nodeType == 1)
+ this.removeAttribute( name );
+ },
+
+ addClass: function( classNames ) {
+ jQuery.className.add( this, classNames );
+ },
+
+ removeClass: function( classNames ) {
+ jQuery.className.remove( this, classNames );
+ },
+
+ toggleClass: function( classNames ) {
+ jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
+ },
+
+ remove: function( selector ) {
+ if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
+ // Prevent memory leaks
+ jQuery( "*", this ).add(this).each(function(){
+ jQuery.event.remove(this);
+ jQuery.removeData(this);
+ });
+ if (this.parentNode)
+ this.parentNode.removeChild( this );
+ }
+ },
+
+ empty: function() {
+ // Remove element nodes and prevent memory leaks
+ jQuery( ">*", this ).remove();
+
+ // Remove any remaining nodes
+ while ( this.firstChild )
+ this.removeChild( this.firstChild );
+ }
+}, function(name, fn){
+ jQuery.fn[ name ] = function(){
+ return this.each( fn, arguments );
+ };
+});
+
+jQuery.each([ "Height", "Width" ], function(i, name){
+ var type = name.toLowerCase();
+
+ jQuery.fn[ type ] = function( size ) {
+ // Get window width or height
+ return this[0] == window ?
+ // Opera reports document.body.client[Width/Height] properly in both quirks and standards
+ jQuery.browser.opera && document.body[ "client" + name ] ||
+
+ // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
+ jQuery.browser.safari && window[ "inner" + name ] ||
+
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+ document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
+
+ // Get document width or height
+ this[0] == document ?
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ Math.max(
+ Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
+ Math.max(document.body["offset" + name], document.documentElement["offset" + name])
+ ) :
+
+ // Get or set width or height on the element
+ size == undefined ?
+ // Get width or height on the element
+ (this.length ? jQuery.css( this[0], type ) : null) :
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ this.css( type, size.constructor == String ? size : size + "px" );
+ };
+});
+
+// Helper function used by the dimensions and offset modules
+function num(elem, prop) {
+ return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
+}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
+ "(?:[\\w*_-]|\\\\.)" :
+ "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
+ quickChild = new RegExp("^>\\s*(" + chars + "+)"),
+ quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
+ quickClass = new RegExp("^([#.]?)(" + chars + "*)");
+
+jQuery.extend({
+ expr: {
+ "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
+ "#": function(a,i,m){return a.getAttribute("id")==m[2];},
+ ":": {
+ // Position Checks
+ lt: function(a,i,m){return i<m[3]-0;},
+ gt: function(a,i,m){return i>m[3]-0;},
+ nth: function(a,i,m){return m[3]-0==i;},
+ eq: function(a,i,m){return m[3]-0==i;},
+ first: function(a,i){return i==0;},
+ last: function(a,i,m,r){return i==r.length-1;},
+ even: function(a,i){return i%2==0;},
+ odd: function(a,i){return i%2;},
+
+ // Child Checks
+ "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
+ "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
+ "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
+
+ // Parent Checks
+ parent: function(a){return a.firstChild;},
+ empty: function(a){return !a.firstChild;},
+
+ // Text Check
+ contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
+
+ // Visibility
+ visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
+ hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
+
+ // Form attributes
+ enabled: function(a){return !a.disabled;},
+ disabled: function(a){return a.disabled;},
+ checked: function(a){return a.checked;},
+ selected: function(a){return a.selected||jQuery.attr(a,"selected");},
+
+ // Form elements
+ text: function(a){return "text"==a.type;},
+ radio: function(a){return "radio"==a.type;},
+ checkbox: function(a){return "checkbox"==a.type;},
+ file: function(a){return "file"==a.type;},
+ password: function(a){return "password"==a.type;},
+ submit: function(a){return "submit"==a.type;},
+ image: function(a){return "image"==a.type;},
+ reset: function(a){return "reset"==a.type;},
+ button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
+ input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
+
+ // :has()
+ has: function(a,i,m){return jQuery.find(m[3],a).length;},
+
+ // :header
+ header: function(a){return /h\d/i.test(a.nodeName);},
+
+ // :animated
+ animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
+ }
+ },
+
+ // The regular expressions that power the parsing engine
+ parse: [
+ // Match: [@value='test'], [@foo]
+ /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
+
+ // Match: :contains('foo')
+ /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
+
+ // Match: :even, :last-child, #id, .class
+ new RegExp("^([:.#]*)(" + chars + "+)")
+ ],
+
+ multiFilter: function( expr, elems, not ) {
+ var old, cur = [];
+
+ while ( expr && expr != old ) {
+ old = expr;
+ var f = jQuery.filter( expr, elems, not );
+ expr = f.t.replace(/^\s*,\s*/, "" );
+ cur = not ? elems = f.r : jQuery.merge( cur, f.r );
+ }
+
+ return cur;
+ },
+
+ find: function( t, context ) {
+ // Quickly handle non-string expressions
+ if ( typeof t != "string" )
+ return [ t ];
+
+ // check to make sure context is a DOM element or a document
+ if ( context && context.nodeType != 1 && context.nodeType != 9)
+ return [ ];
+
+ // Set the correct context (if none is provided)
+ context = context || document;
+
+ // Initialize the search
+ var ret = [context], done = [], last, nodeName;
+
+ // Continue while a selector expression exists, and while
+ // we're no longer looping upon ourselves
+ while ( t && last != t ) {
+ var r = [];
+ last = t;
+
+ t = jQuery.trim(t);
+
+ var foundToken = false,
+
+ // An attempt at speeding up child selectors that
+ // point to a specific element tag
+ re = quickChild,
+
+ m = re.exec(t);
+
+ if ( m ) {
+ nodeName = m[1].toUpperCase();
+
+ // Perform our own iteration and filter
+ for ( var i = 0; ret[i]; i++ )
+ for ( var c = ret[i].firstChild; c; c = c.nextSibling )
+ if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
+ r.push( c );
+
+ ret = r;
+ t = t.replace( re, "" );
+ if ( t.indexOf(" ") == 0 ) continue;
+ foundToken = true;
+ } else {
+ re = /^([>+~])\s*(\w*)/i;
+
+ if ( (m = re.exec(t)) != null ) {
+ r = [];
+
+ var merge = {};
+ nodeName = m[2].toUpperCase();
+ m = m[1];
+
+ for ( var j = 0, rl = ret.length; j < rl; j++ ) {
+ var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
+ for ( ; n; n = n.nextSibling )
+ if ( n.nodeType == 1 ) {
+ var id = jQuery.data(n);
+
+ if ( m == "~" && merge[id] ) break;
+
+ if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
+ if ( m == "~" ) merge[id] = true;
+ r.push( n );
+ }
+
+ if ( m == "+" ) break;
+ }
+ }
+
+ ret = r;
+
+ // And remove the token
+ t = jQuery.trim( t.replace( re, "" ) );
+ foundToken = true;
+ }
+ }
+
+ // See if there's still an expression, and that we haven't already
+ // matched a token
+ if ( t && !foundToken ) {
+ // Handle multiple expressions
+ if ( !t.indexOf(",") ) {
+ // Clean the result set
+ if ( context == ret[0] ) ret.shift();
+
+ // Merge the result sets
+ done = jQuery.merge( done, ret );
+
+ // Reset the context
+ r = ret = [context];
+
+ // Touch up the selector string
+ t = " " + t.substr(1,t.length);
+
+ } else {
+ // Optimize for the case nodeName#idName
+ var re2 = quickID;
+ var m = re2.exec(t);
+
+ // Re-organize the results, so that they're consistent
+ if ( m ) {
+ m = [ 0, m[2], m[3], m[1] ];
+
+ } else {
+ // Otherwise, do a traditional filter check for
+ // ID, class, and element selectors
+ re2 = quickClass;
+ m = re2.exec(t);
+ }
+
+ m[2] = m[2].replace(/\\/g, "");
+
+ var elem = ret[ret.length-1];
+
+ // Try to do a global search by ID, where we can
+ if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
+ // Optimization for HTML document case
+ var oid = elem.getElementById(m[2]);
+
+ // Do a quick check for the existence of the actual ID attribute
+ // to avoid selecting by the name attribute in IE
+ // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
+ if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
+ oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
+
+ // Do a quick check for node name (where applicable) so
+ // that div#foo searches will be really fast
+ ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
+ } else {
+ // We need to find all descendant elements
+ for ( var i = 0; ret[i]; i++ ) {
+ // Grab the tag name being searched for
+ var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
+
+ // Handle IE7 being really dumb about <object>s
+ if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
+ tag = "param";
+
+ r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+ }
+
+ // It's faster to filter by class and be done with it
+ if ( m[1] == "." )
+ r = jQuery.classFilter( r, m[2] );
+
+ // Same with ID filtering
+ if ( m[1] == "#" ) {
+ var tmp = [];
+
+ // Try to find the element with the ID
+ for ( var i = 0; r[i]; i++ )
+ if ( r[i].getAttribute("id") == m[2] ) {
+ tmp = [ r[i] ];
+ break;
+ }
+
+ r = tmp;
+ }
+
+ ret = r;
+ }
+
+ t = t.replace( re2, "" );
+ }
+
+ }
+
+ // If a selector string still exists
+ if ( t ) {
+ // Attempt to filter it
+ var val = jQuery.filter(t,r);
+ ret = r = val.r;
+ t = jQuery.trim(val.t);
+ }
+ }
+
+ // An error occurred with the selector;
+ // just return an empty set instead
+ if ( t )
+ ret = [];
+
+ // Remove the root context
+ if ( ret && context == ret[0] )
+ ret.shift();
+
+ // And combine the results
+ done = jQuery.merge( done, ret );
+
+ return done;
+ },
+
+ classFilter: function(r,m,not){
+ m = " " + m + " ";
+ var tmp = [];
+ for ( var i = 0; r[i]; i++ ) {
+ var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
+ if ( !not && pass || not && !pass )
+ tmp.push( r[i] );
+ }
+ return tmp;
+ },
+
+ filter: function(t,r,not) {
+ var last;
+
+ // Look for common filter expressions
+ while ( t && t != last ) {
+ last = t;
+
+ var p = jQuery.parse, m;
+
+ for ( var i = 0; p[i]; i++ ) {
+ m = p[i].exec( t );
+
+ if ( m ) {
+ // Remove what we just matched
+ t = t.substring( m[0].length );
+
+ m[2] = m[2].replace(/\\/g, "");
+ break;
+ }
+ }
+
+ if ( !m )
+ break;
+
+ // :not() is a special case that can be optimized by
+ // keeping it out of the expression list
+ if ( m[1] == ":" && m[2] == "not" )
+ // optimize if only one selector found (most common case)
+ r = isSimple.test( m[3] ) ?
+ jQuery.filter(m[3], r, true).r :
+ jQuery( r ).not( m[3] );
+
+ // We can get a big speed boost by filtering by class here
+ else if ( m[1] == "." )
+ r = jQuery.classFilter(r, m[2], not);
+
+ else if ( m[1] == "[" ) {
+ var tmp = [], type = m[3];
+
+ for ( var i = 0, rl = r.length; i < rl; i++ ) {
+ var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
+
+ if ( z == null || /href|src|selected/.test(m[2]) )
+ z = jQuery.attr(a,m[2]) || '';
+
+ if ( (type == "" && !!z ||
+ type == "=" && z == m[5] ||
+ type == "!=" && z != m[5] ||
+ type == "^=" && z && !z.indexOf(m[5]) ||
+ type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
+ (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
+ tmp.push( a );
+ }
+
+ r = tmp;
+
+ // We can get a speed boost by handling nth-child here
+ } else if ( m[1] == ":" && m[2] == "nth-child" ) {
+ var merge = {}, tmp = [],
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+ m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
+ !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
+ // calculate the numbers (first)n+(last) including if they are negative
+ first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
+
+ // loop through all the elements left in the jQuery object
+ for ( var i = 0, rl = r.length; i < rl; i++ ) {
+ var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
+
+ if ( !merge[id] ) {
+ var c = 1;
+
+ for ( var n = parentNode.firstChild; n; n = n.nextSibling )
+ if ( n.nodeType == 1 )
+ n.nodeIndex = c++;
+
+ merge[id] = true;
+ }
+
+ var add = false;
+
+ if ( first == 0 ) {
+ if ( node.nodeIndex == last )
+ add = true;
+ } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
+ add = true;
+
+ if ( add ^ not )
+ tmp.push( node );
+ }
+
+ r = tmp;
+
+ // Otherwise, find the expression to execute
+ } else {
+ var fn = jQuery.expr[ m[1] ];
+ if ( typeof fn == "object" )
+ fn = fn[ m[2] ];
+
+ if ( typeof fn == "string" )
+ fn = eval("false||function(a,i){return " + fn + ";}");
+
+ // Execute it against the current filter
+ r = jQuery.grep( r, function(elem, i){
+ return fn(elem, i, m, r);
+ }, not );
+ }
+ }
+
+ // Return an array of filtered elements (r)
+ // and the modified expression string (t)
+ return { r: r, t: t };
+ },
+
+ dir: function( elem, dir ){
+ var matched = [],
+ cur = elem[dir];
+ while ( cur && cur != document ) {
+ if ( cur.nodeType == 1 )
+ matched.push( cur );
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ nth: function(cur,result,dir,elem){
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] )
+ if ( cur.nodeType == 1 && ++num == result )
+ break;
+
+ return cur;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType == 1 && n != elem )
+ r.push( n );
+ }
+
+ return r;
+ }
+});
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code orignated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function(elem, types, handler, data) {
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ // For whatever reason, IE has trouble passing the window object
+ // around, causing it to be cloned in the process
+ if ( jQuery.browser.msie && elem.setInterval )
+ elem = window;
+
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid )
+ handler.guid = this.guid++;
+
+ // if data is passed, bind to handler
+ if( data != undefined ) {
+ // Create temporary function pointer to original handler
+ var fn = handler;
+
+ // Create unique handler function, wrapped around original handler
+ handler = this.proxy( fn, function() {
+ // Pass arguments and context to original handler
+ return fn.apply(this, arguments);
+ });
+
+ // Store data in unique handler
+ handler.data = data;
+ }
+
+ // Init the element's event structure
+ var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
+ handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
+ // Handle the second event of a trigger and when
+ // an event is called after a page has unloaded
+ if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
+ return jQuery.event.handle.apply(arguments.callee.elem, arguments);
+ });
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native
+ // event in IE.
+ handle.elem = elem;
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type) {
+ // Namespaced event handlers
+ var parts = type.split(".");
+ type = parts[0];
+ handler.type = parts[1];
+
+ // Get the current list of functions bound to this event
+ var handlers = events[type];
+
+ // Init the event handler queue
+ if (!handlers) {
+ handlers = events[type] = {};
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
+ // Bind the global event handler to the element
+ if (elem.addEventListener)
+ elem.addEventListener(type, handle, false);
+ else if (elem.attachEvent)
+ elem.attachEvent("on" + type, handle);
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers[handler.guid] = handler;
+
+ // Keep track of which events have been used, for global triggering
+ jQuery.event.global[type] = true;
+ });
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ guid: 1,
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function(elem, types, handler) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ var events = jQuery.data(elem, "events"), ret, index;
+
+ if ( events ) {
+ // Unbind all events for the element
+ if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
+ for ( var type in events )
+ this.remove( elem, type + (types || "") );
+ else {
+ // types is actually an event object here
+ if ( types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Handle multiple events seperated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type){
+ // Namespaced event handlers
+ var parts = type.split(".");
+ type = parts[0];
+
+ if ( events[type] ) {
+ // remove the given handler for the given type
+ if ( handler )
+ delete events[type][handler.guid];
+
+ // remove all handlers for the given type
+ else
+ for ( handler in events[type] )
+ // Handle the removal of namespaced events
+ if ( !parts[1] || events[type][handler].type == parts[1] )
+ delete events[type][handler];
+
+ // remove generic event handler if no more handlers exist
+ for ( ret in events[type] ) break;
+ if ( !ret ) {
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
+ if (elem.removeEventListener)
+ elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
+ else if (elem.detachEvent)
+ elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
+ }
+ ret = null;
+ delete events[type];
+ }
+ }
+ });
+ }
+
+ // Remove the expando if it's no longer used
+ for ( ret in events ) break;
+ if ( !ret ) {
+ var handle = jQuery.data( elem, "handle" );
+ if ( handle ) handle.elem = null;
+ jQuery.removeData( elem, "events" );
+ jQuery.removeData( elem, "handle" );
+ }
+ }
+ },
+
+ trigger: function(type, data, elem, donative, extra) {
+ // Clone the incoming data, if any
+ data = jQuery.makeArray(data);
+
+ if ( type.indexOf("!") >= 0 ) {
+ type = type.slice(0, -1);
+ var exclusive = true;
+ }
+
+ // Handle a global trigger
+ if ( !elem ) {
+ // Only trigger if we've ever bound an event for it
+ if ( this.global[type] )
+ jQuery("*").add([window, document]).trigger(type, data);
+
+ // Handle triggering a single element
+ } else {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return undefined;
+
+ var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
+ // Check to see if we need to provide a fake event, or not
+ event = !data[0] || !data[0].preventDefault;
+
+ // Pass along a fake event
+ if ( event ) {
+ data.unshift({
+ type: type,
+ target: elem,
+ preventDefault: function(){},
+ stopPropagation: function(){},
+ timeStamp: now()
+ });
+ data[0][expando] = true; // no need to fix fake event
+ }
+
+ // Enforce the right trigger type
+ data[0].type = type;
+ if ( exclusive )
+ data[0].exclusive = true;
+
+ // Trigger the event, it is assumed that "handle" is a function
+ var handle = jQuery.data(elem, "handle");
+ if ( handle )
+ val = handle.apply( elem, data );
+
+ // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
+ if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
+ val = false;
+
+ // Extra functions don't get the custom event object
+ if ( event )
+ data.shift();
+
+ // Handle triggering of extra function
+ if ( extra && jQuery.isFunction( extra ) ) {
+ // call the extra function and tack the current return value on the end for possible inspection
+ ret = extra.apply( elem, val == null ? data : data.concat( val ) );
+ // if anything is returned, give it precedence and have it overwrite the previous value
+ if (ret !== undefined)
+ val = ret;
+ }
+
+ // Trigger the native events (except for clicks on links)
+ if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
+ this.triggered = true;
+ try {
+ elem[ type ]();
+ // prevent IE from throwing an error for some hidden elements
+ } catch (e) {}
+ }
+
+ this.triggered = false;
+ }
+
+ return val;
+ },
+
+ handle: function(event) {
+ // returned undefined or false
+ var val, ret, namespace, all, handlers;
+
+ event = arguments[0] = jQuery.event.fix( event || window.event );
+
+ // Namespaced event handlers
+ namespace = event.type.split(".");
+ event.type = namespace[0];
+ namespace = namespace[1];
+ // Cache this now, all = true means, any handler
+ all = !namespace && !event.exclusive;
+
+ handlers = ( jQuery.data(this, "events") || {} )[event.type];
+
+ for ( var j in handlers ) {
+ var handler = handlers[j];
+
+ // Filter the functions by class
+ if ( all || handler.type == namespace ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handler;
+ event.data = handler.data;
+
+ ret = handler.apply( this, arguments );
+
+ if ( val !== false )
+ val = ret;
+
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+
+ return val;
+ },
+
+ fix: function(event) {
+ if ( event[expando] == true )
+ return event;
+
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = { originalEvent: originalEvent };
+ var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
+ for ( var i=props.length; i; i-- )
+ event[ props[i] ] = originalEvent[ props[i] ];
+
+ // Mark it as fixed
+ event[expando] = true;
+
+ // add preventDefault and stopPropagation since
+ // they will not work on the clone
+ event.preventDefault = function() {
+ // if preventDefault exists run it on the original event
+ if (originalEvent.preventDefault)
+ originalEvent.preventDefault();
+ // otherwise set the returnValue property of the original event to false (IE)
+ originalEvent.returnValue = false;
+ };
+ event.stopPropagation = function() {
+ // if stopPropagation exists run it on the original event
+ if (originalEvent.stopPropagation)
+ originalEvent.stopPropagation();
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ originalEvent.cancelBubble = true;
+ };
+
+ // Fix timeStamp
+ event.timeStamp = event.timeStamp || now();
+
+ // Fix target property, if necessary
+ if ( !event.target )
+ event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType == 3 )
+ event.target = event.target.parentNode;
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement )
+ event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var doc = document.documentElement, body = document.body;
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+ }
+
+ // Add which for key events
+ if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
+ event.which = event.charCode || event.keyCode;
+
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey )
+ event.metaKey = event.ctrlKey;
+
+ // Add which for click: 1 == left; 2 == middle; 3 == right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button )
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+
+ return event;
+ },
+
+ proxy: function( fn, proxy ){
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
+ // So proxy can be declared as an argument
+ return proxy;
+ },
+
+ special: {
+ ready: {
+ setup: function() {
+ // Make sure the ready event is setup
+ bindReady();
+ return;
+ },
+
+ teardown: function() { return; }
+ },
+
+ mouseenter: {
+ setup: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
+ return true;
+ },
+
+ teardown: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
+ return true;
+ },
+
+ handler: function(event) {
+ // If we actually just moused on to a sub-element, ignore it
+ if ( withinElement(event, this) ) return true;
+ // Execute the right handlers by setting the event type to mouseenter
+ event.type = "mouseenter";
+ return jQuery.event.handle.apply(this, arguments);
+ }
+ },
+
+ mouseleave: {
+ setup: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
+ return true;
+ },
+
+ teardown: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
+ return true;
+ },
+
+ handler: function(event) {
+ // If we actually just moused on to a sub-element, ignore it
+ if ( withinElement(event, this) ) return true;
+ // Execute the right handlers by setting the event type to mouseleave
+ event.type = "mouseleave";
+ return jQuery.event.handle.apply(this, arguments);
+ }
+ }
+ }
+};
+
+jQuery.fn.extend({
+ bind: function( type, data, fn ) {
+ return type == "unload" ? this.one(type, data, fn) : this.each(function(){
+ jQuery.event.add( this, type, fn || data, fn && data );
+ });
+ },
+
+ one: function( type, data, fn ) {
+ var one = jQuery.event.proxy( fn || data, function(event) {
+ jQuery(this).unbind(event, one);
+ return (fn || data).apply( this, arguments );
+ });
+ return this.each(function(){
+ jQuery.event.add( this, type, one, fn && data);
+ });
+ },
+
+ unbind: function( type, fn ) {
+ return this.each(function(){
+ jQuery.event.remove( this, type, fn );
+ });
+ },
+
+ trigger: function( type, data, fn ) {
+ return this.each(function(){
+ jQuery.event.trigger( type, data, this, true, fn );
+ });
+ },
+
+ triggerHandler: function( type, data, fn ) {
+ return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments, i = 1;
+
+ // link all the functions, so any of them can unbind this click handler
+ while( i < args.length )
+ jQuery.event.proxy( fn, args[i++] );
+
+ return this.click( jQuery.event.proxy( fn, function(event) {
+ // Figure out which function to execute
+ this.lastToggle = ( this.lastToggle || 0 ) % i;
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ this.lastToggle++ ].apply( this, arguments ) || false;
+ }));
+ },
+
+ hover: function(fnOver, fnOut) {
+ return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
+ },
+
+ ready: function(fn) {
+ // Attach the listeners
+ bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady )
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ else
+ // Add the function to the wait list
+ jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
+
+ return this;
+ }
+});
+
+jQuery.extend({
+ isReady: false,
+ readyList: [],
+ // Handle when the DOM is ready
+ ready: function() {
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.isReady ) {
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If there are functions bound, to execute
+ if ( jQuery.readyList ) {
+ // Execute all of them
+ jQuery.each( jQuery.readyList, function(){
+ this.call( document );
+ });
+
+ // Reset the list of functions
+ jQuery.readyList = null;
+ }
+
+ // Trigger any bound ready events
+ jQuery(document).triggerHandler("ready");
+ }
+ }
+});
+
+var readyBound = false;
+
+function bindReady(){
+ if ( readyBound ) return;
+ readyBound = true;
+
+ // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
+ if ( document.addEventListener && !jQuery.browser.opera)
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
+
+ // If IE is used and is not in a frame
+ // Continually check to see if the document is ready
+ if ( jQuery.browser.msie && window == top ) (function(){
+ if (jQuery.isReady) return;
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch( error ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ // and execute any waiting functions
+ jQuery.ready();
+ })();
+
+ if ( jQuery.browser.opera )
+ document.addEventListener( "DOMContentLoaded", function () {
+ if (jQuery.isReady) return;
+ for (var i = 0; i < document.styleSheets.length; i++)
+ if (document.styleSheets[i].disabled) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ // and execute any waiting functions
+ jQuery.ready();
+ }, false);
+
+ if ( jQuery.browser.safari ) {
+ var numStyles;
+ (function(){
+ if (jQuery.isReady) return;
+ if ( document.readyState != "loaded" && document.readyState != "complete" ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ if ( numStyles === undefined )
+ numStyles = jQuery("style, link[rel=stylesheet]").length;
+ if ( document.styleSheets.length != numStyles ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ // and execute any waiting functions
+ jQuery.ready();
+ })();
+ }
+
+ // A fallback to window.onload, that will always work
+ jQuery.event.add( window, "load", jQuery.ready );
+}
+
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+ "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
+ "submit,keydown,keypress,keyup,error").split(","), function(i, name){
+
+ // Handle event binding
+ jQuery.fn[name] = function(fn){
+ return fn ? this.bind(name, fn) : this.trigger(name);
+ };
+});
+
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event, elem) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
+ // Traverse up the tree
+ while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
+ // Return true if we actually just moused on to a sub-element
+ return parent == elem;
+};
+
+// Prevent memory leaks in IE
+// And prevent errors on refresh with events like mouseover in other browsers
+// Window isn't included so as not to unbind existing unload events
+jQuery(window).bind("unload", function() {
+ jQuery("*").add(document).unbind();
+});
+jQuery.fn.extend({
+ // Keep a copy of the old load
+ _load: jQuery.fn.load,
+
+ load: function( url, params, callback ) {
+ if ( typeof url != 'string' )
+ return this._load( url );
+
+ var off = url.indexOf(" ");
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
+
+ callback = callback || function(){};
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params )
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = null;
+
+ // Otherwise, build a param string
+ } else {
+ params = jQuery.param( params );
+ type = "POST";
+ }
+
+ var self = this;
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ complete: function(res, status){
+ // If successful, inject the HTML into all the matched elements
+ if ( status == "success" || status == "notmodified" )
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div/>")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ res.responseText );
+
+ self.each( callback, [res.responseText, status, res] );
+ }
+ });
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param(this.serializeArray());
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ return jQuery.nodeName(this, "form") ?
+ jQuery.makeArray(this.elements) : this;
+ })
+ .filter(function(){
+ return this.name && !this.disabled &&
+ (this.checked || /select|textarea/i.test(this.nodeName) ||
+ /text|hidden|password/i.test(this.type));
+ })
+ .map(function(i, elem){
+ var val = jQuery(this).val();
+ return val == null ? null :
+ val.constructor == Array ?
+ jQuery.map( val, function(val, i){
+ return {name: elem.name, value: val};
+ }) :
+ {name: elem.name, value: val};
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
+ jQuery.fn[o] = function(f){
+ return this.bind(o, f);
+ };
+});
+
+var jsc = now();
+
+jQuery.extend({
+ get: function( url, data, callback, type ) {
+ // shift arguments if data argument was ommited
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = null;
+ }
+
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get(url, null, callback, "script");
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get(url, data, callback, "json");
+ },
+
+ post: function( url, data, callback, type ) {
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = {};
+ }
+
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ ajaxSetup: function( settings ) {
+ jQuery.extend( jQuery.ajaxSettings, settings );
+ },
+
+ ajaxSettings: {
+ url: location.href,
+ global: true,
+ type: "GET",
+ timeout: 0,
+ contentType: "application/x-www-form-urlencoded",
+ processData: true,
+ async: true,
+ data: null,
+ username: null,
+ password: null,
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ script: "text/javascript, application/javascript",
+ json: "application/json, text/javascript",
+ text: "text/plain",
+ _default: "*/*"
+ }
+ },
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+
+ ajax: function( s ) {
+ // Extend the settings, but re-extend 's' so that it can be
+ // checked again later (in the test suite, specifically)
+ s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
+
+ var jsonp, jsre = /=\?(&|$)/g, status, data,
+ type = s.type.toUpperCase();
+
+ // convert data if not already a string
+ if ( s.data && s.processData && typeof s.data != "string" )
+ s.data = jQuery.param(s.data);
+
+ // Handle JSONP Parameter Callbacks
+ if ( s.dataType == "jsonp" ) {
+ if ( type == "GET" ) {
+ if ( !s.url.match(jsre) )
+ s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+ } else if ( !s.data || !s.data.match(jsre) )
+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+ s.dataType = "json";
+ }
+
+ // Build temporary JSONP function
+ if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
+ jsonp = "jsonp" + jsc++;
+
+ // Replace the =? sequence both in the query string and the data
+ if ( s.data )
+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+ // We need to make sure
+ // that a JSONP style response is executed properly
+ s.dataType = "script";
+
+ // Handle JSONP-style loading
+ window[ jsonp ] = function(tmp){
+ data = tmp;
+ success();
+ complete();
+ // Garbage collect
+ window[ jsonp ] = undefined;
+ try{ delete window[ jsonp ]; } catch(e){}
+ if ( head )
+ head.removeChild( script );
+ };
+ }
+
+ if ( s.dataType == "script" && s.cache == null )
+ s.cache = false;
+
+ if ( s.cache === false && type == "GET" ) {
+ var ts = now();
+ // try replacing _= if it is there
+ var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
+ }
+
+ // If data is available, append data to url for get requests
+ if ( s.data && type == "GET" ) {
+ s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
+
+ // IE likes to send both get and post data, prevent this
+ s.data = null;
+ }
+
+ // Watch for a new set of requests
+ if ( s.global && ! jQuery.active++ )
+ jQuery.event.trigger( "ajaxStart" );
+
+ // Matches an absolute URL, and saves the domain
+ var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
+
+ // If we're requesting a remote document
+ // and trying to load JSON or Script with a GET
+ if ( s.dataType == "script" && type == "GET"
+ && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
+ var head = document.getElementsByTagName("head")[0];
+ var script = document.createElement("script");
+ script.src = s.url;
+ if (s.scriptCharset)
+ script.charset = s.scriptCharset;
+
+ // Handle Script loading
+ if ( !jsonp ) {
+ var done = false;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function(){
+ if ( !done && (!this.readyState ||
+ this.readyState == "loaded" || this.readyState == "complete") ) {
+ done = true;
+ success();
+ complete();
+ head.removeChild( script );
+ }
+ };
+ }
+
+ head.appendChild(script);
+
+ // We handle everything using the script element injection
+ return undefined;
+ }
+
+ var requestDone = false;
+
+ // Create the request object; Microsoft failed to properly
+ // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+ var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if( s.username )
+ xhr.open(type, s.url, s.async, s.username, s.password);
+ else
+ xhr.open(type, s.url, s.async);
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ // Set the correct header, if data is being sent
+ if ( s.data )
+ xhr.setRequestHeader("Content-Type", s.contentType);
+
+ // Set the If-Modified-Since header, if ifModified mode.
+ if ( s.ifModified )
+ xhr.setRequestHeader("If-Modified-Since",
+ jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+
+ // Set header so the called script knows that it's an XMLHttpRequest
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+
+ // Set the Accepts header for the server, depending on the dataType
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+ s.accepts[ s.dataType ] + ", */*" :
+ s.accepts._default );
+ } catch(e){}
+
+ // Allow custom headers/mimetypes
+ if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
+ // cleanup active request counter
+ s.global && jQuery.active--;
+ // close opended socket
+ xhr.abort();
+ return false;
+ }
+
+ if ( s.global )
+ jQuery.event.trigger("ajaxSend", [xhr, s]);
+
+ // Wait for a response to come back
+ var onreadystatechange = function(isTimeout){
+ // The transfer is complete and the data is available, or the request timed out
+ if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
+ requestDone = true;
+
+ // clear poll interval
+ if (ival) {
+ clearInterval(ival);
+ ival = null;
+ }
+
+ status = isTimeout == "timeout" && "timeout" ||
+ !jQuery.httpSuccess( xhr ) && "error" ||
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
+ "success";
+
+ if ( status == "success" ) {
+ // Watch for, and catch, XML document parse errors
+ try {
+ // process the data (runs the xml through httpData regardless of callback)
+ data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
+ } catch(e) {
+ status = "parsererror";
+ }
+ }
+
+ // Make sure that the request was successful or notmodified
+ if ( status == "success" ) {
+ // Cache Last-Modified header, if ifModified mode.
+ var modRes;
+ try {
+ modRes = xhr.getResponseHeader("Last-Modified");
+ } catch(e) {} // swallow exception thrown by FF if header is not available
+
+ if ( s.ifModified && modRes )
+ jQuery.lastModified[s.url] = modRes;
+
+ // JSONP handles its own success callback
+ if ( !jsonp )
+ success();
+ } else
+ jQuery.handleError(s, xhr, status);
+
+ // Fire the complete handlers
+ complete();
+
+ // Stop memory leaks
+ if ( s.async )
+ xhr = null;
+ }
+ };
+
+ if ( s.async ) {
+ // don't attach the handler to the request, just poll it instead
+ var ival = setInterval(onreadystatechange, 13);
+
+ // Timeout checker
+ if ( s.timeout > 0 )
+ setTimeout(function(){
+ // Check to see if the request is still happening
+ if ( xhr ) {
+ // Cancel the request
+ xhr.abort();
+
+ if( !requestDone )
+ onreadystatechange( "timeout" );
+ }
+ }, s.timeout);
+ }
+
+ // Send the data
+ try {
+ xhr.send(s.data);
+ } catch(e) {
+ jQuery.handleError(s, xhr, null, e);
+ }
+
+ // firefox 1.5 doesn't fire statechange for sync requests
+ if ( !s.async )
+ onreadystatechange();
+
+ function success(){
+ // If a local callback was specified, fire it and pass it the data
+ if ( s.success )
+ s.success( data, status );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
+ }
+
+ function complete(){
+ // Process result
+ if ( s.complete )
+ s.complete(xhr, status);
+
+ // The request was completed
+ if ( s.global )
+ jQuery.event.trigger( "ajaxComplete", [xhr, s] );
+
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ }
+
+ // return XMLHttpRequest to allow aborting the request etc.
+ return xhr;
+ },
+
+ handleError: function( s, xhr, status, e ) {
+ // If a local callback was specified, fire it
+ if ( s.error ) s.error( xhr, status, e );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxError", [xhr, s, e] );
+ },
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Determines if an XMLHttpRequest was successful or not
+ httpSuccess: function( xhr ) {
+ try {
+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+ return !xhr.status && location.protocol == "file:" ||
+ ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
+ jQuery.browser.safari && xhr.status == undefined;
+ } catch(e){}
+ return false;
+ },
+
+ // Determines if an XMLHttpRequest returns NotModified
+ httpNotModified: function( xhr, url ) {
+ try {
+ var xhrRes = xhr.getResponseHeader("Last-Modified");
+
+ // Firefox always returns 200. check Last-Modified date
+ return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
+ jQuery.browser.safari && xhr.status == undefined;
+ } catch(e){}
+ return false;
+ },
+
+ httpData: function( xhr, type, filter ) {
+ var ct = xhr.getResponseHeader("content-type"),
+ xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if ( xml && data.documentElement.tagName == "parsererror" )
+ throw "parsererror";
+
+ // Allow a pre-filtering function to sanitize the response
+ if( filter )
+ data = filter( data, type );
+
+ // If the type is "script", eval it in global context
+ if ( type == "script" )
+ jQuery.globalEval( data );
+
+ // Get the JavaScript object, if JSON is used.
+ if ( type == "json" )
+ data = eval("(" + data + ")");
+
+ return data;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a ) {
+ var s = [];
+
+ // If an array was passed in, assume that it is an array
+ // of form elements
+ if ( a.constructor == Array || a.jquery )
+ // Serialize the form elements
+ jQuery.each( a, function(){
+ s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
+ });
+
+ // Otherwise, assume that it's an object of key/value pairs
+ else
+ // Serialize the key/values
+ for ( var j in a )
+ // If the value is an array then the key names need to be repeated
+ if ( a[j] && a[j].constructor == Array )
+ jQuery.each( a[j], function(){
+ s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
+ });
+ else
+ s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
+
+ // Return the resulting serialization
+ return s.join("&").replace(/%20/g, "+");
+ }
+
+});
+jQuery.fn.extend({
+ show: function(speed,callback){
+ return speed ?
+ this.animate({
+ height: "show", width: "show", opacity: "show"
+ }, speed, callback) :
+
+ this.filter(":hidden").each(function(){
+ this.style.display = this.oldblock || "";
+ if ( jQuery.css(this,"display") == "none" ) {
+ var elem = jQuery("<" + this.tagName + " />").appendTo("body");
+ this.style.display = elem.css("display");
+ // handle an edge condition where css is - div { display:none; } or similar
+ if (this.style.display == "none")
+ this.style.display = "block";
+ elem.remove();
+ }
+ }).end();
+ },
+
+ hide: function(speed,callback){
+ return speed ?
+ this.animate({
+ height: "hide", width: "hide", opacity: "hide"
+ }, speed, callback) :
+
+ this.filter(":visible").each(function(){
+ this.oldblock = this.oldblock || jQuery.css(this,"display");
+ this.style.display = "none";
+ }).end();
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2 ){
+ return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+ this._toggle.apply( this, arguments ) :
+ fn ?
+ this.animate({
+ height: "toggle", width: "toggle", opacity: "toggle"
+ }, fn, fn2) :
+ this.each(function(){
+ jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
+ });
+ },
+
+ slideDown: function(speed,callback){
+ return this.animate({height: "show"}, speed, callback);
+ },
+
+ slideUp: function(speed,callback){
+ return this.animate({height: "hide"}, speed, callback);
+ },
+
+ slideToggle: function(speed, callback){
+ return this.animate({height: "toggle"}, speed, callback);
+ },
+
+ fadeIn: function(speed, callback){
+ return this.animate({opacity: "show"}, speed, callback);
+ },
+
+ fadeOut: function(speed, callback){
+ return this.animate({opacity: "hide"}, speed, callback);
+ },
+
+ fadeTo: function(speed,to,callback){
+ return this.animate({opacity: to}, speed, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed(speed, easing, callback);
+
+ return this[ optall.queue === false ? "each" : "queue" ](function(){
+ if ( this.nodeType != 1)
+ return false;
+
+ var opt = jQuery.extend({}, optall), p,
+ hidden = jQuery(this).is(":hidden"), self = this;
+
+ for ( p in prop ) {
+ if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+ return opt.complete.call(this);
+
+ if ( p == "height" || p == "width" ) {
+ // Store display property
+ opt.display = jQuery.css(this, "display");
+
+ // Make sure that nothing sneaks out
+ opt.overflow = this.style.overflow;
+ }
+ }
+
+ if ( opt.overflow != null )
+ this.style.overflow = "hidden";
+
+ opt.curAnim = jQuery.extend({}, prop);
+
+ jQuery.each( prop, function(name, val){
+ var e = new jQuery.fx( self, opt, name );
+
+ if ( /toggle|show|hide/.test(val) )
+ e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+ else {
+ var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+ start = e.cur(true) || 0;
+
+ if ( parts ) {
+ var end = parseFloat(parts[2]),
+ unit = parts[3] || "px";
+
+ // We need to compute starting value
+ if ( unit != "px" ) {
+ self.style[ name ] = (end || 1) + unit;
+ start = ((end || 1) / e.cur(true)) * start;
+ self.style[ name ] = start + unit;
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] )
+ end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+
+ e.custom( start, end, unit );
+ } else
+ e.custom( start, val, "" );
+ }
+ });
+
+ // For JS strict compliance
+ return true;
+ });
+ },
+
+ queue: function(type, fn){
+ if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
+ fn = type;
+ type = "fx";
+ }
+
+ if ( !type || (typeof type == "string" && !fn) )
+ return queue( this[0], type );
+
+ return this.each(function(){
+ if ( fn.constructor == Array )
+ queue(this, type, fn);
+ else {
+ queue(this, type).push( fn );
+
+ if ( queue(this, type).length == 1 )
+ fn.call(this);
+ }
+ });
+ },
+
+ stop: function(clearQueue, gotoEnd){
+ var timers = jQuery.timers;
+
+ if (clearQueue)
+ this.queue([]);
+
+ this.each(function(){
+ // go in reverse order so anything added to the queue during the loop is ignored
+ for ( var i = timers.length - 1; i >= 0; i-- )
+ if ( timers[i].elem == this ) {
+ if (gotoEnd)
+ // force the next step to be the last
+ timers[i](true);
+ timers.splice(i, 1);
+ }
+ });
+
+ // start the next in the queue if the last step wasn't forced
+ if (!gotoEnd)
+ this.dequeue();
+
+ return this;
+ }
+
+});
+
+var queue = function( elem, type, array ) {
+ if ( elem ){
+
+ type = type || "fx";
+
+ var q = jQuery.data( elem, type + "queue" );
+
+ if ( !q || array )
+ q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
+
+ }
+ return q;
+};
+
+jQuery.fn.dequeue = function(type){
+ type = type || "fx";
+
+ return this.each(function(){
+ var q = queue(this, type);
+
+ q.shift();
+
+ if ( q.length )
+ q[0].call( this );
+ });
+};
+
+jQuery.extend({
+
+ speed: function(speed, easing, fn) {
+ var opt = speed && speed.constructor == Object ? speed : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && easing.constructor != Function && easing
+ };
+
+ opt.duration = (opt.duration && opt.duration.constructor == Number ?
+ opt.duration :
+ jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
+
+ // Queueing
+ opt.old = opt.complete;
+ opt.complete = function(){
+ if ( opt.queue !== false )
+ jQuery(this).dequeue();
+ if ( jQuery.isFunction( opt.old ) )
+ opt.old.call( this );
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p, n, firstNum, diff ) {
+ return firstNum + diff * p;
+ },
+ swing: function( p, n, firstNum, diff ) {
+ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+ }
+ },
+
+ timers: [],
+ timerId: null,
+
+ fx: function( elem, options, prop ){
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ if ( !options.orig )
+ options.orig = {};
+ }
+
+});
+
+jQuery.fx.prototype = {
+
+ // Simple function for setting a style value
+ update: function(){
+ if ( this.options.step )
+ this.options.step.call( this.elem, this.now, this );
+
+ (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+ // Set display property to block for height/width animations
+ if ( this.prop == "height" || this.prop == "width" )
+ this.elem.style.display = "block";
+ },
+
+ // Get the current size
+ cur: function(force){
+ if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
+ return this.elem[ this.prop ];
+
+ var r = parseFloat(jQuery.css(this.elem, this.prop, force));
+ return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+ },
+
+ // Start an animation from one number to another
+ custom: function(from, to, unit){
+ this.startTime = now();
+ this.start = from;
+ this.end = to;
+ this.unit = unit || this.unit || "px";
+ this.now = this.start;
+ this.pos = this.state = 0;
+ this.update();
+
+ var self = this;
+ function t(gotoEnd){
+ return self.step(gotoEnd);
+ }
+
+ t.elem = this.elem;
+
+ jQuery.timers.push(t);
+
+ if ( jQuery.timerId == null ) {
+ jQuery.timerId = setInterval(function(){
+ var timers = jQuery.timers;
+
+ for ( var i = 0; i < timers.length; i++ )
+ if ( !timers[i]() )
+ timers.splice(i--, 1);
+
+ if ( !timers.length ) {
+ clearInterval( jQuery.timerId );
+ jQuery.timerId = null;
+ }
+ }, 13);
+ }
+ },
+
+ // Simple 'show' function
+ show: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ this.custom(0, this.cur());
+
+ // Make sure that we start at a small width/height to avoid any
+ // flash of content
+ if ( this.prop == "width" || this.prop == "height" )
+ this.elem.style[this.prop] = "1px";
+
+ // Start by showing the element
+ jQuery(this.elem).show();
+ },
+
+ // Simple 'hide' function
+ hide: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom(this.cur(), 0);
+ },
+
+ // Each step of an animation
+ step: function(gotoEnd){
+ var t = now();
+
+ if ( gotoEnd || t > this.options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ this.options.curAnim[ this.prop ] = true;
+
+ var done = true;
+ for ( var i in this.options.curAnim )
+ if ( this.options.curAnim[i] !== true )
+ done = false;
+
+ if ( done ) {
+ if ( this.options.display != null ) {
+ // Reset the overflow
+ this.elem.style.overflow = this.options.overflow;
+
+ // Reset the display
+ this.elem.style.display = this.options.display;
+ if ( jQuery.css(this.elem, "display") == "none" )
+ this.elem.style.display = "block";
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( this.options.hide )
+ this.elem.style.display = "none";
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( this.options.hide || this.options.show )
+ for ( var p in this.options.curAnim )
+ jQuery.attr(this.elem.style, p, this.options.orig[p]);
+ }
+
+ if ( done )
+ // Execute the complete function
+ this.options.complete.call( this.elem );
+
+ return false;
+ } else {
+ var n = t - this.startTime;
+ this.state = n / this.options.duration;
+
+ // Perform the easing function, defaults to swing
+ this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+ this.now = this.start + ((this.end - this.start) * this.pos);
+
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+
+};
+
+jQuery.extend( jQuery.fx, {
+ speeds:{
+ slow: 600,
+ fast: 200,
+ // Default speed
+ def: 400
+ },
+ step: {
+ scrollLeft: function(fx){
+ fx.elem.scrollLeft = fx.now;
+ },
+
+ scrollTop: function(fx){
+ fx.elem.scrollTop = fx.now;
+ },
+
+ opacity: function(fx){
+ jQuery.attr(fx.elem.style, "opacity", fx.now);
+ },
+
+ _default: function(fx){
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ }
+ }
+});
+// The Offset Method
+// Originally By Brandon Aaron, part of the Dimension Plugin
+// http://jquery.com/plugins/project/dimensions
+jQuery.fn.offset = function() {
+ var left = 0, top = 0, elem = this[0], results;
+
+ if ( elem ) with ( jQuery.browser ) {
+ var parent = elem.parentNode,
+ offsetChild = elem,
+ offsetParent = elem.offsetParent,
+ doc = elem.ownerDocument,
+ safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
+ css = jQuery.curCSS,
+ fixed = css(elem, "position") == "fixed";
+
+ // Use getBoundingClientRect if available
+ if ( elem.getBoundingClientRect ) {
+ var box = elem.getBoundingClientRect();
+
+ // Add the document scroll offsets
+ add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+ box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
+
+ // IE adds the HTML element's border, by default it is medium which is 2px
+ // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
+ // IE 7 standards mode, the border is always 2px
+ // This border/offset is typically represented by the clientLeft and clientTop properties
+ // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
+ // Therefore this method will be off by 2px in IE while in quirksmode
+ add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
+
+ // Otherwise loop through the offsetParents and parentNodes
+ } else {
+
+ // Initial element offsets
+ add( elem.offsetLeft, elem.offsetTop );
+
+ // Get parent offsets
+ while ( offsetParent ) {
+ // Add offsetParent offsets
+ add( offsetParent.offsetLeft, offsetParent.offsetTop );
+
+ // Mozilla and Safari > 2 does not include the border on offset parents
+ // However Mozilla adds the border for table or table cells
+ if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
+ border( offsetParent );
+
+ // Add the document scroll offsets if position is fixed on any offsetParent
+ if ( !fixed && css(offsetParent, "position") == "fixed" )
+ fixed = true;
+
+ // Set offsetChild to previous offsetParent unless it is the body element
+ offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
+ // Get next offsetParent
+ offsetParent = offsetParent.offsetParent;
+ }
+
+ // Get parent scroll offsets
+ while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
+ // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
+ if ( !/^inline|table.*$/i.test(css(parent, "display")) )
+ // Subtract parent scroll offsets
+ add( -parent.scrollLeft, -parent.scrollTop );
+
+ // Mozilla does not add the border for a parent that has overflow != visible
+ if ( mozilla && css(parent, "overflow") != "visible" )
+ border( parent );
+
+ // Get next parent
+ parent = parent.parentNode;
+ }
+
+ // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
+ // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
+ if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
+ (mozilla && css(offsetChild, "position") != "absolute") )
+ add( -doc.body.offsetLeft, -doc.body.offsetTop );
+
+ // Add the document scroll offsets if position is fixed
+ if ( fixed )
+ add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+ Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
+ }
+
+ // Return an object with top and left properties
+ results = { top: top, left: left };
+ }
+
+ function border(elem) {
+ add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
+ }
+
+ function add(l, t) {
+ left += parseInt(l, 10) || 0;
+ top += parseInt(t, 10) || 0;
+ }
+
+ return results;
+};
+
+
+jQuery.fn.extend({
+ position: function() {
+ var left = 0, top = 0, results;
+
+ if ( this[0] ) {
+ // Get *real* offsetParent
+ var offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= num( this, 'marginTop' );
+ offset.left -= num( this, 'marginLeft' );
+
+ // Add offsetParent borders
+ parentOffset.top += num( offsetParent, 'borderTopWidth' );
+ parentOffset.left += num( offsetParent, 'borderLeftWidth' );
+
+ // Subtract the two offsets
+ results = {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ }
+
+ return results;
+ },
+
+ offsetParent: function() {
+ var offsetParent = this[0].offsetParent;
+ while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
+ offsetParent = offsetParent.offsetParent;
+ return jQuery(offsetParent);
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( ['Left', 'Top'], function(i, name) {
+ var method = 'scroll' + name;
+
+ jQuery.fn[ method ] = function(val) {
+ if (!this[0]) return;
+
+ return val != undefined ?
+
+ // Set the scroll offset
+ this.each(function() {
+ this == window || this == document ?
+ window.scrollTo(
+ !i ? val : jQuery(window).scrollLeft(),
+ i ? val : jQuery(window).scrollTop()
+ ) :
+ this[ method ] = val;
+ }) :
+
+ // Return the scroll offset
+ this[0] == window || this[0] == document ?
+ self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
+ jQuery.boxModel && document.documentElement[ method ] ||
+ document.body[ method ] :
+ this[0][ method ];
+ };
+});
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each([ "Height", "Width" ], function(i, name){
+
+ var tl = i ? "Left" : "Top", // top or left
+ br = i ? "Right" : "Bottom"; // bottom or right
+
+ // innerHeight and innerWidth
+ jQuery.fn["inner" + name] = function(){
+ return this[ name.toLowerCase() ]() +
+ num(this, "padding" + tl) +
+ num(this, "padding" + br);
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn["outer" + name] = function(margin) {
+ return this["inner" + name]() +
+ num(this, "border" + tl + "Width") +
+ num(this, "border" + br + "Width") +
+ (margin ?
+ num(this, "margin" + tl) + num(this, "margin" + br) : 0);
+ };
+
+});})();
diff --git a/dom/tests/mochitest/ajax/jquery/manifest.json b/dom/tests/mochitest/ajax/jquery/manifest.json
new file mode 100644
index 0000000000..d33c00c7f1
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/manifest.json
@@ -0,0 +1 @@
+{testcases:["test/index.html"]}
diff --git a/dom/tests/mochitest/ajax/jquery/mochitest.ini b/dom/tests/mochitest/ajax/jquery/mochitest.ini
new file mode 100644
index 0000000000..3f10b1cf77
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/mochitest.ini
@@ -0,0 +1,37 @@
+[DEFAULT]
+support-files =
+ manifest.json
+ dist/jquery.js
+ test/index.html
+ test/offset.html
+ test/test.js
+ test/fix.html
+ test/data/cow.jpg
+ test/data/dashboard.xml
+ test/data/iframe.html
+ test/data/json_assigned_obj.js
+ test/data/json_obj.js
+ test/data/name.html
+ test/data/test.html
+ test/data/test.js
+ test/data/test2.html
+ test/data/test3.html
+ test/data/testrunner.js
+ test/data/testsuite.css
+ test/data/with_fries.xml
+ test/data/offset/absolute.html
+ test/data/offset/fixed.html
+ test/data/offset/relative.html
+ test/data/offset/scroll.html
+ test/data/offset/static.html
+ test/data/offset/table.html
+ test/unit/ajax.js
+ test/unit/core.js
+ test/unit/dimensions.js
+ test/unit/event.js
+ test/unit/fx.js
+ test/unit/offset.js
+ test/unit/selector.js
+
+[test_jQuery.html]
+skip-if = (os == "android") # Bug 1780219
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/cow.jpg b/dom/tests/mochitest/ajax/jquery/test/data/cow.jpg
new file mode 100644
index 0000000000..2c5b672259
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/cow.jpg
Binary files differ
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/dashboard.xml b/dom/tests/mochitest/ajax/jquery/test/data/dashboard.xml
new file mode 100644
index 0000000000..10f6b33479
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/dashboard.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dashboard>
+ <locations class="foo">
+ <location for="bar">
+ <infowindowtab>
+ <tab title="Location"><![CDATA[blabla]]></tab>
+ <tab title="Users"><![CDATA[blublu]]></tab>
+ </infowindowtab>
+ </location>
+ </locations>
+</dashboard>
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/iframe.html b/dom/tests/mochitest/ajax/jquery/test/data/iframe.html
new file mode 100644
index 0000000000..3ff26e1612
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/iframe.html
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>iframe</title>
+ </head>
+ <body>
+ <div><span>span text</span></div>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/json_assigned_obj.js b/dom/tests/mochitest/ajax/jquery/test/data/json_assigned_obj.js
new file mode 100644
index 0000000000..867251dad1
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/json_assigned_obj.js
@@ -0,0 +1 @@
+json_assigned_obj = { "test" : "worked" };
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/json_obj.js b/dom/tests/mochitest/ajax/jquery/test/data/json_obj.js
new file mode 100644
index 0000000000..7fa61820f8
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/json_obj.js
@@ -0,0 +1 @@
+{ "data": {"lang": "en", "length": 25} }
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/name.html b/dom/tests/mochitest/ajax/jquery/test/data/name.html
new file mode 100644
index 0000000000..0fa32d1a82
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/name.html
@@ -0,0 +1 @@
+ERROR <script type="text/javascript">ok( true, "name.html retrieved" );</script>
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/absolute.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/absolute.html
new file mode 100644
index 0000000000..3bbc8417dc
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/absolute.html
@@ -0,0 +1,39 @@
+<!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=utf-8">
+ <title>absolute</title>
+ <style type="text/css" media="screen">
+ body { margin: 1px; padding: 5px; }
+ div.absolute { position: absolute; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; }
+ #absolute-1 { top: 0; left: 0; }
+ #absolute-1-1 { top: 1px; left: 1px; }
+ #absolute-1-1-1 { top: 1px; left: 1px; }
+ #absolute-2 { top: 19px; left: 19px; }
+ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
+ p.instructions { position: absolute; bottom: 0; }
+ </style>
+ <script type="text/javascript" src="../../../dist/jquery.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ $(function() {
+ $('.absolute').click(function() {
+ $('#marker').css( $(this).offset() );
+ var pos = $(this).position();
+ $(this).css({ top: pos.top, left: pos.left });
+ return false;
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <div id="absolute-1" class="absolute">absolute-1
+ <div id="absolute-1-1" class="absolute">absolute-1-1
+ <div id="absolute-1-1-1" class="absolute">absolute-1-1-1</div>
+ </div>
+ </div>
+ <div id="absolute-2" class="absolute">absolute-2</div>
+ <div id="marker"></div>
+ <p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/fixed.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/fixed.html
new file mode 100644
index 0000000000..8d69aae94d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/fixed.html
@@ -0,0 +1,33 @@
+<!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=utf-8">
+ <title>fixed</title>
+ <style type="text/css" media="screen">
+ body { margin: 1px; padding: 5px; }
+ div.fixed { position: fixed; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
+ #fixed-1 { top: 0; left: 0; }
+ #fixed-2 { top: 20px; left: 20px; }
+ #forceScroll { width: 5000px; height: 5000px; }
+ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
+ </style>
+ <script type="text/javascript" src="../../../dist/jquery.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ $(function() {
+ window.scrollTo(1000,1000);
+ $('.fixed').click(function() {
+ $('#marker').css( $(this).offset() );
+ return false;
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <div id="fixed-1" class="fixed"></div>
+ <div id="fixed-2" class="fixed"></div>
+ <div id="forceScroll"></div>
+ <div id="marker"></div>
+ <p class="instructions">Click the white box to move the marker to it.</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html
new file mode 100644
index 0000000000..89aae83e4a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html
@@ -0,0 +1,31 @@
+<!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=utf-8">
+ <title>relative</title>
+ <style type="text/css" media="screen">
+ body { margin: 1px; padding: 5px; }
+ div.relative { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
+ #relative-2 { top: 20px; left: 20px; }
+ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
+ </style>
+ <script type="text/javascript" src="../../../dist/jquery.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ $(function() {
+ $('.relative').click(function() {
+ $('#marker').css( $(this).offset() );
+ var pos = $(this).position();
+ $(this).css({ position: 'absolute', top: pos.top, left: pos.left });
+ return false;
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <div id="relative-1" class="relative"><div id="relative-1-1" class="relative"><div id="relative-1-1-1" class="relative"></div></div></div>
+ <div id="relative-2" class="relative"></div>
+ <div id="marker"></div>
+ <p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/scroll.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/scroll.html
new file mode 100644
index 0000000000..494f640581
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/scroll.html
@@ -0,0 +1,39 @@
+<!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=utf-8">
+ <title>scroll</title>
+ <style type="text/css" media="screen">
+ body { margin: 1px; padding: 5px; }
+ div.scroll { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: auto; }
+ #scroll-1 { top: 0; left: 0; }
+ #scroll-1-1 { top: 1px; left: 1px; }
+ #scroll-1-1-1 { top: 1px; left: 1px; }
+ #forceScroll { width: 5000px; height: 5000px; }
+ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
+ </style>
+ <script type="text/javascript" src="../../../dist/jquery.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ $(function() {
+ window.scrollTo(1000,1000);
+ $('#scroll-1')[0].scrollLeft = 5;
+ $('#scroll-1')[0].scrollTop = 5;
+ $('.scroll').click(function() {
+ $('#marker').css( $(this).offset() );
+ return false;
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <div id="scroll-1" class="scroll">
+ <div id="scroll-1-1" class="scroll">
+ <div id="scroll-1-1-1" class="scroll"></div>
+ </div>
+ </div>
+ <div id="forceScroll"></div>
+ <div id="marker"></div>
+ <p class="instructions">Click the white box to move the marker to it.</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/static.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/static.html
new file mode 100644
index 0000000000..10116af65b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/static.html
@@ -0,0 +1,31 @@
+<!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=utf-8">
+ <title>static</title>
+ <style type="text/css" media="screen">
+ body { margin: 1px; padding: 5px; }
+ div.static { position: static; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
+ #static-2 { top: 20px; left: 20px; }
+ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
+ </style>
+ <script type="text/javascript" src="../../../dist/jquery.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ $(function() {
+ $('.static').click(function() {
+ $('#marker').css( $(this).offset() );
+ var pos = $(this).position();
+ $(this).css({ position: 'absolute', top: pos.top, left: pos.left });
+ return false;
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <div id="static-1" class="static"><div id="static-1-1" class="static"><div id="static-1-1-1" class="static"></div></div></div>
+ <div id="static-2" class="static"></div>
+ <div id="marker"></div>
+ <p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/table.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/table.html
new file mode 100644
index 0000000000..5d15b903b6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/table.html
@@ -0,0 +1,43 @@
+<!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=utf-8">
+ <title>table</title>
+ <style type="text/css" media="screen">
+ body { margin: 1px; padding: 5px; }
+ table { border: 2px solid #000; }
+ th, td { border: 1px solid #000; width: 100px; height: 100px; }
+ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
+ </style>
+ <script type="text/javascript" src="../../../dist/jquery.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ $(function() {
+ $('table, th, td').click(function() {
+ $('#marker').css( $(this).offset() );
+ return false;
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <table id="table-1">
+ <thead>
+ <tr valign="top">
+ <th id="th-1">th-1</th>
+ <th id="th-2">th-2</th>
+ <th id="th-3">th-3</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr valign="top">
+ <td id="td-1">td-1</td>
+ <td id="td-2">td-2</td>
+ <td id="td-3">td-3</td>
+ </tr>
+ </tbody>
+ </table>
+ <div id="marker"></div>
+ <p class="instructions">Click the white box to move the marker to it.</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test.html b/dom/tests/mochitest/ajax/jquery/test/data/test.html
new file mode 100644
index 0000000000..fc6dc38607
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/test.html
@@ -0,0 +1,7 @@
+html text<br/>
+<script type="text/javascript">/* <![CDATA[ */
+testFoo = "foo"; $('#foo').html('foo');
+ok( true, "test.html executed" );
+/* ]]> */</script>
+<script src="data/test.js"></script>
+blabla
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test.js b/dom/tests/mochitest/ajax/jquery/test/data/test.js
new file mode 100644
index 0000000000..f8bdd091e4
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/test.js
@@ -0,0 +1,3 @@
+var foobar = "bar";
+$('#ap').html('bar');
+ok( true, "test.js executed");
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test2.html b/dom/tests/mochitest/ajax/jquery/test/data/test2.html
new file mode 100644
index 0000000000..ebf610e438
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/test2.html
@@ -0,0 +1,5 @@
+<script type="text/javascript">
+var testFoo = "foo";
+$('#foo').html('foo');
+ok( true, "test2.html executed" );
+</script>
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test3.html b/dom/tests/mochitest/ajax/jquery/test/data/test3.html
new file mode 100644
index 0000000000..909d41745c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/test3.html
@@ -0,0 +1,3 @@
+<div class="user">This is a user</div>
+<div class="user">This is a user</div>
+<div class="teacher">This is a teacher</div>
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/testrunner.js b/dom/tests/mochitest/ajax/jquery/test/data/testrunner.js
new file mode 100644
index 0000000000..24bf0a863a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/testrunner.js
@@ -0,0 +1,334 @@
+var _config = {
+ fixture: null,
+ Test: [],
+ stats: {
+ all: 0,
+ bad: 0
+ },
+ queue: [],
+ blocking: true,
+ timeout: null,
+ expected: null,
+ currentModule: null,
+ asyncTimeout: 2 // seconds for async timeout
+};
+
+_config.filters = location.search.length > 1 && //restrict modules/tests by get parameters
+ $.map( location.search.slice(1).split('&'), decodeURIComponent );
+
+var isLocal = !!(window.location.protocol == 'file:');
+
+$(function() {
+ $('#userAgent').html(navigator.userAgent);
+ runTest();
+});
+
+function synchronize(callback) {
+ _config.queue[_config.queue.length] = callback;
+ if(!_config.blocking) {
+ process();
+ }
+}
+
+function process() {
+ while(_config.queue.length && !_config.blocking) {
+ var call = _config.queue[0];
+ _config.queue = _config.queue.slice(1);
+ call();
+ }
+}
+
+function stop(allowFailure) {
+ _config.blocking = true;
+ var handler = allowFailure ? start : function() {
+ ok( false, "Test timed out" );
+ start();
+ };
+ // Disabled, caused too many random errors
+ //_config.timeout = setTimeout(handler, _config.asyncTimeout * 1000);
+}
+function start() {
+ // A slight delay, to avoid any current callbacks
+ setTimeout(function(){
+ if(_config.timeout)
+ clearTimeout(_config.timeout);
+ _config.blocking = false;
+ process();
+ }, 13);
+}
+
+function validTest( name ) {
+ var filters = _config.filters;
+ if( !filters )
+ return true;
+
+ var i = filters.length,
+ run = false;
+ while( i-- ){
+ var filter = filters[i],
+ not = filter.charAt(0) == '!';
+ if( not )
+ filter = filter.slice(1);
+ if( name.indexOf(filter) != -1 )
+ return !not;
+ if( not )
+ run = true;
+ }
+ return run;
+}
+
+function runTest() {
+ _config.blocking = false;
+ var time = new Date();
+ _config.fixture = document.getElementById('main').innerHTML;
+ _config.ajaxSettings = $.ajaxSettings;
+ synchronize(function() {
+ time = new Date() - time;
+ $("<div>").html(['<p class="result">Tests completed in ',
+ time, ' milliseconds.<br/>',
+ _config.stats.bad, ' tests of ', _config.stats.all, ' failed.</p>']
+ .join(''))
+ .appendTo("body");
+ $("#banner").addClass(_config.stats.bad ? "fail" : "pass");
+ if ( parent.runAJAXTest )
+ parent.runAJAXTest();
+
+ });
+}
+
+function test(name, callback, nowait) {
+ if(_config.currentModule)
+ name = _config.currentModule + " module: " + name;
+
+ if ( !validTest(name) )
+ return;
+
+ synchronize(function() {
+ _config.Test = [];
+ try {
+ callback();
+ } catch(e) {
+ if( typeof console != "undefined" && console.error && console.warn ) {
+ console.error("Test " + name + " died, exception and test follows");
+ console.error(e);
+ console.warn(callback.toString());
+ }
+ _config.Test.push( [ false, "Died on test #" + (_config.Test.length+1) + ": " + e.message ] );
+ }
+ });
+ synchronize(function() {
+ reset();
+
+ // don't output pause tests
+ if(nowait) return;
+
+ if(_config.expected && _config.expected != _config.Test.length) {
+ _config.Test.push( [ false, "Expected " + _config.expected + " assertions, but " + _config.Test.length + " were run" ] );
+ }
+ _config.expected = null;
+
+ var good = 0, bad = 0;
+ var ol = document.createElement("ol");
+ ol.style.display = "none";
+ var li = "", state = "pass";
+ for ( var i = 0; i < _config.Test.length; i++ ) {
+ var li = document.createElement("li");
+ li.className = _config.Test[i][0] ? "pass" : "fail";
+ li.innerHTML = _config.Test[i][1];
+ ol.appendChild( li );
+
+ _config.stats.all++;
+ if ( !_config.Test[i][0] ) {
+ state = "fail";
+ bad++;
+ _config.stats.bad++;
+ } else good++;
+
+ if ( parent.SimpleTest ){
+ parent.SimpleTest.ok( _config.Test[i][0], `${name}: ${_config.Test[i][1]}` );}
+ }
+
+ var li = document.createElement("li");
+ li.className = state;
+
+ var b = document.createElement("strong");
+ b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + _config.Test.length + ")</b>";
+ b.onclick = function(){
+ var n = this.nextSibling;
+ if ( jQuery.css( n, "display" ) == "none" )
+ n.style.display = "block";
+ else
+ n.style.display = "none";
+ };
+ $(b).dblclick(function(event) {
+ var target = jQuery(event.target).filter("strong").clone();
+ if ( target.length ) {
+ target.children().remove();
+ location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent($.trim(target.text()));
+ }
+ });
+ li.appendChild( b );
+ li.appendChild( ol );
+
+ document.getElementById("tests").appendChild( li );
+ });
+}
+
+// call on start of module test to prepend name to all tests
+function module(moduleName) {
+ _config.currentModule = moduleName;
+}
+
+/**
+ * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
+ */
+function expect(asserts) {
+ _config.expected = asserts;
+}
+
+/**
+ * Resets the test setup. Useful for tests that modify the DOM.
+ */
+function reset() {
+ $("#main").html( _config.fixture );
+ $.event.global = {};
+ $.ajaxSettings = $.extend({}, _config.ajaxSettings);
+}
+
+/**
+ * Asserts true.
+ * @example ok( $("a").size() > 5, "There must be at least 5 anchors" );
+ */
+function ok(a, msg) {
+ _config.Test.push( [ !!a, msg ] );
+}
+
+/**
+ * Asserts that two arrays are the same
+ */
+function isSet(a, b, msg) {
+ var ret = true;
+ if ( a && b && a.length != undefined && a.length == b.length ) {
+ for ( var i = 0; i < a.length; i++ )
+ if ( a[i] != b[i] )
+ ret = false;
+ } else
+ ret = false;
+ if ( !ret )
+ _config.Test.push( [ ret, msg + " expected: " + serialArray(b) + " result: " + serialArray(a) ] );
+ else
+ _config.Test.push( [ ret, msg ] );
+}
+
+/**
+ * Asserts that two objects are equivalent
+ */
+function isObj(a, b, msg) {
+ var ret = true;
+
+ if ( a && b ) {
+ for ( var i in a )
+ if ( a[i] != b[i] )
+ ret = false;
+
+ for ( i in b )
+ if ( a[i] != b[i] )
+ ret = false;
+ } else
+ ret = false;
+
+ _config.Test.push( [ ret, msg ] );
+}
+
+function serialArray( a ) {
+ var r = [];
+
+ if ( a && a.length )
+ for ( var i = 0; i < a.length; i++ ) {
+ var str = a[i].nodeName;
+ if ( str ) {
+ str = str.toLowerCase();
+ if ( a[i].id )
+ str += "#" + a[i].id;
+ } else
+ str = a[i];
+ r.push( str );
+ }
+
+ return "[ " + r.join(", ") + " ]";
+}
+
+/**
+ * Returns an array of elements with the given IDs, eg.
+ * @example q("main", "foo", "bar")
+ * @result [<div id="main">, <span id="foo">, <input id="bar">]
+ */
+function q() {
+ var r = [];
+ for ( var i = 0; i < arguments.length; i++ )
+ r.push( document.getElementById( arguments[i] ) );
+ return r;
+}
+
+/**
+ * Asserts that a select matches the given IDs
+ * @example t("Check for something", "//[a]", ["foo", "baar"]);
+ * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
+ */
+function t(a,b,c) {
+ var f = jQuery(b);
+ var s = "";
+ for ( var i = 0; i < f.length; i++ )
+ s += (s && ",") + '"' + f[i].id + '"';
+ isSet(f, q.apply(q,c), a + " (" + b + ")");
+}
+
+/**
+ * Add random number to url to stop IE from caching
+ *
+ * @example url("data/test.html")
+ * @result "data/test.html?10538358428943"
+ *
+ * @example url("data/test.php?foo=bar")
+ * @result "data/test.php?foo=bar&10538358345554"
+ */
+function url(value) {
+ return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
+}
+
+/**
+ * Checks that the first two arguments are equal, with an optional message.
+ * Prints out both expected and actual values on failure.
+ *
+ * Prefered to ok( expected == actual, message )
+ *
+ * @example equals( "Expected 2 characters.", v.formatMessage("Expected {0} characters.", 2) );
+ *
+ * @param Object actual
+ * @param Object expected
+ * @param String message (optional)
+ */
+function equals(actual, expected, message) {
+ var result = expected == actual;
+ message = message || (result ? "okay" : "failed");
+ _config.Test.push( [ result, result ? message + ": " + expected : message + " expected: " + expected + " actual: " + actual ] );
+}
+
+/**
+ * Trigger an event on an element.
+ *
+ * @example triggerEvent( document.body, "click" );
+ *
+ * @param DOMElement elem
+ * @param String type
+ */
+function triggerEvent( elem, type, event ) {
+ if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
+ event = document.createEvent("MouseEvents");
+ event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ elem.dispatchEvent( event );
+ } else if ( jQuery.browser.msie ) {
+ elem.fireEvent("on"+type);
+ }
+} \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/testsuite.css b/dom/tests/mochitest/ajax/jquery/test/data/testsuite.css
new file mode 100644
index 0000000000..4801becd65
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/testsuite.css
@@ -0,0 +1,117 @@
+body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 }
+body {font-size: 10pt; }
+h1 { padding: 15px; font-size: large; background-color: #06b; color: white; }
+h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal }
+
+.pass { color: green; }
+.fail { color: red; }
+p.result { margin-left: 1em; }
+
+#banner { height: 2em; border-bottom: 1px solid white; }
+h2.pass { background-color: green; }
+h2.fail { background-color: red; }
+
+ol#tests > li > strong { cursor:pointer; }
+
+div#fx-tests h4 {
+ background: red;
+}
+
+div#fx-tests h4.pass {
+ background: green;
+}
+
+div#fx-tests div.box {
+ background: red url(data/cow.jpg) no-repeat;
+ overflow: hidden;
+ border: 2px solid #000;
+}
+
+div#fx-tests div.overflow {
+ overflow: visible;
+}
+
+div.inline {
+ display: inline;
+}
+
+div.autoheight {
+ height: auto;
+}
+
+div.autowidth {
+ width: auto;
+}
+
+div.autoopacity {
+ opacity: auto;
+}
+
+div.largewidth {
+ width: 100px;
+}
+
+div.largeheight {
+ height: 100px;
+}
+
+div.largeopacity {
+ filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
+}
+
+div.medwidth {
+ width: 50px;
+}
+
+div.medheight {
+ height: 50px;
+}
+
+div.medopacity {
+ opacity: 0.5;
+ filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
+}
+
+div.nowidth {
+ width: 0px;
+}
+
+div.noheight {
+ height: 0px;
+}
+
+div.noopacity {
+ opacity: 0;
+ filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
+}
+
+div.hidden {
+ display: none;
+}
+
+div#fx-tests div.widewidth {
+ background-repeat: repeat-x;
+}
+
+div#fx-tests div.wideheight {
+ background-repeat: repeat-y;
+}
+
+div#fx-tests div.widewidth.wideheight {
+ background-repeat: repeat;
+}
+
+div#fx-tests div.noback {
+ background-image: none;
+}
+
+div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; }
+div.chain div { position: absolute; top: 0px; left: 0px; }
+
+div.chain.test { background: red; }
+div.chain.test div { background: green; }
+
+div.chain.out { background: green; }
+div.chain.out div { background: red; display: none; }
+
+div#show-tests * { display: none; } \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/with_fries.xml b/dom/tests/mochitest/ajax/jquery/test/data/with_fries.xml
new file mode 100644
index 0000000000..88e0e49d57
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/data/with_fries.xml
@@ -0,0 +1,25 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <soap:Body>
+ <jsconf xmlns="http://www.example.com/ns1">
+ <response xmlns:ab="http://www.example.com/ns2">
+ <meta>
+ <component id="seite1">
+ <properties xmlns:cd="http://www.example.com/ns3">
+ <property name="prop1">
+ <thing />
+ <value>1</value>
+ </property>
+ <property name="prop2">
+ <thing att="something" />
+ </property>
+ <foo_bar>foo</foo_bar>
+ </properties>
+ </component>
+ </meta>
+ </response>
+ </jsconf>
+ </soap:Body>
+</soap:Envelope>
diff --git a/dom/tests/mochitest/ajax/jquery/test/fix.html b/dom/tests/mochitest/ajax/jquery/test/fix.html
new file mode 100644
index 0000000000..f4edab7919
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/fix.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta name="generator"
+ content="HTML Tidy, see www.w3.org" />
+
+ <title>Tester</title>
+<style type="text/css">
+ #container { background:yellow; width:400px; height:400px; }
+
+</style>
+<script type="text/javascript" src="../dist/jquery.js">
+</script>
+<script type="text/javascript">
+ function doIt() {
+ $("#adiv").text("click!");
+ $("#adiv").trigger("acustom.atype");
+ }
+
+ function showMouse(e) {
+ $("#adiv").text("( " + e.pageX + ", " + e.pageY + " )");
+ }
+
+ $(function () {
+ $("#doit").bind('click.mine', doIt);
+ $("#container").mousemove(showMouse);
+ $("#adiv").bind("acustom.atype", function () {
+ //console.log("custom");
+ });
+ });
+
+</script>
+ </head>
+
+ <body>
+ <button id="doit">Do It</button>
+
+ <div id="container">
+ Hi
+ </div>
+
+ <div id="adiv">
+ </div>
+ </body>
+</html>
+
diff --git a/dom/tests/mochitest/ajax/jquery/test/index.html b/dom/tests/mochitest/ajax/jquery/test/index.html
new file mode 100644
index 0000000000..8608f430b5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/index.html
@@ -0,0 +1,187 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>jQuery Test Suite</title>
+ <link rel="Stylesheet" media="screen" href="data/testsuite.css" />
+ <script>var jQuery = "jQuery", $ = "$"; // For testing .noConflict()</script>
+ <script type="text/javascript" src="../dist/jquery.js"></script>
+ <script type="text/javascript" src="data/testrunner.js"></script>
+ <script type="text/javascript" src="unit/core.js"></script>
+ <script type="text/javascript" src="unit/dimensions.js"></script>
+ <script type="text/javascript" src="unit/selector.js"></script>
+ <script type="text/javascript" src="unit/event.js"></script>
+ <script type="text/javascript" src="unit/ajax.js"></script>
+ <script type="text/javascript" src="unit/fx.js"></script>
+</head>
+
+<body id="body">
+ <h1 id="header">jQuery Test Suite</h1>
+ <h2 id="banner"></h2>
+ <h2 id="userAgent"></h2>
+
+ <!-- Test HTML -->
+ <div id="nothiddendiv" style="height:1px;background:white;">
+ <div id="nothiddendivchild"></div>
+ </div>
+ <!-- this iframe is outside the #main so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
+ <iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
+ <dl id="dl" style="display:none;">
+ <div id="main" style="display: none;">
+ <p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
+ <p id="ap">
+ Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
+ <a id="groups" href="http://groups.google.com/">Google Groups</a>.
+ This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
+ <a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
+
+ </p>
+ <div id="foo">
+ <p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
+ <p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
+ <p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
+
+ </div>
+ <p id="first">Try them out:</p>
+ <ul id="firstUL"></ul>
+ <ol id="empty"></ol>
+ <form id="form" action="formaction">
+ <input type="text" name="action" value="Test" id="text1" minlength="20" maxlength="30"/>
+ <input type="text" name="text2" value="Test" id="text2" disabled="disabled"/>
+ <input type="radio" name="radio1" id="radio1" value="on"/>
+
+ <input type="radio" name="radio2" id="radio2" checked="checked"/>
+ <input type="checkbox" name="check" id="check1" checked="checked"/>
+ <input type="checkbox" id="check2" value="on"/>
+
+ <input type="hidden" name="hidden" id="hidden1"/>
+ <input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
+
+ <input type="text" id="name" name="name" value="name" />
+
+ <button id="button" name="button">Button</button>
+
+ <textarea id="area1" minlength="20" maxlength="30">foobar</textarea>
+
+ <select name="select1" id="select1">
+ <option id="option1a" class="emptyopt" value="">Nothing</option>
+ <option id="option1b" value="1">1</option>
+ <option id="option1c" value="2">2</option>
+ <option id="option1d" value="3">3</option>
+ </select>
+ <select name="select2" id="select2">
+ <option id="option2a" class="emptyopt" value="">Nothing</option>
+ <option id="option2b" value="1">1</option>
+ <option id="option2c" value="2">2</option>
+ <option id="option2d" selected="selected" value="3">3</option>
+ </select>
+ <select name="select3" id="select3" multiple="multiple">
+ <option id="option3a" class="emptyopt" value="">Nothing</option>
+ <option id="option3b" selected="selected" value="1">1</option>
+ <option id="option3c" selected="selected" value="2">2</option>
+ <option id="option3d" value="3">3</option>
+ </select>
+
+ <object id="object1" codebase="stupid">
+ <param name="p1" value="x1" />
+ <param name="p2" value="x2" />
+ </object>
+
+ <span id="台北Táiběi"></span>
+ <span id="台北" lang="中文"></span>
+ <span id="utf8class1" class="台北Táiběi 台北"></span>
+ <span id="utf8class2" class="台北"></span>
+ <span id="foo:bar" class="foo:bar"></span>
+ <span id="test.foo[5]bar" class="test.foo[5]bar"></span>
+
+ <foo_bar id="foobar">test element</foo_bar>
+ </form>
+ <b id="floatTest">Float test.</b>
+ <iframe id="iframe" name="iframe"></iframe>
+ <form id="lengthtest">
+ <input type="text" id="length" name="test"/>
+ <input type="text" id="idTest" name="id"/>
+ </form>
+ <table id="table"></table>
+
+ <div id="fx-queue">
+ <div id="fadein" class='chain test'>fadeIn<div>fadeIn</div></div>
+ <div id="fadeout" class='chain test out'>fadeOut<div>fadeOut</div></div>
+
+ <div id="show" class='chain test'>show<div>show</div></div>
+ <div id="hide" class='chain test out'>hide<div>hide</div></div>
+
+ <div id="togglein" class='chain test'>togglein<div>togglein</div></div>
+ <div id="toggleout" class='chain test out'>toggleout<div>toggleout</div></div>
+
+
+ <div id="slideup" class='chain test'>slideUp<div>slideUp</div></div>
+ <div id="slidedown" class='chain test out'>slideDown<div>slideDown</div></div>
+
+ <div id="slidetogglein" class='chain test'>slideToggleIn<div>slideToggleIn</div></div>
+ <div id="slidetoggleout" class='chain test out'>slideToggleOut<div>slideToggleOut</div></div>
+ </div>
+
+ <div id="fx-tests"></div>
+
+ <form id="testForm" action="#" method="get">
+ <textarea name="T3" rows="2" cols="15">?
+Z</textarea>
+ <input type="hidden" name="H1" value="x" />
+ <input type="hidden" name="H2" />
+ <input name="PWD" type="password" value="" />
+ <input name="T1" type="text" />
+ <input name="T2" type="text" value="YES" readonly="readonly" />
+ <input type="checkbox" name="C1" value="1" />
+ <input type="checkbox" name="C2" />
+ <input type="radio" name="R1" value="1" />
+ <input type="radio" name="R1" value="2" />
+ <input type="text" name="My Name" value="me" />
+ <input type="reset" name="reset" value="NO" />
+ <select name="S1">
+ <option value="abc">ABC</option>
+ <option value="abc">ABC</option>
+ <option value="abc">ABC</option>
+ </select>
+ <select name="S2" multiple="multiple" size="3">
+ <option value="abc">ABC</option>
+ <option value="abc">ABC</option>
+ <option value="abc">ABC</option>
+ </select>
+ <select name="S3">
+ <option selected="selected">YES</option>
+ </select>
+ <select name="S4">
+ <option value="" selected="selected">NO</option>
+ </select>
+ <input type="submit" name="sub1" value="NO" />
+ <input type="submit" name="sub2" value="NO" />
+ <input type="image" name="sub3" value="NO" />
+ <button name="sub4" type="submit" value="NO">NO</button>
+ <input name="D1" type="text" value="NO" disabled="disabled" />
+ <input type="checkbox" checked="checked" disabled="disabled" name="D2" value="NO" />
+ <input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" />
+ <select name="D4" disabled="disabled">
+ <option selected="selected" value="NO">NO</option>
+ </select>
+ </form>
+ <div id="moretests">
+ <form>
+ <div id="checkedtest" style="display:none;">
+ <input type="radio" name="checkedtestradios" checked="checked"/>
+ <input type="radio" name="checkedtestradios" value="on"/>
+ <input type="checkbox" name="checkedtestcheckboxes" checked="checked"/>
+ <input type="checkbox" name="checkedtestcheckboxes" />
+ </div>
+ </form>
+ <div id="nonnodes"><span>hi</span> there <!-- mon ami --></div>
+ <div id="t2037">
+ <div><div class="hidden">hidden</div></div>
+ </div>
+ </div>
+ </div>
+ </dl>
+
+ <ol id="tests"></ol>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/jquery/test/offset.html b/dom/tests/mochitest/ajax/jquery/test/offset.html
new file mode 100644
index 0000000000..f802dea346
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/offset.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>jQuery Offset Test Suite</title>
+ <link rel="Stylesheet" media="screen" href="data/testsuite.css" />
+ <script type="text/javascript" src="../dist/jquery.js"></script>
+ <script type="text/javascript" src="data/testrunner.js"></script>
+ <script type="text/javascript" src="unit/offset.js"></script>
+</head>
+
+<body id="body">
+ <h1 id="header">jQuery Offset Test Suite</h1>
+ <h2 id="banner"></h2>
+ <h2 id="userAgent"></h2>
+
+ <!-- Test HTML -->
+ <div id="nothiddendiv" style="height:1px;background:white;"></div>
+ <dl id="dl" style="display:none;">
+ <div id="main" style="display: none;">
+
+ </div>
+ </dl>
+
+ <ol id="tests"></ol>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/jquery/test/test.js b/dom/tests/mochitest/ajax/jquery/test/test.js
new file mode 100644
index 0000000000..e76b795a2c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/test.js
@@ -0,0 +1,41 @@
+load( "build/js/writeFile.js", "build/js/parse.js" );
+
+function addParams(name, params) {
+ if(params.length > 0) {
+ name += "(";
+ for ( var i = 0; i < params.length; i++) {
+ name += params[i].type + ", ";
+ }
+ return name.substring(0, name.length - 2) + ")";
+ } else {
+ return name + "()";
+ }
+}
+function addTestWrapper(name, test) {
+ return 'test("' + name + '", function() {\n' + test + '\n});';
+}
+
+var dir = arguments[1];
+var jq = parse( read(arguments[0]) );
+
+var testFile = [];
+
+String.prototype.decode = function() {
+ return this.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
+};
+
+for ( var i = 0; i < jq.length; i++ ) {
+ if ( jq[i].tests.length > 0 ) {
+ var method = jq[i];
+ var name = addParams(method.name, method.params);
+ for(var j = 0; j < method.tests.length; j++) {
+ if(j > 0) {
+ name += "x";
+ }
+ testFile[testFile.length] = addTestWrapper(name, method.tests[j].decode()) + "\n";
+ }
+ }
+}
+
+var indexFile = readFile( "build/test/index.html" );
+writeFile( dir + "/index.html", indexFile.replace( /{TESTS}/g, testFile.join("\n") ) );
diff --git a/dom/tests/mochitest/ajax/jquery/test/unit/ajax.js b/dom/tests/mochitest/ajax/jquery/test/unit/ajax.js
new file mode 100644
index 0000000000..b60d39e72f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/ajax.js
@@ -0,0 +1,837 @@
+module("ajax");
+
+// Safari 3 randomly crashes when running these tests,
+// but only in the full suite - you can run just the Ajax
+// tests and they'll pass
+//if ( !jQuery.browser.safari ) {
+
+if ( !isLocal ) {
+
+test("$.ajax() - success callbacks", function() {
+ expect( 8 );
+
+ $.ajaxSetup({ timeout: 0 });
+
+ stop();
+
+ setTimeout(function(){
+ $('#foo').ajaxStart(function(){
+ ok( true, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( true, "ajaxStop" );
+ start();
+ }).ajaxSend(function(){
+ ok( true, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( true, "ajaxComplete" );
+ }).ajaxError(function(){
+ ok( false, "ajaxError" );
+ }).ajaxSuccess(function(){
+ ok( true, "ajaxSuccess" );
+ });
+
+ $.ajax({
+ url: url("data/name.html"),
+ beforeSend: function(){ ok(true, "beforeSend"); },
+ success: function(){ ok(true, "success"); },
+ error: function(){ ok(false, "error"); },
+ complete: function(){ ok(true, "complete"); }
+ });
+ }, 13);
+});
+
+/* mozilla: the ajaxSuccess part fails intermittently on MacOSX
+
+test("$.ajax() - error callbacks", function() {
+ expect( 7 );
+ stop();
+
+ $('#foo').ajaxStart(function(){
+ ok( true, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( true, "ajaxStop" );
+ start();
+ }).ajaxSend(function(){
+ ok( true, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( true, "ajaxComplete" );
+ }).ajaxError(function(){
+ ok( true, "ajaxError" );
+ }).ajaxSuccess(function(){
+ ok( false, "ajaxSuccess" );
+ })
+ ;
+
+ $.ajaxSetup({ timeout: 500 });
+
+ $.ajax({
+ url: url("data/name.php?wait=5"),
+ beforeSend: function(){ ok(true, "beforeSend"); },
+ success: function(){ ok(false, "success"); },
+ error: function(){ ok(true, "error"); },
+ complete: function(){ ok(true, "complete"); }
+ });
+});
+
+*/
+
+test("$.ajax() - disabled globals", function() {
+ expect( 3 );
+ stop();
+
+ $('#foo').ajaxStart(function(){
+ ok( false, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( false, "ajaxStop" );
+ }).ajaxSend(function(){
+ ok( false, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( false, "ajaxComplete" );
+ }).ajaxError(function(){
+ ok( false, "ajaxError" );
+ }).ajaxSuccess(function(){
+ ok( false, "ajaxSuccess" );
+ });
+
+ $.ajax({
+ global: false,
+ url: url("data/name.html"),
+ beforeSend: function(){ ok(true, "beforeSend"); },
+ success: function(){ ok(true, "success"); },
+ error: function(){ ok(false, "error"); },
+ complete: function(){
+ ok(true, "complete");
+ setTimeout(function(){ start(); }, 13);
+ }
+ });
+});
+
+test("$.ajax - xml: non-namespace elements inside namespaced elements", function() {
+ expect(3);
+ stop();
+ $.ajax({
+ url: url("data/with_fries.xml"),
+ dataType: "xml",
+ success: function(resp) {
+ equals( $("properties", resp).length, 1, 'properties in responseXML' );
+ equals( $("jsconf", resp).length, 1, 'jsconf in responseXML' );
+ equals( $("thing", resp).length, 2, 'things in responseXML' );
+ start();
+ }
+ });
+});
+
+test("$.ajax - beforeSend", function() {
+ expect(1);
+ stop();
+
+ var check = false;
+
+ $.ajaxSetup({ timeout: 0 });
+
+ $.ajax({
+ url: url("data/name.html"),
+ beforeSend: function(xml) {
+ check = true;
+ },
+ success: function(data) {
+ ok( check, "check beforeSend was executed" );
+ start();
+ }
+ });
+});
+
+test("$.ajax - beforeSend, cancel request (#2688)", function() {
+ expect(2);
+ var request = $.ajax({
+ url: url("data/name.html"),
+ beforeSend: function() {
+ ok( true, "beforeSend got called, canceling" );
+ return false;
+ },
+ success: function() {
+ ok( false, "request didn't get canceled" );
+ },
+ complete: function() {
+ ok( false, "request didn't get canceled" );
+ },
+ error: function() {
+ ok( false, "request didn't get canceled" );
+ }
+ });
+ ok( request === false, "canceled request must return false instead of XMLHttpRequest instance" );
+});
+
+var foobar;
+
+test("$.ajax - dataType html", function() {
+ expect(5);
+ stop();
+
+ foobar = null;
+ testFoo = undefined;
+
+ var verifyEvaluation = function() {
+ equals( testFoo, "foo", 'Check if script was evaluated for datatype html' );
+ equals( foobar, "bar", 'Check if script src was evaluated for datatype html' );
+ start();
+ };
+
+ $.ajax({
+ dataType: "html",
+ url: url("data/test.html"),
+ success: function(data) {
+ $("#ap").html(data);
+ ok( data.match(/^html text/), 'Check content for datatype html' );
+ setTimeout(verifyEvaluation, 600);
+ }
+ });
+});
+
+test("serialize()", function() {
+ expect(6);
+
+ equals( $('#form').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
+ 'Check form serialization as query string');
+
+ equals( $('#form :input').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
+ 'Check input serialization as query string');
+
+ equals( $('#testForm').serialize(),
+ 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=',
+ 'Check form serialization as query string');
+
+ equals( $('#testForm :input').serialize(),
+ 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=',
+ 'Check input serialization as query string');
+
+ equals( $('#form, #testForm').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+ 'Multiple form serialization as query string');
+
+ equals( $('#form, #testForm :input').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+ 'Mixed form/input serialization as query string');
+});
+
+test("$.param()", function() {
+ expect(4);
+ var params = {foo:"bar", baz:42, quux:"All your base are belong to us"};
+ equals( $.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" );
+
+ params = {someName: [1, 2, 3], regularThing: "blah" };
+ equals( $.param(params), "someName=1&someName=2&someName=3&regularThing=blah", "with array" );
+
+ params = {"foo[]":["baz", 42, "All your base are belong to us"]};
+ equals( $.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" );
+
+ params = {"foo[bar]":"baz", "foo[beep]":42, "foo[quux]":"All your base are belong to us"};
+ equals( $.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );
+});
+
+test("synchronous request", function() {
+ expect(1);
+ ok( /^{ "data"/.test( $.ajax({url: url("data/json_obj.js"), async: false}).responseText ), "check returned text" );
+});
+
+test("synchronous request with callbacks", function() {
+ expect(2);
+ var result;
+ $.ajax({url: url("data/json_obj.js"), async: false, success: function(data) { ok(true, "success callback executed"); result = data; } });
+ ok( /^{ "data"/.test( result ), "check returned text" );
+});
+
+test("pass-through request object", function() {
+ expect(8);
+ stop(true);
+
+ var target = "data/name.html";
+ var successCount = 0;
+ var errorCount = 0;
+ var errorEx = "";
+ var success = function() {
+ successCount++;
+ };
+ $("#foo").ajaxError(function (e, xml, s, ex) {
+ errorCount++;
+ errorEx += ": " + xml.status;
+ });
+ $("#foo").one('ajaxStop', function () {
+ equals(successCount, 5, "Check all ajax calls successful");
+ equals(errorCount, 0, "Check no ajax errors (status" + errorEx + ")");
+ $("#foo").unbind('ajaxError');
+ start();
+ });
+
+ ok( $.get(url(target), success), "get" );
+ ok( $.post(url(target), success), "post" );
+ ok( $.getScript(url("data/test.js"), success), "script" );
+ ok( $.getJSON(url("data/json_obj.js"), success), "json" );
+ ok( $.ajax({url: url(target), success: success}), "generic" );
+});
+
+/* mozilla: php not currently supported in mochitest (08/08/2008)
+test("ajax cache", function () {
+ expect(18);
+ stop();
+
+ var count = 0;
+
+ $("#firstp").bind("ajaxSuccess", function (e, xml, s) {
+ var re = /_=(.*?)(&|$)/g;
+ var oldOne = null;
+ for (var i = 0; i < 6; i++) {
+ var ret = re.exec(s.url);
+ if (!ret) {
+ break;
+ }
+ oldOne = ret[1];
+ }
+ equals(i, 1, "Test to make sure only one 'no-cache' parameter is there");
+ ok(oldOne != "tobereplaced555", "Test to be sure parameter (if it was there) was replaced");
+ if(++count == 6)
+ start();
+ });
+
+ ok( $.ajax({url: "data/text.php", cache:false}), "test with no parameters" );
+ ok( $.ajax({url: "data/text.php?pizza=true", cache:false}), "test with 1 parameter" );
+ ok( $.ajax({url: "data/text.php?_=tobereplaced555", cache:false}), "test with _= parameter" );
+ ok( $.ajax({url: "data/text.php?pizza=true&_=tobereplaced555", cache:false}), "test with 1 parameter plus _= one" );
+ ok( $.ajax({url: "data/text.php?_=tobereplaced555&tv=false", cache:false}), "test with 1 parameter plus _= one before it" );
+ ok( $.ajax({url: "data/text.php?name=David&_=tobereplaced555&washere=true", cache:false}), "test with 2 parameters surrounding _= one" );
+});
+*/
+
+test("global ajaxSettings", function() {
+ expect(2);
+
+ var tmp = jQuery.extend({}, jQuery.ajaxSettings);
+ var orig = { url: "data/with_fries.xml" };
+ var t;
+
+ $.ajaxSetup({ data: {foo: 'bar', bar: 'BAR'} });
+
+ t = jQuery.extend({}, orig);
+ t.data = {};
+ $.ajax(t);
+ ok( t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending {}" );
+
+ t = jQuery.extend({}, orig);
+ t.data = { zoo: 'a', ping: 'b' };
+ $.ajax(t);
+ ok( t.url.indexOf('ping') > -1 && t.url.indexOf('zoo') > -1 && t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending { zoo: 'a', ping: 'b' }" );
+
+ jQuery.ajaxSettings = tmp;
+});
+
+test("load(String)", function() {
+ expect(1);
+ stop(true); // check if load can be called with only url
+ $('#first').load("data/name.html", start);
+});
+
+test("load('url selector')", function() {
+ expect(1);
+ stop(true); // check if load can be called with only url
+ $('#first').load("data/test3.html div.user", function(){
+ equals( $(this).children("div").length, 2, "Verify that specific elements were injected" );
+ start();
+ });
+});
+
+test("load(String, Function) with ajaxSetup on dataType json, see #2046", function() {
+ expect(1);
+ stop();
+ $.ajaxSetup({ dataType: "json" });
+ $("#first").ajaxComplete(function (e, xml, s) {
+ equals( s.dataType, "html", "Verify the load() dataType was html" );
+ $("#first").unbind("ajaxComplete");
+ $.ajaxSetup({ dataType: "" });
+ start();
+ });
+ $('#first').load("data/test3.html");
+});
+
+test("load(String, Function) - simple: inject text into DOM", function() {
+ expect(2);
+ stop();
+ $('#first').load(url("data/name.html"), function() {
+ ok( /^ERROR/.test($('#first').text()), 'Check if content was injected into the DOM' );
+ start();
+ });
+});
+
+test("load(String, Function) - check scripts", function() {
+ expect(7);
+ stop();
+ window.testFoo = undefined;
+ window.foobar = null;
+ var verifyEvaluation = function() {
+ equals( foobar, "bar", 'Check if script src was evaluated after load' );
+ equals( $('#ap').html(), 'bar', 'Check if script evaluation has modified DOM');
+ start();
+ };
+ $('#first').load(url('data/test.html'), function() {
+ ok( $('#first').html().match(/^html text/), 'Check content after loading html' );
+ equals( $('#foo').html(), 'foo', 'Check if script evaluation has modified DOM');
+ equals( testFoo, "foo", 'Check if script was evaluated after load' );
+ setTimeout(verifyEvaluation, 600);
+ });
+});
+
+test("load(String, Function) - check file with only a script tag", function() {
+ expect(3);
+ stop();
+ testFoo = undefined;
+ $('#first').load(url('data/test2.html'), function() {
+ equals( $('#foo').html(), 'foo', 'Check if script evaluation has modified DOM');
+ equals( testFoo, "foo", 'Check if script was evaluated after load' );
+ start();
+ });
+});
+
+test("$.get(String, Hash, Function) - parse xml and use text() on nodes", function() {
+ expect(2);
+ stop();
+ $.get(url('data/dashboard.xml'), function(xml) {
+ var content = [];
+ $('tab', xml).each(function() {
+ content.push($(this).text());
+ });
+ equals( content[0], 'blabla', 'Check first tab');
+ equals( content[1], 'blublu', 'Check second tab');
+ start();
+ });
+});
+
+test("$.getScript(String, Function) - with callback", function() {
+ expect(2);
+ stop();
+ window.foobar = null;
+ $.getScript(url("data/test.js"), function() {
+ equals( foobar, "bar", 'Check if script was evaluated' );
+ setTimeout(start, 100);
+ });
+});
+
+test("$.getScript(String, Function) - no callback", function() {
+ expect(1);
+ stop(true);
+ $.getScript(url("data/test.js"), start);
+});
+
+/* mozilla: Tests using php scripts not currently supported (06/26/2008)
+
+test("$.ajax() - JSONP, Local", function() {
+ expect(7);
+
+ var count = 0;
+ function plus(){ if ( ++count == 7 ) start(); }
+
+ stop();
+
+ $.ajax({
+ url: "data/jsonp.php",
+ dataType: "jsonp",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, no callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, no callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ url: "data/jsonp.php?callback=?",
+ dataType: "jsonp",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, url callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, url callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ url: "data/jsonp.php",
+ dataType: "jsonp",
+ data: "callback=?",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, data callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, data callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ url: "data/jsonp.php",
+ dataType: "jsonp",
+ jsonp: "callback",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, data obj callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, data obj callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ type: "POST",
+ url: "data/jsonp.php",
+ dataType: "jsonp",
+ success: function(data){
+ ok( data.data, "JSON results returned (POST, no callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, data obj callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ type: "POST",
+ url: "data/jsonp.php",
+ data: "callback=?",
+ dataType: "jsonp",
+ success: function(data){
+ ok( data.data, "JSON results returned (POST, data callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (POST, data callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ type: "POST",
+ url: "data/jsonp.php",
+ jsonp: "callback",
+ dataType: "jsonp",
+ success: function(data){
+ ok( data.data, "JSON results returned (POST, data obj callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (POST, data obj callback)" );
+ plus();
+ }
+ });
+});
+
+test("$.ajax() - JSONP, Remote", function() {
+ expect(4);
+
+ var count = 0;
+ function plus(){ if ( ++count == 4 ) start(); }
+
+ var base = window.location.href.replace(/\?.*$/, "");
+
+ stop();
+
+ $.ajax({
+ url: base + "data/jsonp.php",
+ dataType: "jsonp",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, no callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, no callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ url: base + "data/jsonp.php?callback=?",
+ dataType: "jsonp",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, url callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, url callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ url: base + "data/jsonp.php",
+ dataType: "jsonp",
+ data: "callback=?",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, data callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, data callback)" );
+ plus();
+ }
+ });
+
+ $.ajax({
+ url: base + "data/jsonp.php",
+ dataType: "jsonp",
+ jsonp: "callback",
+ success: function(data){
+ ok( data.data, "JSON results returned (GET, data obj callback)" );
+ plus();
+ },
+ error: function(data){
+ ok( false, "Ajax error JSON (GET, data obj callback)" );
+ plus();
+ }
+ });
+});
+
+test("$.ajax() - script, Remote", function() {
+ expect(2);
+
+ var base = window.location.href.replace(/\?.*$/, "");
+
+ stop();
+
+ window.foobar = null;
+ $.ajax({
+ url: base + "data/test.js",
+ dataType: "script",
+ success: function(data){
+ ok( foobar, "Script results returned (GET, no callback)" );
+ start();
+ }
+ });
+});
+
+test("$.ajax() - script, Remote with POST", function() {
+ expect(3);
+
+ var base = window.location.href.replace(/\?.*$/, "");
+
+ stop();
+
+ window.foobar = null;
+ $.ajax({
+ url: base + "data/test.js",
+ type: "POST",
+ dataType: "script",
+ success: function(data, status){
+ ok( foobar, "Script results returned (GET, no callback)" );
+ equals( status, "success", "Script results returned (GET, no callback)" );
+ start();
+ }
+ });
+});
+
+test("$.ajax() - script, Remote with scheme-less URL", function() {
+ expect(2);
+
+ var base = window.location.href.replace(/\?.*$/, "");
+ base = base.replace(/^.*?\/\//, "//");
+
+ stop();
+
+ window.foobar = null;
+ $.ajax({
+ url: base + "data/test.js",
+ dataType: "script",
+ success: function(data){
+ ok( foobar, "Script results returned (GET, no callback)" );
+ start();
+ }
+ });
+});
+
+test("$.getJSON(String, Hash, Function) - JSON array", function() {
+ expect(4);
+ stop();
+ $.getJSON(url("data/json.php"), {json: "array"}, function(json) {
+ equals( json[0].name, 'John', 'Check JSON: first, name' );
+ equals( json[0].age, 21, 'Check JSON: first, age' );
+ equals( json[1].name, 'Peter', 'Check JSON: second, name' );
+ equals( json[1].age, 25, 'Check JSON: second, age' );
+ start();
+ });
+});
+
+test("$.getJSON(String, Function) - JSON object", function() {
+ expect(2);
+ stop();
+ $.getJSON(url("data/json.php"), function(json) {
+ equals( json.data.lang, 'en', 'Check JSON: lang' );
+ equals( json.data.length, 25, 'Check JSON: length' );
+ start();
+ });
+});
+
+test("$.getJSON(String, Function) - JSON object with absolute url to local content", function() {
+ expect(2);
+
+ var base = window.location.href.replace(/\?.*$/, "");
+
+ stop();
+ $.getJSON(url(base + "data/json.php"), function(json) {
+ equals( json.data.lang, 'en', 'Check JSON: lang' );
+ equals( json.data.length, 25, 'Check JSON: length' );
+ start();
+ });
+});
+
+test("$.post(String, Hash, Function) - simple with xml", function() {
+ expect(4);
+ stop();
+ $.post(url("data/name.php"), {xml: "5-2"}, function(xml){
+ $('math', xml).each(function() {
+ equals( $('calculation', this).text(), '5-2', 'Check for XML' );
+ equals( $('result', this).text(), '3', 'Check for XML' );
+ });
+ });
+
+ $.post(url("data/name.php?xml=5-2"), {}, function(xml){
+ $('math', xml).each(function() {
+ equals( $('calculation', this).text(), '5-2', 'Check for XML' );
+ equals( $('result', this).text(), '3', 'Check for XML' );
+ });
+ start();
+ });
+});
+
+test("$.ajaxSetup({timeout: Number}) - with global timeout", function() {
+ stop();
+
+ var passed = 0;
+
+ $.ajaxSetup({timeout: 1000});
+
+ var pass = function() {
+ passed++;
+ if ( passed == 2 ) {
+ ok( true, 'Check local and global callbacks after timeout' );
+ $('#main').unbind("ajaxError");
+ start();
+ }
+ };
+
+ var fail = function(a,b,c) {
+ ok( false, 'Check for timeout failed ' + a + ' ' + b );
+ start();
+ };
+
+ $('#main').ajaxError(pass);
+
+ $.ajax({
+ type: "GET",
+ url: url("data/name.php?wait=5"),
+ error: pass,
+ success: fail
+ });
+
+ // reset timeout
+ $.ajaxSetup({timeout: 0});
+});
+
+test("$.ajaxSetup({timeout: Number}) with localtimeout", function() {
+ stop();
+ $.ajaxSetup({timeout: 50});
+
+ $.ajax({
+ type: "GET",
+ timeout: 5000,
+ url: url("data/name.php?wait=1"),
+ error: function() {
+ ok( false, 'Check for local timeout failed' );
+ start();
+ },
+ success: function() {
+ ok( true, 'Check for local timeout' );
+ start();
+ }
+ });
+
+ // reset timeout
+ $.ajaxSetup({timeout: 0});
+});
+
+test("$.ajax - simple get", function() {
+ expect(1);
+ stop();
+ $.ajax({
+ type: "GET",
+ url: url("data/name.php?name=foo"),
+ success: function(msg){
+ equals( msg, 'bar', 'Check for GET' );
+ start();
+ }
+ });
+});
+
+test("$.ajax - simple post", function() {
+ expect(1);
+ stop();
+ $.ajax({
+ type: "POST",
+ url: url("data/name.php"),
+ data: "name=peter",
+ success: function(msg){
+ equals( msg, 'pan', 'Check for POST' );
+ start();
+ }
+ });
+});
+
+test("ajaxSetup()", function() {
+ expect(1);
+ stop();
+ $.ajaxSetup({
+ url: url("data/name.php?name=foo"),
+ success: function(msg){
+ equals( msg, 'bar', 'Check for GET' );
+ start();
+ }
+ });
+ $.ajax();
+});
+
+test("custom timeout does not set error message when timeout occurs, see #970", function() {
+ stop();
+ $.ajax({
+ url: "data/name.php?wait=10",
+ timeout: 500,
+ error: function(request, status) {
+ ok( status != null, "status shouldn't be null in error handler" );
+ equals( "timeout", status );
+ start();
+ }
+ });
+});
+
+test("data option: evaluate function values (#2806)", function() {
+ stop();
+ $.ajax({
+ url: "data/echoQuery.php",
+ data: {
+ key: function() {
+ return "value";
+ }
+ },
+ success: function(result) {
+ equals( result, "key=value" );
+ start();
+ }
+ })
+});
+*/
+}
+
+//}
diff --git a/dom/tests/mochitest/ajax/jquery/test/unit/core.js b/dom/tests/mochitest/ajax/jquery/test/unit/core.js
new file mode 100644
index 0000000000..74a03192c0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/core.js
@@ -0,0 +1,1700 @@
+module("core");
+
+test("Basic requirements", function() {
+ expect(7);
+ ok( Array.prototype.push, "Array.push()" );
+ ok( Function.prototype.apply, "Function.apply()" );
+ ok( document.getElementById, "getElementById" );
+ ok( document.getElementsByTagName, "getElementsByTagName" );
+ ok( RegExp, "RegExp" );
+ ok( jQuery, "jQuery" );
+ ok( $, "$()" );
+});
+
+test("$()", function() {
+ expect(8);
+
+ var main = $("#main");
+ isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );
+
+/*
+ // disabled since this test was doing nothing. i tried to fix it but i'm not sure
+ // what the expected behavior should even be. FF returns "\n" for the text node
+ // make sure this is handled
+ var crlfContainer = $('<p>\r\n</p>');
+ var x = crlfContainer.contents().get(0).nodeValue;
+ equals( x, what???, "Check for \\r and \\n in jQuery()" );
+*/
+
+ /* // Disabled until we add this functionality in
+ var pass = true;
+ try {
+ $("<div>Testing</div>").appendTo(document.getElementById("iframe").contentDocument.body);
+ } catch(e){
+ pass = false;
+ }
+ ok( pass, "$('&lt;tag&gt;') needs optional document parameter to ease cross-frame DOM wrangling, see #968" );*/
+
+ var code = $("<code/>");
+ equals( code.length, 1, "Correct number of elements generated for code" );
+ var img = $("<img/>");
+ equals( img.length, 1, "Correct number of elements generated for img" );
+ var div = $("<div/><hr/><code/><b/>");
+ equals( div.length, 4, "Correct number of elements generated for div hr code b" );
+
+ // can actually yield more than one, when iframes are included, the window is an array as well
+ equals( $(window).length, 1, "Correct number of elements generated for window" );
+
+ equals( $(document).length, 1, "Correct number of elements generated for document" );
+
+ equals( $([1,2,3]).get(1), 2, "Test passing an array to the factory" );
+
+ equals( $(document.body).get(0), $('body').get(0), "Test passing an html node to the factory" );
+});
+
+test("browser", function() {
+ expect(13);
+ var browsers = {
+ //Internet Explorer
+ "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)": "6.0",
+ "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)": "7.0",
+ /** Failing #1876
+ * "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)": "7.0",
+ */
+ //Browsers with Gecko engine
+ //Mozilla
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915" : "1.7.12",
+ //Firefox
+ "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3": "1.8.1.3",
+ //Netscape
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20070321 Netscape/8.1.3" : "1.7.5",
+ //Flock
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070321 Firefox/1.5.0.11 Flock/0.7.12" : "1.8.0.11",
+ //Opera browser
+ "Opera/9.20 (X11; Linux x86_64; U; en)": "9.20",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.20" : "9.20",
+ "Mozilla/5.0 (Windows NT 5.1; U; pl; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.20": "9.20",
+ //WebKit engine
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3": "418.9",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3" : "418.8",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.5": "312.8",
+ //Other user agent string
+ "Other browser's user agent 1.0":null
+ };
+ for (var i in browsers) {
+ var v = i.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ); // RegEx from Core jQuery.browser.version check
+ version = v ? v[1] : null;
+ equals( version, browsers[i], "Checking UA string" );
+ }
+});
+
+test("noConflict", function() {
+ expect(6);
+
+ var old = jQuery;
+ var newjQuery = jQuery.noConflict();
+
+ equals( newjQuery, old, "noConflict returned the jQuery object" );
+ equals( jQuery, old, "Make sure jQuery wasn't touched." );
+ equals( $, "$", "Make sure $ was reverted." );
+
+ jQuery = $ = old;
+
+ newjQuery = jQuery.noConflict(true);
+
+ equals( newjQuery, old, "noConflict returned the jQuery object" );
+ equals( jQuery, "jQuery", "Make sure jQuery was reverted." );
+ equals( $, "$", "Make sure $ was reverted." );
+
+ jQuery = $ = old;
+});
+
+test("isFunction", function() {
+ expect(21);
+
+ // Make sure that false values return false
+ ok( !jQuery.isFunction(), "No Value" );
+ ok( !jQuery.isFunction( null ), "null Value" );
+ ok( !jQuery.isFunction( undefined ), "undefined Value" );
+ ok( !jQuery.isFunction( "" ), "Empty String Value" );
+ ok( !jQuery.isFunction( 0 ), "0 Value" );
+
+ // Check built-ins
+ // Safari uses "(Internal Function)"
+ ok( jQuery.isFunction(String), "String Function("+String+")" );
+ ok( jQuery.isFunction(Array), "Array Function("+Array+")" );
+ ok( jQuery.isFunction(Object), "Object Function("+Object+")" );
+ ok( jQuery.isFunction(Function), "Function Function("+Function+")" );
+
+ // When stringified, this could be misinterpreted
+ var mystr = "function";
+ ok( !jQuery.isFunction(mystr), "Function String" );
+
+ // When stringified, this could be misinterpreted
+ var myarr = [ "function" ];
+ ok( !jQuery.isFunction(myarr), "Function Array" );
+
+ // When stringified, this could be misinterpreted
+ var myfunction = { "function": "test" };
+ ok( !jQuery.isFunction(myfunction), "Function Object" );
+
+ // Make sure normal functions still work
+ var fn = function(){};
+ ok( jQuery.isFunction(fn), "Normal Function" );
+
+ var obj = document.createElement("object");
+
+ // Firefox says this is a function
+ ok( !jQuery.isFunction(obj), "Object Element" );
+
+ // IE says this is an object
+ ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );
+
+ var nodes = document.body.childNodes;
+
+ // Safari says this is a function
+ ok( !jQuery.isFunction(nodes), "childNodes Property" );
+
+ var first = document.body.firstChild;
+
+ // Normal elements are reported ok everywhere
+ ok( !jQuery.isFunction(first), "A normal DOM Element" );
+
+ var input = document.createElement("input");
+ input.type = "text";
+ document.body.appendChild( input );
+
+ // IE says this is an object
+ ok( jQuery.isFunction(input.focus), "A default function property" );
+
+ document.body.removeChild( input );
+
+ var a = document.createElement("a");
+ a.href = "some-function";
+ document.body.appendChild( a );
+
+ // This serializes with the word 'function' in it
+ ok( !jQuery.isFunction(a), "Anchor Element" );
+
+ document.body.removeChild( a );
+
+ // Recursive function calls have lengths and array-like properties
+ function callme(callback){
+ function fn(response){
+ callback(response);
+ }
+
+ ok( jQuery.isFunction(fn), "Recursive Function Call" );
+
+ fn({ some: "data" });
+ };
+
+ callme(function(){
+ callme(function(){});
+ });
+});
+
+var foo = false;
+
+test("$('html')", function() {
+ expect(6);
+
+ reset();
+ foo = false;
+ var s = $("<script>var foo='test';</script>")[0];
+ ok( s, "Creating a script" );
+ ok( !foo, "Make sure the script wasn't executed prematurely" );
+ $("body").append(s);
+ ok( foo, "Executing a scripts contents in the right context" );
+
+ reset();
+ ok( $("<link rel='stylesheet'/>")[0], "Creating a link" );
+
+ reset();
+
+ var j = $("<span>hi</span> there <!-- mon ami -->");
+ ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
+
+ ok( !$("<option>test</option>")[0].selected, "Make sure that options are auto-selected #2050" );
+});
+
+test("$('html', context)", function() {
+ expect(1);
+
+ var $div = $("<div/>");
+ var $span = $("<span/>", $div);
+ equals($span.length, 1, "Verify a span created with a div context works, #1763");
+});
+
+if ( !isLocal ) {
+test("$(selector, xml).text(str) - Loaded via XML document", function() {
+ expect(2);
+ stop();
+ $.get('data/dashboard.xml', function(xml) {
+ // tests for #1419 where IE was a problem
+ equals( $("tab:first", xml).text(), "blabla", "Verify initial text correct" );
+ $("tab:first", xml).text("newtext");
+ equals( $("tab:first", xml).text(), "newtext", "Verify new text correct" );
+ start();
+ });
+});
+}
+
+test("length", function() {
+ expect(1);
+ equals( $("p").length, 6, "Get Number of Elements Found" );
+});
+
+test("size()", function() {
+ expect(1);
+ equals( $("p").size(), 6, "Get Number of Elements Found" );
+});
+
+test("get()", function() {
+ expect(1);
+ isSet( $("p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
+});
+
+test("get(Number)", function() {
+ expect(1);
+ equals( $("p").get(0), document.getElementById("firstp"), "Get A Single Element" );
+});
+
+test("add(String|Element|Array|undefined)", function() {
+ expect(12);
+ isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
+ isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
+ ok( $([]).add($("#form")[0].elements).length >= 13, "Check elements from array" );
+
+ // For the time being, we're discontinuing support for $(form.elements) since it's ambiguous in IE
+ // use $([]).add(form.elements) instead.
+ //equals( $([]).add($("#form")[0].elements).length, $($("#form")[0].elements).length, "Array in constructor must equals array in add()" );
+
+ var x = $([]).add($("<p id='x1'>xxx</p>")).add($("<p id='x2'>xxx</p>"));
+ equals( x[0].id, "x1", "Check on-the-fly element1" );
+ equals( x[1].id, "x2", "Check on-the-fly element2" );
+
+ var x = $([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
+ equals( x[0].id, "x1", "Check on-the-fly element1" );
+ equals( x[1].id, "x2", "Check on-the-fly element2" );
+
+ var notDefined;
+ equals( $([]).add(notDefined).length, 0, "Check that undefined adds nothing" );
+
+ // Added after #2811
+ equals( $([]).add([window,document,document.body,document]).length, 3, "Pass an array" );
+ equals( $(document).add(document).length, 1, "Check duplicated elements" );
+ equals( $(window).add(window).length, 1, "Check duplicated elements using the window" );
+ ok( $([]).add( document.getElementById('form') ).length >= 13, "Add a form (adds the elements)" );
+});
+
+test("each(Function)", function() {
+ expect(1);
+ var div = $("div");
+ div.each(function(){this.foo = 'zoo';});
+ var pass = true;
+ for ( var i = 0; i < div.size(); i++ ) {
+ if ( div.get(i).foo != "zoo" ) pass = false;
+ }
+ ok( pass, "Execute a function, Relative" );
+});
+
+test("index(Object)", function() {
+ expect(10);
+
+ var elements = $([window, document]),
+ inputElements = $('#radio1,#radio2,#check1,#check2');
+
+ equals( elements.index(window), 0, "Check for index of elements" );
+ equals( elements.index(document), 1, "Check for index of elements" );
+ equals( inputElements.index(document.getElementById('radio1')), 0, "Check for index of elements" );
+ equals( inputElements.index(document.getElementById('radio2')), 1, "Check for index of elements" );
+ equals( inputElements.index(document.getElementById('check1')), 2, "Check for index of elements" );
+ equals( inputElements.index(document.getElementById('check2')), 3, "Check for index of elements" );
+ equals( inputElements.index(window), -1, "Check for not found index" );
+ equals( inputElements.index(document), -1, "Check for not found index" );
+
+ // enabled since [5500]
+ equals( elements.index( elements ), 0, "Pass in a jQuery object" );
+ equals( elements.index( elements.eq(1) ), 1, "Pass in a jQuery object" );
+});
+
+test("attr(String)", function() {
+ expect(29);
+ equals( $('#text1').attr('value'), "Test", 'Check for value attribute' );
+ equals( $('#text1').attr('value', "Test2").attr('defaultValue'), "Test", 'Check for defaultValue attribute' );
+ equals( $('#text1').attr('type'), "text", 'Check for type attribute' );
+ equals( $('#radio1').attr('type'), "radio", 'Check for type attribute' );
+ equals( $('#check1').attr('type'), "checkbox", 'Check for type attribute' );
+ equals( $('#simon1').attr('rel'), "bookmark", 'Check for rel attribute' );
+ equals( $('#google').attr('title'), "Google!", 'Check for title attribute' );
+ equals( $('#mark').attr('hreflang'), "en", 'Check for hreflang attribute' );
+ equals( $('#en').attr('lang'), "en", 'Check for lang attribute' );
+ equals( $('#simon').attr('class'), "blog link", 'Check for class attribute' );
+ equals( $('#name').attr('name'), "name", 'Check for name attribute' );
+ equals( $('#text1').attr('name'), "action", 'Check for name attribute' );
+ ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );
+ equals( $('#text1').attr('minlength'), '20', 'Check for minlength attribute' );
+ equals( $('#text1').attr('minLength'), '20', 'Check for minLength attribute' );
+ equals( $('#area1').attr('minLength'), '20', 'Check for minLength attribute' );
+ equals( $('#text1').attr('maxlength'), '30', 'Check for maxlength attribute' );
+ equals( $('#text1').attr('maxLength'), '30', 'Check for maxLength attribute' );
+ equals( $('#area1').attr('maxLength'), '30', 'Check for maxLength attribute' );
+ equals( $('#select2').attr('selectedIndex'), 3, 'Check for selectedIndex attribute' );
+ equals( $('#foo').attr('nodeName'), 'DIV', 'Check for nodeName attribute' );
+ equals( $('#foo').attr('tagName'), 'DIV', 'Check for tagName attribute' );
+
+ $('<a id="tAnchor5"></a>').attr('href', '#5').appendTo('#main'); // using innerHTML in IE causes href attribute to be serialized to the full path
+ equals( $('#tAnchor5').attr('href'), "#5", 'Check for non-absolute href (an anchor)' );
+
+
+ // Related to [5574] and [5683]
+ var body = document.body, $body = $(body);
+
+ ok( $body.attr('foo') === undefined, 'Make sure that a non existent attribute returns undefined' );
+ ok( $body.attr('nextSibling') === null, 'Make sure a null expando returns null' );
+
+ body.setAttribute('foo', 'baz');
+ equals( $body.attr('foo'), 'baz', 'Make sure the dom attribute is retrieved when no expando is found' );
+
+ body.foo = 'bar';
+ equals( $body.attr('foo'), 'bar', 'Make sure the expando is preferred over the dom attribute' );
+
+ $body.attr('foo','cool');
+ equals( $body.attr('foo'), 'cool', 'Make sure that setting works well when both expando and dom attribute are available' );
+
+ body.foo = undefined;
+ ok( $body.attr('foo') === undefined, 'Make sure the expando is preferred over the dom attribute, even if undefined' );
+
+ body.removeAttribute('foo'); // Cleanup
+});
+
+if ( !isLocal ) {
+ test("attr(String) in XML Files", function() {
+ expect(2);
+ stop();
+ $.get("data/dashboard.xml", function(xml) {
+ equals( $("locations", xml).attr("class"), "foo", "Check class attribute in XML document" );
+ equals( $("location", xml).attr("for"), "bar", "Check for attribute in XML document" );
+ start();
+ });
+ });
+}
+
+test("attr(String, Function)", function() {
+ expect(2);
+ equals( $('#text1').attr('value', function() { return this.id })[0].value, "text1", "Set value from id" );
+ equals( $('#text1').attr('title', function(i) { return i }).attr('title'), "0", "Set value with an index");
+});
+
+test("attr(Hash)", function() {
+ expect(1);
+ var pass = true;
+ $("div").attr({foo: 'baz', zoo: 'ping'}).each(function(){
+ if ( this.getAttribute('foo') != "baz" && this.getAttribute('zoo') != "ping" ) pass = false;
+ });
+ ok( pass, "Set Multiple Attributes" );
+});
+
+test("attr(String, Object)", function() {
+ expect(19);
+ var div = $("div").attr("foo", "bar");
+ fail = false;
+ for ( var i = 0; i < div.size(); i++ ) {
+ if ( div.get(i).getAttribute('foo') != "bar" ){
+ fail = i;
+ break;
+ }
+ }
+ equals( fail, false, "Set Attribute, the #"+fail+" element didn't get the attribute 'foo'" );
+
+ ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" );
+
+ $("#name").attr('name', 'something');
+ equals( $("#name").attr('name'), 'something', 'Set name attribute' );
+ $("#check2").attr('checked', true);
+ equals( document.getElementById('check2').checked, true, 'Set checked attribute' );
+ $("#check2").attr('checked', false);
+ equals( document.getElementById('check2').checked, false, 'Set checked attribute' );
+ $("#text1").attr('readonly', true);
+ equals( document.getElementById('text1').readOnly, true, 'Set readonly attribute' );
+ $("#text1").attr('readonly', false);
+ equals( document.getElementById('text1').readOnly, false, 'Set readonly attribute' );
+ $("#name").attr('maxlength', '5');
+ equals( document.getElementById('name').maxLength, '5', 'Set maxlength attribute' );
+ $("#name").attr('maxLength', '10');
+ equals( document.getElementById('name').maxLength, '10', 'Set maxlength attribute' );
+ $("#name").attr('minlength', '5');
+ equals( document.getElementById('name').minLength, '5', 'Set minlength attribute' );
+ $("#name").attr('minLength', '10');
+ equals( document.getElementById('name').minLength, '10', 'Set minlength attribute' );
+
+ // for #1070
+ $("#name").attr('someAttr', '0');
+ equals( $("#name").attr('someAttr'), '0', 'Set attribute to a string of "0"' );
+ $("#name").attr('someAttr', 0);
+ equals( $("#name").attr('someAttr'), 0, 'Set attribute to the number 0' );
+ $("#name").attr('someAttr', 1);
+ equals( $("#name").attr('someAttr'), 1, 'Set attribute to the number 1' );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+
+ j.attr("name", "attrvalue");
+ equals( j.attr("name"), "attrvalue", "Check node,textnode,comment for attr" );
+ j.removeAttr("name");
+
+ reset();
+
+ var type = $("#check2").attr('type');
+ var thrown = false;
+ try {
+ $("#check2").attr('type','hidden');
+ } catch(e) {
+ thrown = true;
+ }
+ ok( thrown, "Exception thrown when trying to change type property" );
+ equals( type, $("#check2").attr('type'), "Verify that you can't change the type of an input element" );
+
+ var check = document.createElement("input");
+ var thrown = true;
+ try {
+ $(check).attr('type','checkbox');
+ } catch(e) {
+ thrown = false;
+ }
+ ok( thrown, "Exception thrown when trying to change type property" );
+ equals( "checkbox", $(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );
+});
+
+if ( !isLocal ) {
+ test("attr(String, Object) - Loaded via XML document", function() {
+ expect(2);
+ stop();
+ $.get('data/dashboard.xml', function(xml) {
+ var titles = [];
+ $('tab', xml).each(function() {
+ titles.push($(this).attr('title'));
+ });
+ equals( titles[0], 'Location', 'attr() in XML context: Check first title' );
+ equals( titles[1], 'Users', 'attr() in XML context: Check second title' );
+ start();
+ });
+ });
+}
+
+test("css(String|Hash)", function() {
+ expect(19);
+
+ equals( $('#main').css("display"), 'none', 'Check for css property "display"');
+
+ ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
+ $('#foo').css({display: 'none'});
+ ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
+ $('#foo').css({display: 'block'});
+ ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible');
+
+ $('#floatTest').css({styleFloat: 'right'});
+ equals( $('#floatTest').css('styleFloat'), 'right', 'Modified CSS float using "styleFloat": Assert float is right');
+ $('#floatTest').css({cssFloat: 'left'});
+ equals( $('#floatTest').css('cssFloat'), 'left', 'Modified CSS float using "cssFloat": Assert float is left');
+ $('#floatTest').css({'float': 'right'});
+ equals( $('#floatTest').css('float'), 'right', 'Modified CSS float using "float": Assert float is right');
+ $('#floatTest').css({'font-size': '30px'});
+ equals( $('#floatTest').css('font-size'), '30px', 'Modified CSS font-size: Assert font-size is 30px');
+
+ $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
+ $('#foo').css({opacity: n});
+ equals( $('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
+ $('#foo').css({opacity: parseFloat(n)});
+ equals( $('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
+ });
+ $('#foo').css({opacity: ''});
+ equals( $('#foo').css('opacity'), '1', "Assert opacity is 1 when set to an empty String" );
+});
+
+test("css(String, Object)", function() {
+ expect(21);
+ ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
+ $('#foo').css('display', 'none');
+ ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
+ $('#foo').css('display', 'block');
+ ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible');
+
+ $('#floatTest').css('styleFloat', 'left');
+ equals( $('#floatTest').css('styleFloat'), 'left', 'Modified CSS float using "styleFloat": Assert float is left');
+ $('#floatTest').css('cssFloat', 'right');
+ equals( $('#floatTest').css('cssFloat'), 'right', 'Modified CSS float using "cssFloat": Assert float is right');
+ $('#floatTest').css('float', 'left');
+ equals( $('#floatTest').css('float'), 'left', 'Modified CSS float using "float": Assert float is left');
+ $('#floatTest').css('font-size', '20px');
+ equals( $('#floatTest').css('font-size'), '20px', 'Modified CSS font-size: Assert font-size is 20px');
+
+ $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
+ $('#foo').css('opacity', n);
+ equals( $('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
+ $('#foo').css('opacity', parseFloat(n));
+ equals( $('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
+ });
+ $('#foo').css('opacity', '');
+ equals( $('#foo').css('opacity'), '1', "Assert opacity is 1 when set to an empty String" );
+ // for #1438, IE throws JS error when filter exists but doesn't have opacity in it
+ if (jQuery.browser.msie) {
+ $('#foo').css("filter", "progid:DXImageTransform.Microsoft.Chroma(color='red');");
+ }
+ equals( $('#foo').css('opacity'), '1', "Assert opacity is 1 when a different filter is set in IE, #1438" );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.css("padding-left", "1px");
+ equals( j.css("padding-left"), "1px", "Check node,textnode,comment css works" );
+
+ // opera sometimes doesn't update 'display' correctly, see #2037
+ $("#t2037")[0].innerHTML = $("#t2037")[0].innerHTML
+ equals( $("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
+});
+
+test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
+ expect(4);
+
+ var $checkedtest = $("#checkedtest");
+ // IE6 was clearing "checked" in jQuery.css(elem, "height");
+ jQuery.css($checkedtest[0], "height");
+ ok( !! $(":radio:first", $checkedtest).attr("checked"), "Check first radio still checked." );
+ ok( ! $(":radio:last", $checkedtest).attr("checked"), "Check last radio still NOT checked." );
+ ok( !! $(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." );
+ ok( ! $(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." );
+});
+
+test("width()", function() {
+ expect(9);
+
+ var $div = $("#nothiddendiv");
+ $div.width(30);
+ equals($div.width(), 30, "Test set to 30 correctly");
+ $div.width(-1); // handle negative numbers by ignoring #1599
+ equals($div.width(), 30, "Test negative width ignored");
+ $div.css("padding", "20px");
+ equals($div.width(), 30, "Test padding specified with pixels");
+ $div.css("border", "2px solid #fff");
+ equals($div.width(), 30, "Test border specified with pixels");
+ $div.css("padding", "2em");
+ equals($div.width(), 30, "Test padding specified with ems");
+ $div.css("border", "1em solid #fff");
+ equals($div.width(), 30, "Test border specified with ems");
+ $div.css("padding", "2%");
+ equals($div.width(), 30, "Test padding specified with percent");
+ $div.hide();
+ equals($div.width(), 30, "Test hidden div");
+
+ $div.css({ display: "", border: "", padding: "" });
+
+ $("#nothiddendivchild").css({ padding: "3px", border: "2px solid #fff" });
+ equals($("#nothiddendivchild").width(), 20, "Test child width with border and padding");
+ $("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });
+});
+
+test("height()", function() {
+ expect(8);
+
+ var $div = $("#nothiddendiv");
+ $div.height(30);
+ equals($div.height(), 30, "Test set to 30 correctly");
+ $div.height(-1); // handle negative numbers by ignoring #1599
+ equals($div.height(), 30, "Test negative height ignored");
+ $div.css("padding", "20px");
+ equals($div.height(), 30, "Test padding specified with pixels");
+ $div.css("border", "2px solid #fff");
+ equals($div.height(), 30, "Test border specified with pixels");
+ $div.css("padding", "2em");
+ equals($div.height(), 30, "Test padding specified with ems");
+ $div.css("border", "1em solid #fff");
+ equals($div.height(), 30, "Test border specified with ems");
+ $div.css("padding", "2%");
+ equals($div.height(), 30, "Test padding specified with percent");
+ $div.hide();
+ equals($div.height(), 30, "Test hidden div");
+
+ $div.css({ display: "", border: "", padding: "", height: "1px" });
+});
+
+test("text()", function() {
+ expect(1);
+ var expected = "This link has class=\"blog\": Simon Willison's Weblog";
+ equals( $('#sap').text(), expected, 'Check for merged text of more then one element.' );
+});
+
+test("wrap(String|Element)", function() {
+ expect(8);
+ var defaultText = 'Try them out:'
+ var result = $('#first').wrap('<div class="red"><span></span></div>').text();
+ equals( defaultText, result, 'Check for wrapping of on-the-fly html' );
+ ok( $('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
+
+ reset();
+ var defaultText = 'Try them out:'
+ var result = $('#first').wrap(document.getElementById('empty')).parent();
+ ok( result.is('ol'), 'Check for element wrapping' );
+ equals( result.text(), defaultText, 'Check for element wrapping' );
+
+ reset();
+ $('#check1').click(function() {
+ var checkbox = this;
+ ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" );
+ $(checkbox).wrap( '<div id="c1" style="display:none;"></div>' );
+ ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" );
+ }).click();
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.wrap("<i></i>");
+ equals( $("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" );
+ equals( $("#nonnodes > i").text(), j.text() + j[1].nodeValue, "Check node,textnode,comment wraps doesn't hurt text" );
+});
+
+test("wrapAll(String|Element)", function() {
+ expect(8);
+ var prev = $("#first")[0].previousSibling;
+ var p = $("#first")[0].parentNode;
+ var result = $('#first,#firstp').wrapAll('<div class="red"><div id="tmp"></div></div>');
+ equals( result.parent().length, 1, 'Check for wrapping of on-the-fly html' );
+ ok( $('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
+ ok( $('#firstp').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
+ equals( $("#first").parent().parent()[0].previousSibling, prev, "Correct Previous Sibling" );
+ equals( $("#first").parent().parent()[0].parentNode, p, "Correct Parent" );
+
+ reset();
+ var prev = $("#first")[0].previousSibling;
+ var p = $("#first")[0].parentNode;
+ var result = $('#first,#firstp').wrapAll(document.getElementById('empty'));
+ equals( $("#first").parent()[0], $("#firstp").parent()[0], "Same Parent" );
+ equals( $("#first").parent()[0].previousSibling, prev, "Correct Previous Sibling" );
+ equals( $("#first").parent()[0].parentNode, p, "Correct Parent" );
+});
+
+test("wrapInner(String|Element)", function() {
+ expect(6);
+ var num = $("#first").children().length;
+ var result = $('#first').wrapInner('<div class="red"><div id="tmp"></div></div>');
+ equals( $("#first").children().length, 1, "Only one child" );
+ ok( $("#first").children().is(".red"), "Verify Right Element" );
+ equals( $("#first").children().children().children().length, num, "Verify Elements Intact" );
+
+ reset();
+ var num = $("#first").children().length;
+ var result = $('#first').wrapInner(document.getElementById('empty'));
+ equals( $("#first").children().length, 1, "Only one child" );
+ ok( $("#first").children().is("#empty"), "Verify Right Element" );
+ equals( $("#first").children().children().length, num, "Verify Elements Intact" );
+});
+
+test("append(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(21);
+ var defaultText = 'Try them out:'
+ var result = $('#first').append('<b>buga</b>');
+ equals( result.text(), defaultText + 'buga', 'Check if text appending works' );
+ equals( $('#select3').append('<option value="appendTest">Append Test</option>').find('option:last-child').attr('value'), 'appendTest', 'Appending html options to select element');
+
+ reset();
+ var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
+ $('#sap').append(document.getElementById('first'));
+ equals( expected, $('#sap').text(), "Check for appending of element" );
+
+ reset();
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
+ $('#sap').append([document.getElementById('first'), document.getElementById('yahoo')]);
+ equals( expected, $('#sap').text(), "Check for appending of array of elements" );
+
+ reset();
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
+ $('#sap').append($("#first, #yahoo"));
+ equals( expected, $('#sap').text(), "Check for appending of jQuery object" );
+
+ reset();
+ $("#sap").append( 5 );
+ ok( $("#sap")[0].innerHTML.match( /5$/ ), "Check for appending a number" );
+
+ reset();
+ $("#sap").append( " text with spaces " );
+ ok( $("#sap")[0].innerHTML.match(/ text with spaces $/), "Check for appending text with spaces" );
+
+ reset();
+ ok( $("#sap").append([]), "Check for appending an empty array." );
+ ok( $("#sap").append(""), "Check for appending an empty string." );
+ ok( $("#sap").append(document.getElementsByTagName("foo")), "Check for appending an empty nodelist." );
+
+ reset();
+ $("#sap").append(document.getElementById('form'));
+ equals( $("#sap>form").size(), 1, "Check for appending a form" ); // Bug #910
+
+ reset();
+ var pass = true;
+ try {
+ $( $("#iframe")[0].contentWindow.document.body ).append("<div>test</div>");
+ } catch(e) {
+ pass = false;
+ }
+
+ ok( pass, "Test for appending a DOM node to the contents of an IFrame" );
+
+ reset();
+ $('<fieldset/>').appendTo('#form').append('<legend id="legend">test</legend>');
+ t( 'Append legend', '#legend', ['legend'] );
+
+ reset();
+ $('#select1').append('<OPTION>Test</OPTION>');
+ equals( $('#select1 option:last').text(), "Test", "Appending &lt;OPTION&gt; (all caps)" );
+
+ $('#table').append('<colgroup></colgroup>');
+ ok( $('#table colgroup').length, "Append colgroup" );
+
+ $('#table colgroup').append('<col/>');
+ ok( $('#table colgroup col').length, "Append col" );
+
+ reset();
+ $('#table').append('<caption></caption>');
+ ok( $('#table caption').length, "Append caption" );
+
+ reset();
+ $('form:last')
+ .append('<select id="appendSelect1"></select>')
+ .append('<select id="appendSelect2"><option>Test</option></select>');
+
+ t( "Append Select", "#appendSelect1, #appendSelect2", ["appendSelect1", "appendSelect2"] );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ var d = $("<div/>").appendTo("#nonnodes").append(j);
+ equals( $("#nonnodes").length, 1, "Check node,textnode,comment append moved leaving just the div" );
+ ok( d.contents().length >= 2, "Check node,textnode,comment append works" );
+ d.contents().appendTo("#nonnodes");
+ d.remove();
+ ok( $("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" );
+});
+
+test("appendTo(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(6);
+ var defaultText = 'Try them out:'
+ $('<b>buga</b>').appendTo('#first');
+ equals( $("#first").text(), defaultText + 'buga', 'Check if text appending works' );
+ equals( $('<option value="appendTest">Append Test</option>').appendTo('#select3').parent().find('option:last-child').attr('value'), 'appendTest', 'Appending html options to select element');
+
+ reset();
+ var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
+ $(document.getElementById('first')).appendTo('#sap');
+ equals( expected, $('#sap').text(), "Check for appending of element" );
+
+ reset();
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
+ $([document.getElementById('first'), document.getElementById('yahoo')]).appendTo('#sap');
+ equals( expected, $('#sap').text(), "Check for appending of array of elements" );
+
+ reset();
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
+ $("#first, #yahoo").appendTo('#sap');
+ equals( expected, $('#sap').text(), "Check for appending of jQuery object" );
+
+ reset();
+ $('#select1').appendTo('#foo');
+ t( 'Append select', '#foo select', ['select1'] );
+});
+
+test("prepend(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(5);
+ var defaultText = 'Try them out:'
+ var result = $('#first').prepend('<b>buga</b>');
+ equals( result.text(), 'buga' + defaultText, 'Check if text prepending works' );
+ equals( $('#select3').prepend('<option value="prependTest">Prepend Test</option>').find('option:first-child').attr('value'), 'prependTest', 'Prepending html options to select element');
+
+ reset();
+ var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
+ $('#sap').prepend(document.getElementById('first'));
+ equals( expected, $('#sap').text(), "Check for prepending of element" );
+
+ reset();
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
+ $('#sap').prepend([document.getElementById('first'), document.getElementById('yahoo')]);
+ equals( expected, $('#sap').text(), "Check for prepending of array of elements" );
+
+ reset();
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
+ $('#sap').prepend($("#first, #yahoo"));
+ equals( expected, $('#sap').text(), "Check for prepending of jQuery object" );
+});
+
+test("prependTo(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(6);
+ var defaultText = 'Try them out:'
+ $('<b>buga</b>').prependTo('#first');
+ equals( $('#first').text(), 'buga' + defaultText, 'Check if text prepending works' );
+ equals( $('<option value="prependTest">Prepend Test</option>').prependTo('#select3').parent().find('option:first-child').attr('value'), 'prependTest', 'Prepending html options to select element');
+
+ reset();
+ var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
+ $(document.getElementById('first')).prependTo('#sap');
+ equals( expected, $('#sap').text(), "Check for prepending of element" );
+
+ reset();
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
+ $([document.getElementById('yahoo'), document.getElementById('first')]).prependTo('#sap');
+ equals( expected, $('#sap').text(), "Check for prepending of array of elements" );
+
+ reset();
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
+ $("#yahoo, #first").prependTo('#sap');
+ equals( expected, $('#sap').text(), "Check for prepending of jQuery object" );
+
+ reset();
+ $('<select id="prependSelect1"></select>').prependTo('form:last');
+ $('<select id="prependSelect2"><option>Test</option></select>').prependTo('form:last');
+
+ t( "Prepend Select", "#prependSelect1, #prependSelect2", ["prependSelect1", "prependSelect2"] );
+});
+
+test("before(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(4);
+ var expected = 'This is a normal link: bugaYahoo';
+ $('#yahoo').before('<b>buga</b>');
+ equals( expected, $('#en').text(), 'Insert String before' );
+
+ reset();
+ expected = "This is a normal link: Try them out:Yahoo";
+ $('#yahoo').before(document.getElementById('first'));
+ equals( expected, $('#en').text(), "Insert element before" );
+
+ reset();
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
+ $('#yahoo').before([document.getElementById('first'), document.getElementById('mark')]);
+ equals( expected, $('#en').text(), "Insert array of elements before" );
+
+ reset();
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
+ $('#yahoo').before($("#first, #mark"));
+ equals( expected, $('#en').text(), "Insert jQuery before" );
+});
+
+test("insertBefore(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(4);
+ var expected = 'This is a normal link: bugaYahoo';
+ $('<b>buga</b>').insertBefore('#yahoo');
+ equals( expected, $('#en').text(), 'Insert String before' );
+
+ reset();
+ expected = "This is a normal link: Try them out:Yahoo";
+ $(document.getElementById('first')).insertBefore('#yahoo');
+ equals( expected, $('#en').text(), "Insert element before" );
+
+ reset();
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
+ $([document.getElementById('first'), document.getElementById('mark')]).insertBefore('#yahoo');
+ equals( expected, $('#en').text(), "Insert array of elements before" );
+
+ reset();
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
+ $("#first, #mark").insertBefore('#yahoo');
+ equals( expected, $('#en').text(), "Insert jQuery before" );
+});
+
+test("after(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(4);
+ var expected = 'This is a normal link: Yahoobuga';
+ $('#yahoo').after('<b>buga</b>');
+ equals( expected, $('#en').text(), 'Insert String after' );
+
+ reset();
+ expected = "This is a normal link: YahooTry them out:";
+ $('#yahoo').after(document.getElementById('first'));
+ equals( expected, $('#en').text(), "Insert element after" );
+
+ reset();
+ expected = "This is a normal link: YahooTry them out:diveintomark";
+ $('#yahoo').after([document.getElementById('first'), document.getElementById('mark')]);
+ equals( expected, $('#en').text(), "Insert array of elements after" );
+
+ reset();
+ expected = "This is a normal link: YahooTry them out:diveintomark";
+ $('#yahoo').after($("#first, #mark"));
+ equals( expected, $('#en').text(), "Insert jQuery after" );
+});
+
+test("insertAfter(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(4);
+ var expected = 'This is a normal link: Yahoobuga';
+ $('<b>buga</b>').insertAfter('#yahoo');
+ equals( expected, $('#en').text(), 'Insert String after' );
+
+ reset();
+ expected = "This is a normal link: YahooTry them out:";
+ $(document.getElementById('first')).insertAfter('#yahoo');
+ equals( expected, $('#en').text(), "Insert element after" );
+
+ reset();
+ expected = "This is a normal link: YahooTry them out:diveintomark";
+ $([document.getElementById('mark'), document.getElementById('first')]).insertAfter('#yahoo');
+ equals( expected, $('#en').text(), "Insert array of elements after" );
+
+ reset();
+ expected = "This is a normal link: YahooTry them out:diveintomark";
+ $("#mark, #first").insertAfter('#yahoo');
+ equals( expected, $('#en').text(), "Insert jQuery after" );
+});
+
+test("replaceWith(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(10);
+ $('#yahoo').replaceWith('<b id="replace">buga</b>');
+ ok( $("#replace")[0], 'Replace element with string' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after string' );
+
+ reset();
+ $('#yahoo').replaceWith(document.getElementById('first'));
+ ok( $("#first")[0], 'Replace element with element' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after element' );
+
+ reset();
+ $('#yahoo').replaceWith([document.getElementById('first'), document.getElementById('mark')]);
+ ok( $("#first")[0], 'Replace element with array of elements' );
+ ok( $("#mark")[0], 'Replace element with array of elements' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
+
+ reset();
+ $('#yahoo').replaceWith($("#first, #mark"));
+ ok( $("#first")[0], 'Replace element with set of elements' );
+ ok( $("#mark")[0], 'Replace element with set of elements' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
+});
+
+test("replaceAll(String|Element|Array&lt;Element&gt;|jQuery)", function() {
+ expect(10);
+ $('<b id="replace">buga</b>').replaceAll("#yahoo");
+ ok( $("#replace")[0], 'Replace element with string' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after string' );
+
+ reset();
+ $(document.getElementById('first')).replaceAll("#yahoo");
+ ok( $("#first")[0], 'Replace element with element' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after element' );
+
+ reset();
+ $([document.getElementById('first'), document.getElementById('mark')]).replaceAll("#yahoo");
+ ok( $("#first")[0], 'Replace element with array of elements' );
+ ok( $("#mark")[0], 'Replace element with array of elements' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
+
+ reset();
+ $("#first, #mark").replaceAll("#yahoo");
+ ok( $("#first")[0], 'Replace element with set of elements' );
+ ok( $("#mark")[0], 'Replace element with set of elements' );
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
+});
+
+test("end()", function() {
+ expect(3);
+ equals( 'Yahoo', $('#yahoo').parent().end().text(), 'Check for end' );
+ ok( $('#yahoo').end(), 'Check for end with nothing to end' );
+
+ var x = $('#yahoo');
+ x.parent();
+ equals( 'Yahoo', $('#yahoo').text(), 'Check for non-destructive behaviour' );
+});
+
+test("find(String)", function() {
+ expect(2);
+ equals( 'Yahoo', $('#foo').find('.blogTest').text(), 'Check for find' );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ equals( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
+});
+
+test("clone()", function() {
+ expect(20);
+ equals( 'This is a normal link: Yahoo', $('#en').text(), 'Assert text for #en' );
+ var clone = $('#yahoo').clone();
+ equals( 'Try them out:Yahoo', $('#first').append(clone).text(), 'Check for clone' );
+ equals( 'This is a normal link: Yahoo', $('#en').text(), 'Reassert text for #en' );
+
+ var cloneTags = [
+ "<table/>", "<tr/>", "<td/>", "<div/>",
+ "<button/>", "<ul/>", "<ol/>", "<li/>",
+ "<input type='checkbox' />", "<select/>", "<option/>", "<textarea/>",
+ "<tbody/>", "<thead/>", "<tfoot/>", "<iframe/>"
+ ];
+ for (var i = 0; i < cloneTags.length; i++) {
+ var j = $(cloneTags[i]);
+ equals( j[0].tagName, j.clone()[0].tagName, 'Clone a &lt;' + cloneTags[i].substring(1));
+ }
+
+ // using contents will get comments regular, text, and comment nodes
+ var cl = $("#nonnodes").contents().clone();
+ ok( cl.length >= 2, "Check node,textnode,comment clone works (some browsers delete comments on clone)" );
+});
+
+if (!isLocal) {
+test("clone() on XML nodes", function() {
+ expect(2);
+ stop();
+ $.get("data/dashboard.xml", function (xml) {
+ var root = $(xml.documentElement).clone();
+ $("tab:first", xml).text("origval");
+ $("tab:first", root).text("cloneval");
+ equals($("tab:first", xml).text(), "origval", "Check original XML node was correctly set");
+ equals($("tab:first", root).text(), "cloneval", "Check cloned XML node was correctly set");
+ start();
+ });
+});
+}
+
+test("is(String)", function() {
+ expect(26);
+ ok( $('#form').is('form'), 'Check for element: A form must be a form' );
+ ok( !$('#form').is('div'), 'Check for element: A form is not a div' );
+ ok( $('#mark').is('.blog'), 'Check for class: Expected class "blog"' );
+ ok( !$('#mark').is('.link'), 'Check for class: Did not expect class "link"' );
+ ok( $('#simon').is('.blog.link'), 'Check for multiple classes: Expected classes "blog" and "link"' );
+ ok( !$('#simon').is('.blogTest'), 'Check for multiple classes: Expected classes "blog" and "link", but not "blogTest"' );
+ ok( $('#en').is('[lang="en"]'), 'Check for attribute: Expected attribute lang to be "en"' );
+ ok( !$('#en').is('[lang="de"]'), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
+ ok( $('#text1').is('[type="text"]'), 'Check for attribute: Expected attribute type to be "text"' );
+ ok( !$('#text1').is('[type="radio"]'), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
+ ok( $('#text2').is(':disabled'), 'Check for pseudoclass: Expected to be disabled' );
+ ok( !$('#text1').is(':disabled'), 'Check for pseudoclass: Expected not disabled' );
+ ok( $('#radio2').is(':checked'), 'Check for pseudoclass: Expected to be checked' );
+ ok( !$('#radio1').is(':checked'), 'Check for pseudoclass: Expected not checked' );
+ ok( $('#foo').is(':has(p)'), 'Check for child: Expected a child "p" element' );
+ ok( !$('#foo').is(':has(ul)'), 'Check for child: Did not expect "ul" element' );
+ ok( $('#foo').is(':has(p):has(a):has(code)'), 'Check for childs: Expected "p", "a" and "code" child elements' );
+ ok( !$('#foo').is(':has(p):has(a):has(code):has(ol)'), 'Check for childs: Expected "p", "a" and "code" child elements, but no "ol"' );
+ ok( !$('#foo').is(0), 'Expected false for an invalid expression - 0' );
+ ok( !$('#foo').is(null), 'Expected false for an invalid expression - null' );
+ ok( !$('#foo').is(''), 'Expected false for an invalid expression - ""' );
+ ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' );
+
+ // test is() with comma-seperated expressions
+ ok( $('#en').is('[lang="en"],[lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
+ ok( $('#en').is('[lang="de"],[lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
+ ok( $('#en').is('[lang="en"] , [lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
+ ok( $('#en').is('[lang="de"] , [lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
+});
+
+test("$.extend(Object, Object)", function() {
+ expect(20);
+
+ var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
+ options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
+ optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
+ merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
+ deep1 = { foo: { bar: true } },
+ deep1copy = { foo: { bar: true } },
+ deep2 = { foo: { baz: true }, foo2: document },
+ deep2copy = { foo: { baz: true }, foo2: document },
+ deepmerged = { foo: { bar: true, baz: true }, foo2: document };
+
+ jQuery.extend(settings, options);
+ isObj( settings, merged, "Check if extended: settings must be extended" );
+ isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
+
+ jQuery.extend(settings, null, options);
+ isObj( settings, merged, "Check if extended: settings must be extended" );
+ isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
+
+ jQuery.extend(true, deep1, deep2);
+ isObj( deep1.foo, deepmerged.foo, "Check if foo: settings must be extended" );
+ isObj( deep2.foo, deep2copy.foo, "Check if not deep2: options must not be modified" );
+ equals( deep1.foo2, document, "Make sure that a deep clone was not attempted on the document" );
+
+ var nullUndef;
+ nullUndef = jQuery.extend({}, options, { xnumber2: null });
+ ok( nullUndef.xnumber2 === null, "Check to make sure null values are copied");
+
+ nullUndef = jQuery.extend({}, options, { xnumber2: undefined });
+ ok( nullUndef.xnumber2 === options.xnumber2, "Check to make sure undefined values are not copied");
+
+ nullUndef = jQuery.extend({}, options, { xnumber0: null });
+ ok( nullUndef.xnumber0 === null, "Check to make sure null values are inserted");
+
+ var target = {};
+ var recursive = { foo:target, bar:5 };
+ jQuery.extend(true, target, recursive);
+ isObj( target, { bar:5 }, "Check to make sure a recursive obj doesn't go never-ending loop by not copying it over" );
+
+ var ret = jQuery.extend(true, { foo: [] }, { foo: [0] } ); // 1907
+ equals( ret.foo.length, 1, "Check to make sure a value with coersion 'false' copies over when necessary to fix #1907" );
+
+ var ret = jQuery.extend(true, { foo: "1,2,3" }, { foo: [1, 2, 3] } );
+ ok( typeof ret.foo != "string", "Check to make sure values equal with coersion (but not actually equal) overwrite correctly" );
+
+ var ret = jQuery.extend(true, { foo:"bar" }, { foo:null } );
+ ok( typeof ret.foo !== 'undefined', "Make sure a null value doesn't crash with deep extend, for #1908" );
+
+ var obj = { foo:null };
+ jQuery.extend(true, obj, { foo:"notnull" } );
+ equals( obj.foo, "notnull", "Make sure a null value can be overwritten" );
+
+ function func() {}
+ jQuery.extend(func, { key: "value" } );
+ equals( func.key, "value", "Verify a function can be extended" );
+
+ var defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
+ defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
+ options1 = { xnumber2: 1, xstring2: "x" },
+ options1Copy = { xnumber2: 1, xstring2: "x" },
+ options2 = { xstring2: "xx", xxx: "newstringx" },
+ options2Copy = { xstring2: "xx", xxx: "newstringx" },
+ merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" };
+
+ var settings = jQuery.extend({}, defaults, options1, options2);
+ isObj( settings, merged2, "Check if extended: settings must be extended" );
+ isObj( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
+ isObj( options1, options1Copy, "Check if not modified: options1 must not be modified" );
+ isObj( options2, options2Copy, "Check if not modified: options2 must not be modified" );
+});
+
+test("val()", function() {
+ expect(4);
+ equals( $("#text1").val(), "Test", "Check for value of input element" );
+ equals( !$("#text1").val(), "", "Check for value of input element" );
+ // ticket #1714 this caused a JS error in IE
+ equals( $("#first").val(), "", "Check a paragraph element to see if it has a value" );
+ ok( $([]).val() === undefined, "Check an empty jQuery object will return undefined from val" );
+});
+
+test("val(String)", function() {
+ expect(4);
+ document.getElementById('text1').value = "bla";
+ equals( $("#text1").val(), "bla", "Check for modified value of input element" );
+ $("#text1").val('test');
+ ok ( document.getElementById('text1').value == "test", "Check for modified (via val(String)) value of input element" );
+
+ $("#select1").val("3");
+ equals( $("#select1").val(), "3", "Check for modified (via val(String)) value of select element" );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.val("asdf");
+ equals( j.val(), "asdf", "Check node,textnode,comment with val()" );
+ j.removeAttr("value");
+});
+
+var scriptorder = 0;
+
+test("html(String)", function() {
+ expect(11);
+ var div = $("#main > div");
+ div.html("<b>test</b>");
+ var pass = true;
+ for ( var i = 0; i < div.size(); i++ ) {
+ if ( div.get(i).childNodes.length != 1 ) pass = false;
+ }
+ ok( pass, "Set HTML" );
+
+ reset();
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.html("<b>bold</b>");
+
+ // this is needed, or the expando added by jQuery unique will yield a different html
+ j.find('b').removeData();
+ equals( j.html().toLowerCase(), "<b>bold</b>", "Check node,textnode,comment with html()" );
+
+ $("#main").html("<select/>");
+ $("#main select").html("<option>O1</option><option selected='selected'>O2</option><option>O3</option>");
+ equals( $("#main select").val(), "O2", "Selected option correct" );
+
+ stop();
+
+ $("#main").html('<script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>');
+
+ $("#main").html('foo <form><script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script></form>');
+
+ // it was decided that waiting to execute ALL scripts makes sense since nested ones have to wait anyway so this test case is changed, see #1959
+ $("#main").html("<script>equals(scriptorder++, 0, 'Script is executed in order');equals($('#scriptorder').length, 1,'Execute after html (even though appears before)')<\/script><span id='scriptorder'><script>equals(scriptorder++, 1, 'Script (nested) is executed in order');equals($('#scriptorder').length, 1,'Execute after html')<\/script></span><script>equals(scriptorder++, 2, 'Script (unnested) is executed in order');equals($('#scriptorder').length, 1,'Execute after html')<\/script>");
+
+ setTimeout( start, 100 );
+});
+
+test("filter()", function() {
+ expect(6);
+ isSet( $("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
+ isSet( $("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
+ isSet( $("p").filter("#ap,#sndp").get(), q("ap", "sndp"), "filter('String,String')" );
+ isSet( $("p").filter(function() { return !$("a", this).length }).get(), q("sndp", "first"), "filter(Function)" );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ equals( j.filter("span").length, 1, "Check node,textnode,comment to filter the one span" );
+ equals( j.filter("[name]").length, 0, "Check node,textnode,comment to filter the one span" );
+});
+
+test("not()", function() {
+ expect(8);
+ equals( $("#main > p#ap > a").not("#google").length, 2, "not('selector')" );
+ equals( $("#main > p#ap > a").not(document.getElementById("google")).length, 2, "not(DOMElement)" );
+ isSet( $("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
+ isSet( $("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
+ isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" );
+ equals( $("p").not(document.getElementsByTagName("p")).length, 0, "not(Array-like DOM collection)" );
+ isSet( $("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')");
+
+ var selects = $("#form select");
+ isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element");
+});
+
+test("andSelf()", function() {
+ expect(4);
+ isSet( $("#en").siblings().andSelf().get(), q("sndp", "sap","en"), "Check for siblings and self" );
+ isSet( $("#foo").children().andSelf().get(), q("sndp", "en", "sap", "foo"), "Check for children and self" );
+ isSet( $("#en, #sndp").parent().andSelf().get(), q("foo","en","sndp"), "Check for parent and self" );
+ isSet( $("#groups").parents("p, div").andSelf().get(), q("ap", "main", "groups"), "Check for parents and self" );
+});
+
+test("siblings([String])", function() {
+ expect(5);
+ isSet( $("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
+ isSet( $("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
+ isSet( $("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
+ isSet( $("#foo").siblings("form, b").get(), q("form", "lengthtest", "testForm", "floatTest"), "Check for multiple filters" );
+ isSet( $("#en, #sndp").siblings().get(), q("sndp", "sap", "en"), "Check for unique results from siblings" );
+});
+
+test("children([String])", function() {
+ expect(3);
+ isSet( $("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" );
+ isSet( $("#foo").children(":has(code)").get(), q("sndp", "sap"), "Check for filtered children" );
+ isSet( $("#foo").children("#en, #sap").get(), q("en", "sap"), "Check for multiple filters" );
+});
+
+test("parent([String])", function() {
+ expect(5);
+ equals( $("#groups").parent()[0].id, "ap", "Simple parent check" );
+ equals( $("#groups").parent("p")[0].id, "ap", "Filtered parent check" );
+ equals( $("#groups").parent("div").length, 0, "Filtered parent check, no match" );
+ equals( $("#groups").parent("div, p")[0].id, "ap", "Check for multiple filters" );
+ isSet( $("#en, #sndp").parent().get(), q("foo"), "Check for unique results from parent" );
+});
+
+test("parents([String])", function() {
+ expect(5);
+ equals( $("#groups").parents()[0].id, "ap", "Simple parents check" );
+ equals( $("#groups").parents("p")[0].id, "ap", "Filtered parents check" );
+ equals( $("#groups").parents("div")[0].id, "main", "Filtered parents check2" );
+ isSet( $("#groups").parents("p, div").get(), q("ap", "main"), "Check for multiple filters" );
+ isSet( $("#en, #sndp").parents().get(), q("foo", "main", "dl", "body", "html"), "Check for unique results from parents" );
+});
+
+test("next([String])", function() {
+ expect(4);
+ equals( $("#ap").next()[0].id, "foo", "Simple next check" );
+ equals( $("#ap").next("div")[0].id, "foo", "Filtered next check" );
+ equals( $("#ap").next("p").length, 0, "Filtered next check, no match" );
+ equals( $("#ap").next("div, p")[0].id, "foo", "Multiple filters" );
+});
+
+test("prev([String])", function() {
+ expect(4);
+ equals( $("#foo").prev()[0].id, "ap", "Simple prev check" );
+ equals( $("#foo").prev("p")[0].id, "ap", "Filtered prev check" );
+ equals( $("#foo").prev("div").length, 0, "Filtered prev check, no match" );
+ equals( $("#foo").prev("p, div")[0].id, "ap", "Multiple filters" );
+});
+
+test("show()", function() {
+ expect(15);
+ var pass = true, div = $("div");
+ div.show().each(function(){
+ if ( this.style.display == "none" ) pass = false;
+ });
+ ok( pass, "Show" );
+
+ $("#main").append('<div id="show-tests"><div><p><a href="#"></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>');
+ var test = {
+ "div" : "block",
+ "p" : "block",
+ "a" : "inline",
+ "code" : "inline",
+ "pre" : "block",
+ "span" : "inline",
+ "table" : $.browser.msie ? "block" : "table",
+ "thead" : $.browser.msie ? "block" : "table-header-group",
+ "tbody" : $.browser.msie ? "block" : "table-row-group",
+ "tr" : $.browser.msie ? "block" : "table-row",
+ "th" : $.browser.msie ? "block" : "table-cell",
+ "td" : $.browser.msie ? "block" : "table-cell",
+ "ul" : "block",
+ "li" : $.browser.msie ? "block" : "list-item"
+ };
+
+ $.each(test, function(selector, expected) {
+ var elem = $(selector, "#show-tests").show();
+ equals( elem.css("display"), expected, "Show using correct display type for " + selector );
+ });
+});
+
+test("addClass(String)", function() {
+ expect(2);
+ var div = $("div");
+ div.addClass("test");
+ var pass = true;
+ for ( var i = 0; i < div.size(); i++ ) {
+ if ( div.get(i).className.indexOf("test") == -1 ) pass = false;
+ }
+ ok( pass, "Add Class" );
+
+ // using contents will get regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.addClass("asdf");
+ ok( j.hasClass("asdf"), "Check node,textnode,comment for addClass" );
+});
+
+test("removeClass(String) - simple", function() {
+ expect(4);
+ var div = $("div").addClass("test").removeClass("test"),
+ pass = true;
+ for ( var i = 0; i < div.size(); i++ ) {
+ if ( div.get(i).className.indexOf("test") != -1 ) pass = false;
+ }
+ ok( pass, "Remove Class" );
+
+ reset();
+ var div = $("div").addClass("test").addClass("foo").addClass("bar");
+ div.removeClass("test").removeClass("bar").removeClass("foo");
+ var pass = true;
+ for ( var i = 0; i < div.size(); i++ ) {
+ if ( div.get(i).className.match(/test|bar|foo/) ) pass = false;
+ }
+ ok( pass, "Remove multiple classes" );
+
+ reset();
+ var div = $("div:eq(0)").addClass("test").removeClass("");
+ ok( div.is('.test'), "Empty string passed to removeClass" );
+
+ // using contents will get regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.removeClass("asdf");
+ ok( !j.hasClass("asdf"), "Check node,textnode,comment for removeClass" );
+});
+
+test("toggleClass(String)", function() {
+ expect(3);
+ var e = $("#firstp");
+ ok( !e.is(".test"), "Assert class not present" );
+ e.toggleClass("test");
+ ok( e.is(".test"), "Assert class present" );
+ e.toggleClass("test");
+ ok( !e.is(".test"), "Assert class not present" );
+});
+
+test("removeAttr(String", function() {
+ expect(1);
+ equals( $('#mark').removeAttr("class")[0].className, "", "remove class" );
+});
+
+test("text(String)", function() {
+ expect(4);
+ equals( $("#foo").text("<div><b>Hello</b> cruel world!</div>")[0].innerHTML, "&lt;div&gt;&lt;b&gt;Hello&lt;/b&gt; cruel world!&lt;/div&gt;", "Check escaped text" );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.text("hi!");
+ equals( $(j[0]).text(), "hi!", "Check node,textnode,comment with text()" );
+ equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" );
+ equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );
+});
+
+test("$.each(Object,Function)", function() {
+ expect(12);
+ $.each( [0,1,2], function(i, n){
+ equals( i, n, "Check array iteration" );
+ });
+
+ $.each( [5,6,7], function(i, n){
+ equals( i, n - 5, "Check array iteration" );
+ });
+
+ $.each( { name: "name", lang: "lang" }, function(i, n){
+ equals( i, n, "Check object iteration" );
+ });
+
+ var total = 0;
+ jQuery.each([1,2,3], function(i,v){ total += v; });
+ equals( total, 6, "Looping over an array" );
+ total = 0;
+ jQuery.each([1,2,3], function(i,v){ total += v; if ( i == 1 ) return false; });
+ equals( total, 3, "Looping over an array, with break" );
+ total = 0;
+ jQuery.each({"a":1,"b":2,"c":3}, function(i,v){ total += v; });
+ equals( total, 6, "Looping over an object" );
+ total = 0;
+ jQuery.each({"a":3,"b":3,"c":3}, function(i,v){ total += v; return false; });
+ equals( total, 3, "Looping over an object, with break" );
+});
+
+test("$.prop", function() {
+ expect(2);
+ var handle = function() { return this.id };
+ equals( $.prop($("#ap")[0], handle), "ap", "Check with Function argument" );
+ equals( $.prop($("#ap")[0], "value"), "value", "Check with value argument" );
+});
+
+test("$.className", function() {
+ expect(6);
+ var x = $("<p>Hi</p>")[0];
+ var c = $.className;
+ c.add(x, "hi");
+ equals( x.className, "hi", "Check single added class" );
+ c.add(x, "foo bar");
+ equals( x.className, "hi foo bar", "Check more added classes" );
+ c.remove(x);
+ equals( x.className, "", "Remove all classes" );
+ c.add(x, "hi foo bar");
+ c.remove(x, "foo");
+ equals( x.className, "hi bar", "Check removal of one class" );
+ ok( c.has(x, "hi"), "Check has1" );
+ ok( c.has(x, "bar"), "Check has2" );
+});
+
+test("$.data", function() {
+ expect(5);
+ var div = $("#foo")[0];
+ equals( jQuery.data(div, "test"), undefined, "Check for no data exists" );
+ jQuery.data(div, "test", "success");
+ equals( jQuery.data(div, "test"), "success", "Check for added data" );
+ jQuery.data(div, "test", "overwritten");
+ equals( jQuery.data(div, "test"), "overwritten", "Check for overwritten data" );
+ jQuery.data(div, "test", undefined);
+ equals( jQuery.data(div, "test"), "overwritten", "Check that data wasn't removed");
+ jQuery.data(div, "test", null);
+ ok( jQuery.data(div, "test") === null, "Check for null data");
+});
+
+test(".data()", function() {
+ expect(18);
+ var div = $("#foo");
+ equals( div.data("test"), undefined, "Check for no data exists" );
+ div.data("test", "success");
+ equals( div.data("test"), "success", "Check for added data" );
+ div.data("test", "overwritten");
+ equals( div.data("test"), "overwritten", "Check for overwritten data" );
+ div.data("test", undefined);
+ equals( div.data("test"), "overwritten", "Check that data wasn't removed");
+ div.data("test", null);
+ ok( div.data("test") === null, "Check for null data");
+
+ div.data("test", "overwritten");
+ var hits = {test:0}, gets = {test:0};
+
+ div
+ .bind("setData",function(e,key,value){ hits[key] += value; })
+ .bind("setData.foo",function(e,key,value){ hits[key] += value; })
+ .bind("getData",function(e,key){ gets[key] += 1; })
+ .bind("getData.foo",function(e,key){ gets[key] += 3; });
+
+ div.data("test.foo", 2);
+ equals( div.data("test"), "overwritten", "Check for original data" );
+ equals( div.data("test.foo"), 2, "Check for namespaced data" );
+ equals( div.data("test.bar"), "overwritten", "Check for unmatched namespace" );
+ equals( hits.test, 2, "Check triggered setter functions" );
+ equals( gets.test, 5, "Check triggered getter functions" );
+
+ hits.test = 0;
+ gets.test = 0;
+
+ div.data("test", 1);
+ equals( div.data("test"), 1, "Check for original data" );
+ equals( div.data("test.foo"), 2, "Check for namespaced data" );
+ equals( div.data("test.bar"), 1, "Check for unmatched namespace" );
+ equals( hits.test, 1, "Check triggered setter functions" );
+ equals( gets.test, 5, "Check triggered getter functions" );
+
+ hits.test = 0;
+ gets.test = 0;
+
+ div
+ .bind("getData",function(e,key){ return key + "root"; })
+ .bind("getData.foo",function(e,key){ return key + "foo"; });
+
+ equals( div.data("test"), "testroot", "Check for original data" );
+ equals( div.data("test.foo"), "testfoo", "Check for namespaced data" );
+ equals( div.data("test.bar"), "testroot", "Check for unmatched namespace" );
+});
+
+test("$.removeData", function() {
+ expect(1);
+ var div = $("#foo")[0];
+ jQuery.data(div, "test", "testing");
+ jQuery.removeData(div, "test");
+ equals( jQuery.data(div, "test"), undefined, "Check removal of data" );
+});
+
+test(".removeData()", function() {
+ expect(6);
+ var div = $("#foo");
+ div.data("test", "testing");
+ div.removeData("test");
+ equals( div.data("test"), undefined, "Check removal of data" );
+
+ div.data("test", "testing");
+ div.data("test.foo", "testing2");
+ div.removeData("test.bar");
+ equals( div.data("test.foo"), "testing2", "Make sure data is intact" );
+ equals( div.data("test"), "testing", "Make sure data is intact" );
+
+ div.removeData("test");
+ equals( div.data("test.foo"), "testing2", "Make sure data is intact" );
+ equals( div.data("test"), undefined, "Make sure data is intact" );
+
+ div.removeData("test.foo");
+ equals( div.data("test.foo"), undefined, "Make sure data is intact" );
+});
+
+test("remove()", function() {
+ expect(6);
+ $("#ap").children().remove();
+ ok( $("#ap").text().length > 10, "Check text is not removed" );
+ equals( $("#ap").children().length, 0, "Check remove" );
+
+ reset();
+ $("#ap").children().remove("a");
+ ok( $("#ap").text().length > 10, "Check text is not removed" );
+ equals( $("#ap").children().length, 1, "Check filtered remove" );
+
+ // using contents will get comments regular, text, and comment nodes
+ equals( $("#nonnodes").contents().length, 3, "Check node,textnode,comment remove works" );
+ $("#nonnodes").contents().remove();
+ equals( $("#nonnodes").contents().length, 0, "Check node,textnode,comment remove works" );
+});
+
+test("empty()", function() {
+ expect(3);
+ equals( $("#ap").children().empty().text().length, 0, "Check text is removed" );
+ equals( $("#ap").children().length, 4, "Check elements are not removed" );
+
+ // using contents will get comments regular, text, and comment nodes
+ var j = $("#nonnodes").contents();
+ j.empty();
+ equals( j.html(), "", "Check node,textnode,comment empty works" );
+});
+
+test("slice()", function() {
+ expect(5);
+ isSet( $("#ap a").slice(1,2), q("groups"), "slice(1,2)" );
+ isSet( $("#ap a").slice(1), q("groups", "anchor1", "mark"), "slice(1)" );
+ isSet( $("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );
+ isSet( $("#ap a").slice(-1), q("mark"), "slice(-1)" );
+
+ isSet( $("#ap a").eq(1), q("groups"), "eq(1)" );
+});
+
+test("map()", function() {
+ expect(2);//expect(6);
+
+ isSet(
+ $("#ap").map(function(){
+ return $(this).find("a").get();
+ }),
+ q("google", "groups", "anchor1", "mark"),
+ "Array Map"
+ );
+
+ isSet(
+ $("#ap > a").map(function(){
+ return this.parentNode;
+ }),
+ q("ap","ap","ap"),
+ "Single Map"
+ );
+
+ return;//these haven't been accepted yet
+
+ //for #2616
+ var keys = $.map( {a:1,b:2}, function( v, k ){
+ return k;
+ }, [ ] );
+
+ equals( keys.join(""), "ab", "Map the keys from a hash to an array" );
+
+ var values = $.map( {a:1,b:2}, function( v, k ){
+ return v;
+ }, [ ] );
+
+ equals( values.join(""), "12", "Map the values from a hash to an array" );
+
+ var scripts = document.getElementsByTagName("script");
+ var mapped = $.map( scripts, function( v, k ){
+ return v;
+ }, {length:0} );
+
+ equals( mapped.length, scripts.length, "Map an array(-like) to a hash" );
+
+ var flat = $.map( Array(4), function( v, k ){
+ return k % 2 ? k : [k,k,k];//try mixing array and regular returns
+ });
+
+ equals( flat.join(""), "00012223", "try the new flatten technique(#2616)" );
+});
+
+test("contents()", function() {
+ expect(12);
+ equals( $("#ap").contents().length, 9, "Check element contents" );
+ ok( $("#iframe").contents()[0], "Check existance of IFrame document" );
+ var ibody = $("#loadediframe").contents()[0].body;
+ ok( ibody, "Check existance of IFrame body" );
+
+ equals( $("span", ibody).text(), "span text", "Find span in IFrame and check its text" );
+
+ $(ibody).append("<div>init text</div>");
+ equals( $("div", ibody).length, 2, "Check the original div and the new div are in IFrame" );
+
+ equals( $("div:last", ibody).text(), "init text", "Add text to div in IFrame" );
+
+ $("div:last", ibody).text("div text");
+ equals( $("div:last", ibody).text(), "div text", "Add text to div in IFrame" );
+
+ $("div:last", ibody).remove();
+ equals( $("div", ibody).length, 1, "Delete the div and check only one div left in IFrame" );
+
+ equals( $("div", ibody).text(), "span text", "Make sure the correct div is still left after deletion in IFrame" );
+
+ $("<table/>", ibody).append("<tr><td>cell</td></tr>").appendTo(ibody);
+ $("table", ibody).remove();
+ equals( $("div", ibody).length, 1, "Check for JS error on add and delete of a table in IFrame" );
+
+ // using contents will get comments regular, text, and comment nodes
+ var c = $("#nonnodes").contents().contents();
+ equals( c.length, 1, "Check node,textnode,comment contents is just one" );
+ equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
+});
+
+test("$.makeArray", function(){
+ expect(15);
+
+ equals( $.makeArray($('html>*'))[0].nodeName, "HEAD", "Pass makeArray a jQuery object" );
+
+ equals( $.makeArray(document.getElementsByName("PWD")).slice(0,1)[0].name, "PWD", "Pass makeArray a nodelist" );
+
+ equals( (function(){ return $.makeArray(arguments); })(1,2).join(""), "12", "Pass makeArray an arguments array" );
+
+ equals( $.makeArray([1,2,3]).join(""), "123", "Pass makeArray a real array" );
+
+ equals( $.makeArray().length, 0, "Pass nothing to makeArray and expect an empty array" );
+
+ equals( $.makeArray( 0 )[0], 0 , "Pass makeArray a number" );
+
+ equals( $.makeArray( "foo" )[0], "foo", "Pass makeArray a string" );
+
+ equals( $.makeArray( true )[0].constructor, Boolean, "Pass makeArray a boolean" );
+
+ equals( $.makeArray( document.createElement("div") )[0].nodeName, "DIV", "Pass makeArray a single node" );
+
+ equals( $.makeArray( {length:2, 0:"a", 1:"b"} ).join(""), "ab", "Pass makeArray an array like map (with length)" );
+
+ equals( $.makeArray( document.documentElement.childNodes ).slice(0,1)[0].nodeName, "HEAD", "Pass makeArray a childNodes array" );
+
+ //function, is tricky as it has length
+ equals( $.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" );
+ //window, also has length
+ equals( $.makeArray(window)[0], window, "Pass makeArray the window" );
+
+ equals( $.makeArray(/a/)[0].constructor, RegExp, "Pass makeArray a regex" );
+
+ ok( $.makeArray(document.getElementById('form')).length >= 13, "Pass makeArray a form (treat as elements)" );
+});
diff --git a/dom/tests/mochitest/ajax/jquery/test/unit/dimensions.js b/dom/tests/mochitest/ajax/jquery/test/unit/dimensions.js
new file mode 100644
index 0000000000..aac1655f51
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/dimensions.js
@@ -0,0 +1,86 @@
+module("dimensions");
+
+test("innerWidth()", function() {
+ expect(3);
+
+ var $div = $("#nothiddendiv");
+ // set styles
+ $div.css({
+ margin: 10,
+ border: "2px solid #fff",
+ width: 30
+ });
+
+ equals($div.innerWidth(), 30, "Test with margin and border");
+ $div.css("padding", "20px");
+ equals($div.innerWidth(), 70, "Test with margin, border and padding");
+ $div.hide();
+ equals($div.innerWidth(), 70, "Test hidden div");
+
+ // reset styles
+ $div.css({ display: "", border: "", padding: "", width: "", height: "" });
+});
+
+test("innerHeight()", function() {
+ expect(3);
+
+ var $div = $("#nothiddendiv");
+ // set styles
+ $div.css({
+ margin: 10,
+ border: "2px solid #fff",
+ height: 30
+ });
+
+ equals($div.innerHeight(), 30, "Test with margin and border");
+ $div.css("padding", "20px");
+ equals($div.innerHeight(), 70, "Test with margin, border and padding");
+ $div.hide();
+ equals($div.innerHeight(), 70, "Test hidden div");
+
+ // reset styles
+ $div.css({ display: "", border: "", padding: "", width: "", height: "" });
+});
+
+test("outerWidth()", function() {
+ expect(6);
+
+ var $div = $("#nothiddendiv");
+ $div.css("width", 30);
+
+ equals($div.outerWidth(), 30, "Test with only width set");
+ $div.css("padding", "20px");
+ equals($div.outerWidth(), 70, "Test with padding");
+ $div.css("border", "2px solid #fff");
+ equals($div.outerWidth(), 74, "Test with padding and border");
+ $div.css("margin", "10px");
+ equals($div.outerWidth(), 74, "Test with padding, border and margin without margin option");
+ $div.css("position", "absolute");
+ equals($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
+ $div.hide();
+ equals($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
+
+ // reset styles
+ $div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" });
+});
+
+test("outerHeight()", function() {
+ expect(6);
+
+ var $div = $("#nothiddendiv");
+ $div.css("height", 30);
+
+ equals($div.outerHeight(), 30, "Test with only width set");
+ $div.css("padding", "20px");
+ equals($div.outerHeight(), 70, "Test with padding");
+ $div.css("border", "2px solid #fff");
+ equals($div.outerHeight(), 74, "Test with padding and border");
+ $div.css("margin", "10px");
+ equals($div.outerHeight(), 74, "Test with padding, border and margin without margin option");
+ equals($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
+ $div.hide();
+ equals($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
+
+ // reset styles
+ $div.css({ display: "", border: "", padding: "", width: "", height: "" });
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/unit/event.js b/dom/tests/mochitest/ajax/jquery/test/unit/event.js
new file mode 100644
index 0000000000..c393f6d62a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/event.js
@@ -0,0 +1,348 @@
+module("event");
+
+test("bind(), with data", function() {
+ expect(3);
+ var handler = function(event) {
+ ok( event.data, "bind() with data, check passed data exists" );
+ equals( event.data.foo, "bar", "bind() with data, Check value of passed data" );
+ };
+ $("#firstp").bind("click", {foo: "bar"}, handler).click().unbind("click", handler);
+
+ ok( !jQuery.data($("#firstp")[0], "events"), "Event handler unbound when using data." );
+});
+
+test("bind(), with data, trigger with data", function() {
+ expect(4);
+ var handler = function(event, data) {
+ ok( event.data, "check passed data exists" );
+ equals( event.data.foo, "bar", "Check value of passed data" );
+ ok( data, "Check trigger data" );
+ equals( data.bar, "foo", "Check value of trigger data" );
+ };
+ $("#firstp").bind("click", {foo: "bar"}, handler).trigger("click", [{bar: "foo"}]).unbind("click", handler);
+});
+
+test("bind(), multiple events at once", function() {
+ expect(2);
+ var clickCounter = 0,
+ mouseoverCounter = 0;
+ var handler = function(event) {
+ if (event.type == "click")
+ clickCounter += 1;
+ else if (event.type == "mouseover")
+ mouseoverCounter += 1;
+ };
+ $("#firstp").bind("click mouseover", handler).trigger("click").trigger("mouseover");
+ equals( clickCounter, 1, "bind() with multiple events at once" );
+ equals( mouseoverCounter, 1, "bind() with multiple events at once" );
+});
+
+test("bind(), no data", function() {
+ expect(1);
+ var handler = function(event) {
+ ok ( !event.data, "Check that no data is added to the event object" );
+ };
+ $("#firstp").bind("click", handler).trigger("click");
+});
+
+test("bind(), iframes", function() {
+ // events don't work with iframes, see #939 - this test fails in IE because of contentDocument
+ // var doc = document.getElementById("iframe").contentDocument;
+ //
+ // doc.body.innerHTML = "<input type='text'/>";
+ //
+ // var input = doc.getElementsByTagName("input")[0];
+ //
+ // $(input).bind("click",function() {
+ // ok( true, "Binding to element inside iframe" );
+ // }).click();
+});
+
+test("bind(), trigger change on select", function() {
+ expect(3);
+ var counter = 0;
+ function selectOnChange(event) {
+ equals( event.data, counter++, "Event.data is not a global event object" );
+ };
+ $("#form select").each(function(i){
+ $(this).bind('change', i, selectOnChange);
+ }).trigger('change');
+});
+
+test("bind(), namespaced events, cloned events", function() {
+ expect(6);
+
+ $("#firstp").bind("custom.test",function(e){
+ ok(true, "Custom event triggered");
+ });
+
+ $("#firstp").bind("click",function(e){
+ ok(true, "Normal click triggered");
+ });
+
+ $("#firstp").bind("click.test",function(e){
+ ok(true, "Namespaced click triggered");
+ });
+
+ // Trigger both bound fn (2)
+ $("#firstp").trigger("click");
+
+ // Trigger one bound fn (1)
+ $("#firstp").trigger("click.test");
+
+ // Remove only the one fn
+ $("#firstp").unbind("click.test");
+
+ // Trigger the remaining fn (1)
+ $("#firstp").trigger("click");
+
+ // Remove the remaining fn
+ $("#firstp").unbind(".test");
+
+ // Trigger the remaining fn (0)
+ $("#firstp").trigger("custom");
+
+ // using contents will get comments regular, text, and comment nodes
+ $("#nonnodes").contents().bind("tester", function () {
+ equals(this.nodeType, 1, "Check node,textnode,comment bind just does real nodes" );
+ }).trigger("tester");
+
+ // Make sure events stick with appendTo'd elements (which are cloned) #2027
+ $("<a href='#fail' class='test'>test</a>").click(function(){ return false; }).appendTo("p");
+ ok( $("a.test:first").triggerHandler("click") === false, "Handler is bound to appendTo'd elements" );
+});
+
+test("trigger() shortcuts", function() {
+ expect(6);
+ $('<li><a href="#">Change location</a></li>').prependTo('#firstUL').find('a').bind('click', function() {
+ var close = $('spanx', this); // same with $(this).find('span');
+ equals( close.length, 0, "Context element does not exist, length must be zero" );
+ ok( !close[0], "Context element does not exist, direct access to element must return undefined" );
+ return false;
+ }).click();
+
+ $("#check1").click(function() {
+ ok( true, "click event handler for checkbox gets fired twice, see #815" );
+ }).click();
+
+ var counter = 0;
+ $('#firstp')[0].onclick = function(event) {
+ counter++;
+ };
+ $('#firstp').click();
+ equals( counter, 1, "Check that click, triggers onclick event handler also" );
+
+ var clickCounter = 0;
+ $('#simon1')[0].onclick = function(event) {
+ clickCounter++;
+ };
+ $('#simon1').click();
+ equals( clickCounter, 1, "Check that click, triggers onclick event handler on an a tag also" );
+
+ $('<img />').load(function(){
+ ok( true, "Trigger the load event, using the shortcut .load() (#2819)");
+ }).load();
+});
+
+test("unbind(event)", function() {
+ expect(8);
+ var el = $("#firstp");
+ el.click(function() {
+ ok( true, "Fake normal bind" );
+ });
+ el.click(function(event) {
+ el.unbind(event);
+ ok( true, "Fake onebind" );
+ });
+ el.click().click();
+
+ el.click(function() { return; });
+ el.unbind('click');
+ ok( !el[0].onclick, "Handler is removed" ); // Bug #964
+
+ el.click(function() { return; });
+ el.unbind('change',function(){ return; });
+ for (var ret in jQuery.data(el[0], "events")['click']) break;
+ ok( ret, "Extra handlers weren't accidentally removed." );
+
+ el.unbind('click');
+ ok( !jQuery.data(el[0], "events"), "Removed the events expando after all handlers are unbound." );
+
+ reset();
+ var clickCounter = (mouseoverCounter = 0);
+ var handler = function(event) {
+ if (event.type == "click")
+ clickCounter += 1;
+ else if (event.type == "mouseover")
+ mouseoverCounter += 1;
+ };
+ $("#firstp").bind("click mouseover", handler).unbind("click mouseover", handler).trigger("click").trigger("mouseover");
+ equals( clickCounter, 0, "unbind() with multiple events at once" );
+ equals( mouseoverCounter, 0, "unbind() with multiple events at once" );
+});
+
+test("trigger(event, [data], [fn])", function() {
+ expect(67);
+
+ var handler = function(event, a, b, c) {
+ equals( event.type, "click", "check passed data" );
+ equals( a, 1, "check passed data" );
+ equals( b, "2", "check passed data" );
+ equals( c, "abc", "check passed data" );
+ return "test";
+ };
+
+ var handler2 = function(a, b, c) {
+ equals( a, 1, "check passed data" );
+ equals( b, "2", "check passed data" );
+ equals( c, "abc", "check passed data" );
+ return false;
+ };
+
+ var handler3 = function(a, b, c, v) {
+ equals( a, 1, "check passed data" );
+ equals( b, "2", "check passed data" );
+ equals( c, "abc", "check passed data" );
+ equals( v, "test", "check current value" );
+ return "newVal";
+ };
+
+ var handler4 = function(a, b, c, v) {
+ equals( a, 1, "check passed data" );
+ equals( b, "2", "check passed data" );
+ equals( c, "abc", "check passed data" );
+ equals( v, "test", "check current value" );
+ };
+
+ // Simulate a "native" click
+ $("#firstp")[0].click = function(){
+ ok( true, "Native call was triggered" );
+ };
+
+ // Triggers handlrs and native
+ // Trigger 5
+ $("#firstp").bind("click", handler).trigger("click", [1, "2", "abc"]);
+
+ // Triggers handlers, native, and extra fn
+ // Triggers 9
+ $("#firstp").trigger("click", [1, "2", "abc"], handler4);
+
+ // Simulate a "native" click
+ $("#firstp")[0].click = function(){
+ ok( false, "Native call was triggered" );
+ };
+
+ // Triggers handlers, native, and extra fn
+ // Triggers 7
+ $("#firstp").trigger("click", [1, "2", "abc"], handler2);
+
+ // Trigger only the handlers (no native)
+ // Triggers 5
+ equals( $("#firstp").triggerHandler("click", [1, "2", "abc"]), "test", "Verify handler response" );
+
+ // Trigger only the handlers (no native) and extra fn
+ // Triggers 8
+ equals( $("#firstp").triggerHandler("click", [1, "2", "abc"], handler2), false, "Verify handler response" );
+
+ // Build fake click event to pass in
+ var eventObj = jQuery.event.fix({ type: "foo", target: document.body });
+
+ // Trigger only the handlers (no native), with external event obj
+ // Triggers 5
+ equals( $("#firstp").triggerHandler("click", [eventObj, 1, "2", "abc"]), "test", "Verify handler response" );
+
+ // Trigger only the handlers (no native) and extra fn, with external event obj
+ // Triggers 9
+ eventObj = jQuery.event.fix({ type: "foo", target: document.body });
+ equals( $("#firstp").triggerHandler("click", [eventObj, 1, "2", "abc"], handler), "test", "Verify handler response" );
+
+ var pass = true;
+ try {
+ $('input:first')
+ .hide()
+ .trigger('focus');
+ } catch(e) {
+ pass = false;
+ }
+ ok( pass, "Trigger focus on hidden element" );
+
+ // have the extra handler override the return
+ // Triggers 9
+ equals( $("#firstp").triggerHandler("click", [1, "2", "abc"], handler3), "newVal", "Verify triggerHandler return is overwritten by extra function" );
+
+ // have the extra handler leave the return value alone
+ // Triggers 9
+ equals( $("#firstp").triggerHandler("click", [1, "2", "abc"], handler4), "test", "Verify triggerHandler return is not overwritten by extra function" );
+});
+
+test("toggle(Function, Function, ...)", function() {
+ expect(11);
+
+ var count = 0,
+ fn1 = function(e) { count++; },
+ fn2 = function(e) { count--; },
+ preventDefault = function(e) { e.preventDefault() },
+ link = $('#mark');
+ link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click();
+ equals( count, 1, "Check for toggle(fn, fn)" );
+
+ $("#firstp").toggle(function () {
+ equals(arguments.length, 4, "toggle correctly passes through additional triggered arguments, see #1701" )
+ }, function() {}).trigger("click", [ 1, 2, 3 ]);
+
+ var first = 0;
+ $("#simon1").one("click", function() {
+ ok( true, "Execute event only once" );
+ $(this).toggle(function() {
+ equals( first++, 0, "toggle(Function,Function) assigned from within one('xxx'), see #1054" );
+ }, function() {
+ equals( first, 1, "toggle(Function,Function) assigned from within one('xxx'), see #1054" );
+ });
+ return false;
+ }).click().click().click();
+
+ var turn = 0;
+ var fns = [
+ function(){
+ turn = 1;
+ },
+ function(){
+ turn = 2;
+ },
+ function(){
+ turn = 3;
+ }
+ ];
+
+ var $div = $("<div>&nbsp;</div>").toggle( fns[0], fns[1], fns[2] );
+ $div.click();
+ equals( turn, 1, "Trying toggle with 3 functions, attempt 1 yields 1");
+ $div.click();
+ equals( turn, 2, "Trying toggle with 3 functions, attempt 2 yields 2");
+ $div.click();
+ equals( turn, 3, "Trying toggle with 3 functions, attempt 3 yields 3");
+ $div.click();
+ equals( turn, 1, "Trying toggle with 3 functions, attempt 4 yields 1");
+ $div.click();
+ equals( turn, 2, "Trying toggle with 3 functions, attempt 5 yields 2");
+
+ $div.unbind('click',fns[0]);
+ var data = $.data( $div[0], 'events' );
+ ok( !data, "Unbinding one function from toggle unbinds them all");
+});
+
+test("jQuery(function($) {})", function() {
+ stop();
+ jQuery(function($) {
+ equals(jQuery, $, "ready doesn't provide an event object, instead it provides a reference to the jQuery function, see http://docs.jquery.com/Events/ready#fn");
+ start();
+ });
+});
+
+test("event properties", function() {
+ stop();
+ $("#simon1").click(function(event) {
+ ok( event.timeStamp, "assert event.timeStamp is present" );
+ start();
+ }).click();
+});
diff --git a/dom/tests/mochitest/ajax/jquery/test/unit/fx.js b/dom/tests/mochitest/ajax/jquery/test/unit/fx.js
new file mode 100644
index 0000000000..77a54bf65c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/fx.js
@@ -0,0 +1,435 @@
+module("fx");
+
+test("animate(Hash, Object, Function)", function() {
+ expect(1);
+ stop();
+ var hash = {opacity: 'show'};
+ var hashCopy = $.extend({}, hash);
+ $('#foo').animate(hash, 0, function() {
+ equals( hash.opacity, hashCopy.opacity, 'Check if animate changed the hash parameter' );
+ start();
+ });
+});
+
+/* Commented out because of bug 450190
+test("animate option (queue === false)", function () {
+ expect(1);
+ stop();
+
+ var order = [];
+
+ var $foo = $("#foo");
+ $foo.animate({width:'100px'}, 200, function () {
+ // should finish after unqueued animation so second
+ order.push(2);
+ });
+ $foo.animate({fontSize:'2em'}, {queue:false, duration:10, complete:function () {
+ // short duration and out of queue so should finish first
+ order.push(1);
+ }});
+ $foo.animate({height:'100px'}, 10, function() {
+ // queued behind the first animation so should finish third
+ order.push(3);
+ isSet( order, [ 1, 2, 3], "Animations finished in the correct order" );
+ start();
+ });
+});
+*/
+
+test("queue() defaults to 'fx' type", function () {
+ expect(2);
+ stop();
+
+ var $foo = $("#foo");
+ $foo.queue("fx", [ "sample", "array" ]);
+ var arr = $foo.queue();
+ isSet(arr, [ "sample", "array" ], "queue() got an array set with type 'fx'");
+ $foo.queue([ "another", "one" ]);
+ var arr = $foo.queue("fx");
+ isSet(arr, [ "another", "one" ], "queue('fx') got an array set with no type");
+ // clean up after test
+ $foo.queue([]);
+
+ start();
+});
+
+test("stop()", function() {
+ expect(3);
+ stop();
+
+ var $foo = $("#nothiddendiv");
+ var w = 0;
+ $foo.hide().width(200).width();
+
+ $foo.animate({ width:'show' }, 1000);
+ setTimeout(function(){
+ var nw = $foo.width();
+ ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
+ $foo.stop();
+
+ nw = $foo.width();
+ ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px");
+ setTimeout(function(){
+ equals( nw, $foo.width(), "The animation didn't continue" );
+ start();
+ }, 100);
+ }, 100);
+});
+
+test("stop() - several in queue", function() {
+// Merge from jquery test 1.3.2
+ expect(2);
+ stop();
+
+ var $foo = $("#nothiddendiv");
+ var w = 0;
+ $foo.hide().width(200).width();
+
+ $foo.animate({ width:'show' }, 1000);
+ $foo.animate({ width:'hide' }, 1000);
+ $foo.animate({ width:'show' }, 1000);
+ setTimeout(function(){
+ // Unreliable. See bug 484994.
+ // equals( $foo.queue().length, 3, "All 3 still in the queue" );
+ var nw = $foo.width();
+ ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
+ $foo.stop();
+
+ nw = $foo.width();
+ ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px");
+ // Merged from 1.3.2, commented out for being flaky in 1.3.2 test suite
+ //equals( $foo.queue().length, 2, "The next animation continued" );
+ $foo.stop(true);
+ start();
+ }, 100);
+});
+
+test("stop(clearQueue)", function() {
+ expect(4);
+ stop();
+
+ var $foo = $("#nothiddendiv");
+ var w = 0;
+ $foo.hide().width(200).width();
+
+ $foo.animate({ width:'show' }, 1000);
+ $foo.animate({ width:'hide' }, 1000);
+ $foo.animate({ width:'show' }, 1000);
+ setTimeout(function(){
+ var nw = $foo.width();
+ ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
+ $foo.stop(true);
+
+ nw = $foo.width();
+ ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px");
+
+ equals( $foo.queue().length, 0, "The animation queue was cleared" );
+ setTimeout(function(){
+ equals( nw, $foo.width(), "The animation didn't continue" );
+ start();
+ }, 100);
+ }, 100);
+});
+
+test("stop(clearQueue, gotoEnd)", function() {
+ // Merge from 1.3.2 - this test marked as being flaky
+ expect(1);
+ stop();
+
+ var $foo = $("#nothiddendiv");
+ var w = 0;
+ $foo.hide().width(200).width();
+
+ $foo.animate({ width:'show' }, 1000);
+ $foo.animate({ width:'hide' }, 1000);
+ $foo.animate({ width:'show' }, 1000);
+ $foo.animate({ width:'hide' }, 1000);
+ setTimeout(function(){
+ var nw = $foo.width();
+ ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
+ $foo.stop(false, true);
+
+ nw = $foo.width();
+ // Merge from 1.3.2 - marked as flaky in that release
+ //equals( nw, 200, "Stop() reset the animation" );
+
+ setTimeout(function(){
+ // Merge from 1.3.2 - marked as flaky in that release
+ //equals( $foo.queue().length, 3, "The next animation continued" );
+ $foo.stop(true);
+ start();
+ }, 100);
+ }, 100);
+});
+
+test("toggle()", function() {
+ expect(3);
+ var x = $("#foo");
+ ok( x.is(":visible"), "is visible" );
+ x.toggle();
+ ok( x.is(":hidden"), "is hidden" );
+ x.toggle();
+ ok( x.is(":visible"), "is visible again" );
+});
+
+var visible = {
+ Normal: function(elem){},
+ "CSS Hidden": function(elem){
+ $(this).addClass("hidden");
+ },
+ "JS Hidden": function(elem){
+ $(this).hide();
+ }
+};
+
+var from = {
+ "CSS Auto": function(elem,prop){
+ $(elem).addClass("auto" + prop)
+ .text("This is a long string of text.");
+ return "";
+ },
+ "JS Auto": function(elem,prop){
+ $(elem).css(prop,"auto")
+ .text("This is a long string of text.");
+ return "";
+ },
+ "CSS 100": function(elem,prop){
+ $(elem).addClass("large" + prop);
+ return "";
+ },
+ "JS 100": function(elem,prop){
+ $(elem).css(prop,prop == "opacity" ? 1 : "100px");
+ return prop == "opacity" ? 1 : 100;
+ },
+ "CSS 50": function(elem,prop){
+ $(elem).addClass("med" + prop);
+ return "";
+ },
+ "JS 50": function(elem,prop){
+ $(elem).css(prop,prop == "opacity" ? 0.50 : "50px");
+ return prop == "opacity" ? 0.5 : 50;
+ },
+ "CSS 0": function(elem,prop){
+ $(elem).addClass("no" + prop);
+ return "";
+ },
+ "JS 0": function(elem,prop){
+ $(elem).css(prop,prop == "opacity" ? 0 : "0px");
+ return 0;
+ }
+};
+
+var to = {
+ "show": function(elem,prop){
+ $(elem).hide().addClass("wide"+prop);
+ return "show";
+ },
+ "hide": function(elem,prop){
+ $(elem).addClass("wide"+prop);
+ return "hide";
+ },
+ "100": function(elem,prop){
+ $(elem).addClass("wide"+prop);
+ return prop == "opacity" ? 1 : 100;
+ },
+ "50": function(elem,prop){
+ return prop == "opacity" ? 0.50 : 50;
+ },
+ "0": function(elem,prop){
+ $(elem).addClass("noback");
+ return 0;
+ }
+};
+
+function checkOverflowDisplay(){
+ var o = jQuery.css( this, "overflow" );
+
+ equals(o, "visible", "Overflow should be visible: " + o);
+ equals(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
+
+ start();
+}
+
+test("JS Overflow and Display", function() {
+ expect(2);
+ stop();
+ makeTest( "JS Overflow and Display" )
+ .addClass("widewidth")
+ .css({ overflow: "visible", display: "inline" })
+ .addClass("widewidth")
+ .text("Some sample text.")
+ .before("text before")
+ .after("text after")
+ .animate({ opacity: 0.5 }, "slow", checkOverflowDisplay);
+});
+
+test("CSS Overflow and Display", function() {
+ expect(2);
+ stop();
+ makeTest( "CSS Overflow and Display" )
+ .addClass("overflow inline")
+ .addClass("widewidth")
+ .text("Some sample text.")
+ .before("text before")
+ .after("text after")
+ .animate({ opacity: 0.5 }, "slow", checkOverflowDisplay);
+});
+
+jQuery.each( from, function(fn, f){
+ jQuery.each( to, function(tn, t){
+ test(fn + " to " + tn, function() {
+ var elem = makeTest( fn + " to " + tn );
+
+ var t_w = t( elem, "width" );
+ var f_w = f( elem, "width" );
+ var t_h = t( elem, "height" );
+ var f_h = f( elem, "height" );
+ var t_o = t( elem, "opacity" );
+ var f_o = f( elem, "opacity" );
+
+ var num = 0;
+
+ if ( t_h == "show" ) num++;
+ if ( t_w == "show" ) num++;
+ if ( t_w == "hide"||t_w == "show" ) num++;
+ if ( t_h == "hide"||t_h == "show" ) num++;
+ if ( t_o == "hide"||t_o == "show" ) num++;
+ if ( t_w == "hide" ) num++;
+ if ( t_o.constructor == Number ) num += 2;
+ if ( t_w.constructor == Number ) num += 2;
+ if ( t_h.constructor == Number ) num +=2;
+
+ expect(num);
+ stop();
+
+ var anim = { width: t_w, height: t_h, opacity: t_o };
+
+ elem.animate(anim, 50, function(){
+ if ( t_w == "show" )
+ equals( this.style.display, "block", "Showing, display should block: " + this.style.display);
+
+ if ( t_w == "hide"||t_w == "show" )
+ equals(this.style.width.indexOf(f_w), 0, "Width must be reset to " + f_w + ": " + this.style.width);
+
+ if ( t_h == "hide"||t_h == "show" )
+ equals(this.style.height.indexOf(f_h), 0, "Height must be reset to " + f_h + ": " + this.style.height);
+
+ var cur_o = jQuery.attr(this.style, "opacity");
+ if ( cur_o !== "" ) cur_o = parseFloat( cur_o );
+
+ if ( t_o == "hide"||t_o == "show" )
+ equals(cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o);
+
+ if ( t_w == "hide" )
+ equals(this.style.display, "none", "Hiding, display should be none: " + this.style.display);
+
+ if ( t_o.constructor == Number ) {
+ equals(cur_o, t_o, "Final opacity should be " + t_o + ": " + cur_o);
+
+ ok(jQuery.curCSS(this, "opacity") != "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o);
+ }
+
+ if ( t_w.constructor == Number ) {
+ equals(this.style.width, t_w + "px", "Final width should be " + t_w + ": " + this.style.width);
+
+ var cur_w = jQuery.css(this,"width");
+
+ ok(this.style.width != "" || cur_w == t_w, "Width should be explicitly set to " + t_w + ", is instead: " + cur_w);
+ }
+
+ if ( t_h.constructor == Number ) {
+ equals(this.style.height, t_h + "px", "Final height should be " + t_h + ": " + this.style.height);
+
+ var cur_h = jQuery.css(this,"height");
+
+ ok(this.style.height != "" || cur_h == t_h, "Height should be explicitly set to " + t_h + ", is instead: " + cur_w);
+ }
+
+ if ( t_h == "show" ) {
+ var old_h = jQuery.curCSS(this, "height");
+ $(elem).append("<br/>Some more text<br/>and some more...");
+ ok(old_h != jQuery.css(this, "height" ), "Make sure height is auto.");
+ }
+
+ start();
+ });
+ });
+ });
+});
+
+var check = ['opacity','height','width','display','overflow'];
+
+jQuery.fn.saveState = function(){
+ expect(check.length);
+ stop();
+ return this.each(function(){
+ var self = this;
+ self.save = {};
+ jQuery.each(check, function(i,c){
+ self.save[c] = jQuery.css(self,c);
+ });
+ });
+};
+
+function checkState(){
+ var self = this;
+ jQuery.each(this.save, function(c,v){
+ var cur = jQuery.css(self,c);
+ equals( v, cur, "Make sure that " + c + " is reset (Old: " + v + " Cur: " + cur + ")");
+ });
+ start();
+}
+
+// Chaining Tests
+test("Chain fadeOut fadeIn", function() {
+ $('#fadein div').saveState().fadeOut('fast').fadeIn('fast',checkState);
+});
+test("Chain fadeIn fadeOut", function() {
+ $('#fadeout div').saveState().fadeIn('fast').fadeOut('fast',checkState);
+});
+
+test("Chain hide show", function() {
+ $('#show div').saveState().hide('fast').show('fast',checkState);
+});
+test("Chain show hide", function() {
+ $('#hide div').saveState().show('fast').hide('fast',checkState);
+});
+
+test("Chain toggle in", function() {
+ $('#togglein div').saveState().toggle('fast').toggle('fast',checkState);
+});
+test("Chain toggle out", function() {
+ $('#toggleout div').saveState().toggle('fast').toggle('fast',checkState);
+});
+
+test("Chain slideDown slideUp", function() {
+ $('#slidedown div').saveState().slideDown('fast').slideUp('fast',checkState);
+});
+test("Chain slideUp slideDown", function() {
+ $('#slideup div').saveState().slideUp('fast').slideDown('fast',checkState);
+});
+
+test("Chain slideToggle in", function() {
+ $('#slidetogglein div').saveState().slideToggle('fast').slideToggle('fast',checkState);
+});
+test("Chain slideToggle out", function() {
+ $('#slidetoggleout div').saveState().slideToggle('fast').slideToggle('fast',checkState);
+});
+
+function makeTest( text ){
+ var elem = $("<div></div>")
+ .attr("id", "test" + makeTest.id++)
+ .addClass("box");
+
+ $("<h4></h4>")
+ .text( text )
+ .appendTo("#fx-tests")
+ .click(function(){
+ $(this).next().toggle();
+ })
+ .after( elem );
+
+ return elem;
+}
+
+makeTest.id = 1;
diff --git a/dom/tests/mochitest/ajax/jquery/test/unit/offset.js b/dom/tests/mochitest/ajax/jquery/test/unit/offset.js
new file mode 100644
index 0000000000..55c3c436a6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/offset.js
@@ -0,0 +1,164 @@
+module("offset");
+
+// opens a new window to run the tests against
+var testwin = function(name, fn) {
+ testwin[name] = load_offset_fixture(name);
+ var interval = setInterval(function() {
+ if (testwin[name] && testwin[name].$ && testwin[name].$.isReady) {
+ clearInterval(interval);
+ test(name, fn);
+ }
+ }, 0);
+
+ function load_offset_fixture(name) {
+ var win = window.open( "./data/offset/" + name + ".html?num"+parseInt(Math.random()*1000), name, 'left=0,top=0,width=500,height=500,toolbar=1,resizable=0' );
+ if ( !win ) {
+ alert("Please disable your popup blocker for the offset test suite");
+ throw "Please disable your popup blocker for the offset test suite";
+ }
+ return win;
+ }
+};
+
+testwin("absolute", function() {
+ var $w = testwin["absolute"].$;
+
+ equals( $w('#absolute-1').offset().top, 1, "$('#absolute-1').offset().top" );
+ equals( $w('#absolute-1').offset().left, 1, "$('#absolute-1').offset().left" );
+
+ equals( $w('#absolute-1-1').offset().top, 5, "$('#absolute-1-1').offset().top" );
+ equals( $w('#absolute-1-1').offset().left, 5, "$('#absolute-1-1').offset().left" );
+
+ equals( $w('#absolute-1-1-1').offset().top, 9, "$('#absolute-1-1-1').offset().top" );
+ equals( $w('#absolute-1-1-1').offset().left, 9, "$('#absolute-1-1-1').offset().left" );
+
+ equals( $w('#absolute-2').offset().top, 20, "$('#absolute-2').offset().top" );
+ equals( $w('#absolute-2').offset().left, 20, "$('#absolute-2').offset().left" );
+
+
+ equals( $w('#absolute-1').position().top, 0, "$('#absolute-1').position().top" );
+ equals( $w('#absolute-1').position().left, 0, "$('#absolute-1').position().left" );
+
+ equals( $w('#absolute-1-1').position().top, 1, "$('#absolute-1-1').position().top" );
+ equals( $w('#absolute-1-1').position().left, 1, "$('#absolute-1-1').position().left" );
+
+ equals( $w('#absolute-1-1-1').position().top, 1, "$('#absolute-1-1-1').position().top" );
+ equals( $w('#absolute-1-1-1').position().left, 1, "$('#absolute-1-1-1').position().left" );
+
+ equals( $w('#absolute-2').position().top, 19, "$('#absolute-2').position().top" );
+ equals( $w('#absolute-2').position().left, 19, "$('#absolute-2').position().left" );
+
+ testwin["absolute"].close();
+});
+
+testwin("relative", function() {
+ var $w = testwin["relative"].$;
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#relative-1').offset().top, $.browser.msie ? 6 : 7, "$('#relative-1').offset().top" );
+ equals( $w('#relative-1').offset().left, 7, "$('#relative-1').offset().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#relative-1-1').offset().top, $.browser.msie ? 13 : 15, "$('#relative-1-1').offset().top" );
+ equals( $w('#relative-1-1').offset().left, 15, "$('#relative-1-1').offset().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#relative-2').offset().top, $.browser.msie ? 141 : 142, "$('#relative-2').offset().top" );
+ equals( $w('#relative-2').offset().left, 27, "$('#relative-2').offset().left" );
+
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#relative-1').position().top, $.browser.msie ? 5 : 6, "$('#relative-1').position().top" );
+ equals( $w('#relative-1').position().left, 6, "$('#relative-1').position().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#relative-1-1').position().top, $.browser.msie ? 4 : 5, "$('#relative-1-1').position().top" );
+ equals( $w('#relative-1-1').position().left, 5, "$('#relative-1-1').position().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#relative-2').position().top, $.browser.msie ? 140 : 141, "$('#relative-2').position().top" );
+ equals( $w('#relative-2').position().left, 26, "$('#relative-2').position().left" );
+
+ testwin["relative"].close();
+});
+
+testwin("static", function() {
+ var $w = testwin["static"].$;
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-1').offset().top, $.browser.msie ? 6 : 7, "$('#static-1').offset().top" );
+ equals( $w('#static-1').offset().left, 7, "$('#static-1').offset().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-1-1').offset().top, $.browser.msie ? 13 : 15, "$('#static-1-1').offset().top" );
+ equals( $w('#static-1-1').offset().left, 15, "$('#static-1-1').offset().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-1-1-1').offset().top, $.browser.msie ? 20 : 23, "$('#static-1-1-1').offset().top" );
+ equals( $w('#static-1-1-1').offset().left, 23, "$('#static-1-1-1').offset().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-2').offset().top, $.browser.msie ? 121 : 122, "$('#static-2').offset().top" );
+ equals( $w('#static-2').offset().left, 7, "$('#static-2').offset().left" );
+
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-1').position().top, $.browser.msie ? 5 : 6, "$('#static-1').position().top" );
+ equals( $w('#static-1').position().left, 6, "$('#static-1').position().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-1-1').position().top, $.browser.msie ? 12 : 14, "$('#static-1-1').position().top" );
+ equals( $w('#static-1-1').position().left, 14, "$('#static-1-1').position().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-1-1-1').position().top, $.browser.msie ? 19 : 22, "$('#static-1-1-1').position().top" );
+ equals( $w('#static-1-1-1').position().left, 22, "$('#static-1-1-1').position().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#static-2').position().top, $.browser.msie ? 120 : 121, "$('#static-2').position().top" );
+ equals( $w('#static-2').position().left, 6, "$('#static-2').position().left" );
+
+ testwin["static"].close();
+});
+
+if ( !$.browser.msie || ($.browser.msie && parseInt($.browser.version) > 6) )
+ testwin("fixed", function() {
+ var $w = testwin["fixed"].$;
+
+ equals( $w('#fixed-1').offset().top, 1001, "$('#fixed-1').offset().top" );
+ equals( $w('#fixed-1').offset().left, $.browser.msie ? 994 : 1001, "$('#fixed-1').offset().left" );
+
+ equals( $w('#fixed-2').offset().top, 1021, "$('#fixed-2').offset().top" );
+ equals( $w('#fixed-2').offset().left, $.browser.msie ? 1014 : 1021, "$('#fixed-2').offset().left" );
+
+ testwin["fixed"].close();
+ });
+
+testwin("table", function() {
+ var $w = testwin["table"].$;
+
+ equals( $w('#table-1').offset().top, 6, "$('#table-1').offset().top" );
+ equals( $w('#table-1').offset().left, 6, "$('#table-1').offset().left" );
+
+ equals( $w('#th-1').offset().top, 10, "$('#table-1').offset().top" );
+ equals( $w('#th-1').offset().left, 10, "$('#table-1').offset().left" );
+
+ equals( $w('#th-2').offset().top, 10, "$('#table-1').offset().top" );
+ equals( $w('#th-2').offset().left, 116, "$('#table-1').offset().left" );
+
+ testwin["table"].close();
+});
+
+testwin("scroll", function() {
+ var $w = testwin["scroll"].$;
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#scroll-1').offset().top, $.browser.msie ? 6 : 7, "$('#scroll-1').offset().top" );
+ equals( $w('#scroll-1').offset().left, 7, "$('#scroll-1').offset().left" );
+
+ // IE is collapsing the top margin of 1px
+ equals( $w('#scroll-1-1').offset().top, $.browser.msie ? 9 : 11, "$('#scroll-1-1').offset().top" );
+ equals( $w('#scroll-1-1').offset().left, 11, "$('#scroll-1-1').offset().left" );
+
+ testwin["scroll"].close();
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/jquery/test/unit/selector.js b/dom/tests/mochitest/ajax/jquery/test/unit/selector.js
new file mode 100644
index 0000000000..07c4434d09
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/selector.js
@@ -0,0 +1,224 @@
+module("selector");
+
+test("element", function() {
+ expect(9);
+ ok( $("*").size() >= 30, "Select all" );
+ var all = $("*"), good = true;
+ for ( var i = 0; i < all.length; i++ )
+ if ( all[i].nodeType == 8 )
+ good = false;
+ ok( good, "Select all elements, no comment nodes" );
+ t( "Element Selector", "p", ["firstp","ap","sndp","en","sap","first"] );
+ t( "Element Selector", "body", ["body"] );
+ t( "Element Selector", "html", ["html"] );
+ t( "Parent Element", "div p", ["firstp","ap","sndp","en","sap","first"] );
+ equals( $("param", "#object1").length, 2, "Object/param as context" );
+
+ ok( $("#length").length, '&lt;input name="length"&gt; cannot be found under IE, see #945' );
+ ok( $("#lengthtest input").length, '&lt;input name="length"&gt; cannot be found under IE, see #945' );
+});
+
+if ( location.protocol != "file:" ) {
+ test("Element Selector with underscore", function() {
+ expect(1);
+ stop();
+ $.get("data/with_fries.xml", function(xml) {
+ equals( $("foo_bar", xml).length, 1, "Element Selector with underscore" );
+ start();
+ });
+ });
+}
+
+test("broken", function() {
+ expect(7);
+ t( "Broken Selector", "[", [] );
+ t( "Broken Selector", "(", [] );
+ t( "Broken Selector", "{", [] );
+ t( "Broken Selector", "<", [] );
+ t( "Broken Selector", "()", [] );
+ t( "Broken Selector", "<>", [] );
+ t( "Broken Selector", "{}", [] );
+});
+
+test("id", function() {
+ expect(25);
+ t( "ID Selector", "#body", ["body"] );
+ t( "ID Selector w/ Element", "body#body", ["body"] );
+ t( "ID Selector w/ Element", "ul#first", [] );
+ t( "ID selector with existing ID descendant", "#firstp #simon1", ["simon1"] );
+ t( "ID selector with non-existant descendant", "#firstp #foobar", [] );
+ t( "ID selector using UTF8", "#台北Táiběi", ["台北Táiběi"] );
+ t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] );
+ t( "Descendant ID selector using UTF8", "div #台北", ["台北"] );
+ t( "Child ID selector using UTF8", "form > #台北", ["台北"] );
+
+ t( "Escaped ID", "#foo\\:bar", ["foo:bar"] );
+ t( "Escaped ID", "#test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+ t( "Descendant escaped ID", "div #foo\\:bar", ["foo:bar"] );
+ t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+ t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] );
+ t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+
+ t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267
+ t( "ID Selector, not an ancestor ID", "#form #first", [] );
+ t( "ID Selector, not a child ID", "#form > #option1a", [] );
+
+ t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
+ t( "All Children of ID with no children", "#firstUL/*", [] );
+
+ $('<a name="tName1">tName1 A</a><a name="tName2">tName2 A</a><div id="tName1">tName1 Div</div>').appendTo('#main');
+ equals( $("#tName1")[0].id, 'tName1', "ID selector with same value for a name attribute" );
+ equals( $("#tName2").length, 0, "ID selector non-existing but name attribute on an A tag" );
+ t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] );
+
+ t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
+
+ isSet( $("body").find("div#form"), [], "ID selector within the context of another element" );
+});
+
+test("class", function() {
+ expect(16);
+ t( "Class Selector", ".blog", ["mark","simon"] );
+ t( "Class Selector", ".blog.link", ["simon"] );
+ t( "Class Selector w/ Element", "a.blog", ["mark","simon"] );
+ t( "Parent Class Selector", "p .blog", ["mark","simon"] );
+
+ t( "Class selector using UTF8", ".台北Táiběi", ["utf8class1"] );
+ t( "Class selector using UTF8", ".台北", ["utf8class1","utf8class2"] );
+ t( "Class selector using UTF8", ".台北Táiběi.台北", ["utf8class1"] );
+ t( "Class selector using UTF8", ".台北Táiběi, .台北", ["utf8class1","utf8class2"] );
+ t( "Descendant class selector using UTF8", "div .台北Táiběi", ["utf8class1"] );
+ t( "Child class selector using UTF8", "form > .台北Táiběi", ["utf8class1"] );
+
+ t( "Escaped Class", ".foo\\:bar", ["foo:bar"] );
+ t( "Escaped Class", ".test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+ t( "Descendant scaped Class", "div .foo\\:bar", ["foo:bar"] );
+ t( "Descendant scaped Class", "div .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+ t( "Child escaped Class", "form > .foo\\:bar", ["foo:bar"] );
+ t( "Child escaped Class", "form > .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+});
+
+test("multiple", function() {
+ expect(4);
+ t( "Comma Support", "a.blog, p", ["mark","simon","firstp","ap","sndp","en","sap","first"] );
+ t( "Comma Support", "a.blog , p", ["mark","simon","firstp","ap","sndp","en","sap","first"] );
+ t( "Comma Support", "a.blog ,p", ["mark","simon","firstp","ap","sndp","en","sap","first"] );
+ t( "Comma Support", "a.blog,p", ["mark","simon","firstp","ap","sndp","en","sap","first"] );
+});
+
+test("child and adjacent", function() {
+ expect(37);
+ t( "Child", "p > a", ["simon1","google","groups","mark","yahoo","simon"] );
+ t( "Child", "p> a", ["simon1","google","groups","mark","yahoo","simon"] );
+ t( "Child", "p >a", ["simon1","google","groups","mark","yahoo","simon"] );
+ t( "Child", "p>a", ["simon1","google","groups","mark","yahoo","simon"] );
+ t( "Child w/ Class", "p > a.blog", ["mark","simon"] );
+ t( "All Children", "code > *", ["anchor1","anchor2"] );
+ t( "All Grandchildren", "p > * > *", ["anchor1","anchor2"] );
+ t( "Adjacent", "a + a", ["groups"] );
+ t( "Adjacent", "a +a", ["groups"] );
+ t( "Adjacent", "a+ a", ["groups"] );
+ t( "Adjacent", "a+a", ["groups"] );
+ t( "Adjacent", "p + p", ["ap","en","sap"] );
+ t( "Comma, Child, and Adjacent", "a + a, code > a", ["groups","anchor1","anchor2"] );
+
+ t( "First Child", "p:first-child", ["firstp","sndp"] );
+ t( "Nth Child", "p:nth-child(1)", ["firstp","sndp"] );
+
+ t( "Last Child", "p:last-child", ["sap"] );
+ t( "Last Child", "a:last-child", ["simon1","anchor1","mark","yahoo","anchor2","simon"] );
+
+ t( "Nth-child", "#main form#form > *:nth-child(2)", ["text2"] );
+ t( "Nth-child", "#main form#form > :nth-child(2)", ["text2"] );
+
+ t( "Nth-child", "#form select:first option:nth-child(3)", ["option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(0n+3)", ["option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(1n+0)", ["option1a", "option1b", "option1c", "option1d"] );
+ t( "Nth-child", "#form select:first option:nth-child(1n)", ["option1a", "option1b", "option1c", "option1d"] );
+ t( "Nth-child", "#form select:first option:nth-child(n)", ["option1a", "option1b", "option1c", "option1d"] );
+ t( "Nth-child", "#form select:first option:nth-child(even)", ["option1b", "option1d"] );
+ t( "Nth-child", "#form select:first option:nth-child(odd)", ["option1a", "option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(2n)", ["option1b", "option1d"] );
+ t( "Nth-child", "#form select:first option:nth-child(2n+1)", ["option1a", "option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n)", ["option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n+1)", ["option1a", "option1d"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n+2)", ["option1b"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n+3)", ["option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n-1)", ["option1b"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n-2)", ["option1a", "option1d"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n-3)", ["option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(3n+0)", ["option1c"] );
+ t( "Nth-child", "#form select:first option:nth-child(-n+3)", ["option1a", "option1b", "option1c"] );
+});
+
+test("attributes", function() {
+ expect(20);
+ t( "Attribute Exists", "a[title]", ["google"] );
+ t( "Attribute Exists", "*[title]", ["google"] );
+ t( "Attribute Exists", "[title]", ["google"] );
+
+ t( "Attribute Equals", "a[rel='bookmark']", ["simon1"] );
+ t( "Attribute Equals", 'a[rel="bookmark"]', ["simon1"] );
+ t( "Attribute Equals", "a[rel=bookmark]", ["simon1"] );
+ t( "Multiple Attribute Equals", "#form input[type='hidden'],#form input[type='radio']", ["hidden1","radio1","radio2"] );
+ t( "Multiple Attribute Equals", "#form input[type=\"hidden\"],#form input[type='radio']", ["hidden1","radio1","radio2"] );
+ t( "Multiple Attribute Equals", "#form input[type=hidden],#form input[type=radio]", ["hidden1","radio1","radio2"] );
+
+ t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] );
+
+ t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
+ t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
+ t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
+
+ t("Select options via [selected]", "#select1 option[selected]", ["option1a"] );
+ t("Select options via [selected]", "#select2 option[selected]", ["option2d"] );
+ t("Select options via [selected]", "#select3 option[selected]", ["option3b", "option3c"] );
+
+ t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] );
+
+ t( ":not() Existing attribute", "#form select:not([multiple])", ["select1", "select2"]);
+ t( ":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3"]);
+ t( ":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3"]);
+});
+
+test("pseudo (:) selectors", function() {
+ expect(35);
+ t( "First Child", "p:first-child", ["firstp","sndp"] );
+ t( "Last Child", "p:last-child", ["sap"] );
+ t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2"] );
+ t( "Empty", "ul:empty", ["firstUL"] );
+ t( "Enabled UI Element", "#form input:enabled", ["text1","radio1","radio2","check1","check2","hidden1","hidden2","name"] );
+ t( "Disabled UI Element", "#form input:disabled", ["text2"] );
+ t( "Checked UI Element", "#form input:checked", ["radio2","check1"] );
+ t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c"] );
+ t( "Text Contains", "a:contains('Google')", ["google","groups"] );
+ t( "Text Contains", "a:contains('Google Groups')", ["groups"] );
+ t( "Element Preceded By", "p ~ div", ["foo","fx-queue","fx-tests", "moretests"] );
+ t( "Not", "a.blog:not(.link)", ["mark"] );
+ t( "Not - multiple", "#form option:not(:contains('Nothing'),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d"] );
+ t( "Not - complex", "#form option:not([id^='opt']:gt(0):nth-child(-n+3))", [ "option1a", "option1d", "option2d", "option3d"] );
+ t( "Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c"] );
+
+ t( "nth Element", "p:nth(1)", ["ap"] );
+ t( "First Element", "p:first", ["firstp"] );
+ t( "Last Element", "p:last", ["first"] );
+ t( "Even Elements", "p:even", ["firstp","sndp","sap"] );
+ t( "Odd Elements", "p:odd", ["ap","en","first"] );
+ t( "Position Equals", "p:eq(1)", ["ap"] );
+ t( "Position Greater Than", "p:gt(0)", ["ap","sndp","en","sap","first"] );
+ t( "Position Less Than", "p:lt(3)", ["firstp","ap","sndp"] );
+ t( "Is A Parent", "p:parent", ["firstp","ap","sndp","en","sap","first"] );
+ t( "Is Visible", "#form input:visible", ["text1","text2","radio1","radio2","check1","check2","name"] );
+ t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
+
+ t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "button", "area1", "select1", "select2", "select3"] );
+ t( "Form element :radio", "#form :radio", ["radio1", "radio2"] );
+ t( "Form element :checkbox", "#form :checkbox", ["check1", "check2"] );
+ t( "Form element :text", "#form :text", ["text1", "text2", "hidden2", "name"] );
+ t( "Form element :radio:checked", "#form :radio:checked", ["radio2"] );
+ t( "Form element :checkbox:checked", "#form :checkbox:checked", ["check1"] );
+ t( "Form element :checkbox:checked, :radio:checked", "#form :checkbox:checked, #form :radio:checked", ["check1", "radio2"] );
+
+ t( "Headers", ":header", ["header", "banner", "userAgent"] );
+ t( "Has Children - :has()", "p:has(a)", ["firstp","ap","en","sap"] );
+});
diff --git a/dom/tests/mochitest/ajax/jquery/test_jQuery.html b/dom/tests/mochitest/ajax/jquery/test_jQuery.html
new file mode 100644
index 0000000000..1a02d3523c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test_jQuery.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for jQuery</title>
+ <script src="/MochiKit/Base.js"></script>
+ <script src="/MochiKit/Async.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript">
+ // On Linux 64 Stylo Disabled, we observed a failure in the
+ // test 'stop() - several in queue' in fx.js with a low precision value.
+ // We specify a value that seems safe. The root cause of this issue is
+ // believed to be jQuery's use of new Date as a mechanism to advance animations.
+ SpecialPowers.pushPrefEnv({set:
+ [["privacy.reduceTimerPrecision", true],
+ ["privacy.resistFingerprinting.reduceTimerPrecision.microseconds", 2000]]});
+ </script>
+ <script type="text/javascript" src="../lib/AJAX_setup.js"></script>
+ <link rel="stylesheet" type="text/css" href="../lib/test.css" />
+</head>
+<body>
+ <iframe width="100%" height="500" id="testframe" src=""></iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/ajax/jquery/version.txt b/dom/tests/mochitest/ajax/jquery/version.txt
new file mode 100644
index 0000000000..3c43790f5d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/version.txt
@@ -0,0 +1 @@
+1.2.6
diff --git a/dom/tests/mochitest/ajax/lib/AJAX_setup.js b/dom/tests/mochitest/ajax/lib/AJAX_setup.js
new file mode 100644
index 0000000000..e94531db06
--- /dev/null
+++ b/dom/tests/mochitest/ajax/lib/AJAX_setup.js
@@ -0,0 +1,35 @@
+var AJAXtests = [];
+
+function runAJAXTest() {
+ if (AJAXtests.length == 0) {
+ SimpleTest.finish();
+ return;
+ }
+
+ var test = AJAXtests.shift();
+ var testframe = document.getElementById("testframe");
+ testframe.src = test;
+}
+
+function onManifestLoad(manifest) {
+ if (manifest.testcases) {
+ AJAXtests = manifest.testcases;
+ runAJAXTest();
+ } else {
+ ok(false, "manifest check", "no manifest!?!");
+ SimpleTest.finish();
+ }
+}
+
+function fetchManifest() {
+ var d = loadJSONDoc("manifest.json");
+ d.addBoth(onManifestLoad);
+}
+
+// Double timeout duration. Since this test case takes longer than 300 seconds
+// on B2G emulator.
+// See bug 968783.
+SimpleTest.requestLongerTimeout(2);
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(fetchManifest);
diff --git a/dom/tests/mochitest/ajax/lib/test.css b/dom/tests/mochitest/ajax/lib/test.css
new file mode 100644
index 0000000000..38a401402f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/lib/test.css
@@ -0,0 +1,28 @@
+.test_ok {
+ color: green;
+ display: none;
+}
+.test_not_ok {
+ color: red;
+ display: block;
+}
+
+.test_ok, .test_not_ok {
+ border-bottom-width: 2px;
+ border-bottom-style: solid;
+ border-bottom-color: black;
+}
+
+.all_pass {
+ background-color: lime;
+}
+
+.some_fail {
+ background-color: red;
+}
+
+.tests_report {
+ border-width: 2px;
+ border-style: solid;
+ width: 20em;
+}
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Async.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Async.js
new file mode 100644
index 0000000000..55f4857b97
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Async.js
@@ -0,0 +1,699 @@
+/***
+
+MochiKit.Async 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide("MochiKit.Async");
+ dojo.require("MochiKit.Base");
+}
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Async depends on MochiKit.Base!";
+}
+
+if (typeof(MochiKit.Async) == 'undefined') {
+ MochiKit.Async = {};
+}
+
+MochiKit.Async.NAME = "MochiKit.Async";
+MochiKit.Async.VERSION = "1.4";
+MochiKit.Async.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+MochiKit.Async.toString = function () {
+ return this.__repr__();
+};
+
+/** @id MochiKit.Async.Deferred */
+MochiKit.Async.Deferred = function (/* optional */ canceller) {
+ this.chain = [];
+ this.id = this._nextId();
+ this.fired = -1;
+ this.paused = 0;
+ this.results = [null, null];
+ this.canceller = canceller;
+ this.silentlyCancelled = false;
+ this.chained = false;
+};
+
+MochiKit.Async.Deferred.prototype = {
+ /** @id MochiKit.Async.Deferred.prototype.repr */
+ repr: function () {
+ var state;
+ if (this.fired == -1) {
+ state = 'unfired';
+ } else if (this.fired === 0) {
+ state = 'success';
+ } else {
+ state = 'error';
+ }
+ return 'Deferred(' + this.id + ', ' + state + ')';
+ },
+
+ toString: MochiKit.Base.forwardCall("repr"),
+
+ _nextId: MochiKit.Base.counter(),
+
+ /** @id MochiKit.Async.Deferred.prototype.cancel */
+ cancel: function () {
+ var self = MochiKit.Async;
+ if (this.fired == -1) {
+ if (this.canceller) {
+ this.canceller(this);
+ } else {
+ this.silentlyCancelled = true;
+ }
+ if (this.fired == -1) {
+ this.errback(new self.CancelledError(this));
+ }
+ } else if ((this.fired === 0) && (this.results[0] instanceof self.Deferred)) {
+ this.results[0].cancel();
+ }
+ },
+
+ _resback: function (res) {
+ /***
+
+ The primitive that means either callback or errback
+
+ ***/
+ this.fired = ((res instanceof Error) ? 1 : 0);
+ this.results[this.fired] = res;
+ this._fire();
+ },
+
+ _check: function () {
+ if (this.fired != -1) {
+ if (!this.silentlyCancelled) {
+ throw new MochiKit.Async.AlreadyCalledError(this);
+ }
+ this.silentlyCancelled = false;
+ return;
+ }
+ },
+
+ /** @id MochiKit.Async.Deferred.prototype.callback */
+ callback: function (res) {
+ this._check();
+ if (res instanceof MochiKit.Async.Deferred) {
+ throw new Error("Deferred instances can only be chained if they are the result of a callback");
+ }
+ this._resback(res);
+ },
+
+ /** @id MochiKit.Async.Deferred.prototype.errback */
+ errback: function (res) {
+ this._check();
+ var self = MochiKit.Async;
+ if (res instanceof self.Deferred) {
+ throw new Error("Deferred instances can only be chained if they are the result of a callback");
+ }
+ if (!(res instanceof Error)) {
+ res = new self.GenericError(res);
+ }
+ this._resback(res);
+ },
+
+ /** @id MochiKit.Async.Deferred.prototype.addBoth */
+ addBoth: function (fn) {
+ if (arguments.length > 1) {
+ fn = MochiKit.Base.partial.apply(null, arguments);
+ }
+ return this.addCallbacks(fn, fn);
+ },
+
+ /** @id MochiKit.Async.Deferred.prototype.addCallback */
+ addCallback: function (fn) {
+ if (arguments.length > 1) {
+ fn = MochiKit.Base.partial.apply(null, arguments);
+ }
+ return this.addCallbacks(fn, null);
+ },
+
+ /** @id MochiKit.Async.Deferred.prototype.addErrback */
+ addErrback: function (fn) {
+ if (arguments.length > 1) {
+ fn = MochiKit.Base.partial.apply(null, arguments);
+ }
+ return this.addCallbacks(null, fn);
+ },
+
+ /** @id MochiKit.Async.Deferred.prototype.addCallbacks */
+ addCallbacks: function (cb, eb) {
+ if (this.chained) {
+ throw new Error("Chained Deferreds can not be re-used");
+ }
+ this.chain.push([cb, eb]);
+ if (this.fired >= 0) {
+ this._fire();
+ }
+ return this;
+ },
+
+ _fire: function () {
+ /***
+
+ Used internally to exhaust the callback sequence when a result
+ is available.
+
+ ***/
+ var chain = this.chain;
+ var fired = this.fired;
+ var res = this.results[fired];
+ var self = this;
+ var cb = null;
+ while (chain.length > 0 && this.paused === 0) {
+ // Array
+ var pair = chain.shift();
+ var f = pair[fired];
+ if (f === null) {
+ continue;
+ }
+ try {
+ res = f(res);
+ fired = ((res instanceof Error) ? 1 : 0);
+ if (res instanceof MochiKit.Async.Deferred) {
+ cb = function (res) {
+ self._resback(res);
+ self.paused--;
+ if ((self.paused === 0) && (self.fired >= 0)) {
+ self._fire();
+ }
+ };
+ this.paused++;
+ }
+ } catch (err) {
+ fired = 1;
+ if (!(err instanceof Error)) {
+ err = new MochiKit.Async.GenericError(err);
+ }
+ res = err;
+ }
+ }
+ this.fired = fired;
+ this.results[fired] = res;
+ if (cb && this.paused) {
+ // this is for "tail recursion" in case the dependent deferred
+ // is already fired
+ res.addBoth(cb);
+ res.chained = true;
+ }
+ }
+};
+
+MochiKit.Base.update(MochiKit.Async, {
+ /** @id MochiKit.Async.evalJSONRequest */
+ evalJSONRequest: function (req) {
+ return MochiKit.Base.evalJSON(req.responseText);
+ },
+
+ /** @id MochiKit.Async.succeed */
+ succeed: function (/* optional */result) {
+ var d = new MochiKit.Async.Deferred();
+ d.callback.apply(d, arguments);
+ return d;
+ },
+
+ /** @id MochiKit.Async.fail */
+ fail: function (/* optional */result) {
+ var d = new MochiKit.Async.Deferred();
+ d.errback.apply(d, arguments);
+ return d;
+ },
+
+ /** @id MochiKit.Async.getXMLHttpRequest */
+ getXMLHttpRequest: function () {
+ var self = arguments.callee;
+ if (!self.XMLHttpRequest) {
+ var tryThese = [
+ function () { return new XMLHttpRequest(); },
+ function () { return new ActiveXObject('Msxml2.XMLHTTP'); },
+ function () { return new ActiveXObject('Microsoft.XMLHTTP'); },
+ function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); },
+ function () {
+ throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest");
+ }
+ ];
+ for (var i = 0; i < tryThese.length; i++) {
+ var func = tryThese[i];
+ try {
+ self.XMLHttpRequest = func;
+ return func();
+ } catch (e) {
+ // pass
+ }
+ }
+ }
+ return self.XMLHttpRequest();
+ },
+
+ _xhr_onreadystatechange: function (d) {
+ // MochiKit.Logging.logDebug('this.readyState', this.readyState);
+ var m = MochiKit.Base;
+ if (this.readyState == 4) {
+ // IE SUCKS
+ try {
+ this.onreadystatechange = null;
+ } catch (e) {
+ try {
+ this.onreadystatechange = m.noop;
+ } catch (e) {
+ }
+ }
+ var status = null;
+ try {
+ status = this.status;
+ if (!status && m.isNotEmpty(this.responseText)) {
+ // 0 or undefined seems to mean cached or local
+ status = 304;
+ }
+ } catch (e) {
+ // pass
+ // MochiKit.Logging.logDebug('error getting status?', repr(items(e)));
+ }
+ // 200 is OK, 201 is CREATED, 204 is NO CONTENT
+ // 304 is NOT MODIFIED, 1223 is apparently a bug in IE
+ if (status == 200 || status == 201 || status == 204 ||
+ status == 304 || status == 1223) {
+ d.callback(this);
+ } else {
+ var err = new MochiKit.Async.XMLHttpRequestError(this, "Request failed");
+ if (err.number) {
+ // XXX: This seems to happen on page change
+ d.errback(err);
+ } else {
+ // XXX: this seems to happen when the server is unreachable
+ d.errback(err);
+ }
+ }
+ }
+ },
+
+ _xhr_canceller: function (req) {
+ // IE SUCKS
+ try {
+ req.onreadystatechange = null;
+ } catch (e) {
+ try {
+ req.onreadystatechange = MochiKit.Base.noop;
+ } catch (e) {
+ }
+ }
+ req.abort();
+ },
+
+
+ /** @id MochiKit.Async.sendXMLHttpRequest */
+ sendXMLHttpRequest: function (req, /* optional */ sendContent) {
+ if (typeof(sendContent) == "undefined" || sendContent === null) {
+ sendContent = "";
+ }
+
+ var m = MochiKit.Base;
+ var self = MochiKit.Async;
+ var d = new self.Deferred(m.partial(self._xhr_canceller, req));
+
+ try {
+ req.onreadystatechange = m.bind(self._xhr_onreadystatechange,
+ req, d);
+ req.send(sendContent);
+ } catch (e) {
+ try {
+ req.onreadystatechange = null;
+ } catch (ignore) {
+ // pass
+ }
+ d.errback(e);
+ }
+
+ return d;
+
+ },
+
+ /** @id MochiKit.Async.doXHR */
+ doXHR: function (url, opts) {
+ /*
+ Work around a Firefox bug by dealing with XHR during
+ the next event loop iteration. Maybe it's this one:
+ https://bugzilla.mozilla.org/show_bug.cgi?id=249843
+ */
+ var self = MochiKit.Async;
+ return self.callLater(0, self._doXHR, url, opts);
+ },
+
+ _doXHR: function (url, opts) {
+ var m = MochiKit.Base;
+ opts = m.update({
+ method: 'GET',
+ sendContent: ''
+ /*
+ queryString: undefined,
+ username: undefined,
+ password: undefined,
+ headers: undefined,
+ mimeType: undefined
+ */
+ }, opts);
+ var self = MochiKit.Async;
+ var req = self.getXMLHttpRequest();
+ if (opts.queryString) {
+ var qs = m.queryString(opts.queryString);
+ if (qs) {
+ url += "?" + qs;
+ }
+ }
+ // Safari will send undefined:undefined, so we have to check.
+ // We can't use apply, since the function is native.
+ if ('username' in opts) {
+ req.open(opts.method, url, true, opts.username, opts.password);
+ } else {
+ req.open(opts.method, url, true);
+ }
+ if (req.overrideMimeType && opts.mimeType) {
+ req.overrideMimeType(opts.mimeType);
+ }
+ if (opts.headers) {
+ var headers = opts.headers;
+ if (!m.isArrayLike(headers)) {
+ headers = m.items(headers);
+ }
+ for (var i = 0; i < headers.length; i++) {
+ var header = headers[i];
+ var name = header[0];
+ var value = header[1];
+ req.setRequestHeader(name, value);
+ }
+ }
+ return self.sendXMLHttpRequest(req, opts.sendContent);
+ },
+
+ _buildURL: function (url/*, ...*/) {
+ if (arguments.length > 1) {
+ var m = MochiKit.Base;
+ var qs = m.queryString.apply(null, m.extend(null, arguments, 1));
+ if (qs) {
+ return url + "?" + qs;
+ }
+ }
+ return url;
+ },
+
+ /** @id MochiKit.Async.doSimpleXMLHttpRequest */
+ doSimpleXMLHttpRequest: function (url/*, ...*/) {
+ var self = MochiKit.Async;
+ url = self._buildURL.apply(self, arguments);
+ return self.doXHR(url);
+ },
+
+ /** @id MochiKit.Async.loadJSONDoc */
+ loadJSONDoc: function (url/*, ...*/) {
+ var self = MochiKit.Async;
+ url = self._buildURL.apply(self, arguments);
+ var d = self.doXHR(url, {
+ 'mimeType': 'text/plain',
+ 'headers': [['Accept', 'application/json']]
+ });
+ d = d.addCallback(self.evalJSONRequest);
+ return d;
+ },
+
+ /** @id MochiKit.Async.wait */
+ wait: function (seconds, /* optional */value) {
+ var d = new MochiKit.Async.Deferred();
+ var m = MochiKit.Base;
+ if (typeof(value) != 'undefined') {
+ d.addCallback(function () { return value; });
+ }
+ var timeout = setTimeout(
+ m.bind("callback", d),
+ Math.floor(seconds * 1000));
+ d.canceller = function () {
+ try {
+ clearTimeout(timeout);
+ } catch (e) {
+ // pass
+ }
+ };
+ return d;
+ },
+
+ /** @id MochiKit.Async.callLater */
+ callLater: function (seconds, func) {
+ var m = MochiKit.Base;
+ var pfunc = m.partial.apply(m, m.extend(null, arguments, 1));
+ return MochiKit.Async.wait(seconds).addCallback(
+ function (res) { return pfunc(); }
+ );
+ }
+});
+
+
+/** @id MochiKit.Async.DeferredLock */
+MochiKit.Async.DeferredLock = function () {
+ this.waiting = [];
+ this.locked = false;
+ this.id = this._nextId();
+};
+
+MochiKit.Async.DeferredLock.prototype = {
+ __class__: MochiKit.Async.DeferredLock,
+ /** @id MochiKit.Async.DeferredLock.prototype.acquire */
+ acquire: function () {
+ var d = new MochiKit.Async.Deferred();
+ if (this.locked) {
+ this.waiting.push(d);
+ } else {
+ this.locked = true;
+ d.callback(this);
+ }
+ return d;
+ },
+ /** @id MochiKit.Async.DeferredLock.prototype.release */
+ release: function () {
+ if (!this.locked) {
+ throw TypeError("Tried to release an unlocked DeferredLock");
+ }
+ this.locked = false;
+ if (this.waiting.length > 0) {
+ this.locked = true;
+ this.waiting.shift().callback(this);
+ }
+ },
+ _nextId: MochiKit.Base.counter(),
+ repr: function () {
+ var state;
+ if (this.locked) {
+ state = 'locked, ' + this.waiting.length + ' waiting';
+ } else {
+ state = 'unlocked';
+ }
+ return 'DeferredLock(' + this.id + ', ' + state + ')';
+ },
+ toString: MochiKit.Base.forwardCall("repr")
+
+};
+
+/** @id MochiKit.Async.DeferredList */
+MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) {
+
+ // call parent constructor
+ MochiKit.Async.Deferred.apply(this, [canceller]);
+
+ this.list = list;
+ var resultList = [];
+ this.resultList = resultList;
+
+ this.finishedCount = 0;
+ this.fireOnOneCallback = fireOnOneCallback;
+ this.fireOnOneErrback = fireOnOneErrback;
+ this.consumeErrors = consumeErrors;
+
+ var cb = MochiKit.Base.bind(this._cbDeferred, this);
+ for (var i = 0; i < list.length; i++) {
+ var d = list[i];
+ resultList.push(undefined);
+ d.addCallback(cb, i, true);
+ d.addErrback(cb, i, false);
+ }
+
+ if (list.length === 0 && !fireOnOneCallback) {
+ this.callback(this.resultList);
+ }
+
+};
+
+MochiKit.Async.DeferredList.prototype = new MochiKit.Async.Deferred();
+
+MochiKit.Async.DeferredList.prototype._cbDeferred = function (index, succeeded, result) {
+ this.resultList[index] = [succeeded, result];
+ this.finishedCount += 1;
+ if (this.fired == -1) {
+ if (succeeded && this.fireOnOneCallback) {
+ this.callback([index, result]);
+ } else if (!succeeded && this.fireOnOneErrback) {
+ this.errback(result);
+ } else if (this.finishedCount == this.list.length) {
+ this.callback(this.resultList);
+ }
+ }
+ if (!succeeded && this.consumeErrors) {
+ result = null;
+ }
+ return result;
+};
+
+/** @id MochiKit.Async.gatherResults */
+MochiKit.Async.gatherResults = function (deferredList) {
+ var d = new MochiKit.Async.DeferredList(deferredList, false, true, false);
+ d.addCallback(function (results) {
+ var ret = [];
+ for (var i = 0; i < results.length; i++) {
+ ret.push(results[i][1]);
+ }
+ return ret;
+ });
+ return d;
+};
+
+/** @id MochiKit.Async.maybeDeferred */
+MochiKit.Async.maybeDeferred = function (func) {
+ var self = MochiKit.Async;
+ var result;
+ try {
+ var r = func.apply(null, MochiKit.Base.extend([], arguments, 1));
+ if (r instanceof self.Deferred) {
+ result = r;
+ } else if (r instanceof Error) {
+ result = self.fail(r);
+ } else {
+ result = self.succeed(r);
+ }
+ } catch (e) {
+ result = self.fail(e);
+ }
+ return result;
+};
+
+
+MochiKit.Async.EXPORT = [
+ "AlreadyCalledError",
+ "CancelledError",
+ "BrowserComplianceError",
+ "GenericError",
+ "XMLHttpRequestError",
+ "Deferred",
+ "succeed",
+ "fail",
+ "getXMLHttpRequest",
+ "doSimpleXMLHttpRequest",
+ "loadJSONDoc",
+ "wait",
+ "callLater",
+ "sendXMLHttpRequest",
+ "DeferredLock",
+ "DeferredList",
+ "gatherResults",
+ "maybeDeferred",
+ "doXHR"
+];
+
+MochiKit.Async.EXPORT_OK = [
+ "evalJSONRequest"
+];
+
+MochiKit.Async.__new__ = function () {
+ var m = MochiKit.Base;
+ var ne = m.partial(m._newNamedError, this);
+
+ ne("AlreadyCalledError",
+ /** @id MochiKit.Async.AlreadyCalledError */
+ function (deferred) {
+ /***
+
+ Raised by the Deferred if callback or errback happens
+ after it was already fired.
+
+ ***/
+ this.deferred = deferred;
+ }
+ );
+
+ ne("CancelledError",
+ /** @id MochiKit.Async.CancelledError */
+ function (deferred) {
+ /***
+
+ Raised by the Deferred cancellation mechanism.
+
+ ***/
+ this.deferred = deferred;
+ }
+ );
+
+ ne("BrowserComplianceError",
+ /** @id MochiKit.Async.BrowserComplianceError */
+ function (msg) {
+ /***
+
+ Raised when the JavaScript runtime is not capable of performing
+ the given function. Technically, this should really never be
+ raised because a non-conforming JavaScript runtime probably
+ isn't going to support exceptions in the first place.
+
+ ***/
+ this.message = msg;
+ }
+ );
+
+ ne("GenericError",
+ /** @id MochiKit.Async.GenericError */
+ function (msg) {
+ this.message = msg;
+ }
+ );
+
+ ne("XMLHttpRequestError",
+ /** @id MochiKit.Async.XMLHttpRequestError */
+ function (req, msg) {
+ /***
+
+ Raised when an XMLHttpRequest does not complete for any reason.
+
+ ***/
+ this.req = req;
+ this.message = msg;
+ try {
+ // Strange but true that this can raise in some cases.
+ this.number = req.status;
+ } catch (e) {
+ // pass
+ }
+ }
+ );
+
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+
+};
+
+MochiKit.Async.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.Async);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Base.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Base.js
new file mode 100644
index 0000000000..ec1350e60d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Base.js
@@ -0,0 +1,1412 @@
+/***
+
+MochiKit.Base 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide("MochiKit.Base");
+}
+if (typeof(MochiKit) == 'undefined') {
+ MochiKit = {};
+}
+if (typeof(MochiKit.Base) == 'undefined') {
+ MochiKit.Base = {};
+}
+if (typeof(MochiKit.__export__) == "undefined") {
+ MochiKit.__export__ = (MochiKit.__compat__ ||
+ (typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined')
+ );
+}
+
+MochiKit.Base.VERSION = "1.4";
+MochiKit.Base.NAME = "MochiKit.Base";
+/** @id MochiKit.Base.update */
+MochiKit.Base.update = function (self, obj/*, ... */) {
+ if (self === null) {
+ self = {};
+ }
+ for (var i = 1; i < arguments.length; i++) {
+ var o = arguments[i];
+ if (typeof(o) != 'undefined' && o !== null) {
+ for (var k in o) {
+ self[k] = o[k];
+ }
+ }
+ }
+ return self;
+};
+
+MochiKit.Base.update(MochiKit.Base, {
+ __repr__: function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+ },
+
+ toString: function () {
+ return this.__repr__();
+ },
+
+ /** @id MochiKit.Base.camelize */
+ camelize: function (selector) {
+ /* from dojo.style.toCamelCase */
+ var arr = selector.split('-');
+ var cc = arr[0];
+ for (var i = 1; i < arr.length; i++) {
+ cc += arr[i].charAt(0).toUpperCase() + arr[i].substring(1);
+ }
+ return cc;
+ },
+
+ /** @id MochiKit.Base.counter */
+ counter: function (n/* = 1 */) {
+ if (arguments.length === 0) {
+ n = 1;
+ }
+ return function () {
+ return n++;
+ };
+ },
+
+ /** @id MochiKit.Base.clone */
+ clone: function (obj) {
+ var me = arguments.callee;
+ if (arguments.length == 1) {
+ me.prototype = obj;
+ return new me();
+ }
+ },
+
+ _flattenArray: function (res, lst) {
+ for (var i = 0; i < lst.length; i++) {
+ var o = lst[i];
+ if (o instanceof Array) {
+ arguments.callee(res, o);
+ } else {
+ res.push(o);
+ }
+ }
+ return res;
+ },
+
+ /** @id MochiKit.Base.flattenArray */
+ flattenArray: function (lst) {
+ return MochiKit.Base._flattenArray([], lst);
+ },
+
+ /** @id MochiKit.Base.flattenArguments */
+ flattenArguments: function (lst/* ...*/) {
+ var res = [];
+ var m = MochiKit.Base;
+ var args = m.extend(null, arguments);
+ while (args.length) {
+ var o = args.shift();
+ if (o && typeof(o) == "object" && typeof(o.length) == "number") {
+ for (var i = o.length - 1; i >= 0; i--) {
+ args.unshift(o[i]);
+ }
+ } else {
+ res.push(o);
+ }
+ }
+ return res;
+ },
+
+ /** @id MochiKit.Base.extend */
+ extend: function (self, obj, /* optional */skip) {
+ // Extend an array with an array-like object starting
+ // from the skip index
+ if (!skip) {
+ skip = 0;
+ }
+ if (obj) {
+ // allow iterable fall-through, but skip the full isArrayLike
+ // check for speed, this is called often.
+ var l = obj.length;
+ if (typeof(l) != 'number' /* !isArrayLike(obj) */) {
+ if (typeof(MochiKit.Iter) != "undefined") {
+ obj = MochiKit.Iter.list(obj);
+ l = obj.length;
+ } else {
+ throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
+ }
+ }
+ if (!self) {
+ self = [];
+ }
+ for (var i = skip; i < l; i++) {
+ self.push(obj[i]);
+ }
+ }
+ // This mutates, but it's convenient to return because
+ // it's often used like a constructor when turning some
+ // ghetto array-like to a real array
+ return self;
+ },
+
+
+ /** @id MochiKit.Base.updatetree */
+ updatetree: function (self, obj/*, ...*/) {
+ if (self === null) {
+ self = {};
+ }
+ for (var i = 1; i < arguments.length; i++) {
+ var o = arguments[i];
+ if (typeof(o) != 'undefined' && o !== null) {
+ for (var k in o) {
+ var v = o[k];
+ if (typeof(self[k]) == 'object' && typeof(v) == 'object') {
+ arguments.callee(self[k], v);
+ } else {
+ self[k] = v;
+ }
+ }
+ }
+ }
+ return self;
+ },
+
+ /** @id MochiKit.Base.setdefault */
+ setdefault: function (self, obj/*, ...*/) {
+ if (self === null) {
+ self = {};
+ }
+ for (var i = 1; i < arguments.length; i++) {
+ var o = arguments[i];
+ for (var k in o) {
+ if (!(k in self)) {
+ self[k] = o[k];
+ }
+ }
+ }
+ return self;
+ },
+
+ /** @id MochiKit.Base.keys */
+ keys: function (obj) {
+ var rval = [];
+ for (var prop in obj) {
+ rval.push(prop);
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Base.values */
+ values: function (obj) {
+ var rval = [];
+ for (var prop in obj) {
+ rval.push(obj[prop]);
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Base.items */
+ items: function (obj) {
+ var rval = [];
+ var e;
+ for (var prop in obj) {
+ var v;
+ try {
+ v = obj[prop];
+ } catch (e) {
+ continue;
+ }
+ rval.push([prop, v]);
+ }
+ return rval;
+ },
+
+
+ _newNamedError: function (module, name, func) {
+ func.prototype = new MochiKit.Base.NamedError(module.NAME + "." + name);
+ module[name] = func;
+ },
+
+
+ /** @id MochiKit.Base.operator */
+ operator: {
+ // unary logic operators
+ /** @id MochiKit.Base.truth */
+ truth: function (a) { return !!a; },
+ /** @id MochiKit.Base.lognot */
+ lognot: function (a) { return !a; },
+ /** @id MochiKit.Base.identity */
+ identity: function (a) { return a; },
+
+ // bitwise unary operators
+ /** @id MochiKit.Base.not */
+ not: function (a) { return ~a; },
+ /** @id MochiKit.Base.neg */
+ neg: function (a) { return -a; },
+
+ // binary operators
+ /** @id MochiKit.Base.add */
+ add: function (a, b) { return a + b; },
+ /** @id MochiKit.Base.sub */
+ sub: function (a, b) { return a - b; },
+ /** @id MochiKit.Base.div */
+ div: function (a, b) { return a / b; },
+ /** @id MochiKit.Base.mod */
+ mod: function (a, b) { return a % b; },
+ /** @id MochiKit.Base.mul */
+ mul: function (a, b) { return a * b; },
+
+ // bitwise binary operators
+ /** @id MochiKit.Base.and */
+ and: function (a, b) { return a & b; },
+ /** @id MochiKit.Base.or */
+ or: function (a, b) { return a | b; },
+ /** @id MochiKit.Base.xor */
+ xor: function (a, b) { return a ^ b; },
+ /** @id MochiKit.Base.lshift */
+ lshift: function (a, b) { return a << b; },
+ /** @id MochiKit.Base.rshift */
+ rshift: function (a, b) { return a >> b; },
+ /** @id MochiKit.Base.zrshift */
+ zrshift: function (a, b) { return a >>> b; },
+
+ // near-worthless built-in comparators
+ /** @id MochiKit.Base.eq */
+ eq: function (a, b) { return a == b; },
+ /** @id MochiKit.Base.ne */
+ ne: function (a, b) { return a != b; },
+ /** @id MochiKit.Base.gt */
+ gt: function (a, b) { return a > b; },
+ /** @id MochiKit.Base.ge */
+ ge: function (a, b) { return a >= b; },
+ /** @id MochiKit.Base.lt */
+ lt: function (a, b) { return a < b; },
+ /** @id MochiKit.Base.le */
+ le: function (a, b) { return a <= b; },
+
+ // strict built-in comparators
+ seq: function (a, b) { return a === b; },
+ sne: function (a, b) { return a !== b; },
+
+ // compare comparators
+ /** @id MochiKit.Base.ceq */
+ ceq: function (a, b) { return MochiKit.Base.compare(a, b) === 0; },
+ /** @id MochiKit.Base.cne */
+ cne: function (a, b) { return MochiKit.Base.compare(a, b) !== 0; },
+ /** @id MochiKit.Base.cgt */
+ cgt: function (a, b) { return MochiKit.Base.compare(a, b) == 1; },
+ /** @id MochiKit.Base.cge */
+ cge: function (a, b) { return MochiKit.Base.compare(a, b) != -1; },
+ /** @id MochiKit.Base.clt */
+ clt: function (a, b) { return MochiKit.Base.compare(a, b) == -1; },
+ /** @id MochiKit.Base.cle */
+ cle: function (a, b) { return MochiKit.Base.compare(a, b) != 1; },
+
+ // binary logical operators
+ /** @id MochiKit.Base.logand */
+ logand: function (a, b) { return a && b; },
+ /** @id MochiKit.Base.logor */
+ logor: function (a, b) { return a || b; },
+ /** @id MochiKit.Base.contains */
+ contains: function (a, b) { return b in a; }
+ },
+
+ /** @id MochiKit.Base.forwardCall */
+ forwardCall: function (func) {
+ return function () {
+ return this[func].apply(this, arguments);
+ };
+ },
+
+ /** @id MochiKit.Base.itemgetter */
+ itemgetter: function (func) {
+ return function (arg) {
+ return arg[func];
+ };
+ },
+
+ /** @id MochiKit.Base.typeMatcher */
+ typeMatcher: function (/* typ */) {
+ var types = {};
+ for (var i = 0; i < arguments.length; i++) {
+ var typ = arguments[i];
+ types[typ] = typ;
+ }
+ return function () {
+ for (var i = 0; i < arguments.length; i++) {
+ if (!(typeof(arguments[i]) in types)) {
+ return false;
+ }
+ }
+ return true;
+ };
+ },
+
+ /** @id MochiKit.Base.isNull */
+ isNull: function (/* ... */) {
+ for (var i = 0; i < arguments.length; i++) {
+ if (arguments[i] !== null) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /** @id MochiKit.Base.isUndefinedOrNull */
+ isUndefinedOrNull: function (/* ... */) {
+ for (var i = 0; i < arguments.length; i++) {
+ var o = arguments[i];
+ if (!(typeof(o) == 'undefined' || o === null)) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /** @id MochiKit.Base.isEmpty */
+ isEmpty: function (obj) {
+ return !MochiKit.Base.isNotEmpty.apply(this, arguments);
+ },
+
+ /** @id MochiKit.Base.isNotEmpty */
+ isNotEmpty: function (obj) {
+ for (var i = 0; i < arguments.length; i++) {
+ var o = arguments[i];
+ if (!(o && o.length)) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /** @id MochiKit.Base.isArrayLike */
+ isArrayLike: function () {
+ for (var i = 0; i < arguments.length; i++) {
+ var o = arguments[i];
+ var typ = typeof(o);
+ if (
+ (typ != 'object' && !(typ == 'function' && typeof(o.item) == 'function')) ||
+ o === null ||
+ typeof(o.length) != 'number' ||
+ o.nodeType === 3
+ ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /** @id MochiKit.Base.isDateLike */
+ isDateLike: function () {
+ for (var i = 0; i < arguments.length; i++) {
+ var o = arguments[i];
+ if (typeof(o) != "object" || o === null
+ || typeof(o.getTime) != 'function') {
+ return false;
+ }
+ }
+ return true;
+ },
+
+
+ /** @id MochiKit.Base.xmap */
+ xmap: function (fn/*, obj... */) {
+ if (fn === null) {
+ return MochiKit.Base.extend(null, arguments, 1);
+ }
+ var rval = [];
+ for (var i = 1; i < arguments.length; i++) {
+ rval.push(fn(arguments[i]));
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Base.map */
+ map: function (fn, lst/*, lst... */) {
+ var m = MochiKit.Base;
+ var itr = MochiKit.Iter;
+ var isArrayLike = m.isArrayLike;
+ if (arguments.length <= 2) {
+ // allow an iterable to be passed
+ if (!isArrayLike(lst)) {
+ if (itr) {
+ // fast path for map(null, iterable)
+ lst = itr.list(lst);
+ if (fn === null) {
+ return lst;
+ }
+ } else {
+ throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
+ }
+ }
+ // fast path for map(null, lst)
+ if (fn === null) {
+ return m.extend(null, lst);
+ }
+ // disabled fast path for map(fn, lst)
+ /*
+ if (false && typeof(Array.prototype.map) == 'function') {
+ // Mozilla fast-path
+ return Array.prototype.map.call(lst, fn);
+ }
+ */
+ var rval = [];
+ for (var i = 0; i < lst.length; i++) {
+ rval.push(fn(lst[i]));
+ }
+ return rval;
+ } else {
+ // default for map(null, ...) is zip(...)
+ if (fn === null) {
+ fn = Array;
+ }
+ var length = null;
+ for (i = 1; i < arguments.length; i++) {
+ // allow iterables to be passed
+ if (!isArrayLike(arguments[i])) {
+ if (itr) {
+ return itr.list(itr.imap.apply(null, arguments));
+ } else {
+ throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
+ }
+ }
+ // find the minimum length
+ var l = arguments[i].length;
+ if (length === null || length > l) {
+ length = l;
+ }
+ }
+ rval = [];
+ for (i = 0; i < length; i++) {
+ var args = [];
+ for (var j = 1; j < arguments.length; j++) {
+ args.push(arguments[j][i]);
+ }
+ rval.push(fn.apply(this, args));
+ }
+ return rval;
+ }
+ },
+
+ /** @id MochiKit.Base.xfilter */
+ xfilter: function (fn/*, obj... */) {
+ var rval = [];
+ if (fn === null) {
+ fn = MochiKit.Base.operator.truth;
+ }
+ for (var i = 1; i < arguments.length; i++) {
+ var o = arguments[i];
+ if (fn(o)) {
+ rval.push(o);
+ }
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Base.filter */
+ filter: function (fn, lst, self) {
+ var rval = [];
+ // allow an iterable to be passed
+ var m = MochiKit.Base;
+ if (!m.isArrayLike(lst)) {
+ if (MochiKit.Iter) {
+ lst = MochiKit.Iter.list(lst);
+ } else {
+ throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
+ }
+ }
+ if (fn === null) {
+ fn = m.operator.truth;
+ }
+ if (typeof(Array.prototype.filter) == 'function') {
+ // Mozilla fast-path
+ return Array.prototype.filter.call(lst, fn, self);
+ } else if (typeof(self) == 'undefined' || self === null) {
+ for (var i = 0; i < lst.length; i++) {
+ var o = lst[i];
+ if (fn(o)) {
+ rval.push(o);
+ }
+ }
+ } else {
+ for (i = 0; i < lst.length; i++) {
+ o = lst[i];
+ if (fn.call(self, o)) {
+ rval.push(o);
+ }
+ }
+ }
+ return rval;
+ },
+
+
+ _wrapDumbFunction: function (func) {
+ return function () {
+ // fast path!
+ switch (arguments.length) {
+ case 0: return func();
+ case 1: return func(arguments[0]);
+ case 2: return func(arguments[0], arguments[1]);
+ case 3: return func(arguments[0], arguments[1], arguments[2]);
+ }
+ var args = [];
+ for (var i = 0; i < arguments.length; i++) {
+ args.push("arguments[" + i + "]");
+ }
+ return eval("(func(" + args.join(",") + "))");
+ };
+ },
+
+ /** @id MochiKit.Base.methodcaller */
+ methodcaller: function (func/*, args... */) {
+ var args = MochiKit.Base.extend(null, arguments, 1);
+ if (typeof(func) == "function") {
+ return function (obj) {
+ return func.apply(obj, args);
+ };
+ } else {
+ return function (obj) {
+ return obj[func].apply(obj, args);
+ };
+ }
+ },
+
+ /** @id MochiKit.Base.method */
+ method: function (self, func) {
+ var m = MochiKit.Base;
+ return m.bind.apply(this, m.extend([func, self], arguments, 2));
+ },
+
+ /** @id MochiKit.Base.compose */
+ compose: function (f1, f2/*, f3, ... fN */) {
+ var fnlist = [];
+ var m = MochiKit.Base;
+ if (arguments.length === 0) {
+ throw new TypeError("compose() requires at least one argument");
+ }
+ for (var i = 0; i < arguments.length; i++) {
+ var fn = arguments[i];
+ if (typeof(fn) != "function") {
+ throw new TypeError(m.repr(fn) + " is not a function");
+ }
+ fnlist.push(fn);
+ }
+ return function () {
+ var args = arguments;
+ for (var i = fnlist.length - 1; i >= 0; i--) {
+ args = [fnlist[i].apply(this, args)];
+ }
+ return args[0];
+ };
+ },
+
+ /** @id MochiKit.Base.bind */
+ bind: function (func, self/* args... */) {
+ if (typeof(func) == "string") {
+ func = self[func];
+ }
+ var im_func = func.im_func;
+ var im_preargs = func.im_preargs;
+ var im_self = func.im_self;
+ var m = MochiKit.Base;
+ if (typeof(func) == "function" && typeof(func.apply) == "undefined") {
+ // this is for cases where JavaScript sucks ass and gives you a
+ // really dumb built-in function like alert() that doesn't have
+ // an apply
+ func = m._wrapDumbFunction(func);
+ }
+ if (typeof(im_func) != 'function') {
+ im_func = func;
+ }
+ if (typeof(self) != 'undefined') {
+ im_self = self;
+ }
+ if (typeof(im_preargs) == 'undefined') {
+ im_preargs = [];
+ } else {
+ im_preargs = im_preargs.slice();
+ }
+ m.extend(im_preargs, arguments, 2);
+ var newfunc = function () {
+ var args = arguments;
+ var me = arguments.callee;
+ if (me.im_preargs.length > 0) {
+ args = m.concat(me.im_preargs, args);
+ }
+ var self = me.im_self;
+ if (!self) {
+ self = this;
+ }
+ return me.im_func.apply(self, args);
+ };
+ newfunc.im_self = im_self;
+ newfunc.im_func = im_func;
+ newfunc.im_preargs = im_preargs;
+ return newfunc;
+ },
+
+ /** @id MochiKit.Base.bindMethods */
+ bindMethods: function (self) {
+ var bind = MochiKit.Base.bind;
+ for (var k in self) {
+ var func = self[k];
+ if (typeof(func) == 'function') {
+ self[k] = bind(func, self);
+ }
+ }
+ },
+
+ /** @id MochiKit.Base.registerComparator */
+ registerComparator: function (name, check, comparator, /* optional */ override) {
+ MochiKit.Base.comparatorRegistry.register(name, check, comparator, override);
+ },
+
+ _primitives: {'boolean': true, 'string': true, 'number': true},
+
+ /** @id MochiKit.Base.compare */
+ compare: function (a, b) {
+ if (a == b) {
+ return 0;
+ }
+ var aIsNull = (typeof(a) == 'undefined' || a === null);
+ var bIsNull = (typeof(b) == 'undefined' || b === null);
+ if (aIsNull && bIsNull) {
+ return 0;
+ } else if (aIsNull) {
+ return -1;
+ } else if (bIsNull) {
+ return 1;
+ }
+ var m = MochiKit.Base;
+ // bool, number, string have meaningful comparisons
+ var prim = m._primitives;
+ if (!(typeof(a) in prim && typeof(b) in prim)) {
+ try {
+ return m.comparatorRegistry.match(a, b);
+ } catch (e) {
+ if (e != m.NotFound) {
+ throw e;
+ }
+ }
+ }
+ if (a < b) {
+ return -1;
+ } else if (a > b) {
+ return 1;
+ }
+ // These types can't be compared
+ var repr = m.repr;
+ throw new TypeError(repr(a) + " and " + repr(b) + " can not be compared");
+ },
+
+ /** @id MochiKit.Base.compareDateLike */
+ compareDateLike: function (a, b) {
+ return MochiKit.Base.compare(a.getTime(), b.getTime());
+ },
+
+ /** @id MochiKit.Base.compareArrayLike */
+ compareArrayLike: function (a, b) {
+ var compare = MochiKit.Base.compare;
+ var count = a.length;
+ var rval = 0;
+ if (count > b.length) {
+ rval = 1;
+ count = b.length;
+ } else if (count < b.length) {
+ rval = -1;
+ }
+ for (var i = 0; i < count; i++) {
+ var cmp = compare(a[i], b[i]);
+ if (cmp) {
+ return cmp;
+ }
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Base.registerRepr */
+ registerRepr: function (name, check, wrap, /* optional */override) {
+ MochiKit.Base.reprRegistry.register(name, check, wrap, override);
+ },
+
+ /** @id MochiKit.Base.repr */
+ repr: function (o) {
+ if (typeof(o) == "undefined") {
+ return "undefined";
+ } else if (o === null) {
+ return "null";
+ }
+ try {
+ if (typeof(o.__repr__) == 'function') {
+ return o.__repr__();
+ } else if (typeof(o.repr) == 'function' && o.repr != arguments.callee) {
+ return o.repr();
+ }
+ return MochiKit.Base.reprRegistry.match(o);
+ } catch (e) {
+ if (typeof(o.NAME) == 'string' && (
+ o.toString == Function.prototype.toString ||
+ o.toString == Object.prototype.toString
+ )) {
+ return o.NAME;
+ }
+ }
+ try {
+ var ostring = (o + "");
+ } catch (e) {
+ return "[" + typeof(o) + "]";
+ }
+ if (typeof(o) == "function") {
+ o = ostring.replace(/^\s+/, "");
+ var idx = o.indexOf("{");
+ if (idx != -1) {
+ o = o.substr(0, idx) + "{...}";
+ }
+ }
+ return ostring;
+ },
+
+ /** @id MochiKit.Base.reprArrayLike */
+ reprArrayLike: function (o) {
+ var m = MochiKit.Base;
+ return "[" + m.map(m.repr, o).join(", ") + "]";
+ },
+
+ /** @id MochiKit.Base.reprString */
+ reprString: function (o) {
+ return ('"' + o.replace(/(["\\])/g, '\\$1') + '"'
+ ).replace(/[\f]/g, "\\f"
+ ).replace(/[\b]/g, "\\b"
+ ).replace(/[\n]/g, "\\n"
+ ).replace(/[\t]/g, "\\t"
+ ).replace(/[\r]/g, "\\r");
+ },
+
+ /** @id MochiKit.Base.reprNumber */
+ reprNumber: function (o) {
+ return o + "";
+ },
+
+ /** @id MochiKit.Base.registerJSON */
+ registerJSON: function (name, check, wrap, /* optional */override) {
+ MochiKit.Base.jsonRegistry.register(name, check, wrap, override);
+ },
+
+
+ /** @id MochiKit.Base.evalJSON */
+ evalJSON: function () {
+ return eval("(" + MochiKit.Base._filterJSON(arguments[0]) + ")");
+ },
+
+ _filterJSON: function (s) {
+ var m = s.match(/^\s*\/\*(.*)\*\/\s*$/);
+ if (m) {
+ return m[1];
+ }
+ return s;
+ },
+
+ /** @id MochiKit.Base.serializeJSON */
+ serializeJSON: function (o) {
+ var objtype = typeof(o);
+ if (objtype == "number" || objtype == "boolean") {
+ return o + "";
+ } else if (o === null) {
+ return "null";
+ }
+ var m = MochiKit.Base;
+ var reprString = m.reprString;
+ if (objtype == "string") {
+ return reprString(o);
+ }
+ // recurse
+ var me = arguments.callee;
+ // short-circuit for objects that support "json" serialization
+ // if they return "self" then just pass-through...
+ var newObj;
+ if (typeof(o.__json__) == "function") {
+ newObj = o.__json__();
+ if (o !== newObj) {
+ return me(newObj);
+ }
+ }
+ if (typeof(o.json) == "function") {
+ newObj = o.json();
+ if (o !== newObj) {
+ return me(newObj);
+ }
+ }
+ // array
+ if (objtype != "function" && typeof(o.length) == "number") {
+ var res = [];
+ for (var i = 0; i < o.length; i++) {
+ var val = me(o[i]);
+ if (typeof(val) != "string") {
+ val = "undefined";
+ }
+ res.push(val);
+ }
+ return "[" + res.join(", ") + "]";
+ }
+ // look in the registry
+ try {
+ newObj = m.jsonRegistry.match(o);
+ if (o !== newObj) {
+ return me(newObj);
+ }
+ } catch (e) {
+ if (e != m.NotFound) {
+ // something really bad happened
+ throw e;
+ }
+ }
+ // undefined is outside of the spec
+ if (objtype == "undefined") {
+ throw new TypeError("undefined can not be serialized as JSON");
+ }
+ // it's a function with no adapter, bad
+ if (objtype == "function") {
+ return null;
+ }
+ // generic object code path
+ res = [];
+ for (var k in o) {
+ var useKey;
+ if (typeof(k) == "number") {
+ useKey = '"' + k + '"';
+ } else if (typeof(k) == "string") {
+ useKey = reprString(k);
+ } else {
+ // skip non-string or number keys
+ continue;
+ }
+ val = me(o[k]);
+ if (typeof(val) != "string") {
+ // skip non-serializable values
+ continue;
+ }
+ res.push(useKey + ":" + val);
+ }
+ return "{" + res.join(", ") + "}";
+ },
+
+
+ /** @id MochiKit.Base.objEqual */
+ objEqual: function (a, b) {
+ return (MochiKit.Base.compare(a, b) === 0);
+ },
+
+ /** @id MochiKit.Base.arrayEqual */
+ arrayEqual: function (self, arr) {
+ if (self.length != arr.length) {
+ return false;
+ }
+ return (MochiKit.Base.compare(self, arr) === 0);
+ },
+
+ /** @id MochiKit.Base.concat */
+ concat: function (/* lst... */) {
+ var rval = [];
+ var extend = MochiKit.Base.extend;
+ for (var i = 0; i < arguments.length; i++) {
+ extend(rval, arguments[i]);
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Base.keyComparator */
+ keyComparator: function (key/* ... */) {
+ // fast-path for single key comparisons
+ var m = MochiKit.Base;
+ var compare = m.compare;
+ if (arguments.length == 1) {
+ return function (a, b) {
+ return compare(a[key], b[key]);
+ };
+ }
+ var compareKeys = m.extend(null, arguments);
+ return function (a, b) {
+ var rval = 0;
+ // keep comparing until something is inequal or we run out of
+ // keys to compare
+ for (var i = 0; (rval === 0) && (i < compareKeys.length); i++) {
+ var key = compareKeys[i];
+ rval = compare(a[key], b[key]);
+ }
+ return rval;
+ };
+ },
+
+ /** @id MochiKit.Base.reverseKeyComparator */
+ reverseKeyComparator: function (key) {
+ var comparator = MochiKit.Base.keyComparator.apply(this, arguments);
+ return function (a, b) {
+ return comparator(b, a);
+ };
+ },
+
+ /** @id MochiKit.Base.partial */
+ partial: function (func) {
+ var m = MochiKit.Base;
+ return m.bind.apply(this, m.extend([func, undefined], arguments, 1));
+ },
+
+ /** @id MochiKit.Base.listMinMax */
+ listMinMax: function (which, lst) {
+ if (lst.length === 0) {
+ return null;
+ }
+ var cur = lst[0];
+ var compare = MochiKit.Base.compare;
+ for (var i = 1; i < lst.length; i++) {
+ var o = lst[i];
+ if (compare(o, cur) == which) {
+ cur = o;
+ }
+ }
+ return cur;
+ },
+
+ /** @id MochiKit.Base.objMax */
+ objMax: function (/* obj... */) {
+ return MochiKit.Base.listMinMax(1, arguments);
+ },
+
+ /** @id MochiKit.Base.objMin */
+ objMin: function (/* obj... */) {
+ return MochiKit.Base.listMinMax(-1, arguments);
+ },
+
+ /** @id MochiKit.Base.findIdentical */
+ findIdentical: function (lst, value, start/* = 0 */, /* optional */end) {
+ if (typeof(end) == "undefined" || end === null) {
+ end = lst.length;
+ }
+ if (typeof(start) == "undefined" || start === null) {
+ start = 0;
+ }
+ for (var i = start; i < end; i++) {
+ if (lst[i] === value) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+ /** @id MochiKit.Base.mean */
+ mean: function(/* lst... */) {
+ /* http://www.nist.gov/dads/HTML/mean.html */
+ var sum = 0;
+
+ var m = MochiKit.Base;
+ var args = m.extend(null, arguments);
+ var count = args.length;
+
+ while (args.length) {
+ var o = args.shift();
+ if (o && typeof(o) == "object" && typeof(o.length) == "number") {
+ count += o.length - 1;
+ for (var i = o.length - 1; i >= 0; i--) {
+ sum += o[i];
+ }
+ } else {
+ sum += o;
+ }
+ }
+
+ if (count <= 0) {
+ throw new TypeError('mean() requires at least one argument');
+ }
+
+ return sum/count;
+ },
+
+ /** @id MochiKit.Base.median */
+ median: function(/* lst... */) {
+ /* http://www.nist.gov/dads/HTML/median.html */
+ var data = MochiKit.Base.flattenArguments(arguments);
+ if (data.length === 0) {
+ throw new TypeError('median() requires at least one argument');
+ }
+ data.sort(compare);
+ if (data.length % 2 == 0) {
+ var upper = data.length / 2;
+ return (data[upper] + data[upper - 1]) / 2;
+ } else {
+ return data[(data.length - 1) / 2];
+ }
+ },
+
+ /** @id MochiKit.Base.findValue */
+ findValue: function (lst, value, start/* = 0 */, /* optional */end) {
+ if (typeof(end) == "undefined" || end === null) {
+ end = lst.length;
+ }
+ if (typeof(start) == "undefined" || start === null) {
+ start = 0;
+ }
+ var cmp = MochiKit.Base.compare;
+ for (var i = start; i < end; i++) {
+ if (cmp(lst[i], value) === 0) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+ /** @id MochiKit.Base.nodeWalk */
+ nodeWalk: function (node, visitor) {
+ var nodes = [node];
+ var extend = MochiKit.Base.extend;
+ while (nodes.length) {
+ var res = visitor(nodes.shift());
+ if (res) {
+ extend(nodes, res);
+ }
+ }
+ },
+
+
+ /** @id MochiKit.Base.nameFunctions */
+ nameFunctions: function (namespace) {
+ var base = namespace.NAME;
+ if (typeof(base) == 'undefined') {
+ base = '';
+ } else {
+ base = base + '.';
+ }
+ for (var name in namespace) {
+ var o = namespace[name];
+ if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') {
+ try {
+ o.NAME = base + name;
+ } catch (e) {
+ // pass
+ }
+ }
+ }
+ },
+
+
+ /** @id MochiKit.Base.queryString */
+ queryString: function (names, values) {
+ // check to see if names is a string or a DOM element, and if
+ // MochiKit.DOM is available. If so, drop it like it's a form
+ // Ugliest conditional in MochiKit? Probably!
+ if (typeof(MochiKit.DOM) != "undefined" && arguments.length == 1
+ && (typeof(names) == "string" || (
+ typeof(names.nodeType) != "undefined" && names.nodeType > 0
+ ))
+ ) {
+ var kv = MochiKit.DOM.formContents(names);
+ names = kv[0];
+ values = kv[1];
+ } else if (arguments.length == 1) {
+ // Allow the return value of formContents to be passed directly
+ if (typeof(names.length) == "number" && names.length == 2) {
+ return arguments.callee(names[0], names[1]);
+ }
+ var o = names;
+ names = [];
+ values = [];
+ for (var k in o) {
+ var v = o[k];
+ if (typeof(v) == "function") {
+ continue;
+ } else if (typeof(v) != "string" &&
+ typeof(v.length) == "number") {
+ for (var i = 0; i < v.length; i++) {
+ names.push(k);
+ values.push(v[i]);
+ }
+ } else {
+ names.push(k);
+ values.push(v);
+ }
+ }
+ }
+ var rval = [];
+ var len = Math.min(names.length, values.length);
+ var urlEncode = MochiKit.Base.urlEncode;
+ for (var i = 0; i < len; i++) {
+ v = values[i];
+ if (typeof(v) != 'undefined' && v !== null) {
+ rval.push(urlEncode(names[i]) + "=" + urlEncode(v));
+ }
+ }
+ return rval.join("&");
+ },
+
+
+ /** @id MochiKit.Base.parseQueryString */
+ parseQueryString: function (encodedString, useArrays) {
+ // strip a leading '?' from the encoded string
+ var qstr = (encodedString.charAt(0) == "?")
+ ? encodedString.substring(1)
+ : encodedString;
+ var pairs = qstr.replace(/\+/g, "%20").split(/(\&amp\;|\&\#38\;|\&#x26;|\&)/);
+ var o = {};
+ var decode;
+ if (typeof(decodeURIComponent) != "undefined") {
+ decode = decodeURIComponent;
+ } else {
+ decode = unescape;
+ }
+ if (useArrays) {
+ for (var i = 0; i < pairs.length; i++) {
+ var pair = pairs[i].split("=");
+ var name = decode(pair.shift());
+ if (!name) {
+ continue;
+ }
+ var arr = o[name];
+ if (!(arr instanceof Array)) {
+ arr = [];
+ o[name] = arr;
+ }
+ arr.push(decode(pair.join("=")));
+ }
+ } else {
+ for (i = 0; i < pairs.length; i++) {
+ pair = pairs[i].split("=");
+ var name = pair.shift();
+ if (!name) {
+ continue;
+ }
+ o[decode(name)] = decode(pair.join("="));
+ }
+ }
+ return o;
+ }
+});
+
+/** @id MochiKit.Base.AdapterRegistry */
+MochiKit.Base.AdapterRegistry = function () {
+ this.pairs = [];
+};
+
+MochiKit.Base.AdapterRegistry.prototype = {
+ /** @id MochiKit.Base.AdapterRegistry.prototype.register */
+ register: function (name, check, wrap, /* optional */ override) {
+ if (override) {
+ this.pairs.unshift([name, check, wrap]);
+ } else {
+ this.pairs.push([name, check, wrap]);
+ }
+ },
+
+ /** @id MochiKit.Base.AdapterRegistry.prototype.match */
+ match: function (/* ... */) {
+ for (var i = 0; i < this.pairs.length; i++) {
+ var pair = this.pairs[i];
+ if (pair[1].apply(this, arguments)) {
+ return pair[2].apply(this, arguments);
+ }
+ }
+ throw MochiKit.Base.NotFound;
+ },
+
+ /** @id MochiKit.Base.AdapterRegistry.prototype.unregister */
+ unregister: function (name) {
+ for (var i = 0; i < this.pairs.length; i++) {
+ var pair = this.pairs[i];
+ if (pair[0] == name) {
+ this.pairs.splice(i, 1);
+ return true;
+ }
+ }
+ return false;
+ }
+};
+
+
+MochiKit.Base.EXPORT = [
+ "flattenArray",
+ "noop",
+ "camelize",
+ "counter",
+ "clone",
+ "extend",
+ "update",
+ "updatetree",
+ "setdefault",
+ "keys",
+ "values",
+ "items",
+ "NamedError",
+ "operator",
+ "forwardCall",
+ "itemgetter",
+ "typeMatcher",
+ "isCallable",
+ "isUndefined",
+ "isUndefinedOrNull",
+ "isNull",
+ "isEmpty",
+ "isNotEmpty",
+ "isArrayLike",
+ "isDateLike",
+ "xmap",
+ "map",
+ "xfilter",
+ "filter",
+ "methodcaller",
+ "compose",
+ "bind",
+ "bindMethods",
+ "NotFound",
+ "AdapterRegistry",
+ "registerComparator",
+ "compare",
+ "registerRepr",
+ "repr",
+ "objEqual",
+ "arrayEqual",
+ "concat",
+ "keyComparator",
+ "reverseKeyComparator",
+ "partial",
+ "merge",
+ "listMinMax",
+ "listMax",
+ "listMin",
+ "objMax",
+ "objMin",
+ "nodeWalk",
+ "zip",
+ "urlEncode",
+ "queryString",
+ "serializeJSON",
+ "registerJSON",
+ "evalJSON",
+ "parseQueryString",
+ "findValue",
+ "findIdentical",
+ "flattenArguments",
+ "method",
+ "average",
+ "mean",
+ "median"
+];
+
+MochiKit.Base.EXPORT_OK = [
+ "nameFunctions",
+ "comparatorRegistry",
+ "reprRegistry",
+ "jsonRegistry",
+ "compareDateLike",
+ "compareArrayLike",
+ "reprArrayLike",
+ "reprString",
+ "reprNumber"
+];
+
+MochiKit.Base._exportSymbols = function (globals, module) {
+ if (!MochiKit.__export__) {
+ return;
+ }
+ var all = module.EXPORT_TAGS[":all"];
+ for (var i = 0; i < all.length; i++) {
+ globals[all[i]] = module[all[i]];
+ }
+};
+
+MochiKit.Base.__new__ = function () {
+ // A singleton raised when no suitable adapter is found
+ var m = this;
+
+ // convenience
+ /** @id MochiKit.Base.noop */
+ m.noop = m.operator.identity;
+
+ // Backwards compat
+ m.forward = m.forwardCall;
+ m.find = m.findValue;
+
+ if (typeof(encodeURIComponent) != "undefined") {
+ /** @id MochiKit.Base.urlEncode */
+ m.urlEncode = function (unencoded) {
+ return encodeURIComponent(unencoded).replace(/\'/g, '%27');
+ };
+ } else {
+ m.urlEncode = function (unencoded) {
+ return escape(unencoded
+ ).replace(/\+/g, '%2B'
+ ).replace(/\"/g,'%22'
+ ).rval.replace(/\'/g, '%27');
+ };
+ }
+
+ /** @id MochiKit.Base.NamedError */
+ m.NamedError = function (name) {
+ this.message = name;
+ this.name = name;
+ };
+ m.NamedError.prototype = new Error();
+ m.update(m.NamedError.prototype, {
+ repr: function () {
+ if (this.message && this.message != this.name) {
+ return this.name + "(" + m.repr(this.message) + ")";
+ } else {
+ return this.name + "()";
+ }
+ },
+ toString: m.forwardCall("repr")
+ });
+
+ /** @id MochiKit.Base.NotFound */
+ m.NotFound = new m.NamedError("MochiKit.Base.NotFound");
+
+
+ /** @id MochiKit.Base.listMax */
+ m.listMax = m.partial(m.listMinMax, 1);
+ /** @id MochiKit.Base.listMin */
+ m.listMin = m.partial(m.listMinMax, -1);
+
+ /** @id MochiKit.Base.isCallable */
+ m.isCallable = m.typeMatcher('function');
+ /** @id MochiKit.Base.isUndefined */
+ m.isUndefined = m.typeMatcher('undefined');
+
+ /** @id MochiKit.Base.merge */
+ m.merge = m.partial(m.update, null);
+ /** @id MochiKit.Base.zip */
+ m.zip = m.partial(m.map, null);
+
+ /** @id MochiKit.Base.average */
+ m.average = m.mean;
+
+ /** @id MochiKit.Base.comparatorRegistry */
+ m.comparatorRegistry = new m.AdapterRegistry();
+ m.registerComparator("dateLike", m.isDateLike, m.compareDateLike);
+ m.registerComparator("arrayLike", m.isArrayLike, m.compareArrayLike);
+
+ /** @id MochiKit.Base.reprRegistry */
+ m.reprRegistry = new m.AdapterRegistry();
+ m.registerRepr("arrayLike", m.isArrayLike, m.reprArrayLike);
+ m.registerRepr("string", m.typeMatcher("string"), m.reprString);
+ m.registerRepr("numbers", m.typeMatcher("number", "boolean"), m.reprNumber);
+
+ /** @id MochiKit.Base.jsonRegistry */
+ m.jsonRegistry = new m.AdapterRegistry();
+
+ var all = m.concat(m.EXPORT, m.EXPORT_OK);
+ m.EXPORT_TAGS = {
+ ":common": m.concat(m.EXPORT_OK),
+ ":all": all
+ };
+
+ m.nameFunctions(this);
+
+};
+
+MochiKit.Base.__new__();
+
+//
+// XXX: Internet Explorer blows
+//
+if (MochiKit.__export__) {
+ compare = MochiKit.Base.compare;
+ compose = MochiKit.Base.compose;
+ serializeJSON = MochiKit.Base.serializeJSON;
+}
+
+MochiKit.Base._exportSymbols(this, MochiKit.Base);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Color.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Color.js
new file mode 100644
index 0000000000..708f49017f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Color.js
@@ -0,0 +1,902 @@
+/***
+
+MochiKit.Color 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito and others. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Color');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+ dojo.require('MochiKit.Style');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+ JSAN.use("MochiKit.DOM", []);
+ JSAN.use("MochiKit.Style", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Color depends on MochiKit.Base";
+}
+
+try {
+ if (typeof(MochiKit.DOM) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Color depends on MochiKit.DOM";
+}
+
+try {
+ if (typeof(MochiKit.Style) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Color depends on MochiKit.Style";
+}
+
+if (typeof(MochiKit.Color) == "undefined") {
+ MochiKit.Color = {};
+}
+
+MochiKit.Color.NAME = "MochiKit.Color";
+MochiKit.Color.VERSION = "1.4";
+
+MochiKit.Color.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+MochiKit.Color.toString = function () {
+ return this.__repr__();
+};
+
+
+/** @id MochiKit.Color.Color */
+MochiKit.Color.Color = function (red, green, blue, alpha) {
+ if (typeof(alpha) == 'undefined' || alpha === null) {
+ alpha = 1.0;
+ }
+ this.rgb = {
+ r: red,
+ g: green,
+ b: blue,
+ a: alpha
+ };
+};
+
+
+// Prototype methods
+
+MochiKit.Color.Color.prototype = {
+
+ __class__: MochiKit.Color.Color,
+
+ /** @id MochiKit.Color.Color.prototype.colorWithAlpha */
+ colorWithAlpha: function (alpha) {
+ var rgb = this.rgb;
+ var m = MochiKit.Color;
+ return m.Color.fromRGB(rgb.r, rgb.g, rgb.b, alpha);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.colorWithHue */
+ colorWithHue: function (hue) {
+ // get an HSL model, and set the new hue...
+ var hsl = this.asHSL();
+ hsl.h = hue;
+ var m = MochiKit.Color;
+ // convert back to RGB...
+ return m.Color.fromHSL(hsl);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.colorWithSaturation */
+ colorWithSaturation: function (saturation) {
+ // get an HSL model, and set the new hue...
+ var hsl = this.asHSL();
+ hsl.s = saturation;
+ var m = MochiKit.Color;
+ // convert back to RGB...
+ return m.Color.fromHSL(hsl);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.colorWithLightness */
+ colorWithLightness: function (lightness) {
+ // get an HSL model, and set the new hue...
+ var hsl = this.asHSL();
+ hsl.l = lightness;
+ var m = MochiKit.Color;
+ // convert back to RGB...
+ return m.Color.fromHSL(hsl);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.darkerColorWithLevel */
+ darkerColorWithLevel: function (level) {
+ var hsl = this.asHSL();
+ hsl.l = Math.max(hsl.l - level, 0);
+ var m = MochiKit.Color;
+ return m.Color.fromHSL(hsl);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.lighterColorWithLevel */
+ lighterColorWithLevel: function (level) {
+ var hsl = this.asHSL();
+ hsl.l = Math.min(hsl.l + level, 1);
+ var m = MochiKit.Color;
+ return m.Color.fromHSL(hsl);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.blendedColor */
+ blendedColor: function (other, /* optional */ fraction) {
+ if (typeof(fraction) == 'undefined' || fraction === null) {
+ fraction = 0.5;
+ }
+ var sf = 1.0 - fraction;
+ var s = this.rgb;
+ var d = other.rgb;
+ var df = fraction;
+ return MochiKit.Color.Color.fromRGB(
+ (s.r * sf) + (d.r * df),
+ (s.g * sf) + (d.g * df),
+ (s.b * sf) + (d.b * df),
+ (s.a * sf) + (d.a * df)
+ );
+ },
+
+ /** @id MochiKit.Color.Color.prototype.compareRGB */
+ compareRGB: function (other) {
+ var a = this.asRGB();
+ var b = other.asRGB();
+ return MochiKit.Base.compare(
+ [a.r, a.g, a.b, a.a],
+ [b.r, b.g, b.b, b.a]
+ );
+ },
+
+ /** @id MochiKit.Color.Color.prototype.isLight */
+ isLight: function () {
+ return this.asHSL().b > 0.5;
+ },
+
+ /** @id MochiKit.Color.Color.prototype.isDark */
+ isDark: function () {
+ return (!this.isLight());
+ },
+
+ /** @id MochiKit.Color.Color.prototype.toHSLString */
+ toHSLString: function () {
+ var c = this.asHSL();
+ var ccc = MochiKit.Color.clampColorComponent;
+ var rval = this._hslString;
+ if (!rval) {
+ var mid = (
+ ccc(c.h, 360).toFixed(0)
+ + "," + ccc(c.s, 100).toPrecision(4) + "%"
+ + "," + ccc(c.l, 100).toPrecision(4) + "%"
+ );
+ var a = c.a;
+ if (a >= 1) {
+ a = 1;
+ rval = "hsl(" + mid + ")";
+ } else {
+ if (a <= 0) {
+ a = 0;
+ }
+ rval = "hsla(" + mid + "," + a + ")";
+ }
+ this._hslString = rval;
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Color.Color.prototype.toRGBString */
+ toRGBString: function () {
+ var c = this.rgb;
+ var ccc = MochiKit.Color.clampColorComponent;
+ var rval = this._rgbString;
+ if (!rval) {
+ var mid = (
+ ccc(c.r, 255).toFixed(0)
+ + "," + ccc(c.g, 255).toFixed(0)
+ + "," + ccc(c.b, 255).toFixed(0)
+ );
+ if (c.a != 1) {
+ rval = "rgba(" + mid + "," + c.a + ")";
+ } else {
+ rval = "rgb(" + mid + ")";
+ }
+ this._rgbString = rval;
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Color.Color.prototype.asRGB */
+ asRGB: function () {
+ return MochiKit.Base.clone(this.rgb);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.toHexString */
+ toHexString: function () {
+ var m = MochiKit.Color;
+ var c = this.rgb;
+ var ccc = MochiKit.Color.clampColorComponent;
+ var rval = this._hexString;
+ if (!rval) {
+ rval = ("#" +
+ m.toColorPart(ccc(c.r, 255)) +
+ m.toColorPart(ccc(c.g, 255)) +
+ m.toColorPart(ccc(c.b, 255))
+ );
+ this._hexString = rval;
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Color.Color.prototype.asHSV */
+ asHSV: function () {
+ var hsv = this.hsv;
+ var c = this.rgb;
+ if (typeof(hsv) == 'undefined' || hsv === null) {
+ hsv = MochiKit.Color.rgbToHSV(this.rgb);
+ this.hsv = hsv;
+ }
+ return MochiKit.Base.clone(hsv);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.asHSL */
+ asHSL: function () {
+ var hsl = this.hsl;
+ var c = this.rgb;
+ if (typeof(hsl) == 'undefined' || hsl === null) {
+ hsl = MochiKit.Color.rgbToHSL(this.rgb);
+ this.hsl = hsl;
+ }
+ return MochiKit.Base.clone(hsl);
+ },
+
+ /** @id MochiKit.Color.Color.prototype.toString */
+ toString: function () {
+ return this.toRGBString();
+ },
+
+ /** @id MochiKit.Color.Color.prototype.repr */
+ repr: function () {
+ var c = this.rgb;
+ var col = [c.r, c.g, c.b, c.a];
+ return this.__class__.NAME + "(" + col.join(", ") + ")";
+ }
+
+};
+
+// Constructor methods
+
+MochiKit.Base.update(MochiKit.Color.Color, {
+ /** @id MochiKit.Color.Color.fromRGB */
+ fromRGB: function (red, green, blue, alpha) {
+ // designated initializer
+ var Color = MochiKit.Color.Color;
+ if (arguments.length == 1) {
+ var rgb = red;
+ red = rgb.r;
+ green = rgb.g;
+ blue = rgb.b;
+ if (typeof(rgb.a) == 'undefined') {
+ alpha = undefined;
+ } else {
+ alpha = rgb.a;
+ }
+ }
+ return new Color(red, green, blue, alpha);
+ },
+
+ /** @id MochiKit.Color.Color.fromHSL */
+ fromHSL: function (hue, saturation, lightness, alpha) {
+ var m = MochiKit.Color;
+ return m.Color.fromRGB(m.hslToRGB.apply(m, arguments));
+ },
+
+ /** @id MochiKit.Color.Color.fromHSV */
+ fromHSV: function (hue, saturation, value, alpha) {
+ var m = MochiKit.Color;
+ return m.Color.fromRGB(m.hsvToRGB.apply(m, arguments));
+ },
+
+ /** @id MochiKit.Color.Color.fromName */
+ fromName: function (name) {
+ var Color = MochiKit.Color.Color;
+ // Opera 9 seems to "quote" named colors(?!)
+ if (name.charAt(0) == '"') {
+ name = name.substr(1, name.length - 2);
+ }
+ var htmlColor = Color._namedColors[name.toLowerCase()];
+ if (typeof(htmlColor) == 'string') {
+ return Color.fromHexString(htmlColor);
+ } else if (name == "transparent") {
+ return Color.transparentColor();
+ }
+ return null;
+ },
+
+ /** @id MochiKit.Color.Color.fromString */
+ fromString: function (colorString) {
+ var self = MochiKit.Color.Color;
+ var three = colorString.substr(0, 3);
+ if (three == "rgb") {
+ return self.fromRGBString(colorString);
+ } else if (three == "hsl") {
+ return self.fromHSLString(colorString);
+ } else if (colorString.charAt(0) == "#") {
+ return self.fromHexString(colorString);
+ }
+ return self.fromName(colorString);
+ },
+
+
+ /** @id MochiKit.Color.Color.fromHexString */
+ fromHexString: function (hexCode) {
+ if (hexCode.charAt(0) == '#') {
+ hexCode = hexCode.substring(1);
+ }
+ var components = [];
+ var i, hex;
+ if (hexCode.length == 3) {
+ for (i = 0; i < 3; i++) {
+ hex = hexCode.substr(i, 1);
+ components.push(parseInt(hex + hex, 16) / 255.0);
+ }
+ } else {
+ for (i = 0; i < 6; i += 2) {
+ hex = hexCode.substr(i, 2);
+ components.push(parseInt(hex, 16) / 255.0);
+ }
+ }
+ var Color = MochiKit.Color.Color;
+ return Color.fromRGB.apply(Color, components);
+ },
+
+
+ _fromColorString: function (pre, method, scales, colorCode) {
+ // parses either HSL or RGB
+ if (colorCode.indexOf(pre) === 0) {
+ colorCode = colorCode.substring(colorCode.indexOf("(", 3) + 1, colorCode.length - 1);
+ }
+ var colorChunks = colorCode.split(/\s*,\s*/);
+ var colorFloats = [];
+ for (var i = 0; i < colorChunks.length; i++) {
+ var c = colorChunks[i];
+ var val;
+ var three = c.substring(c.length - 3);
+ if (c.charAt(c.length - 1) == '%') {
+ val = 0.01 * parseFloat(c.substring(0, c.length - 1));
+ } else if (three == "deg") {
+ val = parseFloat(c) / 360.0;
+ } else if (three == "rad") {
+ val = parseFloat(c) / (Math.PI * 2);
+ } else {
+ val = scales[i] * parseFloat(c);
+ }
+ colorFloats.push(val);
+ }
+ return this[method].apply(this, colorFloats);
+ },
+
+ /** @id MochiKit.Color.Color.fromComputedStyle */
+ fromComputedStyle: function (elem, style) {
+ var d = MochiKit.DOM;
+ var cls = MochiKit.Color.Color;
+ for (elem = d.getElement(elem); elem; elem = elem.parentNode) {
+ var actualColor = MochiKit.Style.getStyle.apply(d, arguments);
+ if (!actualColor) {
+ continue;
+ }
+ var color = cls.fromString(actualColor);
+ if (!color) {
+ break;
+ }
+ if (color.asRGB().a > 0) {
+ return color;
+ }
+ }
+ return null;
+ },
+
+ /** @id MochiKit.Color.Color.fromBackground */
+ fromBackground: function (elem) {
+ var cls = MochiKit.Color.Color;
+ return cls.fromComputedStyle(
+ elem, "backgroundColor", "background-color") || cls.whiteColor();
+ },
+
+ /** @id MochiKit.Color.Color.fromText */
+ fromText: function (elem) {
+ var cls = MochiKit.Color.Color;
+ return cls.fromComputedStyle(
+ elem, "color", "color") || cls.blackColor();
+ },
+
+ /** @id MochiKit.Color.Color.namedColors */
+ namedColors: function () {
+ return MochiKit.Base.clone(MochiKit.Color.Color._namedColors);
+ }
+});
+
+
+// Module level functions
+
+MochiKit.Base.update(MochiKit.Color, {
+ /** @id MochiKit.Color.clampColorComponent */
+ clampColorComponent: function (v, scale) {
+ v *= scale;
+ if (v < 0) {
+ return 0;
+ } else if (v > scale) {
+ return scale;
+ } else {
+ return v;
+ }
+ },
+
+ _hslValue: function (n1, n2, hue) {
+ if (hue > 6.0) {
+ hue -= 6.0;
+ } else if (hue < 0.0) {
+ hue += 6.0;
+ }
+ var val;
+ if (hue < 1.0) {
+ val = n1 + (n2 - n1) * hue;
+ } else if (hue < 3.0) {
+ val = n2;
+ } else if (hue < 4.0) {
+ val = n1 + (n2 - n1) * (4.0 - hue);
+ } else {
+ val = n1;
+ }
+ return val;
+ },
+
+ /** @id MochiKit.Color.hsvToRGB */
+ hsvToRGB: function (hue, saturation, value, alpha) {
+ if (arguments.length == 1) {
+ var hsv = hue;
+ hue = hsv.h;
+ saturation = hsv.s;
+ value = hsv.v;
+ alpha = hsv.a;
+ }
+ var red;
+ var green;
+ var blue;
+ if (saturation === 0) {
+ red = value;
+ green = value;
+ blue = value;
+ } else {
+ var i = Math.floor(hue * 6);
+ var f = (hue * 6) - i;
+ var p = value * (1 - saturation);
+ var q = value * (1 - (saturation * f));
+ var t = value * (1 - (saturation * (1 - f)));
+ switch (i) {
+ case 1: red = q; green = value; blue = p; break;
+ case 2: red = p; green = value; blue = t; break;
+ case 3: red = p; green = q; blue = value; break;
+ case 4: red = t; green = p; blue = value; break;
+ case 5: red = value; green = p; blue = q; break;
+ case 6: // fall through
+ case 0: red = value; green = t; blue = p; break;
+ }
+ }
+ return {
+ r: red,
+ g: green,
+ b: blue,
+ a: alpha
+ };
+ },
+
+ /** @id MochiKit.Color.hslToRGB */
+ hslToRGB: function (hue, saturation, lightness, alpha) {
+ if (arguments.length == 1) {
+ var hsl = hue;
+ hue = hsl.h;
+ saturation = hsl.s;
+ lightness = hsl.l;
+ alpha = hsl.a;
+ }
+ var red;
+ var green;
+ var blue;
+ if (saturation === 0) {
+ red = lightness;
+ green = lightness;
+ blue = lightness;
+ } else {
+ var m2;
+ if (lightness <= 0.5) {
+ m2 = lightness * (1.0 + saturation);
+ } else {
+ m2 = lightness + saturation - (lightness * saturation);
+ }
+ var m1 = (2.0 * lightness) - m2;
+ var f = MochiKit.Color._hslValue;
+ var h6 = hue * 6.0;
+ red = f(m1, m2, h6 + 2);
+ green = f(m1, m2, h6);
+ blue = f(m1, m2, h6 - 2);
+ }
+ return {
+ r: red,
+ g: green,
+ b: blue,
+ a: alpha
+ };
+ },
+
+ /** @id MochiKit.Color.rgbToHSV */
+ rgbToHSV: function (red, green, blue, alpha) {
+ if (arguments.length == 1) {
+ var rgb = red;
+ red = rgb.r;
+ green = rgb.g;
+ blue = rgb.b;
+ alpha = rgb.a;
+ }
+ var max = Math.max(Math.max(red, green), blue);
+ var min = Math.min(Math.min(red, green), blue);
+ var hue;
+ var saturation;
+ var value = max;
+ if (min == max) {
+ hue = 0;
+ saturation = 0;
+ } else {
+ var delta = (max - min);
+ saturation = delta / max;
+
+ if (red == max) {
+ hue = (green - blue) / delta;
+ } else if (green == max) {
+ hue = 2 + ((blue - red) / delta);
+ } else {
+ hue = 4 + ((red - green) / delta);
+ }
+ hue /= 6;
+ if (hue < 0) {
+ hue += 1;
+ }
+ if (hue > 1) {
+ hue -= 1;
+ }
+ }
+ return {
+ h: hue,
+ s: saturation,
+ v: value,
+ a: alpha
+ };
+ },
+
+ /** @id MochiKit.Color.rgbToHSL */
+ rgbToHSL: function (red, green, blue, alpha) {
+ if (arguments.length == 1) {
+ var rgb = red;
+ red = rgb.r;
+ green = rgb.g;
+ blue = rgb.b;
+ alpha = rgb.a;
+ }
+ var max = Math.max(red, Math.max(green, blue));
+ var min = Math.min(red, Math.min(green, blue));
+ var hue;
+ var saturation;
+ var lightness = (max + min) / 2.0;
+ var delta = max - min;
+ if (delta === 0) {
+ hue = 0;
+ saturation = 0;
+ } else {
+ if (lightness <= 0.5) {
+ saturation = delta / (max + min);
+ } else {
+ saturation = delta / (2 - max - min);
+ }
+ if (red == max) {
+ hue = (green - blue) / delta;
+ } else if (green == max) {
+ hue = 2 + ((blue - red) / delta);
+ } else {
+ hue = 4 + ((red - green) / delta);
+ }
+ hue /= 6;
+ if (hue < 0) {
+ hue += 1;
+ }
+ if (hue > 1) {
+ hue -= 1;
+ }
+
+ }
+ return {
+ h: hue,
+ s: saturation,
+ l: lightness,
+ a: alpha
+ };
+ },
+
+ /** @id MochiKit.Color.toColorPart */
+ toColorPart: function (num) {
+ num = Math.round(num);
+ var digits = num.toString(16);
+ if (num < 16) {
+ return '0' + digits;
+ }
+ return digits;
+ },
+
+ __new__: function () {
+ var m = MochiKit.Base;
+ /** @id MochiKit.Color.fromRGBString */
+ this.Color.fromRGBString = m.bind(
+ this.Color._fromColorString, this.Color, "rgb", "fromRGB",
+ [1.0/255.0, 1.0/255.0, 1.0/255.0, 1]
+ );
+ /** @id MochiKit.Color.fromHSLString */
+ this.Color.fromHSLString = m.bind(
+ this.Color._fromColorString, this.Color, "hsl", "fromHSL",
+ [1.0/360.0, 0.01, 0.01, 1]
+ );
+
+ var third = 1.0 / 3.0;
+ /** @id MochiKit.Color.colors */
+ var colors = {
+ // NSColor colors plus transparent
+ /** @id MochiKit.Color.blackColor */
+ black: [0, 0, 0],
+ /** @id MochiKit.Color.blueColor */
+ blue: [0, 0, 1],
+ /** @id MochiKit.Color.brownColor */
+ brown: [0.6, 0.4, 0.2],
+ /** @id MochiKit.Color.cyanColor */
+ cyan: [0, 1, 1],
+ /** @id MochiKit.Color.darkGrayColor */
+ darkGray: [third, third, third],
+ /** @id MochiKit.Color.grayColor */
+ gray: [0.5, 0.5, 0.5],
+ /** @id MochiKit.Color.greenColor */
+ green: [0, 1, 0],
+ /** @id MochiKit.Color.lightGrayColor */
+ lightGray: [2 * third, 2 * third, 2 * third],
+ /** @id MochiKit.Color.magentaColor */
+ magenta: [1, 0, 1],
+ /** @id MochiKit.Color.orangeColor */
+ orange: [1, 0.5, 0],
+ /** @id MochiKit.Color.purpleColor */
+ purple: [0.5, 0, 0.5],
+ /** @id MochiKit.Color.redColor */
+ red: [1, 0, 0],
+ /** @id MochiKit.Color.transparentColor */
+ transparent: [0, 0, 0, 0],
+ /** @id MochiKit.Color.whiteColor */
+ white: [1, 1, 1],
+ /** @id MochiKit.Color.yellowColor */
+ yellow: [1, 1, 0]
+ };
+
+ var makeColor = function (name, r, g, b, a) {
+ var rval = this.fromRGB(r, g, b, a);
+ this[name] = function () { return rval; };
+ return rval;
+ };
+
+ for (var k in colors) {
+ var name = k + "Color";
+ var bindArgs = m.concat(
+ [makeColor, this.Color, name],
+ colors[k]
+ );
+ this.Color[name] = m.bind.apply(null, bindArgs);
+ }
+
+ var isColor = function () {
+ for (var i = 0; i < arguments.length; i++) {
+ if (!(arguments[i] instanceof Color)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ var compareColor = function (a, b) {
+ return a.compareRGB(b);
+ };
+
+ m.nameFunctions(this);
+
+ m.registerComparator(this.Color.NAME, isColor, compareColor);
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ }
+});
+
+MochiKit.Color.EXPORT = [
+ "Color"
+];
+
+MochiKit.Color.EXPORT_OK = [
+ "clampColorComponent",
+ "rgbToHSL",
+ "hslToRGB",
+ "rgbToHSV",
+ "hsvToRGB",
+ "toColorPart"
+];
+
+MochiKit.Color.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.Color);
+
+// Full table of css3 X11 colors <http://www.w3.org/TR/css3-color/#X11COLORS>
+
+MochiKit.Color.Color._namedColors = {
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Controls.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Controls.js
new file mode 100644
index 0000000000..c044ef2abf
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Controls.js
@@ -0,0 +1,1388 @@
+/***
+Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+ (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+ (c) 2005 Jon Tirsen (http://www.tirsen.com)
+Contributors:
+ Richard Livsey
+ Rahul Bhargava
+ Rob Wills
+ Mochi-ized By Thomas Herve (_firstname_@nimail.org)
+
+See scriptaculous.js for full license.
+
+Autocompleter.Base handles all the autocompletion functionality
+that's independent of the data source for autocompletion. This
+includes drawing the autocompletion menu, observing keyboard
+and mouse events, and similar.
+
+Specific autocompleters need to provide, at the very least,
+a getUpdatedChoices function that will be invoked every time
+the text inside the monitored textbox changes. This method
+should get the text for which to provide autocompletion by
+invoking this.getToken(), NOT by directly accessing
+this.element.value. This is to allow incremental tokenized
+autocompletion. Specific auto-completion logic (AJAX, etc)
+belongs in getUpdatedChoices.
+
+Tokenized incremental autocompletion is enabled automatically
+when an autocompleter is instantiated with the 'tokens' option
+in the options parameter, e.g.:
+new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
+will incrementally autocomplete with a comma as the token.
+Additionally, ',' in the above example can be replaced with
+a token array, e.g. { tokens: [',', '\n'] } which
+enables autocompletion on multiple tokens. This is most
+useful when one of the tokens is \n (a newline), as it
+allows smart autocompletion after linebreaks.
+
+***/
+
+MochiKit.Base.update(MochiKit.Base, {
+ ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
+
+/** @id MochiKit.Base.stripScripts */
+ stripScripts: function (str) {
+ return str.replace(new RegExp(MochiKit.Base.ScriptFragment, 'img'), '');
+ },
+
+/** @id MochiKit.Base.stripTags */
+ stripTags: function(str) {
+ return str.replace(/<\/?[^>]+>/gi, '');
+ },
+
+/** @id MochiKit.Base.extractScripts */
+ extractScripts: function (str) {
+ var matchAll = new RegExp(MochiKit.Base.ScriptFragment, 'img');
+ var matchOne = new RegExp(MochiKit.Base.ScriptFragment, 'im');
+ return MochiKit.Base.map(function (scriptTag) {
+ return (scriptTag.match(matchOne) || ['', ''])[1];
+ }, str.match(matchAll) || []);
+ },
+
+/** @id MochiKit.Base.evalScripts */
+ evalScripts: function (str) {
+ return MochiKit.Base.map(function (scr) {
+ eval(scr);
+ }, MochiKit.Base.extractScripts(str));
+ }
+});
+
+MochiKit.Form = {
+
+/** @id MochiKit.Form.serialize */
+ serialize: function (form) {
+ var elements = MochiKit.Form.getElements(form);
+ var queryComponents = [];
+
+ for (var i = 0; i < elements.length; i++) {
+ var queryComponent = MochiKit.Form.serializeElement(elements[i]);
+ if (queryComponent) {
+ queryComponents.push(queryComponent);
+ }
+ }
+
+ return queryComponents.join('&');
+ },
+
+/** @id MochiKit.Form.getElements */
+ getElements: function (form) {
+ form = MochiKit.DOM.getElement(form);
+ var elements = [];
+
+ for (var tagName in MochiKit.Form.Serializers) {
+ var tagElements = form.getElementsByTagName(tagName);
+ for (var j = 0; j < tagElements.length; j++) {
+ elements.push(tagElements[j]);
+ }
+ }
+ return elements;
+ },
+
+/** @id MochiKit.Form.serializeElement */
+ serializeElement: function (element) {
+ element = MochiKit.DOM.getElement(element);
+ var method = element.tagName.toLowerCase();
+ var parameter = MochiKit.Form.Serializers[method](element);
+
+ if (parameter) {
+ var key = encodeURIComponent(parameter[0]);
+ if (key.length === 0) {
+ return;
+ }
+
+ if (!(parameter[1] instanceof Array)) {
+ parameter[1] = [parameter[1]];
+ }
+
+ return parameter[1].map(function (value) {
+ return key + '=' + encodeURIComponent(value);
+ }).join('&');
+ }
+ }
+};
+
+MochiKit.Form.Serializers = {
+
+/** @id MochiKit.Form.Serializers.input */
+ input: function (element) {
+ switch (element.type.toLowerCase()) {
+ case 'submit':
+ case 'hidden':
+ case 'password':
+ case 'text':
+ return MochiKit.Form.Serializers.textarea(element);
+ case 'checkbox':
+ case 'radio':
+ return MochiKit.Form.Serializers.inputSelector(element);
+ }
+ return false;
+ },
+
+/** @id MochiKit.Form.Serializers.inputSelector */
+ inputSelector: function (element) {
+ if (element.checked) {
+ return [element.name, element.value];
+ }
+ },
+
+/** @id MochiKit.Form.Serializers.textarea */
+ textarea: function (element) {
+ return [element.name, element.value];
+ },
+
+/** @id MochiKit.Form.Serializers.select */
+ select: function (element) {
+ return MochiKit.Form.Serializers[element.type == 'select-one' ?
+ 'selectOne' : 'selectMany'](element);
+ },
+
+/** @id MochiKit.Form.Serializers.selectOne */
+ selectOne: function (element) {
+ var value = '', opt, index = element.selectedIndex;
+ if (index >= 0) {
+ opt = element.options[index];
+ value = opt.value;
+ if (!value && !('value' in opt)) {
+ value = opt.text;
+ }
+ }
+ return [element.name, value];
+ },
+
+/** @id MochiKit.Form.Serializers.selectMany */
+ selectMany: function (element) {
+ var value = [];
+ for (var i = 0; i < element.length; i++) {
+ var opt = element.options[i];
+ if (opt.selected) {
+ var optValue = opt.value;
+ if (!optValue && !('value' in opt)) {
+ optValue = opt.text;
+ }
+ value.push(optValue);
+ }
+ }
+ return [element.name, value];
+ }
+};
+
+/** @id Ajax */
+var Ajax = {
+ activeRequestCount: 0
+};
+
+Ajax.Responders = {
+ responders: [],
+
+/** @id Ajax.Responders.register */
+ register: function (responderToAdd) {
+ if (MochiKit.Base.find(this.responders, responderToAdd) == -1) {
+ this.responders.push(responderToAdd);
+ }
+ },
+
+/** @id Ajax.Responders.unregister */
+ unregister: function (responderToRemove) {
+ this.responders = this.responders.without(responderToRemove);
+ },
+
+/** @id Ajax.Responders.dispatch */
+ dispatch: function (callback, request, transport, json) {
+ MochiKit.Iter.forEach(this.responders, function (responder) {
+ if (responder[callback] &&
+ typeof(responder[callback]) == 'function') {
+ try {
+ responder[callback].apply(responder, [request, transport, json]);
+ } catch (e) {}
+ }
+ });
+ }
+};
+
+Ajax.Responders.register({
+
+/** @id Ajax.Responders.onCreate */
+ onCreate: function () {
+ Ajax.activeRequestCount++;
+ },
+
+/** @id Ajax.Responders.onComplete */
+ onComplete: function () {
+ Ajax.activeRequestCount--;
+ }
+});
+
+/** @id Ajax.Base */
+Ajax.Base = function () {};
+
+Ajax.Base.prototype = {
+
+/** @id Ajax.Base.prototype.setOptions */
+ setOptions: function (options) {
+ this.options = {
+ method: 'post',
+ asynchronous: true,
+ parameters: ''
+ }
+ MochiKit.Base.update(this.options, options || {});
+ },
+
+/** @id Ajax.Base.prototype.responseIsSuccess */
+ responseIsSuccess: function () {
+ return this.transport.status == undefined
+ || this.transport.status === 0
+ || (this.transport.status >= 200 && this.transport.status < 300);
+ },
+
+/** @id Ajax.Base.prototype.responseIsFailure */
+ responseIsFailure: function () {
+ return !this.responseIsSuccess();
+ }
+};
+
+/** @id Ajax.Request */
+Ajax.Request = function (url, options) {
+ this.__init__(url, options);
+};
+
+/** @id Ajax.Events */
+Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded',
+ 'Interactive', 'Complete'];
+
+MochiKit.Base.update(Ajax.Request.prototype, Ajax.Base.prototype);
+
+MochiKit.Base.update(Ajax.Request.prototype, {
+ __init__: function (url, options) {
+ this.transport = MochiKit.Async.getXMLHttpRequest();
+ this.setOptions(options);
+ this.request(url);
+ },
+
+/** @id Ajax.Request.prototype.request */
+ request: function (url) {
+ var parameters = this.options.parameters || '';
+ if (parameters.length > 0){
+ parameters += '&_=';
+ }
+
+ try {
+ this.url = url;
+ if (this.options.method == 'get' && parameters.length > 0) {
+ this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
+ }
+ Ajax.Responders.dispatch('onCreate', this, this.transport);
+
+ this.transport.open(this.options.method, this.url,
+ this.options.asynchronous);
+
+ if (this.options.asynchronous) {
+ this.transport.onreadystatechange = MochiKit.Base.bind(this.onStateChange, this);
+ setTimeout(MochiKit.Base.bind(function () {
+ this.respondToReadyState(1);
+ }, this), 10);
+ }
+
+ this.setRequestHeaders();
+
+ var body = this.options.postBody ? this.options.postBody : parameters;
+ this.transport.send(this.options.method == 'post' ? body : null);
+
+ } catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+/** @id Ajax.Request.prototype.setRequestHeaders */
+ setRequestHeaders: function () {
+ var requestHeaders = ['X-Requested-With', 'XMLHttpRequest'];
+
+ if (this.options.method == 'post') {
+ requestHeaders.push('Content-type',
+ 'application/x-www-form-urlencoded');
+
+ /* Force 'Connection: close' for Mozilla browsers to work around
+ * a bug where XMLHttpRequest sends an incorrect Content-length
+ * header. See Mozilla Bugzilla #246651.
+ */
+ if (this.transport.overrideMimeType) {
+ requestHeaders.push('Connection', 'close');
+ }
+ }
+
+ if (this.options.requestHeaders) {
+ requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
+ }
+
+ for (var i = 0; i < requestHeaders.length; i += 2) {
+ this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
+ }
+ },
+
+/** @id Ajax.Request.prototype.onStateChange */
+ onStateChange: function () {
+ var readyState = this.transport.readyState;
+ if (readyState != 1) {
+ this.respondToReadyState(this.transport.readyState);
+ }
+ },
+
+/** @id Ajax.Request.prototype.header */
+ header: function (name) {
+ try {
+ return this.transport.getResponseHeader(name);
+ } catch (e) {}
+ },
+
+/** @id Ajax.Request.prototype.evalJSON */
+ evalJSON: function () {
+ try {
+ return eval(this.header('X-JSON'));
+ } catch (e) {}
+ },
+
+/** @id Ajax.Request.prototype.evalResponse */
+ evalResponse: function () {
+ try {
+ return eval(this.transport.responseText);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+/** @id Ajax.Request.prototype.respondToReadyState */
+ respondToReadyState: function (readyState) {
+ var event = Ajax.Request.Events[readyState];
+ var transport = this.transport, json = this.evalJSON();
+
+ if (event == 'Complete') {
+ try {
+ (this.options['on' + this.transport.status]
+ || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
+ || MochiKit.Base.noop)(transport, json);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ if ((this.header('Content-type') || '').match(/^text\/javascript/i)) {
+ this.evalResponse();
+ }
+ }
+
+ try {
+ (this.options['on' + event] || MochiKit.Base.noop)(transport, json);
+ Ajax.Responders.dispatch('on' + event, this, transport, json);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
+ if (event == 'Complete') {
+ this.transport.onreadystatechange = MochiKit.Base.noop;
+ }
+ },
+
+/** @id Ajax.Request.prototype.dispatchException */
+ dispatchException: function (exception) {
+ (this.options.onException || MochiKit.Base.noop)(this, exception);
+ Ajax.Responders.dispatch('onException', this, exception);
+ }
+});
+
+/** @id Ajax.Updater */
+Ajax.Updater = function (container, url, options) {
+ this.__init__(container, url, options);
+};
+
+MochiKit.Base.update(Ajax.Updater.prototype, Ajax.Request.prototype);
+
+MochiKit.Base.update(Ajax.Updater.prototype, {
+ __init__: function (container, url, options) {
+ this.containers = {
+ success: container.success ? MochiKit.DOM.getElement(container.success) : MochiKit.DOM.getElement(container),
+ failure: container.failure ? MochiKit.DOM.getElement(container.failure) :
+ (container.success ? null : MochiKit.DOM.getElement(container))
+ }
+ this.transport = MochiKit.Async.getXMLHttpRequest();
+ this.setOptions(options);
+
+ var onComplete = this.options.onComplete || MochiKit.Base.noop;
+ this.options.onComplete = MochiKit.Base.bind(function (transport, object) {
+ this.updateContent();
+ onComplete(transport, object);
+ }, this);
+
+ this.request(url);
+ },
+
+/** @id Ajax.Updater.prototype.updateContent */
+ updateContent: function () {
+ var receiver = this.responseIsSuccess() ?
+ this.containers.success : this.containers.failure;
+ var response = this.transport.responseText;
+
+ if (!this.options.evalScripts) {
+ response = MochiKit.Base.stripScripts(response);
+ }
+
+ if (receiver) {
+ if (this.options.insertion) {
+ new this.options.insertion(receiver, response);
+ } else {
+ MochiKit.DOM.getElement(receiver).innerHTML =
+ MochiKit.Base.stripScripts(response);
+ setTimeout(function () {
+ MochiKit.Base.evalScripts(response);
+ }, 10);
+ }
+ }
+
+ if (this.responseIsSuccess()) {
+ if (this.onComplete) {
+ setTimeout(MochiKit.Base.bind(this.onComplete, this), 10);
+ }
+ }
+ }
+});
+
+/** @id Field */
+var Field = {
+
+/** @id clear */
+ clear: function () {
+ for (var i = 0; i < arguments.length; i++) {
+ MochiKit.DOM.getElement(arguments[i]).value = '';
+ }
+ },
+
+/** @id focus */
+ focus: function (element) {
+ MochiKit.DOM.getElement(element).focus();
+ },
+
+/** @id present */
+ present: function () {
+ for (var i = 0; i < arguments.length; i++) {
+ if (MochiKit.DOM.getElement(arguments[i]).value == '') {
+ return false;
+ }
+ }
+ return true;
+ },
+
+/** @id select */
+ select: function (element) {
+ MochiKit.DOM.getElement(element).select();
+ },
+
+/** @id activate */
+ activate: function (element) {
+ element = MochiKit.DOM.getElement(element);
+ element.focus();
+ if (element.select) {
+ element.select();
+ }
+ },
+
+/** @id scrollFreeActivate */
+ scrollFreeActivate: function (field) {
+ setTimeout(function () {
+ Field.activate(field);
+ }, 1);
+ }
+};
+
+
+/** @id Autocompleter */
+var Autocompleter = {};
+
+/** @id Autocompleter.Base */
+Autocompleter.Base = function () {};
+
+Autocompleter.Base.prototype = {
+
+/** @id Autocompleter.Base.prototype.baseInitialize */
+ baseInitialize: function (element, update, options) {
+ this.element = MochiKit.DOM.getElement(element);
+ this.update = MochiKit.DOM.getElement(update);
+ this.hasFocus = false;
+ this.changed = false;
+ this.active = false;
+ this.index = 0;
+ this.entryCount = 0;
+
+ if (this.setOptions) {
+ this.setOptions(options);
+ }
+ else {
+ this.options = options || {};
+ }
+
+ this.options.paramName = this.options.paramName || this.element.name;
+ this.options.tokens = this.options.tokens || [];
+ this.options.frequency = this.options.frequency || 0.4;
+ this.options.minChars = this.options.minChars || 1;
+ this.options.onShow = this.options.onShow || function (element, update) {
+ if (!update.style.position || update.style.position == 'absolute') {
+ update.style.position = 'absolute';
+ MochiKit.Position.clone(element, update, {
+ setHeight: false,
+ offsetTop: element.offsetHeight
+ });
+ }
+ MochiKit.Visual.appear(update, {duration:0.15});
+ };
+ this.options.onHide = this.options.onHide || function (element, update) {
+ MochiKit.Visual.fade(update, {duration: 0.15});
+ };
+
+ if (typeof(this.options.tokens) == 'string') {
+ this.options.tokens = new Array(this.options.tokens);
+ }
+
+ this.observer = null;
+
+ this.element.setAttribute('autocomplete', 'off');
+
+ MochiKit.Style.hideElement(this.update);
+
+ MochiKit.Signal.connect(this.element, 'onblur', this, this.onBlur);
+ MochiKit.Signal.connect(this.element, 'onkeypress', this, this.onKeyPress, this);
+ },
+
+/** @id Autocompleter.Base.prototype.show */
+ show: function () {
+ if (MochiKit.Style.getStyle(this.update, 'display') == 'none') {
+ this.options.onShow(this.element, this.update);
+ }
+ if (!this.iefix && /MSIE/.test(navigator.userAgent &&
+ (MochiKit.Style.getStyle(this.update, 'position') == 'absolute'))) {
+ new Insertion.After(this.update,
+ '<iframe id="' + this.update.id + '_iefix" '+
+ 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
+ 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
+ this.iefix = MochiKit.DOM.getElement(this.update.id + '_iefix');
+ }
+ if (this.iefix) {
+ setTimeout(MochiKit.Base.bind(this.fixIEOverlapping, this), 50);
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.fixIEOverlapping */
+ fixIEOverlapping: function () {
+ MochiKit.Position.clone(this.update, this.iefix);
+ this.iefix.style.zIndex = 1;
+ this.update.style.zIndex = 2;
+ MochiKit.Style.showElement(this.iefix);
+ },
+
+/** @id Autocompleter.Base.prototype.hide */
+ hide: function () {
+ this.stopIndicator();
+ if (MochiKit.Style.getStyle(this.update, 'display') != 'none') {
+ this.options.onHide(this.element, this.update);
+ }
+ if (this.iefix) {
+ MochiKit.Style.hideElement(this.iefix);
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.startIndicator */
+ startIndicator: function () {
+ if (this.options.indicator) {
+ MochiKit.Style.showElement(this.options.indicator);
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.stopIndicator */
+ stopIndicator: function () {
+ if (this.options.indicator) {
+ MochiKit.Style.hideElement(this.options.indicator);
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.onKeyPress */
+ onKeyPress: function (event) {
+ if (this.active) {
+ if (event.key().string == "KEY_TAB" || event.key().string == "KEY_RETURN") {
+ this.selectEntry();
+ MochiKit.Event.stop(event);
+ } else if (event.key().string == "KEY_ESCAPE") {
+ this.hide();
+ this.active = false;
+ MochiKit.Event.stop(event);
+ return;
+ } else if (event.key().string == "KEY_LEFT" || event.key().string == "KEY_RIGHT") {
+ return;
+ } else if (event.key().string == "KEY_UP") {
+ this.markPrevious();
+ this.render();
+ if (/AppleWebKit'/.test(navigator.appVersion)) {
+ event.stop();
+ }
+ return;
+ } else if (event.key().string == "KEY_DOWN") {
+ this.markNext();
+ this.render();
+ if (/AppleWebKit'/.test(navigator.appVersion)) {
+ event.stop();
+ }
+ return;
+ }
+ } else {
+ if (event.key().string == "KEY_TAB" || event.key().string == "KEY_RETURN") {
+ return;
+ }
+ }
+
+ this.changed = true;
+ this.hasFocus = true;
+
+ if (this.observer) {
+ clearTimeout(this.observer);
+ }
+ this.observer = setTimeout(MochiKit.Base.bind(this.onObserverEvent, this),
+ this.options.frequency*1000);
+ },
+
+/** @id Autocompleter.Base.prototype.findElement */
+ findElement: function (event, tagName) {
+ var element = event.target;
+ while (element.parentNode && (!element.tagName ||
+ (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
+ element = element.parentNode;
+ }
+ return element;
+ },
+
+/** @id Autocompleter.Base.prototype.hover */
+ onHover: function (event) {
+ var element = this.findElement(event, 'LI');
+ if (this.index != element.autocompleteIndex) {
+ this.index = element.autocompleteIndex;
+ this.render();
+ }
+ event.stop();
+ },
+
+/** @id Autocompleter.Base.prototype.onClick */
+ onClick: function (event) {
+ var element = this.findElement(event, 'LI');
+ this.index = element.autocompleteIndex;
+ this.selectEntry();
+ this.hide();
+ },
+
+/** @id Autocompleter.Base.prototype.onBlur */
+ onBlur: function (event) {
+ // needed to make click events working
+ setTimeout(MochiKit.Base.bind(this.hide, this), 250);
+ this.hasFocus = false;
+ this.active = false;
+ },
+
+/** @id Autocompleter.Base.prototype.render */
+ render: function () {
+ if (this.entryCount > 0) {
+ for (var i = 0; i < this.entryCount; i++) {
+ this.index == i ?
+ MochiKit.DOM.addElementClass(this.getEntry(i), 'selected') :
+ MochiKit.DOM.removeElementClass(this.getEntry(i), 'selected');
+ }
+ if (this.hasFocus) {
+ this.show();
+ this.active = true;
+ }
+ } else {
+ this.active = false;
+ this.hide();
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.markPrevious */
+ markPrevious: function () {
+ if (this.index > 0) {
+ this.index--
+ } else {
+ this.index = this.entryCount-1;
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.markNext */
+ markNext: function () {
+ if (this.index < this.entryCount-1) {
+ this.index++
+ } else {
+ this.index = 0;
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.getEntry */
+ getEntry: function (index) {
+ return this.update.firstChild.childNodes[index];
+ },
+
+/** @id Autocompleter.Base.prototype.getCurrentEntry */
+ getCurrentEntry: function () {
+ return this.getEntry(this.index);
+ },
+
+/** @id Autocompleter.Base.prototype.selectEntry */
+ selectEntry: function () {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ },
+
+/** @id Autocompleter.Base.prototype.collectTextNodesIgnoreClass */
+ collectTextNodesIgnoreClass: function (element, className) {
+ return MochiKit.Base.flattenArray(MochiKit.Base.map(function (node) {
+ if (node.nodeType == 3) {
+ return node.nodeValue;
+ } else if (node.hasChildNodes() && !MochiKit.DOM.hasElementClass(node, className)) {
+ return this.collectTextNodesIgnoreClass(node, className);
+ }
+ return '';
+ }, MochiKit.DOM.getElement(element).childNodes)).join('');
+ },
+
+/** @id Autocompleter.Base.prototype.updateElement */
+ updateElement: function (selectedElement) {
+ if (this.options.updateElement) {
+ this.options.updateElement(selectedElement);
+ return;
+ }
+ var value = '';
+ if (this.options.select) {
+ var nodes = document.getElementsByClassName(this.options.select, selectedElement) || [];
+ if (nodes.length > 0) {
+ value = MochiKit.DOM.scrapeText(nodes[0]);
+ }
+ } else {
+ value = this.collectTextNodesIgnoreClass(selectedElement, 'informal');
+ }
+ var lastTokenPos = this.findLastToken();
+ if (lastTokenPos != -1) {
+ var newValue = this.element.value.substr(0, lastTokenPos + 1);
+ var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
+ if (whitespace) {
+ newValue += whitespace[0];
+ }
+ this.element.value = newValue + value;
+ } else {
+ this.element.value = value;
+ }
+ this.element.focus();
+
+ if (this.options.afterUpdateElement) {
+ this.options.afterUpdateElement(this.element, selectedElement);
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.updateChoices */
+ updateChoices: function (choices) {
+ if (!this.changed && this.hasFocus) {
+ this.update.innerHTML = choices;
+ var d = MochiKit.DOM;
+ d.removeEmptyTextNodes(this.update);
+ d.removeEmptyTextNodes(this.update.firstChild);
+
+ if (this.update.firstChild && this.update.firstChild.childNodes) {
+ this.entryCount = this.update.firstChild.childNodes.length;
+ for (var i = 0; i < this.entryCount; i++) {
+ var entry = this.getEntry(i);
+ entry.autocompleteIndex = i;
+ this.addObservers(entry);
+ }
+ } else {
+ this.entryCount = 0;
+ }
+
+ this.stopIndicator();
+
+ this.index = 0;
+ this.render();
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.addObservers */
+ addObservers: function (element) {
+ MochiKit.Signal.connect(element, 'onmouseover', this, this.onHover);
+ MochiKit.Signal.connect(element, 'onclick', this, this.onClick);
+ },
+
+/** @id Autocompleter.Base.prototype.onObserverEvent */
+ onObserverEvent: function () {
+ this.changed = false;
+ if (this.getToken().length >= this.options.minChars) {
+ this.startIndicator();
+ this.getUpdatedChoices();
+ } else {
+ this.active = false;
+ this.hide();
+ }
+ },
+
+/** @id Autocompleter.Base.prototype.getToken */
+ getToken: function () {
+ var tokenPos = this.findLastToken();
+ if (tokenPos != -1) {
+ var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
+ } else {
+ var ret = this.element.value;
+ }
+ return /\n/.test(ret) ? '' : ret;
+ },
+
+/** @id Autocompleter.Base.prototype.findLastToken */
+ findLastToken: function () {
+ var lastTokenPos = -1;
+
+ for (var i = 0; i < this.options.tokens.length; i++) {
+ var thisTokenPos = this.element.value.lastIndexOf(this.options.tokens[i]);
+ if (thisTokenPos > lastTokenPos) {
+ lastTokenPos = thisTokenPos;
+ }
+ }
+ return lastTokenPos;
+ }
+}
+
+/** @id Ajax.Autocompleter */
+Ajax.Autocompleter = function (element, update, url, options) {
+ this.__init__(element, update, url, options);
+};
+
+MochiKit.Base.update(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype);
+
+MochiKit.Base.update(Ajax.Autocompleter.prototype, {
+ __init__: function (element, update, url, options) {
+ this.baseInitialize(element, update, options);
+ this.options.asynchronous = true;
+ this.options.onComplete = MochiKit.Base.bind(this.onComplete, this);
+ this.options.defaultParams = this.options.parameters || null;
+ this.url = url;
+ },
+
+/** @id Ajax.Autocompleter.prototype.getUpdatedChoices */
+ getUpdatedChoices: function () {
+ var entry = encodeURIComponent(this.options.paramName) + '=' +
+ encodeURIComponent(this.getToken());
+
+ this.options.parameters = this.options.callback ?
+ this.options.callback(this.element, entry) : entry;
+
+ if (this.options.defaultParams) {
+ this.options.parameters += '&' + this.options.defaultParams;
+ }
+ new Ajax.Request(this.url, this.options);
+ },
+
+/** @id Ajax.Autocompleter.prototype.onComplete */
+ onComplete: function (request) {
+ this.updateChoices(request.responseText);
+ }
+});
+
+/***
+
+The local array autocompleter. Used when you'd prefer to
+inject an array of autocompletion options into the page, rather
+than sending out Ajax queries, which can be quite slow sometimes.
+
+The constructor takes four parameters. The first two are, as usual,
+the id of the monitored textbox, and id of the autocompletion menu.
+The third is the array you want to autocomplete from, and the fourth
+is the options block.
+
+Extra local autocompletion options:
+- choices - How many autocompletion choices to offer
+
+- partialSearch - If false, the autocompleter will match entered
+ text only at the beginning of strings in the
+ autocomplete array. Defaults to true, which will
+ match text at the beginning of any *word* in the
+ strings in the autocomplete array. If you want to
+ search anywhere in the string, additionally set
+ the option fullSearch to true (default: off).
+
+- fullSsearch - Search anywhere in autocomplete array strings.
+
+- partialChars - How many characters to enter before triggering
+ a partial match (unlike minChars, which defines
+ how many characters are required to do any match
+ at all). Defaults to 2.
+
+- ignoreCase - Whether to ignore case when autocompleting.
+ Defaults to true.
+
+It's possible to pass in a custom function as the 'selector'
+option, if you prefer to write your own autocompletion logic.
+In that case, the other options above will not apply unless
+you support them.
+
+***/
+
+/** @id Autocompleter.Local */
+Autocompleter.Local = function (element, update, array, options) {
+ this.__init__(element, update, array, options);
+};
+
+MochiKit.Base.update(Autocompleter.Local.prototype, Autocompleter.Base.prototype);
+
+MochiKit.Base.update(Autocompleter.Local.prototype, {
+ __init__: function (element, update, array, options) {
+ this.baseInitialize(element, update, options);
+ this.options.array = array;
+ },
+
+/** @id Autocompleter.Local.prototype.getUpdatedChoices */
+ getUpdatedChoices: function () {
+ this.updateChoices(this.options.selector(this));
+ },
+
+/** @id Autocompleter.Local.prototype.setOptions */
+ setOptions: function (options) {
+ this.options = MochiKit.Base.update({
+ choices: 10,
+ partialSearch: true,
+ partialChars: 2,
+ ignoreCase: true,
+ fullSearch: false,
+ selector: function (instance) {
+ var ret = []; // Beginning matches
+ var partial = []; // Inside matches
+ var entry = instance.getToken();
+ var count = 0;
+
+ for (var i = 0; i < instance.options.array.length &&
+ ret.length < instance.options.choices ; i++) {
+
+ var elem = instance.options.array[i];
+ var foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase()) :
+ elem.indexOf(entry);
+
+ while (foundPos != -1) {
+ if (foundPos === 0 && elem.length != entry.length) {
+ ret.push('<li><strong>' + elem.substr(0, entry.length) + '</strong>' +
+ elem.substr(entry.length) + '</li>');
+ break;
+ } else if (entry.length >= instance.options.partialChars &&
+ instance.options.partialSearch && foundPos != -1) {
+ if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos - 1, 1))) {
+ partial.push('<li>' + elem.substr(0, foundPos) + '<strong>' +
+ elem.substr(foundPos, entry.length) + '</strong>' + elem.substr(
+ foundPos + entry.length) + '</li>');
+ break;
+ }
+ }
+
+ foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
+ elem.indexOf(entry, foundPos + 1);
+
+ }
+ }
+ if (partial.length) {
+ ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
+ }
+ return '<ul>' + ret.join('') + '</ul>';
+ }
+ }, options || {});
+ }
+});
+
+/***
+
+AJAX in-place editor
+
+see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
+
+Use this if you notice weird scrolling problems on some browsers,
+the DOM might be a bit confused when this gets called so do this
+waits 1 ms (with setTimeout) until it does the activation
+
+***/
+
+/** @id Ajax.InPlaceEditor */
+Ajax.InPlaceEditor = function (element, url, options) {
+ this.__init__(element, url, options);
+};
+
+/** @id Ajax.InPlaceEditor.defaultHighlightColor */
+Ajax.InPlaceEditor.defaultHighlightColor = '#FFFF99';
+
+Ajax.InPlaceEditor.prototype = {
+ __init__: function (element, url, options) {
+ this.url = url;
+ this.element = MochiKit.DOM.getElement(element);
+
+ this.options = MochiKit.Base.update({
+ okButton: true,
+ okText: 'ok',
+ cancelLink: true,
+ cancelText: 'cancel',
+ savingText: 'Saving...',
+ clickToEditText: 'Click to edit',
+ okText: 'ok',
+ rows: 1,
+ onComplete: function (transport, element) {
+ new MochiKit.Visual.Highlight(element, {startcolor: this.options.highlightcolor});
+ },
+ onFailure: function (transport) {
+ alert('Error communicating with the server: ' + MochiKit.Base.stripTags(transport.responseText));
+ },
+ callback: function (form) {
+ return MochiKit.DOM.formContents(form);
+ },
+ handleLineBreaks: true,
+ loadingText: 'Loading...',
+ savingClassName: 'inplaceeditor-saving',
+ loadingClassName: 'inplaceeditor-loading',
+ formClassName: 'inplaceeditor-form',
+ highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
+ highlightendcolor: '#FFFFFF',
+ externalControl: null,
+ submitOnBlur: false,
+ ajaxOptions: {}
+ }, options || {});
+
+ if (!this.options.formId && this.element.id) {
+ this.options.formId = this.element.id + '-inplaceeditor';
+ if (MochiKit.DOM.getElement(this.options.formId)) {
+ // there's already a form with that name, don't specify an id
+ this.options.formId = null;
+ }
+ }
+
+ if (this.options.externalControl) {
+ this.options.externalControl = MochiKit.DOM.getElement(this.options.externalControl);
+ }
+
+ this.originalBackground = MochiKit.Style.getStyle(this.element, 'background-color');
+ if (!this.originalBackground) {
+ this.originalBackground = 'transparent';
+ }
+
+ this.element.title = this.options.clickToEditText;
+
+ this.onclickListener = MochiKit.Signal.connect(this.element, 'onclick', this, this.enterEditMode);
+ this.mouseoverListener = MochiKit.Signal.connect(this.element, 'onmouseover', this, this.enterHover);
+ this.mouseoutListener = MochiKit.Signal.connect(this.element, 'onmouseout', this, this.leaveHover);
+ if (this.options.externalControl) {
+ this.onclickListenerExternal = MochiKit.Signal.connect(this.options.externalControl,
+ 'onclick', this, this.enterEditMode);
+ this.mouseoverListenerExternal = MochiKit.Signal.connect(this.options.externalControl,
+ 'onmouseover', this, this.enterHover);
+ this.mouseoutListenerExternal = MochiKit.Signal.connect(this.options.externalControl,
+ 'onmouseout', this, this.leaveHover);
+ }
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.enterEditMode */
+ enterEditMode: function (evt) {
+ if (this.saving) {
+ return;
+ }
+ if (this.editing) {
+ return;
+ }
+ this.editing = true;
+ this.onEnterEditMode();
+ if (this.options.externalControl) {
+ MochiKit.Style.hideElement(this.options.externalControl);
+ }
+ MochiKit.Style.hideElement(this.element);
+ this.createForm();
+ this.element.parentNode.insertBefore(this.form, this.element);
+ Field.scrollFreeActivate(this.editField);
+ // stop the event to avoid a page refresh in Safari
+ if (evt) {
+ evt.stop();
+ }
+ return false;
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.createForm */
+ createForm: function () {
+ this.form = document.createElement('form');
+ this.form.id = this.options.formId;
+ MochiKit.DOM.addElementClass(this.form, this.options.formClassName)
+ this.form.onsubmit = MochiKit.Base.bind(this.onSubmit, this);
+
+ this.createEditField();
+
+ if (this.options.textarea) {
+ var br = document.createElement('br');
+ this.form.appendChild(br);
+ }
+
+ if (this.options.okButton) {
+ okButton = document.createElement('input');
+ okButton.type = 'submit';
+ okButton.value = this.options.okText;
+ this.form.appendChild(okButton);
+ }
+
+ if (this.options.cancelLink) {
+ cancelLink = document.createElement('a');
+ cancelLink.href = '#';
+ cancelLink.appendChild(document.createTextNode(this.options.cancelText));
+ cancelLink.onclick = MochiKit.Base.bind(this.onclickCancel, this);
+ this.form.appendChild(cancelLink);
+ }
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.hasHTMLLineBreaks */
+ hasHTMLLineBreaks: function (string) {
+ if (!this.options.handleLineBreaks) {
+ return false;
+ }
+ return string.match(/<br/i) || string.match(/<p>/i);
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.convertHTMLLineBreaks */
+ convertHTMLLineBreaks: function (string) {
+ return string.replace(/<br>/gi, '\n').replace(/<br\/>/gi, '\n').replace(/<\/p>/gi, '\n').replace(/<p>/gi, '');
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.createEditField */
+ createEditField: function () {
+ var text;
+ if (this.options.loadTextURL) {
+ text = this.options.loadingText;
+ } else {
+ text = this.getText();
+ }
+
+ var obj = this;
+
+ if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
+ this.options.textarea = false;
+ var textField = document.createElement('input');
+ textField.obj = this;
+ textField.type = 'text';
+ textField.name = 'value';
+ textField.value = text;
+ textField.style.backgroundColor = this.options.highlightcolor;
+ var size = this.options.size || this.options.cols || 0;
+ if (size !== 0) {
+ textField.size = size;
+ }
+ if (this.options.submitOnBlur) {
+ textField.onblur = MochiKit.Base.bind(this.onSubmit, this);
+ }
+ this.editField = textField;
+ } else {
+ this.options.textarea = true;
+ var textArea = document.createElement('textarea');
+ textArea.obj = this;
+ textArea.name = 'value';
+ textArea.value = this.convertHTMLLineBreaks(text);
+ textArea.rows = this.options.rows;
+ textArea.cols = this.options.cols || 40;
+ if (this.options.submitOnBlur) {
+ textArea.onblur = MochiKit.Base.bind(this.onSubmit, this);
+ }
+ this.editField = textArea;
+ }
+
+ if (this.options.loadTextURL) {
+ this.loadExternalText();
+ }
+ this.form.appendChild(this.editField);
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.getText */
+ getText: function () {
+ return this.element.innerHTML;
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.loadExternalText */
+ loadExternalText: function () {
+ MochiKit.DOM.addElementClass(this.form, this.options.loadingClassName);
+ this.editField.disabled = true;
+ new Ajax.Request(
+ this.options.loadTextURL,
+ MochiKit.Base.update({
+ asynchronous: true,
+ onComplete: MochiKit.Base.bind(this.onLoadedExternalText, this)
+ }, this.options.ajaxOptions)
+ );
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onLoadedExternalText */
+ onLoadedExternalText: function (transport) {
+ MochiKit.DOM.removeElementClass(this.form, this.options.loadingClassName);
+ this.editField.disabled = false;
+ this.editField.value = MochiKit.Base.stripTags(transport);
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onclickCancel */
+ onclickCancel: function () {
+ this.onComplete();
+ this.leaveEditMode();
+ return false;
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onFailure */
+ onFailure: function (transport) {
+ this.options.onFailure(transport);
+ if (this.oldInnerHTML) {
+ this.element.innerHTML = this.oldInnerHTML;
+ this.oldInnerHTML = null;
+ }
+ return false;
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onSubmit */
+ onSubmit: function () {
+ // onLoading resets these so we need to save them away for the Ajax call
+ var form = this.form;
+ var value = this.editField.value;
+
+ // do this first, sometimes the ajax call returns before we get a
+ // chance to switch on Saving which means this will actually switch on
+ // Saving *after* we have left edit mode causing Saving to be
+ // displayed indefinitely
+ this.onLoading();
+
+ new Ajax.Updater(
+ {
+ success: this.element,
+ // dont update on failure (this could be an option)
+ failure: null
+ },
+ this.url,
+ MochiKit.Base.update({
+ parameters: this.options.callback(form, value),
+ onComplete: MochiKit.Base.bind(this.onComplete, this),
+ onFailure: MochiKit.Base.bind(this.onFailure, this)
+ }, this.options.ajaxOptions)
+ );
+ // stop the event to avoid a page refresh in Safari
+ if (arguments.length > 1) {
+ arguments[0].stop();
+ }
+ return false;
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onLoading */
+ onLoading: function () {
+ this.saving = true;
+ this.removeForm();
+ this.leaveHover();
+ this.showSaving();
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onSaving */
+ showSaving: function () {
+ this.oldInnerHTML = this.element.innerHTML;
+ this.element.innerHTML = this.options.savingText;
+ MochiKit.DOM.addElementClass(this.element, this.options.savingClassName);
+ this.element.style.backgroundColor = this.originalBackground;
+ MochiKit.Style.showElement(this.element);
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.removeForm */
+ removeForm: function () {
+ if (this.form) {
+ if (this.form.parentNode) {
+ MochiKit.DOM.removeElement(this.form);
+ }
+ this.form = null;
+ }
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.enterHover */
+ enterHover: function () {
+ if (this.saving) {
+ return;
+ }
+ this.element.style.backgroundColor = this.options.highlightcolor;
+ if (this.effect) {
+ this.effect.cancel();
+ }
+ MochiKit.DOM.addElementClass(this.element, this.options.hoverClassName)
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.leaveHover */
+ leaveHover: function () {
+ if (this.options.backgroundColor) {
+ this.element.style.backgroundColor = this.oldBackground;
+ }
+ MochiKit.DOM.removeElementClass(this.element, this.options.hoverClassName)
+ if (this.saving) {
+ return;
+ }
+ this.effect = new MochiKit.Visual.Highlight(this.element, {
+ startcolor: this.options.highlightcolor,
+ endcolor: this.options.highlightendcolor,
+ restorecolor: this.originalBackground
+ });
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.leaveEditMode */
+ leaveEditMode: function () {
+ MochiKit.DOM.removeElementClass(this.element, this.options.savingClassName);
+ this.removeForm();
+ this.leaveHover();
+ this.element.style.backgroundColor = this.originalBackground;
+ MochiKit.Style.showElement(this.element);
+ if (this.options.externalControl) {
+ MochiKit.Style.showElement(this.options.externalControl);
+ }
+ this.editing = false;
+ this.saving = false;
+ this.oldInnerHTML = null;
+ this.onLeaveEditMode();
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onComplete */
+ onComplete: function (transport) {
+ this.leaveEditMode();
+ MochiKit.Base.bind(this.options.onComplete, this)(transport, this.element);
+ },
+
+/** @id Ajax.InPlaceEditor.prototype.onEnterEditMode */
+ onEnterEditMode: function () {},
+
+/** @id Ajax.InPlaceEditor.prototype.onLeaveEditMode */
+ onLeaveEditMode: function () {},
+
+ /** @id Ajax.InPlaceEditor.prototype.dispose */
+ dispose: function () {
+ if (this.oldInnerHTML) {
+ this.element.innerHTML = this.oldInnerHTML;
+ }
+ this.leaveEditMode();
+ MochiKit.Signal.disconnect(this.onclickListener);
+ MochiKit.Signal.disconnect(this.mouseoverListener);
+ MochiKit.Signal.disconnect(this.mouseoutListener);
+ if (this.options.externalControl) {
+ MochiKit.Signal.disconnect(this.onclickListenerExternal);
+ MochiKit.Signal.disconnect(this.mouseoverListenerExternal);
+ MochiKit.Signal.disconnect(this.mouseoutListenerExternal);
+ }
+ }
+};
+
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/DOM.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/DOM.js
new file mode 100644
index 0000000000..02fe5bfb9c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/DOM.js
@@ -0,0 +1,1276 @@
+/***
+
+MochiKit.DOM 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide("MochiKit.DOM");
+ dojo.require("MochiKit.Base");
+}
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.DOM depends on MochiKit.Base!";
+}
+
+if (typeof(MochiKit.DOM) == 'undefined') {
+ MochiKit.DOM = {};
+}
+
+MochiKit.DOM.NAME = "MochiKit.DOM";
+MochiKit.DOM.VERSION = "1.4";
+MochiKit.DOM.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+MochiKit.DOM.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.DOM.EXPORT = [
+ "removeEmptyTextNodes",
+ "formContents",
+ "currentWindow",
+ "currentDocument",
+ "withWindow",
+ "withDocument",
+ "registerDOMConverter",
+ "coerceToDOM",
+ "createDOM",
+ "createDOMFunc",
+ "isChildNode",
+ "getNodeAttribute",
+ "removeNodeAttribute",
+ "setNodeAttribute",
+ "updateNodeAttributes",
+ "appendChildNodes",
+ "insertSiblingNodesAfter",
+ "insertSiblingNodesBefore",
+ "replaceChildNodes",
+ "removeElement",
+ "swapDOM",
+ "BUTTON",
+ "TT",
+ "PRE",
+ "H1",
+ "H2",
+ "H3",
+ "BR",
+ "CANVAS",
+ "HR",
+ "LABEL",
+ "TEXTAREA",
+ "FORM",
+ "STRONG",
+ "SELECT",
+ "OPTION",
+ "OPTGROUP",
+ "LEGEND",
+ "FIELDSET",
+ "P",
+ "UL",
+ "OL",
+ "LI",
+ "TD",
+ "TR",
+ "THEAD",
+ "TBODY",
+ "TFOOT",
+ "TABLE",
+ "TH",
+ "INPUT",
+ "SPAN",
+ "A",
+ "DIV",
+ "IMG",
+ "getElement",
+ "$",
+ "getElementsByTagAndClassName",
+ "addToCallStack",
+ "addLoadEvent",
+ "focusOnLoad",
+ "setElementClass",
+ "toggleElementClass",
+ "addElementClass",
+ "removeElementClass",
+ "swapElementClass",
+ "hasElementClass",
+ "escapeHTML",
+ "toHTML",
+ "emitHTML",
+ "scrapeText",
+ "isParent",
+ "getFirstParentByTagAndClassName",
+ "makeClipping",
+ "undoClipping",
+ "makePositioned",
+ "undoPositioned",
+ "getFirstElementByTagAndClassName"
+];
+
+MochiKit.DOM.EXPORT_OK = [
+ "domConverters"
+];
+
+MochiKit.DOM.DEPRECATED = [
+ ['computedStyle', 'MochiKit.Style.getStyle', '1.4'],
+ /** @id MochiKit.DOM.elementDimensions */
+ ['elementDimensions', 'MochiKit.Style.getElementDimensions', '1.4'],
+ /** @id MochiKit.DOM.elementPosition */
+ ['elementPosition', 'MochiKit.Style.getElementPosition', '1.4'],
+ ['hideElement', 'MochiKit.Style.hideElement', '1.4'],
+ /** @id MochiKit.DOM.setElementDimensions */
+ ['setElementDimensions', 'MochiKit.Style.setElementDimensions', '1.4'],
+ /** @id MochiKit.DOM.setElementPosition */
+ ['setElementPosition', 'MochiKit.Style.setElementPosition', '1.4'],
+ ['setDisplayForElement', 'MochiKit.Style.setDisplayForElement', '1.4'],
+ /** @id MochiKit.DOM.setOpacity */
+ ['setOpacity', 'MochiKit.Style.setOpacity', '1.4'],
+ ['showElement', 'MochiKit.Style.showElement', '1.4'],
+ /** @id MochiKit.DOM.Coordinates */
+ ['Coordinates', 'MochiKit.Style.Coordinates', '1.4'], // FIXME: broken
+ /** @id MochiKit.DOM.Dimensions */
+ ['Dimensions', 'MochiKit.Style.Dimensions', '1.4'] // FIXME: broken
+];
+
+/** @id MochiKit.DOM.getViewportDimensions */
+MochiKit.DOM.getViewportDimensions = new Function('' +
+ 'if (!MochiKit["Style"]) {' +
+ ' throw new Error("This function has been deprecated and depends on MochiKit.Style.");' +
+ '}' +
+ 'return MochiKit.Style.getViewportDimensions.apply(this, arguments);');
+
+MochiKit.Base.update(MochiKit.DOM, {
+
+ /** @id MochiKit.DOM.currentWindow */
+ currentWindow: function () {
+ return MochiKit.DOM._window;
+ },
+
+ /** @id MochiKit.DOM.currentDocument */
+ currentDocument: function () {
+ return MochiKit.DOM._document;
+ },
+
+ /** @id MochiKit.DOM.withWindow */
+ withWindow: function (win, func) {
+ var self = MochiKit.DOM;
+ var oldDoc = self._document;
+ var oldWin = self._window;
+ var rval;
+ try {
+ self._window = win;
+ self._document = win.document;
+ rval = func();
+ } catch (e) {
+ self._window = oldWin;
+ self._document = oldDoc;
+ throw e;
+ }
+ self._window = oldWin;
+ self._document = oldDoc;
+ return rval;
+ },
+
+ /** @id MochiKit.DOM.formContents */
+ formContents: function (elem/* = document.body */) {
+ var names = [];
+ var values = [];
+ var m = MochiKit.Base;
+ var self = MochiKit.DOM;
+ if (typeof(elem) == "undefined" || elem === null) {
+ elem = self._document.body;
+ } else {
+ elem = self.getElement(elem);
+ }
+ m.nodeWalk(elem, function (elem) {
+ var name = elem.name;
+ if (m.isNotEmpty(name)) {
+ var tagName = elem.tagName.toUpperCase();
+ if (tagName === "INPUT"
+ && (elem.type == "radio" || elem.type == "checkbox")
+ && !elem.checked
+ ) {
+ return null;
+ }
+ if (tagName === "SELECT") {
+ if (elem.type == "select-one") {
+ if (elem.selectedIndex >= 0) {
+ var opt = elem.options[elem.selectedIndex];
+ var v = opt.value;
+ if (!v) {
+ var h = opt.outerHTML;
+ // internet explorer sure does suck.
+ if (h && !h.match(/^[^>]+\svalue\s*=/i)) {
+ v = opt.text;
+ }
+ }
+ names.push(name);
+ values.push(v);
+ return null;
+ }
+ // no form elements?
+ names.push(name);
+ values.push("");
+ return null;
+ } else {
+ var opts = elem.options;
+ if (!opts.length) {
+ names.push(name);
+ values.push("");
+ return null;
+ }
+ for (var i = 0; i < opts.length; i++) {
+ var opt = opts[i];
+ if (!opt.selected) {
+ continue;
+ }
+ var v = opt.value;
+ if (!v) {
+ var h = opt.outerHTML;
+ // internet explorer sure does suck.
+ if (h && !h.match(/^[^>]+\svalue\s*=/i)) {
+ v = opt.text;
+ }
+ }
+ names.push(name);
+ values.push(v);
+ }
+ return null;
+ }
+ }
+ if (tagName === "FORM" || tagName === "P" || tagName === "SPAN"
+ || tagName === "DIV"
+ ) {
+ return elem.childNodes;
+ }
+ names.push(name);
+ values.push(elem.value || '');
+ return null;
+ }
+ return elem.childNodes;
+ });
+ return [names, values];
+ },
+
+ /** @id MochiKit.DOM.withDocument */
+ withDocument: function (doc, func) {
+ var self = MochiKit.DOM;
+ var oldDoc = self._document;
+ var rval;
+ try {
+ self._document = doc;
+ rval = func();
+ } catch (e) {
+ self._document = oldDoc;
+ throw e;
+ }
+ self._document = oldDoc;
+ return rval;
+ },
+
+ /** @id MochiKit.DOM.registerDOMConverter */
+ registerDOMConverter: function (name, check, wrap, /* optional */override) {
+ MochiKit.DOM.domConverters.register(name, check, wrap, override);
+ },
+
+ /** @id MochiKit.DOM.coerceToDOM */
+ coerceToDOM: function (node, ctx) {
+ var m = MochiKit.Base;
+ var im = MochiKit.Iter;
+ var self = MochiKit.DOM;
+ if (im) {
+ var iter = im.iter;
+ var repeat = im.repeat;
+ var map = m.map;
+ }
+ var domConverters = self.domConverters;
+ var coerceToDOM = arguments.callee;
+ var NotFound = m.NotFound;
+ while (true) {
+ if (typeof(node) == 'undefined' || node === null) {
+ return null;
+ }
+ // this is a safari childNodes object, avoiding crashes w/ attr
+ // lookup
+ if (typeof(node) == "function" &&
+ typeof(node.length) == "number" &&
+ !(node instanceof Function)) {
+ node = im.list(node);
+ }
+ if (typeof(node.nodeType) != 'undefined' && node.nodeType > 0) {
+ return node;
+ }
+ if (typeof(node) == 'number' || typeof(node) == 'boolean') {
+ node = node.toString();
+ // FALL THROUGH
+ }
+ if (typeof(node) == 'string') {
+ return self._document.createTextNode(node);
+ }
+ if (typeof(node.__dom__) == 'function') {
+ node = node.__dom__(ctx);
+ continue;
+ }
+ if (typeof(node.dom) == 'function') {
+ node = node.dom(ctx);
+ continue;
+ }
+ if (typeof(node) == 'function') {
+ node = node.apply(ctx, [ctx]);
+ continue;
+ }
+
+ if (im) {
+ // iterable
+ var iterNodes = null;
+ try {
+ iterNodes = iter(node);
+ } catch (e) {
+ // pass
+ }
+ if (iterNodes) {
+ return map(coerceToDOM, iterNodes, repeat(ctx));
+ }
+ }
+
+ // adapter
+ try {
+ node = domConverters.match(node, ctx);
+ continue;
+ } catch (e) {
+ if (e != NotFound) {
+ throw e;
+ }
+ }
+
+ // fallback
+ return self._document.createTextNode(node.toString());
+ }
+ // mozilla warnings aren't too bright
+ return undefined;
+ },
+
+ /** @id MochiKit.DOM.isChildNode */
+ isChildNode: function (node, maybeparent) {
+ var self = MochiKit.DOM;
+ if (typeof(node) == "string") {
+ node = self.getElement(node);
+ }
+ if (typeof(maybeparent) == "string") {
+ maybeparent = self.getElement(maybeparent);
+ }
+ if (node === maybeparent) {
+ return true;
+ }
+ while (node && node.tagName.toUpperCase() != "BODY") {
+ node = node.parentNode;
+ if (node === maybeparent) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ /** @id MochiKit.DOM.setNodeAttribute */
+ setNodeAttribute: function (node, attr, value) {
+ var o = {};
+ o[attr] = value;
+ try {
+ return MochiKit.DOM.updateNodeAttributes(node, o);
+ } catch (e) {
+ // pass
+ }
+ return null;
+ },
+
+ /** @id MochiKit.DOM.getNodeAttribute */
+ getNodeAttribute: function (node, attr) {
+ var self = MochiKit.DOM;
+ var rename = self.attributeArray.renames[attr];
+ node = self.getElement(node);
+ try {
+ if (rename) {
+ return node[rename];
+ }
+ return node.getAttribute(attr);
+ } catch (e) {
+ // pass
+ }
+ return null;
+ },
+
+ /** @id MochiKit.DOM.removeNodeAttribute */
+ removeNodeAttribute: function (node, attr) {
+ var self = MochiKit.DOM;
+ var rename = self.attributeArray.renames[attr];
+ node = self.getElement(node);
+ try {
+ if (rename) {
+ return node[rename];
+ }
+ return node.removeAttribute(attr);
+ } catch (e) {
+ // pass
+ }
+ return null;
+ },
+
+ /** @id MochiKit.DOM.updateNodeAttributes */
+ updateNodeAttributes: function (node, attrs) {
+ var elem = node;
+ var self = MochiKit.DOM;
+ if (typeof(node) == 'string') {
+ elem = self.getElement(node);
+ }
+ if (attrs) {
+ var updatetree = MochiKit.Base.updatetree;
+ if (self.attributeArray.compliant) {
+ // not IE, good.
+ for (var k in attrs) {
+ var v = attrs[k];
+ if (typeof(v) == 'object' && typeof(elem[k]) == 'object') {
+ if (k == "style" && MochiKit.Style) {
+ MochiKit.Style.setStyle(elem, v);
+ } else {
+ updatetree(elem[k], v);
+ }
+ } else if (k.substring(0, 2) == "on") {
+ if (typeof(v) == "string") {
+ v = new Function(v);
+ }
+ elem[k] = v;
+ } else {
+ elem.setAttribute(k, v);
+ }
+ }
+ } else {
+ // IE is insane in the membrane
+ var renames = self.attributeArray.renames;
+ for (var k in attrs) {
+ v = attrs[k];
+ var renamed = renames[k];
+ if (k == "style" && typeof(v) == "string") {
+ elem.style.cssText = v;
+ } else if (typeof(renamed) == "string") {
+ elem[renamed] = v;
+ } else if (typeof(elem[k]) == 'object'
+ && typeof(v) == 'object') {
+ if (k == "style" && MochiKit.Style) {
+ MochiKit.Style.setStyle(elem, v);
+ } else {
+ updatetree(elem[k], v);
+ }
+ } else if (k.substring(0, 2) == "on") {
+ if (typeof(v) == "string") {
+ v = new Function(v);
+ }
+ elem[k] = v;
+ } else {
+ elem.setAttribute(k, v);
+ }
+ }
+ }
+ }
+ return elem;
+ },
+
+ /** @id MochiKit.DOM.appendChildNodes */
+ appendChildNodes: function (node/*, nodes...*/) {
+ var elem = node;
+ var self = MochiKit.DOM;
+ if (typeof(node) == 'string') {
+ elem = self.getElement(node);
+ }
+ var nodeStack = [
+ self.coerceToDOM(
+ MochiKit.Base.extend(null, arguments, 1),
+ elem
+ )
+ ];
+ var concat = MochiKit.Base.concat;
+ while (nodeStack.length) {
+ var n = nodeStack.shift();
+ if (typeof(n) == 'undefined' || n === null) {
+ // pass
+ } else if (typeof(n.nodeType) == 'number') {
+ elem.appendChild(n);
+ } else {
+ nodeStack = concat(n, nodeStack);
+ }
+ }
+ return elem;
+ },
+
+
+ /** @id MochiKit.DOM.insertSiblingNodesBefore */
+ insertSiblingNodesBefore: function (node/*, nodes...*/) {
+ var elem = node;
+ var self = MochiKit.DOM;
+ if (typeof(node) == 'string') {
+ elem = self.getElement(node);
+ }
+ var nodeStack = [
+ self.coerceToDOM(
+ MochiKit.Base.extend(null, arguments, 1),
+ elem
+ )
+ ];
+ var parentnode = elem.parentNode;
+ var concat = MochiKit.Base.concat;
+ while (nodeStack.length) {
+ var n = nodeStack.shift();
+ if (typeof(n) == 'undefined' || n === null) {
+ // pass
+ } else if (typeof(n.nodeType) == 'number') {
+ parentnode.insertBefore(n, elem);
+ } else {
+ nodeStack = concat(n, nodeStack);
+ }
+ }
+ return parentnode;
+ },
+
+ /** @id MochiKit.DOM.insertSiblingNodesAfter */
+ insertSiblingNodesAfter: function (node/*, nodes...*/) {
+ var elem = node;
+ var self = MochiKit.DOM;
+
+ if (typeof(node) == 'string') {
+ elem = self.getElement(node);
+ }
+ var nodeStack = [
+ self.coerceToDOM(
+ MochiKit.Base.extend(null, arguments, 1),
+ elem
+ )
+ ];
+
+ if (elem.nextSibling) {
+ return self.insertSiblingNodesBefore(elem.nextSibling, nodeStack);
+ }
+ else {
+ return self.appendChildNodes(elem.parentNode, nodeStack);
+ }
+ },
+
+ /** @id MochiKit.DOM.replaceChildNodes */
+ replaceChildNodes: function (node/*, nodes...*/) {
+ var elem = node;
+ var self = MochiKit.DOM;
+ if (typeof(node) == 'string') {
+ elem = self.getElement(node);
+ arguments[0] = elem;
+ }
+ var child;
+ while ((child = elem.firstChild)) {
+ elem.removeChild(child);
+ }
+ if (arguments.length < 2) {
+ return elem;
+ } else {
+ return self.appendChildNodes.apply(this, arguments);
+ }
+ },
+
+ /** @id MochiKit.DOM.createDOM */
+ createDOM: function (name, attrs/*, nodes... */) {
+ var elem;
+ var self = MochiKit.DOM;
+ var m = MochiKit.Base;
+ if (typeof(attrs) == "string" || typeof(attrs) == "number") {
+ var args = m.extend([name, null], arguments, 1);
+ return arguments.callee.apply(this, args);
+ }
+ if (typeof(name) == 'string') {
+ // Internet Explorer is dumb
+ var xhtml = self._xhtml;
+ if (attrs && !self.attributeArray.compliant) {
+ // http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/name_2.asp
+ var contents = "";
+ if ('name' in attrs) {
+ contents += ' name="' + self.escapeHTML(attrs.name) + '"';
+ }
+ if (name == 'input' && 'type' in attrs) {
+ contents += ' type="' + self.escapeHTML(attrs.type) + '"';
+ }
+ if (contents) {
+ name = "<" + name + contents + ">";
+ xhtml = false;
+ }
+ }
+ var d = self._document;
+ if (xhtml && d === document) {
+ elem = d.createElementNS("http://www.w3.org/1999/xhtml", name);
+ } else {
+ elem = d.createElement(name);
+ }
+ } else {
+ elem = name;
+ }
+ if (attrs) {
+ self.updateNodeAttributes(elem, attrs);
+ }
+ if (arguments.length <= 2) {
+ return elem;
+ } else {
+ var args = m.extend([elem], arguments, 2);
+ return self.appendChildNodes.apply(this, args);
+ }
+ },
+
+ /** @id MochiKit.DOM.createDOMFunc */
+ createDOMFunc: function (/* tag, attrs, *nodes */) {
+ var m = MochiKit.Base;
+ return m.partial.apply(
+ this,
+ m.extend([MochiKit.DOM.createDOM], arguments)
+ );
+ },
+
+ /** @id MochiKit.DOM.removeElement */
+ removeElement: function (elem) {
+ var e = MochiKit.DOM.getElement(elem);
+ e.parentNode.removeChild(e);
+ return e;
+ },
+
+ /** @id MochiKit.DOM.swapDOM */
+ swapDOM: function (dest, src) {
+ var self = MochiKit.DOM;
+ dest = self.getElement(dest);
+ var parent = dest.parentNode;
+ if (src) {
+ src = self.getElement(src);
+ parent.replaceChild(src, dest);
+ } else {
+ parent.removeChild(dest);
+ }
+ return src;
+ },
+
+ /** @id MochiKit.DOM.getElement */
+ getElement: function (id) {
+ var self = MochiKit.DOM;
+ if (arguments.length == 1) {
+ return ((typeof(id) == "string") ?
+ self._document.getElementById(id) : id);
+ } else {
+ return MochiKit.Base.map(self.getElement, arguments);
+ }
+ },
+
+ /** @id MochiKit.DOM.getElementsByTagAndClassName */
+ getElementsByTagAndClassName: function (tagName, className,
+ /* optional */parent) {
+ var self = MochiKit.DOM;
+ if (typeof(tagName) == 'undefined' || tagName === null) {
+ tagName = '*';
+ }
+ if (typeof(parent) == 'undefined' || parent === null) {
+ parent = self._document;
+ }
+ parent = self.getElement(parent);
+ var children = (parent.getElementsByTagName(tagName)
+ || self._document.all);
+ if (typeof(className) == 'undefined' || className === null) {
+ return MochiKit.Base.extend(null, children);
+ }
+
+ var elements = [];
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var cls = child.className;
+ if (!cls) {
+ continue;
+ }
+ var classNames = cls.split(' ');
+ for (var j = 0; j < classNames.length; j++) {
+ if (classNames[j] == className) {
+ elements.push(child);
+ break;
+ }
+ }
+ }
+
+ return elements;
+ },
+
+ _newCallStack: function (path, once) {
+ var rval = function () {
+ var callStack = arguments.callee.callStack;
+ for (var i = 0; i < callStack.length; i++) {
+ if (callStack[i].apply(this, arguments) === false) {
+ break;
+ }
+ }
+ if (once) {
+ try {
+ this[path] = null;
+ } catch (e) {
+ // pass
+ }
+ }
+ };
+ rval.callStack = [];
+ return rval;
+ },
+
+ /** @id MochiKit.DOM.addToCallStack */
+ addToCallStack: function (target, path, func, once) {
+ var self = MochiKit.DOM;
+ var existing = target[path];
+ var regfunc = existing;
+ if (!(typeof(existing) == 'function'
+ && typeof(existing.callStack) == "object"
+ && existing.callStack !== null)) {
+ regfunc = self._newCallStack(path, once);
+ if (typeof(existing) == 'function') {
+ regfunc.callStack.push(existing);
+ }
+ target[path] = regfunc;
+ }
+ regfunc.callStack.push(func);
+ },
+
+ /** @id MochiKit.DOM.addLoadEvent */
+ addLoadEvent: function (func) {
+ var self = MochiKit.DOM;
+ self.addToCallStack(self._window, "onload", func, true);
+
+ },
+
+ /** @id MochiKit.DOM.focusOnLoad */
+ focusOnLoad: function (element) {
+ var self = MochiKit.DOM;
+ self.addLoadEvent(function () {
+ element = self.getElement(element);
+ if (element) {
+ element.focus();
+ }
+ });
+ },
+
+ /** @id MochiKit.DOM.setElementClass */
+ setElementClass: function (element, className) {
+ var self = MochiKit.DOM;
+ var obj = self.getElement(element);
+ if (self.attributeArray.compliant) {
+ obj.setAttribute("class", className);
+ } else {
+ obj.setAttribute("className", className);
+ }
+ },
+
+ /** @id MochiKit.DOM.toggleElementClass */
+ toggleElementClass: function (className/*, element... */) {
+ var self = MochiKit.DOM;
+ for (var i = 1; i < arguments.length; i++) {
+ var obj = self.getElement(arguments[i]);
+ if (!self.addElementClass(obj, className)) {
+ self.removeElementClass(obj, className);
+ }
+ }
+ },
+
+ /** @id MochiKit.DOM.addElementClass */
+ addElementClass: function (element, className) {
+ var self = MochiKit.DOM;
+ var obj = self.getElement(element);
+ var cls = obj.className;
+ // trivial case, no className yet
+ if (cls == undefined || cls.length === 0) {
+ self.setElementClass(obj, className);
+ return true;
+ }
+ // the other trivial case, already set as the only class
+ if (cls == className) {
+ return false;
+ }
+ var classes = cls.split(" ");
+ for (var i = 0; i < classes.length; i++) {
+ // already present
+ if (classes[i] == className) {
+ return false;
+ }
+ }
+ // append class
+ self.setElementClass(obj, cls + " " + className);
+ return true;
+ },
+
+ /** @id MochiKit.DOM.removeElementClass */
+ removeElementClass: function (element, className) {
+ var self = MochiKit.DOM;
+ var obj = self.getElement(element);
+ var cls = obj.className;
+ // trivial case, no className yet
+ if (cls == undefined || cls.length === 0) {
+ return false;
+ }
+ // other trivial case, set only to className
+ if (cls == className) {
+ self.setElementClass(obj, "");
+ return true;
+ }
+ var classes = cls.split(" ");
+ for (var i = 0; i < classes.length; i++) {
+ // already present
+ if (classes[i] == className) {
+ // only check sane case where the class is used once
+ classes.splice(i, 1);
+ self.setElementClass(obj, classes.join(" "));
+ return true;
+ }
+ }
+ // not found
+ return false;
+ },
+
+ /** @id MochiKit.DOM.swapElementClass */
+ swapElementClass: function (element, fromClass, toClass) {
+ var obj = MochiKit.DOM.getElement(element);
+ var res = MochiKit.DOM.removeElementClass(obj, fromClass);
+ if (res) {
+ MochiKit.DOM.addElementClass(obj, toClass);
+ }
+ return res;
+ },
+
+ /** @id MochiKit.DOM.hasElementClass */
+ hasElementClass: function (element, className/*...*/) {
+ var obj = MochiKit.DOM.getElement(element);
+ var cls = obj.className;
+ if (!cls) {
+ return false;
+ }
+ var classes = cls.split(" ");
+ for (var i = 1; i < arguments.length; i++) {
+ var good = false;
+ for (var j = 0; j < classes.length; j++) {
+ if (classes[j] == arguments[i]) {
+ good = true;
+ break;
+ }
+ }
+ if (!good) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /** @id MochiKit.DOM.escapeHTML */
+ escapeHTML: function (s) {
+ return s.replace(/&/g, "&amp;"
+ ).replace(/"/g, "&quot;"
+ ).replace(/</g, "&lt;"
+ ).replace(/>/g, "&gt;");
+ },
+
+ /** @id MochiKit.DOM.toHTML */
+ toHTML: function (dom) {
+ return MochiKit.DOM.emitHTML(dom).join("");
+ },
+
+ /** @id MochiKit.DOM.emitHTML */
+ emitHTML: function (dom, /* optional */lst) {
+ if (typeof(lst) == 'undefined' || lst === null) {
+ lst = [];
+ }
+ // queue is the call stack, we're doing this non-recursively
+ var queue = [dom];
+ var self = MochiKit.DOM;
+ var escapeHTML = self.escapeHTML;
+ var attributeArray = self.attributeArray;
+ while (queue.length) {
+ dom = queue.pop();
+ if (typeof(dom) == 'string') {
+ lst.push(dom);
+ } else if (dom.nodeType == 1) {
+ // we're not using higher order stuff here
+ // because safari has heisenbugs.. argh.
+ //
+ // I think it might have something to do with
+ // garbage collection and function calls.
+ lst.push('<' + dom.tagName.toLowerCase());
+ var attributes = [];
+ var domAttr = attributeArray(dom);
+ for (var i = 0; i < domAttr.length; i++) {
+ var a = domAttr[i];
+ attributes.push([
+ " ",
+ a.name,
+ '="',
+ escapeHTML(a.value),
+ '"'
+ ]);
+ }
+ attributes.sort();
+ for (i = 0; i < attributes.length; i++) {
+ var attrs = attributes[i];
+ for (var j = 0; j < attrs.length; j++) {
+ lst.push(attrs[j]);
+ }
+ }
+ if (dom.hasChildNodes()) {
+ lst.push(">");
+ // queue is the FILO call stack, so we put the close tag
+ // on first
+ queue.push("</" + dom.tagName.toLowerCase() + ">");
+ var cnodes = dom.childNodes;
+ for (i = cnodes.length - 1; i >= 0; i--) {
+ queue.push(cnodes[i]);
+ }
+ } else {
+ lst.push('/>');
+ }
+ } else if (dom.nodeType == 3) {
+ lst.push(escapeHTML(dom.nodeValue));
+ }
+ }
+ return lst;
+ },
+
+ /** @id MochiKit.DOM.scrapeText */
+ scrapeText: function (node, /* optional */asArray) {
+ var rval = [];
+ (function (node) {
+ var cn = node.childNodes;
+ if (cn) {
+ for (var i = 0; i < cn.length; i++) {
+ arguments.callee.call(this, cn[i]);
+ }
+ }
+ var nodeValue = node.nodeValue;
+ if (typeof(nodeValue) == 'string') {
+ rval.push(nodeValue);
+ }
+ })(MochiKit.DOM.getElement(node));
+ if (asArray) {
+ return rval;
+ } else {
+ return rval.join("");
+ }
+ },
+
+ /** @id MochiKit.DOM.removeEmptyTextNodes */
+ removeEmptyTextNodes: function (element) {
+ element = MochiKit.DOM.getElement(element);
+ for (var i = 0; i < element.childNodes.length; i++) {
+ var node = element.childNodes[i];
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) {
+ node.parentNode.removeChild(node);
+ }
+ }
+ },
+
+ /** @id MochiKit.DOM.makeClipping */
+ makeClipping: function (element) {
+ element = MochiKit.DOM.getElement(element);
+ var oldOverflow = element.style.overflow;
+ if ((MochiKit.Style.getStyle(element, 'overflow') || 'visible') != 'hidden') {
+ element.style.overflow = 'hidden';
+ }
+ return oldOverflow;
+ },
+
+ /** @id MochiKit.DOM.undoClipping */
+ undoClipping: function (element, overflow) {
+ element = MochiKit.DOM.getElement(element);
+ if (!overflow) {
+ return;
+ }
+ element.style.overflow = overflow;
+ },
+
+ /** @id MochiKit.DOM.makePositioned */
+ makePositioned: function (element) {
+ element = MochiKit.DOM.getElement(element);
+ var pos = MochiKit.Style.getStyle(element, 'position');
+ if (pos == 'static' || !pos) {
+ element.style.position = 'relative';
+ // Opera returns the offset relative to the positioning context,
+ // when an element is position relative but top and left have
+ // not been defined
+ if (/Opera/.test(navigator.userAgent)) {
+ element.style.top = 0;
+ element.style.left = 0;
+ }
+ }
+ },
+
+ /** @id MochiKit.DOM.undoPositioned */
+ undoPositioned: function (element) {
+ element = MochiKit.DOM.getElement(element);
+ if (element.style.position == 'relative') {
+ element.style.position = element.style.top = element.style.left = element.style.bottom = element.style.right = '';
+ }
+ },
+
+ /** @id MochiKit.DOM.getFirstElementByTagAndClassName */
+ getFirstElementByTagAndClassName: function (tagName, className,
+ /* optional */parent) {
+ var self = MochiKit.DOM;
+ if (typeof(tagName) == 'undefined' || tagName === null) {
+ tagName = '*';
+ }
+ if (typeof(parent) == 'undefined' || parent === null) {
+ parent = self._document;
+ }
+ parent = self.getElement(parent);
+ var children = (parent.getElementsByTagName(tagName)
+ || self._document.all);
+ if (typeof(className) == 'undefined' || className === null) {
+ return children[0];
+ }
+
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var classNames = child.className.split(' ');
+ for (var j = 0; j < classNames.length; j++) {
+ if (classNames[j] == className) {
+ return child;
+ }
+ }
+ }
+ },
+
+ /** @id MochiKit.DOM.getFirstParentByTagAndClassName */
+ getFirstParentByTagAndClassName: function (elem, tagName, className) {
+ var self = MochiKit.DOM;
+ elem = self.getElement(elem);
+ if (typeof(tagName) == 'undefined' || tagName === null) {
+ tagName = '*';
+ } else {
+ tagName = tagName.toUpperCase();
+ }
+ if (typeof(className) == 'undefined' || className === null) {
+ className = null;
+ }
+
+ var classList = '';
+ var curTagName = '';
+ while (elem && elem.tagName) {
+ elem = elem.parentNode;
+ if (tagName == '*' && className === null) {
+ return elem;
+ }
+ classList = elem.className.split(' ');
+ curTagName = elem.tagName.toUpperCase();
+ if (className === null && tagName == curTagName) {
+ return elem;
+ } else if (className !== null) {
+ for (var i = 0; i < classList.length; i++) {
+ if (tagName == '*' && classList[i] == className) {
+ return elem;
+ } else if (tagName == curTagName && classList[i] == className) {
+ return elem;
+ }
+ }
+ }
+ }
+ return elem;
+ },
+
+ /** @id MochiKit.DOM.isParent */
+ isParent: function (child, element) {
+ if (!child.parentNode || child == element) {
+ return false;
+ }
+
+ if (child.parentNode == element) {
+ return true;
+ }
+
+ return MochiKit.DOM.isParent(child.parentNode, element);
+ },
+
+ __new__: function (win) {
+
+ var m = MochiKit.Base;
+ if (typeof(document) != "undefined") {
+ this._document = document;
+ var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ this._xhtml = (document.documentElement &&
+ document.createElementNS &&
+ document.documentElement.namespaceURI === kXULNSURI);
+ } else if (MochiKit.MockDOM) {
+ this._document = MochiKit.MockDOM.document;
+ }
+ this._window = win;
+
+ this.domConverters = new m.AdapterRegistry();
+
+ var __tmpElement = this._document.createElement("span");
+ var attributeArray;
+ if (__tmpElement && __tmpElement.attributes &&
+ __tmpElement.attributes.length > 0) {
+ // for braindead browsers (IE) that insert extra junk
+ var filter = m.filter;
+ attributeArray = function (node) {
+ return filter(attributeArray.ignoreAttrFilter, node.attributes);
+ };
+ attributeArray.ignoreAttr = {};
+ var attrs = __tmpElement.attributes;
+ var ignoreAttr = attributeArray.ignoreAttr;
+ for (var i = 0; i < attrs.length; i++) {
+ var a = attrs[i];
+ ignoreAttr[a.name] = a.value;
+ }
+ attributeArray.ignoreAttrFilter = function (a) {
+ return (attributeArray.ignoreAttr[a.name] != a.value);
+ };
+ attributeArray.compliant = false;
+ attributeArray.renames = {
+ "class": "className",
+ "checked": "defaultChecked",
+ "usemap": "useMap",
+ "for": "htmlFor",
+ "readonly": "readOnly",
+ "colspan": "colSpan",
+ "bgcolor": "bgColor",
+ "cellspacing": "cellSpacing",
+ "cellpadding": "cellPadding"
+ };
+ } else {
+ attributeArray = function (node) {
+ /***
+
+ Return an array of attributes for a given node,
+ filtering out attributes that don't belong for
+ that are inserted by "Certain Browsers".
+
+ ***/
+ return node.attributes;
+ };
+ attributeArray.compliant = true;
+ attributeArray.renames = {};
+ }
+ this.attributeArray = attributeArray;
+
+ // FIXME: this really belongs in Base, and could probably be cleaner
+ var _deprecated = function(fromModule, arr) {
+ var modules = arr[1].split('.');
+ var str = '';
+ var obj = {};
+
+ str += 'if (!MochiKit.' + modules[1] + ') { throw new Error("';
+ str += 'This function has been deprecated and depends on MochiKit.';
+ str += modules[1] + '.");}';
+ str += 'return MochiKit.' + modules[1] + '.' + arr[0];
+ str += '.apply(this, arguments);';
+
+ obj[modules[2]] = new Function(str);
+ MochiKit.Base.update(MochiKit[fromModule], obj);
+ }
+ for (var i; i < MochiKit.DOM.DEPRECATED.length; i++) {
+ _deprecated('DOM', MochiKit.DOM.DEPRECATED[i]);
+ }
+
+ // shorthand for createDOM syntax
+ var createDOMFunc = this.createDOMFunc;
+ /** @id MochiKit.DOM.UL */
+ this.UL = createDOMFunc("ul");
+ /** @id MochiKit.DOM.OL */
+ this.OL = createDOMFunc("ol");
+ /** @id MochiKit.DOM.LI */
+ this.LI = createDOMFunc("li");
+ /** @id MochiKit.DOM.TD */
+ this.TD = createDOMFunc("td");
+ /** @id MochiKit.DOM.TR */
+ this.TR = createDOMFunc("tr");
+ /** @id MochiKit.DOM.TBODY */
+ this.TBODY = createDOMFunc("tbody");
+ /** @id MochiKit.DOM.THEAD */
+ this.THEAD = createDOMFunc("thead");
+ /** @id MochiKit.DOM.TFOOT */
+ this.TFOOT = createDOMFunc("tfoot");
+ /** @id MochiKit.DOM.TABLE */
+ this.TABLE = createDOMFunc("table");
+ /** @id MochiKit.DOM.TH */
+ this.TH = createDOMFunc("th");
+ /** @id MochiKit.DOM.INPUT */
+ this.INPUT = createDOMFunc("input");
+ /** @id MochiKit.DOM.SPAN */
+ this.SPAN = createDOMFunc("span");
+ /** @id MochiKit.DOM.A */
+ this.A = createDOMFunc("a");
+ /** @id MochiKit.DOM.DIV */
+ this.DIV = createDOMFunc("div");
+ /** @id MochiKit.DOM.IMG */
+ this.IMG = createDOMFunc("img");
+ /** @id MochiKit.DOM.BUTTON */
+ this.BUTTON = createDOMFunc("button");
+ /** @id MochiKit.DOM.TT */
+ this.TT = createDOMFunc("tt");
+ /** @id MochiKit.DOM.PRE */
+ this.PRE = createDOMFunc("pre");
+ /** @id MochiKit.DOM.H1 */
+ this.H1 = createDOMFunc("h1");
+ /** @id MochiKit.DOM.H2 */
+ this.H2 = createDOMFunc("h2");
+ /** @id MochiKit.DOM.H3 */
+ this.H3 = createDOMFunc("h3");
+ /** @id MochiKit.DOM.BR */
+ this.BR = createDOMFunc("br");
+ /** @id MochiKit.DOM.HR */
+ this.HR = createDOMFunc("hr");
+ /** @id MochiKit.DOM.LABEL */
+ this.LABEL = createDOMFunc("label");
+ /** @id MochiKit.DOM.TEXTAREA */
+ this.TEXTAREA = createDOMFunc("textarea");
+ /** @id MochiKit.DOM.FORM */
+ this.FORM = createDOMFunc("form");
+ /** @id MochiKit.DOM.P */
+ this.P = createDOMFunc("p");
+ /** @id MochiKit.DOM.SELECT */
+ this.SELECT = createDOMFunc("select");
+ /** @id MochiKit.DOM.OPTION */
+ this.OPTION = createDOMFunc("option");
+ /** @id MochiKit.DOM.OPTGROUP */
+ this.OPTGROUP = createDOMFunc("optgroup");
+ /** @id MochiKit.DOM.LEGEND */
+ this.LEGEND = createDOMFunc("legend");
+ /** @id MochiKit.DOM.FIELDSET */
+ this.FIELDSET = createDOMFunc("fieldset");
+ /** @id MochiKit.DOM.STRONG */
+ this.STRONG = createDOMFunc("strong");
+ /** @id MochiKit.DOM.CANVAS */
+ this.CANVAS = createDOMFunc("canvas");
+
+ /** @id MochiKit.DOM.$ */
+ this.$ = this.getElement;
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+
+ }
+});
+
+
+MochiKit.DOM.__new__(((typeof(window) == "undefined") ? this : window));
+
+//
+// XXX: Internet Explorer blows
+//
+if (MochiKit.__export__) {
+ withWindow = MochiKit.DOM.withWindow;
+ withDocument = MochiKit.DOM.withDocument;
+}
+
+MochiKit.Base._exportSymbols(this, MochiKit.DOM);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/DateTime.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/DateTime.js
new file mode 100644
index 0000000000..c0b03ee9db
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/DateTime.js
@@ -0,0 +1,216 @@
+/***
+
+MochiKit.DateTime 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.DateTime');
+}
+
+if (typeof(MochiKit) == 'undefined') {
+ MochiKit = {};
+}
+
+if (typeof(MochiKit.DateTime) == 'undefined') {
+ MochiKit.DateTime = {};
+}
+
+MochiKit.DateTime.NAME = "MochiKit.DateTime";
+MochiKit.DateTime.VERSION = "1.4";
+MochiKit.DateTime.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+MochiKit.DateTime.toString = function () {
+ return this.__repr__();
+};
+
+/** @id MochiKit.DateTime.isoDate */
+MochiKit.DateTime.isoDate = function (str) {
+ str = str + "";
+ if (typeof(str) != "string" || str.length === 0) {
+ return null;
+ }
+ var iso = str.split('-');
+ if (iso.length === 0) {
+ return null;
+ }
+ return new Date(iso[0], iso[1] - 1, iso[2]);
+};
+
+MochiKit.DateTime._isoRegexp = /(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/;
+
+/** @id MochiKit.DateTime.isoTimestamp */
+MochiKit.DateTime.isoTimestamp = function (str) {
+ str = str + "";
+ if (typeof(str) != "string" || str.length === 0) {
+ return null;
+ }
+ var res = str.match(MochiKit.DateTime._isoRegexp);
+ if (typeof(res) == "undefined" || res === null) {
+ return null;
+ }
+ var year, month, day, hour, min, sec, msec;
+ year = parseInt(res[1], 10);
+ if (typeof(res[2]) == "undefined" || res[2] === '') {
+ return new Date(year);
+ }
+ month = parseInt(res[2], 10) - 1;
+ day = parseInt(res[3], 10);
+ if (typeof(res[4]) == "undefined" || res[4] === '') {
+ return new Date(year, month, day);
+ }
+ hour = parseInt(res[4], 10);
+ min = parseInt(res[5], 10);
+ sec = (typeof(res[6]) != "undefined" && res[6] !== '') ? parseInt(res[6], 10) : 0;
+ if (typeof(res[7]) != "undefined" && res[7] !== '') {
+ msec = Math.round(1000.0 * parseFloat("0." + res[7]));
+ } else {
+ msec = 0;
+ }
+ if ((typeof(res[8]) == "undefined" || res[8] === '') && (typeof(res[9]) == "undefined" || res[9] === '')) {
+ return new Date(year, month, day, hour, min, sec, msec);
+ }
+ var ofs;
+ if (typeof(res[9]) != "undefined" && res[9] !== '') {
+ ofs = parseInt(res[10], 10) * 3600000;
+ if (typeof(res[11]) != "undefined" && res[11] !== '') {
+ ofs += parseInt(res[11], 10) * 60000;
+ }
+ if (res[9] == "-") {
+ ofs = -ofs;
+ }
+ } else {
+ ofs = 0;
+ }
+ return new Date(Date.UTC(year, month, day, hour, min, sec, msec) - ofs);
+};
+
+/** @id MochiKit.DateTime.toISOTime */
+MochiKit.DateTime.toISOTime = function (date, realISO/* = false */) {
+ if (typeof(date) == "undefined" || date === null) {
+ return null;
+ }
+ var hh = date.getHours();
+ var mm = date.getMinutes();
+ var ss = date.getSeconds();
+ var lst = [
+ ((realISO && (hh < 10)) ? "0" + hh : hh),
+ ((mm < 10) ? "0" + mm : mm),
+ ((ss < 10) ? "0" + ss : ss)
+ ];
+ return lst.join(":");
+};
+
+/** @id MochiKit.DateTime.toISOTimeStamp */
+MochiKit.DateTime.toISOTimestamp = function (date, realISO/* = false*/) {
+ if (typeof(date) == "undefined" || date === null) {
+ return null;
+ }
+ var sep = realISO ? "T" : " ";
+ var foot = realISO ? "Z" : "";
+ if (realISO) {
+ date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000));
+ }
+ return MochiKit.DateTime.toISODate(date) + sep + MochiKit.DateTime.toISOTime(date, realISO) + foot;
+};
+
+/** @id MochiKit.DateTime.toISODate */
+MochiKit.DateTime.toISODate = function (date) {
+ if (typeof(date) == "undefined" || date === null) {
+ return null;
+ }
+ var _padTwo = MochiKit.DateTime._padTwo;
+ return [
+ date.getFullYear(),
+ _padTwo(date.getMonth() + 1),
+ _padTwo(date.getDate())
+ ].join("-");
+};
+
+/** @id MochiKit.DateTime.americanDate */
+MochiKit.DateTime.americanDate = function (d) {
+ d = d + "";
+ if (typeof(d) != "string" || d.length === 0) {
+ return null;
+ }
+ var a = d.split('/');
+ return new Date(a[2], a[0] - 1, a[1]);
+};
+
+MochiKit.DateTime._padTwo = function (n) {
+ return (n > 9) ? n : "0" + n;
+};
+
+/** @id MochiKit.DateTime.toPaddedAmericanDate */
+MochiKit.DateTime.toPaddedAmericanDate = function (d) {
+ if (typeof(d) == "undefined" || d === null) {
+ return null;
+ }
+ var _padTwo = MochiKit.DateTime._padTwo;
+ return [
+ _padTwo(d.getMonth() + 1),
+ _padTwo(d.getDate()),
+ d.getFullYear()
+ ].join('/');
+};
+
+/** @id MochiKit.DateTime.toAmericanDate */
+MochiKit.DateTime.toAmericanDate = function (d) {
+ if (typeof(d) == "undefined" || d === null) {
+ return null;
+ }
+ return [d.getMonth() + 1, d.getDate(), d.getFullYear()].join('/');
+};
+
+MochiKit.DateTime.EXPORT = [
+ "isoDate",
+ "isoTimestamp",
+ "toISOTime",
+ "toISOTimestamp",
+ "toISODate",
+ "americanDate",
+ "toPaddedAmericanDate",
+ "toAmericanDate"
+];
+
+MochiKit.DateTime.EXPORT_OK = [];
+MochiKit.DateTime.EXPORT_TAGS = {
+ ":common": MochiKit.DateTime.EXPORT,
+ ":all": MochiKit.DateTime.EXPORT
+};
+
+MochiKit.DateTime.__new__ = function () {
+ // MochiKit.Base.nameFunctions(this);
+ var base = this.NAME + ".";
+ for (var k in this) {
+ var o = this[k];
+ if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') {
+ try {
+ o.NAME = base + k;
+ } catch (e) {
+ // pass
+ }
+ }
+ }
+};
+
+MochiKit.DateTime.__new__();
+
+if (typeof(MochiKit.Base) != "undefined") {
+ MochiKit.Base._exportSymbols(this, MochiKit.DateTime);
+} else {
+ (function (globals, module) {
+ if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined')
+ || (MochiKit.__export__ === false)) {
+ var all = module.EXPORT_TAGS[":all"];
+ for (var i = 0; i < all.length; i++) {
+ globals[all[i]] = module[all[i]];
+ }
+ }
+ })(this, MochiKit.DateTime);
+}
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/DragAndDrop.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/DragAndDrop.js
new file mode 100644
index 0000000000..c471ffe900
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/DragAndDrop.js
@@ -0,0 +1,824 @@
+/***
+MochiKit.DragAndDrop 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+ Mochi-ized By Thomas Herve (_firstname_@nimail.org)
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.DragAndDrop');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+ dojo.require('MochiKit.Iter');
+ dojo.require('MochiKit.Visual');
+ dojo.require('MochiKit.Signal');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+ JSAN.use("MochiKit.DOM", []);
+ JSAN.use("MochiKit.Visual", []);
+ JSAN.use("MochiKit.Iter", []);
+ JSAN.use("MochiKit.Signal", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined' ||
+ typeof(MochiKit.DOM) == 'undefined' ||
+ typeof(MochiKit.Visual) == 'undefined' ||
+ typeof(MochiKit.Signal) == 'undefined' ||
+ typeof(MochiKit.Iter) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.DragAndDrop depends on MochiKit.Base, MochiKit.DOM, MochiKit.Visual, MochiKit.Signal and MochiKit.Iter!";
+}
+
+if (typeof(MochiKit.DragAndDrop) == 'undefined') {
+ MochiKit.DragAndDrop = {};
+}
+
+MochiKit.DragAndDrop.NAME = 'MochiKit.DragAndDrop';
+MochiKit.DragAndDrop.VERSION = '1.4';
+
+MochiKit.DragAndDrop.__repr__ = function () {
+ return '[' + this.NAME + ' ' + this.VERSION + ']';
+};
+
+MochiKit.DragAndDrop.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.DragAndDrop.EXPORT = [
+ "Droppable",
+ "Draggable"
+];
+
+MochiKit.DragAndDrop.EXPORT_OK = [
+ "Droppables",
+ "Draggables"
+];
+
+MochiKit.DragAndDrop.Droppables = {
+ /***
+
+ Manage all droppables. Shouldn't be used, use the Droppable object instead.
+
+ ***/
+ drops: [],
+
+ remove: function (element) {
+ this.drops = MochiKit.Base.filter(function (d) {
+ return d.element != MochiKit.DOM.getElement(element);
+ }, this.drops);
+ },
+
+ register: function (drop) {
+ this.drops.push(drop);
+ },
+
+ unregister: function (drop) {
+ this.drops = MochiKit.Base.filter(function (d) {
+ return d != drop;
+ }, this.drops);
+ },
+
+ prepare: function (element) {
+ MochiKit.Base.map(function (drop) {
+ if (drop.isAccepted(element)) {
+ if (drop.options.activeclass) {
+ MochiKit.DOM.addElementClass(drop.element,
+ drop.options.activeclass);
+ }
+ drop.options.onactive(drop.element, element);
+ }
+ }, this.drops);
+ },
+
+ findDeepestChild: function (drops) {
+ deepest = drops[0];
+
+ for (i = 1; i < drops.length; ++i) {
+ if (MochiKit.DOM.isParent(drops[i].element, deepest.element)) {
+ deepest = drops[i];
+ }
+ }
+ return deepest;
+ },
+
+ show: function (point, element) {
+ if (!this.drops.length) {
+ return;
+ }
+ var affected = [];
+
+ if (this.last_active) {
+ this.last_active.deactivate();
+ }
+ MochiKit.Iter.forEach(this.drops, function (drop) {
+ if (drop.isAffected(point, element)) {
+ affected.push(drop);
+ }
+ });
+ if (affected.length > 0) {
+ drop = this.findDeepestChild(affected);
+ MochiKit.Position.within(drop.element, point.page.x, point.page.y);
+ drop.options.onhover(element, drop.element,
+ MochiKit.Position.overlap(drop.options.overlap, drop.element));
+ drop.activate();
+ }
+ },
+
+ fire: function (event, element) {
+ if (!this.last_active) {
+ return;
+ }
+ MochiKit.Position.prepare();
+
+ if (this.last_active.isAffected(event.mouse(), element)) {
+ this.last_active.options.ondrop(element,
+ this.last_active.element, event);
+ }
+ },
+
+ reset: function (element) {
+ MochiKit.Base.map(function (drop) {
+ if (drop.options.activeclass) {
+ MochiKit.DOM.removeElementClass(drop.element,
+ drop.options.activeclass);
+ }
+ drop.options.ondesactive(drop.element, element);
+ }, this.drops);
+ if (this.last_active) {
+ this.last_active.deactivate();
+ }
+ }
+};
+
+/** @id MochiKit.DragAndDrop.Droppable */
+MochiKit.DragAndDrop.Droppable = function (element, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, options);
+ }
+ this.__init__(element, options);
+};
+
+MochiKit.DragAndDrop.Droppable.prototype = {
+ /***
+
+ A droppable object. Simple use is to create giving an element:
+
+ new MochiKit.DragAndDrop.Droppable('myelement');
+
+ Generally you'll want to define the 'ondrop' function and maybe the
+ 'accept' option to filter draggables.
+
+ ***/
+ __class__: MochiKit.DragAndDrop.Droppable,
+
+ __init__: function (element, /* optional */options) {
+ var d = MochiKit.DOM;
+ var b = MochiKit.Base;
+ this.element = d.getElement(element);
+ this.options = b.update({
+
+ /** @id MochiKit.DragAndDrop.greedy */
+ greedy: true,
+
+ /** @id MochiKit.DragAndDrop.hoverclass */
+ hoverclass: null,
+
+ /** @id MochiKit.DragAndDrop.activeclass */
+ activeclass: null,
+
+ /** @id MochiKit.DragAndDrop.hoverfunc */
+ hoverfunc: b.noop,
+
+ /** @id MochiKit.DragAndDrop.accept */
+ accept: null,
+
+ /** @id MochiKit.DragAndDrop.onactive */
+ onactive: b.noop,
+
+ /** @id MochiKit.DragAndDrop.ondesactive */
+ ondesactive: b.noop,
+
+ /** @id MochiKit.DragAndDrop.onhover */
+ onhover: b.noop,
+
+ /** @id MochiKit.DragAndDrop.ondrop */
+ ondrop: b.noop,
+
+ /** @id MochiKit.DragAndDrop.containment */
+ containment: [],
+ tree: false
+ }, options || {});
+
+ // cache containers
+ this.options._containers = [];
+ b.map(MochiKit.Base.bind(function (c) {
+ this.options._containers.push(d.getElement(c));
+ }, this), this.options.containment);
+
+ d.makePositioned(this.element); // fix IE
+
+ MochiKit.DragAndDrop.Droppables.register(this);
+ },
+
+ /** @id MochiKit.DragAndDrop.isContained */
+ isContained: function (element) {
+ if (this.options._containers.length) {
+ var containmentNode;
+ if (this.options.tree) {
+ containmentNode = element.treeNode;
+ } else {
+ containmentNode = element.parentNode;
+ }
+ return MochiKit.Iter.some(this.options._containers, function (c) {
+ return containmentNode == c;
+ });
+ } else {
+ return true;
+ }
+ },
+
+ /** @id MochiKit.DragAndDrop.isAccepted */
+ isAccepted: function (element) {
+ return ((!this.options.accept) || MochiKit.Iter.some(
+ this.options.accept, function (c) {
+ return MochiKit.DOM.hasElementClass(element, c);
+ }));
+ },
+
+ /** @id MochiKit.DragAndDrop.isAffected */
+ isAffected: function (point, element) {
+ return ((this.element != element) &&
+ this.isContained(element) &&
+ this.isAccepted(element) &&
+ MochiKit.Position.within(this.element, point.page.x,
+ point.page.y));
+ },
+
+ /** @id MochiKit.DragAndDrop.deactivate */
+ deactivate: function () {
+ /***
+
+ A droppable is deactivate when a draggable has been over it and left.
+
+ ***/
+ if (this.options.hoverclass) {
+ MochiKit.DOM.removeElementClass(this.element,
+ this.options.hoverclass);
+ }
+ this.options.hoverfunc(this.element, false);
+ MochiKit.DragAndDrop.Droppables.last_active = null;
+ },
+
+ /** @id MochiKit.DragAndDrop.activate */
+ activate: function () {
+ /***
+
+ A droppable is active when a draggable is over it.
+
+ ***/
+ if (this.options.hoverclass) {
+ MochiKit.DOM.addElementClass(this.element, this.options.hoverclass);
+ }
+ this.options.hoverfunc(this.element, true);
+ MochiKit.DragAndDrop.Droppables.last_active = this;
+ },
+
+ /** @id MochiKit.DragAndDrop.destroy */
+ destroy: function () {
+ /***
+
+ Delete this droppable.
+
+ ***/
+ MochiKit.DragAndDrop.Droppables.unregister(this);
+ },
+
+ /** @id MochiKit.DragAndDrop.repr */
+ repr: function () {
+ return '[' + this.__class__.NAME + ", options:" + MochiKit.Base.repr(this.options) + "]";
+ }
+};
+
+MochiKit.DragAndDrop.Draggables = {
+ /***
+
+ Manage draggables elements. Not intended to direct use.
+
+ ***/
+ drags: [],
+
+ register: function (draggable) {
+ if (this.drags.length === 0) {
+ var conn = MochiKit.Signal.connect;
+ this.eventMouseUp = conn(document, 'onmouseup', this, this.endDrag);
+ this.eventMouseMove = conn(document, 'onmousemove', this,
+ this.updateDrag);
+ this.eventKeypress = conn(document, 'onkeypress', this,
+ this.keyPress);
+ }
+ this.drags.push(draggable);
+ },
+
+ unregister: function (draggable) {
+ this.drags = MochiKit.Base.filter(function (d) {
+ return d != draggable;
+ }, this.drags);
+ if (this.drags.length === 0) {
+ var disc = MochiKit.Signal.disconnect;
+ disc(this.eventMouseUp);
+ disc(this.eventMouseMove);
+ disc(this.eventKeypress);
+ }
+ },
+
+ activate: function (draggable) {
+ // allows keypress events if window is not currently focused
+ // fails for Safari
+ window.focus();
+ this.activeDraggable = draggable;
+ },
+
+ deactivate: function () {
+ this.activeDraggable = null;
+ },
+
+ updateDrag: function (event) {
+ if (!this.activeDraggable) {
+ return;
+ }
+ var pointer = event.mouse();
+ // Mozilla-based browsers fire successive mousemove events with
+ // the same coordinates, prevent needless redrawing (moz bug?)
+ if (this._lastPointer && (MochiKit.Base.repr(this._lastPointer.page) ==
+ MochiKit.Base.repr(pointer.page))) {
+ return;
+ }
+ this._lastPointer = pointer;
+ this.activeDraggable.updateDrag(event, pointer);
+ },
+
+ endDrag: function (event) {
+ if (!this.activeDraggable) {
+ return;
+ }
+ this._lastPointer = null;
+ this.activeDraggable.endDrag(event);
+ this.activeDraggable = null;
+ },
+
+ keyPress: function (event) {
+ if (this.activeDraggable) {
+ this.activeDraggable.keyPress(event);
+ }
+ },
+
+ notify: function (eventName, draggable, event) {
+ MochiKit.Signal.signal(this, eventName, draggable, event);
+ }
+};
+
+/** @id MochiKit.DragAndDrop.Draggable */
+MochiKit.DragAndDrop.Draggable = function (element, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, options);
+ }
+ this.__init__(element, options);
+};
+
+MochiKit.DragAndDrop.Draggable.prototype = {
+ /***
+
+ A draggable object. Simple instantiate :
+
+ new MochiKit.DragAndDrop.Draggable('myelement');
+
+ ***/
+ __class__ : MochiKit.DragAndDrop.Draggable,
+
+ __init__: function (element, /* optional */options) {
+ var v = MochiKit.Visual;
+ var b = MochiKit.Base;
+ options = b.update({
+
+ /** @id MochiKit.DragAndDrop.handle */
+ handle: false,
+
+ /** @id MochiKit.DragAndDrop.starteffect */
+ starteffect: function (innerelement) {
+ this._savedOpacity = MochiKit.Style.getStyle(innerelement, 'opacity') || 1.0;
+ new v.Opacity(innerelement, {duration:0.2, from:this._savedOpacity, to:0.7});
+ },
+ /** @id MochiKit.DragAndDrop.reverteffect */
+ reverteffect: function (innerelement, top_offset, left_offset) {
+ var dur = Math.sqrt(Math.abs(top_offset^2) +
+ Math.abs(left_offset^2))*0.02;
+ return new v.Move(innerelement,
+ {x: -left_offset, y: -top_offset, duration: dur});
+ },
+
+ /** @id MochiKit.DragAndDrop.endeffect */
+ endeffect: function (innerelement) {
+ new v.Opacity(innerelement, {duration:0.2, from:0.7, to:this._savedOpacity});
+ },
+
+ /** @id MochiKit.DragAndDrop.onchange */
+ onchange: b.noop,
+
+ /** @id MochiKit.DragAndDrop.zindex */
+ zindex: 1000,
+
+ /** @id MochiKit.DragAndDrop.revert */
+ revert: false,
+
+ /** @id MochiKit.DragAndDrop.scroll */
+ scroll: false,
+
+ /** @id MochiKit.DragAndDrop.scrollSensitivity */
+ scrollSensitivity: 20,
+
+ /** @id MochiKit.DragAndDrop.scrollSpeed */
+ scrollSpeed: 15,
+ // false, or xy or [x, y] or function (x, y){return [x, y];}
+
+ /** @id MochiKit.DragAndDrop.snap */
+ snap: false
+ }, options || {});
+
+ var d = MochiKit.DOM;
+ this.element = d.getElement(element);
+
+ if (options.handle && (typeof(options.handle) == 'string')) {
+ this.handle = d.getFirstElementByTagAndClassName(null,
+ options.handle, this.element);
+ }
+ if (!this.handle) {
+ this.handle = d.getElement(options.handle);
+ }
+ if (!this.handle) {
+ this.handle = this.element;
+ }
+
+ if (options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
+ options.scroll = d.getElement(options.scroll);
+ this._isScrollChild = MochiKit.DOM.isChildNode(this.element, options.scroll);
+ }
+
+ d.makePositioned(this.element); // fix IE
+
+ this.delta = this.currentDelta();
+ this.options = options;
+ this.dragging = false;
+
+ this.eventMouseDown = MochiKit.Signal.connect(this.handle,
+ 'onmousedown', this, this.initDrag);
+ MochiKit.DragAndDrop.Draggables.register(this);
+ },
+
+ /** @id MochiKit.DragAndDrop.destroy */
+ destroy: function () {
+ MochiKit.Signal.disconnect(this.eventMouseDown);
+ MochiKit.DragAndDrop.Draggables.unregister(this);
+ },
+
+ /** @id MochiKit.DragAndDrop.currentDelta */
+ currentDelta: function () {
+ var s = MochiKit.Style.getStyle;
+ return [
+ parseInt(s(this.element, 'left') || '0'),
+ parseInt(s(this.element, 'top') || '0')];
+ },
+
+ /** @id MochiKit.DragAndDrop.initDrag */
+ initDrag: function (event) {
+ if (!event.mouse().button.left) {
+ return;
+ }
+ // abort on form elements, fixes a Firefox issue
+ var src = event.target();
+ var tagName = (src.tagName || '').toUpperCase();
+ if (tagName === 'INPUT' || tagName === 'SELECT' ||
+ tagName === 'OPTION' || tagName === 'BUTTON' ||
+ tagName === 'TEXTAREA') {
+ return;
+ }
+
+ if (this._revert) {
+ this._revert.cancel();
+ this._revert = null;
+ }
+
+ var pointer = event.mouse();
+ var pos = MochiKit.Position.cumulativeOffset(this.element);
+ this.offset = [pointer.page.x - pos.x, pointer.page.y - pos.y];
+
+ MochiKit.DragAndDrop.Draggables.activate(this);
+ event.stop();
+ },
+
+ /** @id MochiKit.DragAndDrop.startDrag */
+ startDrag: function (event) {
+ this.dragging = true;
+ if (this.options.selectclass) {
+ MochiKit.DOM.addElementClass(this.element,
+ this.options.selectclass);
+ }
+ if (this.options.zindex) {
+ this.originalZ = parseInt(MochiKit.Style.getStyle(this.element,
+ 'z-index') || '0');
+ this.element.style.zIndex = this.options.zindex;
+ }
+
+ if (this.options.ghosting) {
+ this._clone = this.element.cloneNode(true);
+ this.ghostPosition = MochiKit.Position.absolutize(this.element);
+ this.element.parentNode.insertBefore(this._clone, this.element);
+ }
+
+ if (this.options.scroll) {
+ if (this.options.scroll == window) {
+ var where = this._getWindowScroll(this.options.scroll);
+ this.originalScrollLeft = where.left;
+ this.originalScrollTop = where.top;
+ } else {
+ this.originalScrollLeft = this.options.scroll.scrollLeft;
+ this.originalScrollTop = this.options.scroll.scrollTop;
+ }
+ }
+
+ MochiKit.DragAndDrop.Droppables.prepare(this.element);
+ MochiKit.DragAndDrop.Draggables.notify('start', this, event);
+ if (this.options.starteffect) {
+ this.options.starteffect(this.element);
+ }
+ },
+
+ /** @id MochiKit.DragAndDrop.updateDrag */
+ updateDrag: function (event, pointer) {
+ if (!this.dragging) {
+ this.startDrag(event);
+ }
+ MochiKit.Position.prepare();
+ MochiKit.DragAndDrop.Droppables.show(pointer, this.element);
+ MochiKit.DragAndDrop.Draggables.notify('drag', this, event);
+ this.draw(pointer);
+ this.options.onchange(this);
+
+ if (this.options.scroll) {
+ this.stopScrolling();
+ var p, q;
+ if (this.options.scroll == window) {
+ var s = this._getWindowScroll(this.options.scroll);
+ p = new MochiKit.Style.Coordinates(s.left, s.top);
+ q = new MochiKit.Style.Coordinates(s.left + s.width,
+ s.top + s.height);
+ } else {
+ p = MochiKit.Position.page(this.options.scroll);
+ p.x += this.options.scroll.scrollLeft;
+ p.y += this.options.scroll.scrollTop;
+ p.x += (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0);
+ p.y += (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);
+ q = new MochiKit.Style.Coordinates(p.x + this.options.scroll.offsetWidth,
+ p.y + this.options.scroll.offsetHeight);
+ }
+ var speed = [0, 0];
+ if (pointer.page.x > (q.x - this.options.scrollSensitivity)) {
+ speed[0] = pointer.page.x - (q.x - this.options.scrollSensitivity);
+ } else if (pointer.page.x < (p.x + this.options.scrollSensitivity)) {
+ speed[0] = pointer.page.x - (p.x + this.options.scrollSensitivity);
+ }
+ if (pointer.page.y > (q.y - this.options.scrollSensitivity)) {
+ speed[1] = pointer.page.y - (q.y - this.options.scrollSensitivity);
+ } else if (pointer.page.y < (p.y + this.options.scrollSensitivity)) {
+ speed[1] = pointer.page.y - (p.y + this.options.scrollSensitivity);
+ }
+ this.startScrolling(speed);
+ }
+
+ // fix AppleWebKit rendering
+ if (/AppleWebKit'/.test(navigator.appVersion)) {
+ window.scrollBy(0, 0);
+ }
+ event.stop();
+ },
+
+ /** @id MochiKit.DragAndDrop.finishDrag */
+ finishDrag: function (event, success) {
+ var dr = MochiKit.DragAndDrop;
+ this.dragging = false;
+ if (this.options.selectclass) {
+ MochiKit.DOM.removeElementClass(this.element,
+ this.options.selectclass);
+ }
+
+ if (this.options.ghosting) {
+ // XXX: from a user point of view, it would be better to remove
+ // the node only *after* the MochiKit.Visual.Move end when used
+ // with revert.
+ MochiKit.Position.relativize(this.element, this.ghostPosition);
+ MochiKit.DOM.removeElement(this._clone);
+ this._clone = null;
+ }
+
+ if (success) {
+ dr.Droppables.fire(event, this.element);
+ }
+ dr.Draggables.notify('end', this, event);
+
+ var revert = this.options.revert;
+ if (revert && typeof(revert) == 'function') {
+ revert = revert(this.element);
+ }
+
+ var d = this.currentDelta();
+ if (revert && this.options.reverteffect) {
+ this._revert = this.options.reverteffect(this.element,
+ d[1] - this.delta[1], d[0] - this.delta[0]);
+ } else {
+ this.delta = d;
+ }
+
+ if (this.options.zindex) {
+ this.element.style.zIndex = this.originalZ;
+ }
+
+ if (this.options.endeffect) {
+ this.options.endeffect(this.element);
+ }
+
+ dr.Draggables.deactivate();
+ dr.Droppables.reset(this.element);
+ },
+
+ /** @id MochiKit.DragAndDrop.keyPress */
+ keyPress: function (event) {
+ if (event.key().string != "KEY_ESCAPE") {
+ return;
+ }
+ this.finishDrag(event, false);
+ event.stop();
+ },
+
+ /** @id MochiKit.DragAndDrop.endDrag */
+ endDrag: function (event) {
+ if (!this.dragging) {
+ return;
+ }
+ this.stopScrolling();
+ this.finishDrag(event, true);
+ event.stop();
+ },
+
+ /** @id MochiKit.DragAndDrop.draw */
+ draw: function (point) {
+ var pos = MochiKit.Position.cumulativeOffset(this.element);
+ var d = this.currentDelta();
+ pos.x -= d[0];
+ pos.y -= d[1];
+
+ if (this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
+ pos.x -= this.options.scroll.scrollLeft - this.originalScrollLeft;
+ pos.y -= this.options.scroll.scrollTop - this.originalScrollTop;
+ }
+
+ var p = [point.page.x - pos.x - this.offset[0],
+ point.page.y - pos.y - this.offset[1]];
+
+ if (this.options.snap) {
+ if (typeof(this.options.snap) == 'function') {
+ p = this.options.snap(p[0], p[1]);
+ } else {
+ if (this.options.snap instanceof Array) {
+ var i = -1;
+ p = MochiKit.Base.map(MochiKit.Base.bind(function (v) {
+ i += 1;
+ return Math.round(v/this.options.snap[i]) *
+ this.options.snap[i];
+ }, this), p);
+ } else {
+ p = MochiKit.Base.map(MochiKit.Base.bind(function (v) {
+ return Math.round(v/this.options.snap) *
+ this.options.snap;
+ }, this), p);
+ }
+ }
+ }
+ var style = this.element.style;
+ if ((!this.options.constraint) ||
+ (this.options.constraint == 'horizontal')) {
+ style.left = p[0] + 'px';
+ }
+ if ((!this.options.constraint) ||
+ (this.options.constraint == 'vertical')) {
+ style.top = p[1] + 'px';
+ }
+ if (style.visibility == 'hidden') {
+ style.visibility = ''; // fix gecko rendering
+ }
+ },
+
+ /** @id MochiKit.DragAndDrop.stopScrolling */
+ stopScrolling: function () {
+ if (this.scrollInterval) {
+ clearInterval(this.scrollInterval);
+ this.scrollInterval = null;
+ MochiKit.DragAndDrop.Draggables._lastScrollPointer = null;
+ }
+ },
+
+ /** @id MochiKit.DragAndDrop.startScrolling */
+ startScrolling: function (speed) {
+ if (!speed[0] && !speed[1]) {
+ return;
+ }
+ this.scrollSpeed = [speed[0] * this.options.scrollSpeed,
+ speed[1] * this.options.scrollSpeed];
+ this.lastScrolled = new Date();
+ this.scrollInterval = setInterval(MochiKit.Base.bind(this.scroll, this), 10);
+ },
+
+ /** @id MochiKit.DragAndDrop.scroll */
+ scroll: function () {
+ var current = new Date();
+ var delta = current - this.lastScrolled;
+ this.lastScrolled = current;
+
+ if (this.options.scroll == window) {
+ var s = this._getWindowScroll(this.options.scroll);
+ if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
+ var dm = delta / 1000;
+ this.options.scroll.scrollTo(s.left + dm * this.scrollSpeed[0],
+ s.top + dm * this.scrollSpeed[1]);
+ }
+ } else {
+ this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
+ this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
+ }
+
+ var d = MochiKit.DragAndDrop;
+
+ MochiKit.Position.prepare();
+ d.Droppables.show(d.Draggables._lastPointer, this.element);
+ d.Draggables.notify('drag', this);
+ if (this._isScrollChild) {
+ d.Draggables._lastScrollPointer = d.Draggables._lastScrollPointer || d.Draggables._lastPointer;
+ d.Draggables._lastScrollPointer.x += this.scrollSpeed[0] * delta / 1000;
+ d.Draggables._lastScrollPointer.y += this.scrollSpeed[1] * delta / 1000;
+ if (d.Draggables._lastScrollPointer.x < 0) {
+ d.Draggables._lastScrollPointer.x = 0;
+ }
+ if (d.Draggables._lastScrollPointer.y < 0) {
+ d.Draggables._lastScrollPointer.y = 0;
+ }
+ this.draw(d.Draggables._lastScrollPointer);
+ }
+
+ this.options.onchange(this);
+ },
+
+ _getWindowScroll: function (win) {
+ var vp, w, h;
+ MochiKit.DOM.withWindow(win, function () {
+ vp = MochiKit.Style.getViewportPosition(win.document);
+ });
+ if (win.innerWidth) {
+ w = win.innerWidth;
+ h = win.innerHeight;
+ } else if (win.document.documentElement && win.document.documentElement.clientWidth) {
+ w = win.document.documentElement.clientWidth;
+ h = win.document.documentElement.clientHeight;
+ } else {
+ w = win.document.body.offsetWidth;
+ h = win.document.body.offsetHeight;
+ }
+ return {top: vp.x, left: vp.y, width: w, height: h};
+ },
+
+ /** @id MochiKit.DragAndDrop.repr */
+ repr: function () {
+ return '[' + this.__class__.NAME + ", options:" + MochiKit.Base.repr(this.options) + "]";
+ }
+};
+
+MochiKit.DragAndDrop.__new__ = function () {
+ MochiKit.Base.nameFunctions(this);
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": MochiKit.Base.concat(this.EXPORT, this.EXPORT_OK)
+ };
+};
+
+MochiKit.DragAndDrop.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.DragAndDrop);
+
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Format.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Format.js
new file mode 100644
index 0000000000..937b681f70
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Format.js
@@ -0,0 +1,304 @@
+/***
+
+MochiKit.Format 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Format');
+}
+
+if (typeof(MochiKit) == 'undefined') {
+ MochiKit = {};
+}
+
+if (typeof(MochiKit.Format) == 'undefined') {
+ MochiKit.Format = {};
+}
+
+MochiKit.Format.NAME = "MochiKit.Format";
+MochiKit.Format.VERSION = "1.4";
+MochiKit.Format.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+MochiKit.Format.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.Format._numberFormatter = function (placeholder, header, footer, locale, isPercent, precision, leadingZeros, separatorAt, trailingZeros) {
+ return function (num) {
+ num = parseFloat(num);
+ if (typeof(num) == "undefined" || num === null || isNaN(num)) {
+ return placeholder;
+ }
+ var curheader = header;
+ var curfooter = footer;
+ if (num < 0) {
+ num = -num;
+ } else {
+ curheader = curheader.replace(/-/, "");
+ }
+ var me = arguments.callee;
+ var fmt = MochiKit.Format.formatLocale(locale);
+ if (isPercent) {
+ num = num * 100.0;
+ curfooter = fmt.percent + curfooter;
+ }
+ num = MochiKit.Format.roundToFixed(num, precision);
+ var parts = num.split(/\./);
+ var whole = parts[0];
+ var frac = (parts.length == 1) ? "" : parts[1];
+ var res = "";
+ while (whole.length < leadingZeros) {
+ whole = "0" + whole;
+ }
+ if (separatorAt) {
+ while (whole.length > separatorAt) {
+ var i = whole.length - separatorAt;
+ //res = res + fmt.separator + whole.substring(i, whole.length);
+ res = fmt.separator + whole.substring(i, whole.length) + res;
+ whole = whole.substring(0, i);
+ }
+ }
+ res = whole + res;
+ if (precision > 0) {
+ while (frac.length < trailingZeros) {
+ frac = frac + "0";
+ }
+ res = res + fmt.decimal + frac;
+ }
+ return curheader + res + curfooter;
+ };
+};
+
+/** @id MochiKit.Format.numberFormatter */
+MochiKit.Format.numberFormatter = function (pattern, placeholder/* = "" */, locale/* = "default" */) {
+ // http://java.sun.com/docs/books/tutorial/i18n/format/numberpattern.html
+ // | 0 | leading or trailing zeros
+ // | # | just the number
+ // | , | separator
+ // | . | decimal separator
+ // | % | Multiply by 100 and format as percent
+ if (typeof(placeholder) == "undefined") {
+ placeholder = "";
+ }
+ var match = pattern.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/);
+ if (!match) {
+ throw TypeError("Invalid pattern");
+ }
+ var header = pattern.substr(0, match.index);
+ var footer = pattern.substr(match.index + match[0].length);
+ if (header.search(/-/) == -1) {
+ header = header + "-";
+ }
+ var whole = match[1];
+ var frac = (typeof(match[2]) == "string" && match[2] != "") ? match[2] : "";
+ var isPercent = (typeof(match[3]) == "string" && match[3] != "");
+ var tmp = whole.split(/,/);
+ var separatorAt;
+ if (typeof(locale) == "undefined") {
+ locale = "default";
+ }
+ if (tmp.length == 1) {
+ separatorAt = null;
+ } else {
+ separatorAt = tmp[1].length;
+ }
+ var leadingZeros = whole.length - whole.replace(/0/g, "").length;
+ var trailingZeros = frac.length - frac.replace(/0/g, "").length;
+ var precision = frac.length;
+ var rval = MochiKit.Format._numberFormatter(
+ placeholder, header, footer, locale, isPercent, precision,
+ leadingZeros, separatorAt, trailingZeros
+ );
+ var m = MochiKit.Base;
+ if (m) {
+ var fn = arguments.callee;
+ var args = m.concat(arguments);
+ rval.repr = function () {
+ return [
+ self.NAME,
+ "(",
+ map(m.repr, args).join(", "),
+ ")"
+ ].join("");
+ };
+ }
+ return rval;
+};
+
+/** @id MochiKit.Format.formatLocale */
+MochiKit.Format.formatLocale = function (locale) {
+ if (typeof(locale) == "undefined" || locale === null) {
+ locale = "default";
+ }
+ if (typeof(locale) == "string") {
+ var rval = MochiKit.Format.LOCALE[locale];
+ if (typeof(rval) == "string") {
+ rval = arguments.callee(rval);
+ MochiKit.Format.LOCALE[locale] = rval;
+ }
+ return rval;
+ } else {
+ return locale;
+ }
+};
+
+/** @id MochiKit.Format.twoDigitAverage */
+MochiKit.Format.twoDigitAverage = function (numerator, denominator) {
+ if (denominator) {
+ var res = numerator / denominator;
+ if (!isNaN(res)) {
+ return MochiKit.Format.twoDigitFloat(numerator / denominator);
+ }
+ }
+ return "0";
+};
+
+/** @id MochiKit.Format.twoDigitFloat */
+MochiKit.Format.twoDigitFloat = function (someFloat) {
+ var sign = (someFloat < 0 ? '-' : '');
+ var s = Math.floor(Math.abs(someFloat) * 100).toString();
+ if (s == '0') {
+ return s;
+ }
+ if (s.length < 3) {
+ while (s.charAt(s.length - 1) == '0') {
+ s = s.substring(0, s.length - 1);
+ }
+ return sign + '0.' + s;
+ }
+ var head = sign + s.substring(0, s.length - 2);
+ var tail = s.substring(s.length - 2, s.length);
+ if (tail == '00') {
+ return head;
+ } else if (tail.charAt(1) == '0') {
+ return head + '.' + tail.charAt(0);
+ } else {
+ return head + '.' + tail;
+ }
+};
+
+/** @id MochiKit.Format.lstrip */
+MochiKit.Format.lstrip = function (str, /* optional */chars) {
+ str = str + "";
+ if (typeof(str) != "string") {
+ return null;
+ }
+ if (!chars) {
+ return str.replace(/^\s+/, "");
+ } else {
+ return str.replace(new RegExp("^[" + chars + "]+"), "");
+ }
+};
+
+/** @id MochiKit.Format.rstrip */
+MochiKit.Format.rstrip = function (str, /* optional */chars) {
+ str = str + "";
+ if (typeof(str) != "string") {
+ return null;
+ }
+ if (!chars) {
+ return str.replace(/\s+$/, "");
+ } else {
+ return str.replace(new RegExp("[" + chars + "]+$"), "");
+ }
+};
+
+/** @id MochiKit.Format.strip */
+MochiKit.Format.strip = function (str, /* optional */chars) {
+ var self = MochiKit.Format;
+ return self.rstrip(self.lstrip(str, chars), chars);
+};
+
+/** @id MochiKit.Format.truncToFixed */
+MochiKit.Format.truncToFixed = function (aNumber, precision) {
+ aNumber = Math.floor(aNumber * Math.pow(10, precision));
+ var res = (aNumber * Math.pow(10, -precision)).toFixed(precision);
+ if (res.charAt(0) == ".") {
+ res = "0" + res;
+ }
+ return res;
+};
+
+/** @id MochiKit.Format.roundToFixed */
+MochiKit.Format.roundToFixed = function (aNumber, precision) {
+ return MochiKit.Format.truncToFixed(
+ aNumber + 0.5 * Math.pow(10, -precision),
+ precision
+ );
+};
+
+/** @id MochiKit.Format.percentFormat */
+MochiKit.Format.percentFormat = function (someFloat) {
+ return MochiKit.Format.twoDigitFloat(100 * someFloat) + '%';
+};
+
+MochiKit.Format.EXPORT = [
+ "truncToFixed",
+ "roundToFixed",
+ "numberFormatter",
+ "formatLocale",
+ "twoDigitAverage",
+ "twoDigitFloat",
+ "percentFormat",
+ "lstrip",
+ "rstrip",
+ "strip"
+];
+
+MochiKit.Format.LOCALE = {
+ en_US: {separator: ",", decimal: ".", percent: "%"},
+ de_DE: {separator: ".", decimal: ",", percent: "%"},
+ fr_FR: {separator: " ", decimal: ",", percent: "%"},
+ "default": "en_US"
+};
+
+MochiKit.Format.EXPORT_OK = [];
+MochiKit.Format.EXPORT_TAGS = {
+ ':all': MochiKit.Format.EXPORT,
+ ':common': MochiKit.Format.EXPORT
+};
+
+MochiKit.Format.__new__ = function () {
+ // MochiKit.Base.nameFunctions(this);
+ var base = this.NAME + ".";
+ var k, v, o;
+ for (k in this.LOCALE) {
+ o = this.LOCALE[k];
+ if (typeof(o) == "object") {
+ o.repr = function () { return this.NAME; };
+ o.NAME = base + "LOCALE." + k;
+ }
+ }
+ for (k in this) {
+ o = this[k];
+ if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') {
+ try {
+ o.NAME = base + k;
+ } catch (e) {
+ // pass
+ }
+ }
+ }
+};
+
+MochiKit.Format.__new__();
+
+if (typeof(MochiKit.Base) != "undefined") {
+ MochiKit.Base._exportSymbols(this, MochiKit.Format);
+} else {
+ (function (globals, module) {
+ if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined')
+ || (MochiKit.__export__ === false)) {
+ var all = module.EXPORT_TAGS[":all"];
+ for (var i = 0; i < all.length; i++) {
+ globals[all[i]] = module[all[i]];
+ }
+ }
+ })(this, MochiKit.Format);
+}
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Iter.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Iter.js
new file mode 100644
index 0000000000..c2fcbeee05
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Iter.js
@@ -0,0 +1,851 @@
+/***
+
+MochiKit.Iter 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Iter');
+ dojo.require('MochiKit.Base');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Iter depends on MochiKit.Base!";
+}
+
+if (typeof(MochiKit.Iter) == 'undefined') {
+ MochiKit.Iter = {};
+}
+
+MochiKit.Iter.NAME = "MochiKit.Iter";
+MochiKit.Iter.VERSION = "1.4";
+MochiKit.Base.update(MochiKit.Iter, {
+ __repr__: function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+ },
+ toString: function () {
+ return this.__repr__();
+ },
+
+ /** @id MochiKit.Iter.registerIteratorFactory */
+ registerIteratorFactory: function (name, check, iterfactory, /* optional */ override) {
+ MochiKit.Iter.iteratorRegistry.register(name, check, iterfactory, override);
+ },
+
+ /** @id MochiKit.Iter.iter */
+ iter: function (iterable, /* optional */ sentinel) {
+ var self = MochiKit.Iter;
+ if (arguments.length == 2) {
+ return self.takewhile(
+ function (a) { return a != sentinel; },
+ iterable
+ );
+ }
+ if (typeof(iterable.next) == 'function') {
+ return iterable;
+ } else if (typeof(iterable.iter) == 'function') {
+ return iterable.iter();
+ /*
+ } else if (typeof(iterable.__iterator__) == 'function') {
+ //
+ // XXX: We can't support JavaScript 1.7 __iterator__ directly
+ // because of Object.prototype.__iterator__
+ //
+ return iterable.__iterator__();
+ */
+ }
+
+ try {
+ return self.iteratorRegistry.match(iterable);
+ } catch (e) {
+ var m = MochiKit.Base;
+ if (e == m.NotFound) {
+ e = new TypeError(typeof(iterable) + ": " + m.repr(iterable) + " is not iterable");
+ }
+ throw e;
+ }
+ },
+
+ /** @id MochiKit.Iter.count */
+ count: function (n) {
+ if (!n) {
+ n = 0;
+ }
+ var m = MochiKit.Base;
+ return {
+ repr: function () { return "count(" + n + ")"; },
+ toString: m.forwardCall("repr"),
+ next: m.counter(n)
+ };
+ },
+
+ /** @id MochiKit.Iter.cycle */
+ cycle: function (p) {
+ var self = MochiKit.Iter;
+ var m = MochiKit.Base;
+ var lst = [];
+ var iterator = self.iter(p);
+ return {
+ repr: function () { return "cycle(...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ try {
+ var rval = iterator.next();
+ lst.push(rval);
+ return rval;
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ if (lst.length === 0) {
+ this.next = function () {
+ throw self.StopIteration;
+ };
+ } else {
+ var i = -1;
+ this.next = function () {
+ i = (i + 1) % lst.length;
+ return lst[i];
+ };
+ }
+ return this.next();
+ }
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.repeat */
+ repeat: function (elem, /* optional */n) {
+ var m = MochiKit.Base;
+ if (typeof(n) == 'undefined') {
+ return {
+ repr: function () {
+ return "repeat(" + m.repr(elem) + ")";
+ },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ return elem;
+ }
+ };
+ }
+ return {
+ repr: function () {
+ return "repeat(" + m.repr(elem) + ", " + n + ")";
+ },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ if (n <= 0) {
+ throw MochiKit.Iter.StopIteration;
+ }
+ n -= 1;
+ return elem;
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.next */
+ next: function (iterator) {
+ return iterator.next();
+ },
+
+ /** @id MochiKit.Iter.izip */
+ izip: function (p, q/*, ...*/) {
+ var m = MochiKit.Base;
+ var self = MochiKit.Iter;
+ var next = self.next;
+ var iterables = m.map(self.iter, arguments);
+ return {
+ repr: function () { return "izip(...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () { return m.map(next, iterables); }
+ };
+ },
+
+ /** @id MochiKit.Iter.ifilter */
+ ifilter: function (pred, seq) {
+ var m = MochiKit.Base;
+ seq = MochiKit.Iter.iter(seq);
+ if (pred === null) {
+ pred = m.operator.truth;
+ }
+ return {
+ repr: function () { return "ifilter(...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ while (true) {
+ var rval = seq.next();
+ if (pred(rval)) {
+ return rval;
+ }
+ }
+ // mozilla warnings aren't too bright
+ return undefined;
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.ifilterfalse */
+ ifilterfalse: function (pred, seq) {
+ var m = MochiKit.Base;
+ seq = MochiKit.Iter.iter(seq);
+ if (pred === null) {
+ pred = m.operator.truth;
+ }
+ return {
+ repr: function () { return "ifilterfalse(...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ while (true) {
+ var rval = seq.next();
+ if (!pred(rval)) {
+ return rval;
+ }
+ }
+ // mozilla warnings aren't too bright
+ return undefined;
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.islice */
+ islice: function (seq/*, [start,] stop[, step] */) {
+ var self = MochiKit.Iter;
+ var m = MochiKit.Base;
+ seq = self.iter(seq);
+ var start = 0;
+ var stop = 0;
+ var step = 1;
+ var i = -1;
+ if (arguments.length == 2) {
+ stop = arguments[1];
+ } else if (arguments.length == 3) {
+ start = arguments[1];
+ stop = arguments[2];
+ } else {
+ start = arguments[1];
+ stop = arguments[2];
+ step = arguments[3];
+ }
+ return {
+ repr: function () {
+ return "islice(" + ["...", start, stop, step].join(", ") + ")";
+ },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ var rval;
+ while (i < start) {
+ rval = seq.next();
+ i++;
+ }
+ if (start >= stop) {
+ throw self.StopIteration;
+ }
+ start += step;
+ return rval;
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.imap */
+ imap: function (fun, p, q/*, ...*/) {
+ var m = MochiKit.Base;
+ var self = MochiKit.Iter;
+ var iterables = m.map(self.iter, m.extend(null, arguments, 1));
+ var map = m.map;
+ var next = self.next;
+ return {
+ repr: function () { return "imap(...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ return fun.apply(this, map(next, iterables));
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.applymap */
+ applymap: function (fun, seq, self) {
+ seq = MochiKit.Iter.iter(seq);
+ var m = MochiKit.Base;
+ return {
+ repr: function () { return "applymap(...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ return fun.apply(self, seq.next());
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.chain */
+ chain: function (p, q/*, ...*/) {
+ // dumb fast path
+ var self = MochiKit.Iter;
+ var m = MochiKit.Base;
+ if (arguments.length == 1) {
+ return self.iter(arguments[0]);
+ }
+ var argiter = m.map(self.iter, arguments);
+ return {
+ repr: function () { return "chain(...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ while (argiter.length > 1) {
+ try {
+ return argiter[0].next();
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ argiter.shift();
+ }
+ }
+ if (argiter.length == 1) {
+ // optimize last element
+ var arg = argiter.shift();
+ this.next = m.bind("next", arg);
+ return this.next();
+ }
+ throw self.StopIteration;
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.takewhile */
+ takewhile: function (pred, seq) {
+ var self = MochiKit.Iter;
+ seq = self.iter(seq);
+ return {
+ repr: function () { return "takewhile(...)"; },
+ toString: MochiKit.Base.forwardCall("repr"),
+ next: function () {
+ var rval = seq.next();
+ if (!pred(rval)) {
+ this.next = function () {
+ throw self.StopIteration;
+ };
+ this.next();
+ }
+ return rval;
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.dropwhile */
+ dropwhile: function (pred, seq) {
+ seq = MochiKit.Iter.iter(seq);
+ var m = MochiKit.Base;
+ var bind = m.bind;
+ return {
+ "repr": function () { return "dropwhile(...)"; },
+ "toString": m.forwardCall("repr"),
+ "next": function () {
+ while (true) {
+ var rval = seq.next();
+ if (!pred(rval)) {
+ break;
+ }
+ }
+ this.next = bind("next", seq);
+ return rval;
+ }
+ };
+ },
+
+ _tee: function (ident, sync, iterable) {
+ sync.pos[ident] = -1;
+ var m = MochiKit.Base;
+ var listMin = m.listMin;
+ return {
+ repr: function () { return "tee(" + ident + ", ...)"; },
+ toString: m.forwardCall("repr"),
+ next: function () {
+ var rval;
+ var i = sync.pos[ident];
+
+ if (i == sync.max) {
+ rval = iterable.next();
+ sync.deque.push(rval);
+ sync.max += 1;
+ sync.pos[ident] += 1;
+ } else {
+ rval = sync.deque[i - sync.min];
+ sync.pos[ident] += 1;
+ if (i == sync.min && listMin(sync.pos) != sync.min) {
+ sync.min += 1;
+ sync.deque.shift();
+ }
+ }
+ return rval;
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.tee */
+ tee: function (iterable, n/* = 2 */) {
+ var rval = [];
+ var sync = {
+ "pos": [],
+ "deque": [],
+ "max": -1,
+ "min": -1
+ };
+ if (arguments.length == 1 || typeof(n) == "undefined" || n === null) {
+ n = 2;
+ }
+ var self = MochiKit.Iter;
+ iterable = self.iter(iterable);
+ var _tee = self._tee;
+ for (var i = 0; i < n; i++) {
+ rval.push(_tee(i, sync, iterable));
+ }
+ return rval;
+ },
+
+ /** @id MochiKit.Iter.list */
+ list: function (iterable) {
+ // Fast-path for Array and Array-like
+ var rval;
+ if (iterable instanceof Array) {
+ return iterable.slice();
+ }
+ // this is necessary to avoid a Safari crash
+ if (typeof(iterable) == "function" &&
+ !(iterable instanceof Function) &&
+ typeof(iterable.length) == 'number') {
+ rval = [];
+ for (var i = 0; i < iterable.length; i++) {
+ rval.push(iterable[i]);
+ }
+ return rval;
+ }
+
+ var self = MochiKit.Iter;
+ iterable = self.iter(iterable);
+ var rval = [];
+ try {
+ while (true) {
+ rval.push(iterable.next());
+ }
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ return rval;
+ }
+ // mozilla warnings aren't too bright
+ return undefined;
+ },
+
+
+ /** @id MochiKit.Iter.reduce */
+ reduce: function (fn, iterable, /* optional */initial) {
+ var i = 0;
+ var x = initial;
+ var self = MochiKit.Iter;
+ iterable = self.iter(iterable);
+ if (arguments.length < 3) {
+ try {
+ x = iterable.next();
+ } catch (e) {
+ if (e == self.StopIteration) {
+ e = new TypeError("reduce() of empty sequence with no initial value");
+ }
+ throw e;
+ }
+ i++;
+ }
+ try {
+ while (true) {
+ x = fn(x, iterable.next());
+ }
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ }
+ return x;
+ },
+
+ /** @id MochiKit.Iter.range */
+ range: function (/* [start,] stop[, step] */) {
+ var start = 0;
+ var stop = 0;
+ var step = 1;
+ if (arguments.length == 1) {
+ stop = arguments[0];
+ } else if (arguments.length == 2) {
+ start = arguments[0];
+ stop = arguments[1];
+ } else if (arguments.length == 3) {
+ start = arguments[0];
+ stop = arguments[1];
+ step = arguments[2];
+ } else {
+ throw new TypeError("range() takes 1, 2, or 3 arguments!");
+ }
+ if (step === 0) {
+ throw new TypeError("range() step must not be 0");
+ }
+ return {
+ next: function () {
+ if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) {
+ throw MochiKit.Iter.StopIteration;
+ }
+ var rval = start;
+ start += step;
+ return rval;
+ },
+ repr: function () {
+ return "range(" + [start, stop, step].join(", ") + ")";
+ },
+ toString: MochiKit.Base.forwardCall("repr")
+ };
+ },
+
+ /** @id MochiKit.Iter.sum */
+ sum: function (iterable, start/* = 0 */) {
+ if (typeof(start) == "undefined" || start === null) {
+ start = 0;
+ }
+ var x = start;
+ var self = MochiKit.Iter;
+ iterable = self.iter(iterable);
+ try {
+ while (true) {
+ x += iterable.next();
+ }
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ }
+ return x;
+ },
+
+ /** @id MochiKit.Iter.exhaust */
+ exhaust: function (iterable) {
+ var self = MochiKit.Iter;
+ iterable = self.iter(iterable);
+ try {
+ while (true) {
+ iterable.next();
+ }
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ }
+ },
+
+ /** @id MochiKit.Iter.forEach */
+ forEach: function (iterable, func, /* optional */self) {
+ var m = MochiKit.Base;
+ if (arguments.length > 2) {
+ func = m.bind(func, self);
+ }
+ // fast path for array
+ if (m.isArrayLike(iterable)) {
+ try {
+ for (var i = 0; i < iterable.length; i++) {
+ func(iterable[i]);
+ }
+ } catch (e) {
+ if (e != MochiKit.Iter.StopIteration) {
+ throw e;
+ }
+ }
+ } else {
+ self = MochiKit.Iter;
+ self.exhaust(self.imap(func, iterable));
+ }
+ },
+
+ /** @id MochiKit.Iter.every */
+ every: function (iterable, func) {
+ var self = MochiKit.Iter;
+ try {
+ self.ifilterfalse(func, iterable).next();
+ return false;
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ return true;
+ }
+ },
+
+ /** @id MochiKit.Iter.sorted */
+ sorted: function (iterable, /* optional */cmp) {
+ var rval = MochiKit.Iter.list(iterable);
+ if (arguments.length == 1) {
+ cmp = MochiKit.Base.compare;
+ }
+ rval.sort(cmp);
+ return rval;
+ },
+
+ /** @id MochiKit.Iter.reversed */
+ reversed: function (iterable) {
+ var rval = MochiKit.Iter.list(iterable);
+ rval.reverse();
+ return rval;
+ },
+
+ /** @id MochiKit.Iter.some */
+ some: function (iterable, func) {
+ var self = MochiKit.Iter;
+ try {
+ self.ifilter(func, iterable).next();
+ return true;
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ return false;
+ }
+ },
+
+ /** @id MochiKit.Iter.iextend */
+ iextend: function (lst, iterable) {
+ if (MochiKit.Base.isArrayLike(iterable)) {
+ // fast-path for array-like
+ for (var i = 0; i < iterable.length; i++) {
+ lst.push(iterable[i]);
+ }
+ } else {
+ var self = MochiKit.Iter;
+ iterable = self.iter(iterable);
+ try {
+ while (true) {
+ lst.push(iterable.next());
+ }
+ } catch (e) {
+ if (e != self.StopIteration) {
+ throw e;
+ }
+ }
+ }
+ return lst;
+ },
+
+ /** @id MochiKit.Iter.groupby */
+ groupby: function(iterable, /* optional */ keyfunc) {
+ var m = MochiKit.Base;
+ var self = MochiKit.Iter;
+ if (arguments.length < 2) {
+ keyfunc = m.operator.identity;
+ }
+ iterable = self.iter(iterable);
+
+ // shared
+ var pk = undefined;
+ var k = undefined;
+ var v;
+
+ function fetch() {
+ v = iterable.next();
+ k = keyfunc(v);
+ };
+
+ function eat() {
+ var ret = v;
+ v = undefined;
+ return ret;
+ };
+
+ var first = true;
+ var compare = m.compare;
+ return {
+ repr: function () { return "groupby(...)"; },
+ next: function() {
+ // iterator-next
+
+ // iterate until meet next group
+ while (compare(k, pk) === 0) {
+ fetch();
+ if (first) {
+ first = false;
+ break;
+ }
+ }
+ pk = k;
+ return [k, {
+ next: function() {
+ // subiterator-next
+ if (v == undefined) { // Is there something to eat?
+ fetch();
+ }
+ if (compare(k, pk) !== 0) {
+ throw self.StopIteration;
+ }
+ return eat();
+ }
+ }];
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.groupby_as_array */
+ groupby_as_array: function (iterable, /* optional */ keyfunc) {
+ var m = MochiKit.Base;
+ var self = MochiKit.Iter;
+ if (arguments.length < 2) {
+ keyfunc = m.operator.identity;
+ }
+
+ iterable = self.iter(iterable);
+ var result = [];
+ var first = true;
+ var prev_key;
+ var compare = m.compare;
+ while (true) {
+ try {
+ var value = iterable.next();
+ var key = keyfunc(value);
+ } catch (e) {
+ if (e == self.StopIteration) {
+ break;
+ }
+ throw e;
+ }
+ if (first || compare(key, prev_key) !== 0) {
+ var values = [];
+ result.push([key, values]);
+ }
+ values.push(value);
+ first = false;
+ prev_key = key;
+ }
+ return result;
+ },
+
+ /** @id MochiKit.Iter.arrayLikeIter */
+ arrayLikeIter: function (iterable) {
+ var i = 0;
+ return {
+ repr: function () { return "arrayLikeIter(...)"; },
+ toString: MochiKit.Base.forwardCall("repr"),
+ next: function () {
+ if (i >= iterable.length) {
+ throw MochiKit.Iter.StopIteration;
+ }
+ return iterable[i++];
+ }
+ };
+ },
+
+ /** @id MochiKit.Iter.hasIterateNext */
+ hasIterateNext: function (iterable) {
+ return (iterable && typeof(iterable.iterateNext) == "function");
+ },
+
+ /** @id MochiKit.Iter.iterateNextIter */
+ iterateNextIter: function (iterable) {
+ return {
+ repr: function () { return "iterateNextIter(...)"; },
+ toString: MochiKit.Base.forwardCall("repr"),
+ next: function () {
+ var rval = iterable.iterateNext();
+ if (rval === null || rval === undefined) {
+ throw MochiKit.Iter.StopIteration;
+ }
+ return rval;
+ }
+ };
+ }
+});
+
+
+MochiKit.Iter.EXPORT_OK = [
+ "iteratorRegistry",
+ "arrayLikeIter",
+ "hasIterateNext",
+ "iterateNextIter",
+];
+
+MochiKit.Iter.EXPORT = [
+ "StopIteration",
+ "registerIteratorFactory",
+ "iter",
+ "count",
+ "cycle",
+ "repeat",
+ "next",
+ "izip",
+ "ifilter",
+ "ifilterfalse",
+ "islice",
+ "imap",
+ "applymap",
+ "chain",
+ "takewhile",
+ "dropwhile",
+ "tee",
+ "list",
+ "reduce",
+ "range",
+ "sum",
+ "exhaust",
+ "forEach",
+ "every",
+ "sorted",
+ "reversed",
+ "some",
+ "iextend",
+ "groupby",
+ "groupby_as_array"
+];
+
+MochiKit.Iter.__new__ = function () {
+ var m = MochiKit.Base;
+ // Re-use StopIteration if exists (e.g. SpiderMonkey)
+ if (typeof(StopIteration) != "undefined") {
+ this.StopIteration = StopIteration;
+ } else {
+ /** @id MochiKit.Iter.StopIteration */
+ this.StopIteration = new m.NamedError("StopIteration");
+ }
+ this.iteratorRegistry = new m.AdapterRegistry();
+ // Register the iterator factory for arrays
+ this.registerIteratorFactory(
+ "arrayLike",
+ m.isArrayLike,
+ this.arrayLikeIter
+ );
+
+ this.registerIteratorFactory(
+ "iterateNext",
+ this.hasIterateNext,
+ this.iterateNextIter
+ );
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+
+};
+
+MochiKit.Iter.__new__();
+
+//
+// XXX: Internet Explorer blows
+//
+if (MochiKit.__export__) {
+ reduce = MochiKit.Iter.reduce;
+}
+
+MochiKit.Base._exportSymbols(this, MochiKit.Iter);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Logging.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Logging.js
new file mode 100644
index 0000000000..ac7678b5e6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Logging.js
@@ -0,0 +1,321 @@
+/***
+
+MochiKit.Logging 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Logging');
+ dojo.require('MochiKit.Base');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Logging depends on MochiKit.Base!";
+}
+
+if (typeof(MochiKit.Logging) == 'undefined') {
+ MochiKit.Logging = {};
+}
+
+MochiKit.Logging.NAME = "MochiKit.Logging";
+MochiKit.Logging.VERSION = "1.4";
+MochiKit.Logging.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+MochiKit.Logging.toString = function () {
+ return this.__repr__();
+};
+
+
+MochiKit.Logging.EXPORT = [
+ "LogLevel",
+ "LogMessage",
+ "Logger",
+ "alertListener",
+ "logger",
+ "log",
+ "logError",
+ "logDebug",
+ "logFatal",
+ "logWarning"
+];
+
+
+MochiKit.Logging.EXPORT_OK = [
+ "logLevelAtLeast",
+ "isLogMessage",
+ "compareLogMessage"
+];
+
+
+/** @id MochiKit.Logging.LogMessage */
+MochiKit.Logging.LogMessage = function (num, level, info) {
+ this.num = num;
+ this.level = level;
+ this.info = info;
+ this.timestamp = new Date();
+};
+
+MochiKit.Logging.LogMessage.prototype = {
+ /** @id MochiKit.Logging.LogMessage.prototype.repr */
+ repr: function () {
+ var m = MochiKit.Base;
+ return 'LogMessage(' +
+ m.map(
+ m.repr,
+ [this.num, this.level, this.info]
+ ).join(', ') + ')';
+ },
+ /** @id MochiKit.Logging.LogMessage.prototype.toString */
+ toString: MochiKit.Base.forwardCall("repr")
+};
+
+MochiKit.Base.update(MochiKit.Logging, {
+ /** @id MochiKit.Logging.logLevelAtLeast */
+ logLevelAtLeast: function (minLevel) {
+ var self = MochiKit.Logging;
+ if (typeof(minLevel) == 'string') {
+ minLevel = self.LogLevel[minLevel];
+ }
+ return function (msg) {
+ var msgLevel = msg.level;
+ if (typeof(msgLevel) == 'string') {
+ msgLevel = self.LogLevel[msgLevel];
+ }
+ return msgLevel >= minLevel;
+ };
+ },
+
+ /** @id MochiKit.Logging.isLogMessage */
+ isLogMessage: function (/* ... */) {
+ var LogMessage = MochiKit.Logging.LogMessage;
+ for (var i = 0; i < arguments.length; i++) {
+ if (!(arguments[i] instanceof LogMessage)) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /** @id MochiKit.Logging.compareLogMessage */
+ compareLogMessage: function (a, b) {
+ return MochiKit.Base.compare([a.level, a.info], [b.level, b.info]);
+ },
+
+ /** @id MochiKit.Logging.alertListener */
+ alertListener: function (msg) {
+ alert(
+ "num: " + msg.num +
+ "\nlevel: " + msg.level +
+ "\ninfo: " + msg.info.join(" ")
+ );
+ }
+
+});
+
+/** @id MochiKit.Logging.Logger */
+MochiKit.Logging.Logger = function (/* optional */maxSize) {
+ this.counter = 0;
+ if (typeof(maxSize) == 'undefined' || maxSize === null) {
+ maxSize = -1;
+ }
+ this.maxSize = maxSize;
+ this._messages = [];
+ this.listeners = {};
+ this.useNativeConsole = false;
+};
+
+MochiKit.Logging.Logger.prototype = {
+ /** @id MochiKit.Logging.Logger.prototype.clear */
+ clear: function () {
+ this._messages.splice(0, this._messages.length);
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.logToConsole */
+ logToConsole: function (msg) {
+ if (typeof(window) != "undefined" && window.console
+ && window.console.log) {
+ // Safari and FireBug 0.4
+ // Percent replacement is a workaround for cute Safari crashing bug
+ window.console.log(msg.replace(/%/g, '\uFF05'));
+ } else if (typeof(opera) != "undefined" && opera.postError) {
+ // Opera
+ opera.postError(msg);
+ } else if (typeof(printfire) == "function") {
+ // FireBug 0.3 and earlier
+ printfire(msg);
+ } else if (typeof(Debug) != "undefined" && Debug.writeln) {
+ // IE Web Development Helper (?)
+ // http://www.nikhilk.net/Entry.aspx?id=93
+ Debug.writeln(msg);
+ } else if (typeof(debug) != "undefined" && debug.trace) {
+ // Atlas framework (?)
+ // http://www.nikhilk.net/Entry.aspx?id=93
+ debug.trace(msg);
+ }
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.dispatchListeners */
+ dispatchListeners: function (msg) {
+ for (var k in this.listeners) {
+ var pair = this.listeners[k];
+ if (pair.ident != k || (pair[0] && !pair[0](msg))) {
+ continue;
+ }
+ pair[1](msg);
+ }
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.addListener */
+ addListener: function (ident, filter, listener) {
+ if (typeof(filter) == 'string') {
+ filter = MochiKit.Logging.logLevelAtLeast(filter);
+ }
+ var entry = [filter, listener];
+ entry.ident = ident;
+ this.listeners[ident] = entry;
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.removeListener */
+ removeListener: function (ident) {
+ delete this.listeners[ident];
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.baseLog */
+ baseLog: function (level, message/*, ...*/) {
+ var msg = new MochiKit.Logging.LogMessage(
+ this.counter,
+ level,
+ MochiKit.Base.extend(null, arguments, 1)
+ );
+ this._messages.push(msg);
+ this.dispatchListeners(msg);
+ if (this.useNativeConsole) {
+ this.logToConsole(msg.level + ": " + msg.info.join(" "));
+ }
+ this.counter += 1;
+ while (this.maxSize >= 0 && this._messages.length > this.maxSize) {
+ this._messages.shift();
+ }
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.getMessages */
+ getMessages: function (howMany) {
+ var firstMsg = 0;
+ if (!(typeof(howMany) == 'undefined' || howMany === null)) {
+ firstMsg = Math.max(0, this._messages.length - howMany);
+ }
+ return this._messages.slice(firstMsg);
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.getMessageText */
+ getMessageText: function (howMany) {
+ if (typeof(howMany) == 'undefined' || howMany === null) {
+ howMany = 30;
+ }
+ var messages = this.getMessages(howMany);
+ if (messages.length) {
+ var lst = map(function (m) {
+ return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' ');
+ }, messages);
+ lst.unshift('LAST ' + messages.length + ' MESSAGES:');
+ return lst.join('');
+ }
+ return '';
+ },
+
+ /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */
+ debuggingBookmarklet: function (inline) {
+ if (typeof(MochiKit.LoggingPane) == "undefined") {
+ alert(this.getMessageText());
+ } else {
+ MochiKit.LoggingPane.createLoggingPane(inline || false);
+ }
+ }
+};
+
+MochiKit.Logging.__new__ = function () {
+ this.LogLevel = {
+ ERROR: 40,
+ FATAL: 50,
+ WARNING: 30,
+ INFO: 20,
+ DEBUG: 10
+ };
+
+ var m = MochiKit.Base;
+ m.registerComparator("LogMessage",
+ this.isLogMessage,
+ this.compareLogMessage
+ );
+
+ var partial = m.partial;
+
+ var Logger = this.Logger;
+ var baseLog = Logger.prototype.baseLog;
+ m.update(this.Logger.prototype, {
+ debug: partial(baseLog, 'DEBUG'),
+ log: partial(baseLog, 'INFO'),
+ error: partial(baseLog, 'ERROR'),
+ fatal: partial(baseLog, 'FATAL'),
+ warning: partial(baseLog, 'WARNING')
+ });
+
+ // indirectly find logger so it can be replaced
+ var self = this;
+ var connectLog = function (name) {
+ return function () {
+ self.logger[name].apply(self.logger, arguments);
+ };
+ };
+
+ /** @id MochiKit.Logging.log */
+ this.log = connectLog('log');
+ /** @id MochiKit.Logging.logError */
+ this.logError = connectLog('error');
+ /** @id MochiKit.Logging.logDebug */
+ this.logDebug = connectLog('debug');
+ /** @id MochiKit.Logging.logFatal */
+ this.logFatal = connectLog('fatal');
+ /** @id MochiKit.Logging.logWarning */
+ this.logWarning = connectLog('warning');
+ this.logger = new Logger();
+ this.logger.useNativeConsole = true;
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+
+};
+
+if (typeof(printfire) == "undefined" &&
+ typeof(document) != "undefined" && document.createEvent &&
+ typeof(dispatchEvent) != "undefined") {
+ // FireBug really should be less stupid about this global function
+ printfire = function () {
+ printfire.args = arguments;
+ var ev = document.createEvent("Events");
+ ev.initEvent("printfire", false, true);
+ dispatchEvent(ev);
+ };
+}
+
+MochiKit.Logging.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.Logging);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/LoggingPane.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/LoggingPane.js
new file mode 100644
index 0000000000..3798ae404e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/LoggingPane.js
@@ -0,0 +1,374 @@
+/***
+
+MochiKit.LoggingPane 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.LoggingPane');
+ dojo.require('MochiKit.Logging');
+ dojo.require('MochiKit.Base');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Logging", []);
+ JSAN.use("MochiKit.Base", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined' || typeof(MochiKit.Logging) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.LoggingPane depends on MochiKit.Base and MochiKit.Logging!";
+}
+
+if (typeof(MochiKit.LoggingPane) == 'undefined') {
+ MochiKit.LoggingPane = {};
+}
+
+MochiKit.LoggingPane.NAME = "MochiKit.LoggingPane";
+MochiKit.LoggingPane.VERSION = "1.4";
+MochiKit.LoggingPane.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+MochiKit.LoggingPane.toString = function () {
+ return this.__repr__();
+};
+
+/** @id MochiKit.LoggingPane.createLoggingPane */
+MochiKit.LoggingPane.createLoggingPane = function (inline/* = false */) {
+ var m = MochiKit.LoggingPane;
+ inline = !(!inline);
+ if (m._loggingPane && m._loggingPane.inline != inline) {
+ m._loggingPane.closePane();
+ m._loggingPane = null;
+ }
+ if (!m._loggingPane || m._loggingPane.closed) {
+ m._loggingPane = new m.LoggingPane(inline, MochiKit.Logging.logger);
+ }
+ return m._loggingPane;
+};
+
+/** @id MochiKit.LoggingPane.LoggingPane */
+MochiKit.LoggingPane.LoggingPane = function (inline/* = false */, logger/* = MochiKit.Logging.logger */) {
+
+ /* Use a div if inline, pop up a window if not */
+ /* Create the elements */
+ if (typeof(logger) == "undefined" || logger === null) {
+ logger = MochiKit.Logging.logger;
+ }
+ this.logger = logger;
+ var update = MochiKit.Base.update;
+ var updatetree = MochiKit.Base.updatetree;
+ var bind = MochiKit.Base.bind;
+ var clone = MochiKit.Base.clone;
+ var win = window;
+ var uid = "_MochiKit_LoggingPane";
+ if (typeof(MochiKit.DOM) != "undefined") {
+ win = MochiKit.DOM.currentWindow();
+ }
+ if (!inline) {
+ // name the popup with the base URL for uniqueness
+ var url = win.location.href.split("?")[0].replace(/[#:\/.><&-]/g, "_");
+ var name = uid + "_" + url;
+ var nwin = win.open("", name, "dependent,resizable,height=200");
+ if (!nwin) {
+ alert("Not able to open debugging window due to pop-up blocking.");
+ return undefined;
+ }
+ nwin.document.write(
+ '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" '
+ + '"http://www.w3.org/TR/html4/loose.dtd">'
+ + '<html><head><title>[MochiKit.LoggingPane]</title></head>'
+ + '<body></body></html>'
+ );
+ nwin.document.close();
+ nwin.document.title += ' ' + win.document.title;
+ win = nwin;
+ }
+ var doc = win.document;
+ this.doc = doc;
+
+ // Connect to the debug pane if it already exists (i.e. in a window orphaned by the page being refreshed)
+ var debugPane = doc.getElementById(uid);
+ var existing_pane = !!debugPane;
+ if (debugPane && typeof(debugPane.loggingPane) != "undefined") {
+ debugPane.loggingPane.logger = this.logger;
+ debugPane.loggingPane.buildAndApplyFilter();
+ return debugPane.loggingPane;
+ }
+
+ if (existing_pane) {
+ // clear any existing contents
+ var child;
+ while ((child = debugPane.firstChild)) {
+ debugPane.removeChild(child);
+ }
+ } else {
+ debugPane = doc.createElement("div");
+ debugPane.id = uid;
+ }
+ debugPane.loggingPane = this;
+ var levelFilterField = doc.createElement("input");
+ var infoFilterField = doc.createElement("input");
+ var filterButton = doc.createElement("button");
+ var loadButton = doc.createElement("button");
+ var clearButton = doc.createElement("button");
+ var closeButton = doc.createElement("button");
+ var logPaneArea = doc.createElement("div");
+ var logPane = doc.createElement("div");
+
+ /* Set up the functions */
+ var listenerId = uid + "_Listener";
+ this.colorTable = clone(this.colorTable);
+ var messages = [];
+ var messageFilter = null;
+
+ /** @id MochiKit.LoggingPane.messageLevel */
+ var messageLevel = function (msg) {
+ var level = msg.level;
+ if (typeof(level) == "number") {
+ level = MochiKit.Logging.LogLevel[level];
+ }
+ return level;
+ };
+
+ /** @id MochiKit.LoggingPane.messageText */
+ var messageText = function (msg) {
+ return msg.info.join(" ");
+ };
+
+ /** @id MochiKit.LoggingPane.addMessageText */
+ var addMessageText = bind(function (msg) {
+ var level = messageLevel(msg);
+ var text = messageText(msg);
+ var c = this.colorTable[level];
+ var p = doc.createElement("span");
+ p.className = "MochiKit-LogMessage MochiKit-LogLevel-" + level;
+ p.style.cssText = "margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: " + c;
+ p.appendChild(doc.createTextNode(level + ": " + text));
+ logPane.appendChild(p);
+ logPane.appendChild(doc.createElement("br"));
+ if (logPaneArea.offsetHeight > logPaneArea.scrollHeight) {
+ logPaneArea.scrollTop = 0;
+ } else {
+ logPaneArea.scrollTop = logPaneArea.scrollHeight;
+ }
+ }, this);
+
+ /** @id MochiKit.LoggingPane.addMessage */
+ var addMessage = function (msg) {
+ messages[messages.length] = msg;
+ addMessageText(msg);
+ };
+
+ /** @id MochiKit.LoggingPane.buildMessageFilter */
+ var buildMessageFilter = function () {
+ var levelre, infore;
+ try {
+ /* Catch any exceptions that might arise due to invalid regexes */
+ levelre = new RegExp(levelFilterField.value);
+ infore = new RegExp(infoFilterField.value);
+ } catch(e) {
+ /* If there was an error with the regexes, do no filtering */
+ logDebug("Error in filter regex: " + e.message);
+ return null;
+ }
+
+ return function (msg) {
+ return (
+ levelre.test(messageLevel(msg)) &&
+ infore.test(messageText(msg))
+ );
+ };
+ };
+
+ /** @id MochiKit.LoggingPane.clearMessagePane */
+ var clearMessagePane = function () {
+ while (logPane.firstChild) {
+ logPane.removeChild(logPane.firstChild);
+ }
+ };
+
+ /** @id MochiKit.LoggingPane.clearMessages */
+ var clearMessages = function () {
+ messages = [];
+ clearMessagePane();
+ };
+
+ /** @id MochiKit.LoggingPane.closePane */
+ var closePane = bind(function () {
+ if (this.closed) {
+ return;
+ }
+ this.closed = true;
+ if (MochiKit.LoggingPane._loggingPane == this) {
+ MochiKit.LoggingPane._loggingPane = null;
+ }
+ this.logger.removeListener(listenerId);
+ try {
+ try {
+ debugPane.loggingPane = null;
+ } catch(e) { logFatal("Bookmarklet was closed incorrectly."); }
+ if (inline) {
+ debugPane.parentNode.removeChild(debugPane);
+ } else {
+ this.win.close();
+ }
+ } catch(e) {}
+ }, this);
+
+ /** @id MochiKit.LoggingPane.filterMessages */
+ var filterMessages = function () {
+ clearMessagePane();
+
+ for (var i = 0; i < messages.length; i++) {
+ var msg = messages[i];
+ if (messageFilter === null || messageFilter(msg)) {
+ addMessageText(msg);
+ }
+ }
+ };
+
+ this.buildAndApplyFilter = function () {
+ messageFilter = buildMessageFilter();
+
+ filterMessages();
+
+ this.logger.removeListener(listenerId);
+ this.logger.addListener(listenerId, messageFilter, addMessage);
+ };
+
+
+ /** @id MochiKit.LoggingPane.loadMessages */
+ var loadMessages = bind(function () {
+ messages = this.logger.getMessages();
+ filterMessages();
+ }, this);
+
+ /** @id MochiKit.LoggingPane.filterOnEnter */
+ var filterOnEnter = bind(function (event) {
+ event = event || window.event;
+ key = event.which || event.keyCode;
+ if (key == 13) {
+ this.buildAndApplyFilter();
+ }
+ }, this);
+
+ /* Create the debug pane */
+ var style = "display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: " + this.logFont;
+ if (inline) {
+ style += "; height: 10em; border-top: 2px solid black";
+ } else {
+ style += "; height: 100%;";
+ }
+ debugPane.style.cssText = style;
+
+ if (!existing_pane) {
+ doc.body.appendChild(debugPane);
+ }
+
+ /* Create the filter fields */
+ style = {"cssText": "width: 33%; display: inline; font: " + this.logFont};
+
+ updatetree(levelFilterField, {
+ "value": "FATAL|ERROR|WARNING|INFO|DEBUG",
+ "onkeypress": filterOnEnter,
+ "style": style
+ });
+ debugPane.appendChild(levelFilterField);
+
+ updatetree(infoFilterField, {
+ "value": ".*",
+ "onkeypress": filterOnEnter,
+ "style": style
+ });
+ debugPane.appendChild(infoFilterField);
+
+ /* Create the buttons */
+ style = "width: 8%; display:inline; font: " + this.logFont;
+
+ filterButton.appendChild(doc.createTextNode("Filter"));
+ filterButton.onclick = bind("buildAndApplyFilter", this);
+ filterButton.style.cssText = style;
+ debugPane.appendChild(filterButton);
+
+ loadButton.appendChild(doc.createTextNode("Load"));
+ loadButton.onclick = loadMessages;
+ loadButton.style.cssText = style;
+ debugPane.appendChild(loadButton);
+
+ clearButton.appendChild(doc.createTextNode("Clear"));
+ clearButton.onclick = clearMessages;
+ clearButton.style.cssText = style;
+ debugPane.appendChild(clearButton);
+
+ closeButton.appendChild(doc.createTextNode("Close"));
+ closeButton.onclick = closePane;
+ closeButton.style.cssText = style;
+ debugPane.appendChild(closeButton);
+
+ /* Create the logging pane */
+ logPaneArea.style.cssText = "overflow: auto; width: 100%";
+ logPane.style.cssText = "width: 100%; height: " + (inline ? "8em" : "100%");
+
+ logPaneArea.appendChild(logPane);
+ debugPane.appendChild(logPaneArea);
+
+ this.buildAndApplyFilter();
+ loadMessages();
+
+ if (inline) {
+ this.win = undefined;
+ } else {
+ this.win = win;
+ }
+ this.inline = inline;
+ this.closePane = closePane;
+ this.closed = false;
+
+
+ return this;
+};
+
+MochiKit.LoggingPane.LoggingPane.prototype = {
+ "logFont": "8pt Verdana,sans-serif",
+ "colorTable": {
+ "ERROR": "red",
+ "FATAL": "darkred",
+ "WARNING": "blue",
+ "INFO": "black",
+ "DEBUG": "green"
+ }
+};
+
+
+MochiKit.LoggingPane.EXPORT_OK = [
+ "LoggingPane"
+];
+
+MochiKit.LoggingPane.EXPORT = [
+ "createLoggingPane"
+];
+
+MochiKit.LoggingPane.__new__ = function () {
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": MochiKit.Base.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ MochiKit.Base.nameFunctions(this);
+
+ MochiKit.LoggingPane._loggingPane = null;
+
+};
+
+MochiKit.LoggingPane.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.LoggingPane);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/MochiKit.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/MochiKit.js
new file mode 100644
index 0000000000..3a13b241fe
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/MochiKit.js
@@ -0,0 +1,154 @@
+/***
+
+MochiKit.MochiKit 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(MochiKit) == 'undefined') {
+ MochiKit = {};
+}
+
+if (typeof(MochiKit.MochiKit) == 'undefined') {
+ /** @id MochiKit.MochiKit */
+ MochiKit.MochiKit = {};
+}
+
+MochiKit.MochiKit.NAME = "MochiKit.MochiKit";
+MochiKit.MochiKit.VERSION = "1.4";
+MochiKit.MochiKit.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+/** @id MochiKit.MochiKit.toString */
+MochiKit.MochiKit.toString = function () {
+ return this.__repr__();
+};
+
+/** @id MochiKit.MochiKit.SUBMODULES */
+MochiKit.MochiKit.SUBMODULES = [
+ "Base",
+ "Iter",
+ "Logging",
+ "DateTime",
+ "Format",
+ "Async",
+ "DOM",
+ "Selector",
+ "Style",
+ "LoggingPane",
+ "Color",
+ "Signal",
+ "Position",
+ "Visual"
+];
+
+if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') {
+ if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.MochiKit');
+ dojo.require("MochiKit.*");
+ }
+ if (typeof(JSAN) != 'undefined') {
+ (function (lst) {
+ for (var i = 0; i < lst.length; i++) {
+ JSAN.use("MochiKit." + lst[i], []);
+ }
+ })(MochiKit.MochiKit.SUBMODULES);
+ }
+ (function () {
+ var extend = MochiKit.Base.extend;
+ var self = MochiKit.MochiKit;
+ var modules = self.SUBMODULES;
+ var EXPORT = [];
+ var EXPORT_OK = [];
+ var EXPORT_TAGS = {};
+ var i, k, m, all;
+ for (i = 0; i < modules.length; i++) {
+ m = MochiKit[modules[i]];
+ extend(EXPORT, m.EXPORT);
+ extend(EXPORT_OK, m.EXPORT_OK);
+ for (k in m.EXPORT_TAGS) {
+ EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]);
+ }
+ all = m.EXPORT_TAGS[":all"];
+ if (!all) {
+ all = extend(null, m.EXPORT, m.EXPORT_OK);
+ }
+ var j;
+ for (j = 0; j < all.length; j++) {
+ k = all[j];
+ self[k] = m[k];
+ }
+ }
+ self.EXPORT = EXPORT;
+ self.EXPORT_OK = EXPORT_OK;
+ self.EXPORT_TAGS = EXPORT_TAGS;
+ }());
+
+} else {
+ if (typeof(MochiKit.__compat__) == 'undefined') {
+ MochiKit.__compat__ = true;
+ }
+ (function () {
+ if (typeof(document) == "undefined") {
+ return;
+ }
+ var scripts = document.getElementsByTagName("script");
+ var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var base = null;
+ var baseElem = null;
+ var allScripts = {};
+ var i;
+ for (i = 0; i < scripts.length; i++) {
+ var src = scripts[i].getAttribute("src");
+ if (!src) {
+ continue;
+ }
+ allScripts[src] = true;
+ if (src.match(/MochiKit.js$/)) {
+ base = src.substring(0, src.lastIndexOf('MochiKit.js'));
+ baseElem = scripts[i];
+ }
+ }
+ if (base === null) {
+ return;
+ }
+ var modules = MochiKit.MochiKit.SUBMODULES;
+ for (var i = 0; i < modules.length; i++) {
+ if (MochiKit[modules[i]]) {
+ continue;
+ }
+ var uri = base + modules[i] + '.js';
+ if (uri in allScripts) {
+ continue;
+ }
+ if (document.documentElement &&
+ document.documentElement.namespaceURI == kXULNSURI) {
+ // XUL
+ var s = document.createElementNS(kXULNSURI, 'script');
+ s.setAttribute("id", "MochiKit_" + base + modules[i]);
+ s.setAttribute("src", uri);
+ s.setAttribute("type", "application/x-javascript");
+ baseElem.parentNode.appendChild(s);
+ } else {
+ // HTML
+ /*
+ DOM can not be used here because Safari does
+ deferred loading of scripts unless they are
+ in the document or inserted with document.write
+
+ This is not XHTML compliant. If you want XHTML
+ compliance then you must use the packed version of MochiKit
+ or include each script individually (basically unroll
+ these document.write calls into your XHTML source)
+
+ */
+ document.write('<script src="' + uri +
+ '" type="text/javascript"></script>');
+ }
+ };
+ })();
+}
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/MockDOM.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/MockDOM.js
new file mode 100644
index 0000000000..92558cb7bf
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/MockDOM.js
@@ -0,0 +1,115 @@
+/***
+
+MochiKit.MockDOM 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(MochiKit) == "undefined") {
+ MochiKit = {};
+}
+
+if (typeof(MochiKit.MockDOM) == "undefined") {
+ MochiKit.MockDOM = {};
+}
+
+MochiKit.MockDOM.NAME = "MochiKit.MockDOM";
+MochiKit.MockDOM.VERSION = "1.4";
+
+MochiKit.MockDOM.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+/** @id MochiKit.MockDOM.toString */
+MochiKit.MockDOM.toString = function () {
+ return this.__repr__();
+};
+
+/** @id MochiKit.MockDOM.createDocument */
+MochiKit.MockDOM.createDocument = function () {
+ var doc = new MochiKit.MockDOM.MockElement("DOCUMENT");
+ doc.body = doc.createElement("BODY");
+ doc.appendChild(doc.body);
+ return doc;
+};
+
+/** @id MochiKit.MockDOM.MockElement */
+MochiKit.MockDOM.MockElement = function (name, data, ownerDocument) {
+ this.tagName = this.nodeName = name.toUpperCase();
+ this.ownerDocument = ownerDocument || null;
+ if (name == "DOCUMENT") {
+ this.nodeType = 9;
+ this.childNodes = [];
+ } else if (typeof(data) == "string") {
+ this.nodeValue = data;
+ this.nodeType = 3;
+ } else {
+ this.nodeType = 1;
+ this.childNodes = [];
+ }
+ if (name.substring(0, 1) == "<") {
+ var nameattr = name.substring(
+ name.indexOf('"') + 1, name.lastIndexOf('"'));
+ name = name.substring(1, name.indexOf(" "));
+ this.tagName = this.nodeName = name.toUpperCase();
+ this.setAttribute("name", nameattr);
+ }
+};
+
+MochiKit.MockDOM.MockElement.prototype = {
+ /** @id MochiKit.MockDOM.MockElement.prototype.createElement */
+ createElement: function (tagName) {
+ return new MochiKit.MockDOM.MockElement(tagName, null, this.nodeType == 9 ? this : this.ownerDocument);
+ },
+ /** @id MochiKit.MockDOM.MockElement.prototype.createTextNode */
+ createTextNode: function (text) {
+ return new MochiKit.MockDOM.MockElement("text", text, this.nodeType == 9 ? this : this.ownerDocument);
+ },
+ /** @id MochiKit.MockDOM.MockElement.prototype.setAttribute */
+ setAttribute: function (name, value) {
+ this[name] = value;
+ },
+ /** @id MochiKit.MockDOM.MockElement.prototype.getAttribute */
+ getAttribute: function (name) {
+ return this[name];
+ },
+ /** @id MochiKit.MockDOM.MockElement.prototype.appendChild */
+ appendChild: function (child) {
+ this.childNodes.push(child);
+ },
+ /** @id MochiKit.MockDOM.MockElement.prototype.toString */
+ toString: function () {
+ return "MockElement(" + this.tagName + ")";
+ },
+ /** @id MochiKit.MockDOM.MockElement.prototype.getElementsByTagName */
+ getElementsByTagName: function (tagName) {
+ var foundElements = [];
+ MochiKit.Base.nodeWalk(this, function(node){
+ if (tagName == '*' || tagName == node.tagName) {
+ foundElements.push(node);
+ return node.childNodes;
+ }
+ });
+ return foundElements;
+ }
+};
+
+ /** @id MochiKit.MockDOM.EXPORT_OK */
+MochiKit.MockDOM.EXPORT_OK = [
+ "mockElement",
+ "createDocument"
+];
+
+ /** @id MochiKit.MockDOM.EXPORT */
+MochiKit.MockDOM.EXPORT = [
+ "document"
+];
+
+MochiKit.MockDOM.__new__ = function () {
+ this.document = this.createDocument();
+};
+
+MochiKit.MockDOM.__new__();
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Position.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Position.js
new file mode 100644
index 0000000000..23b0f181ce
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Position.js
@@ -0,0 +1,258 @@
+/***
+
+MochiKit.Position 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005-2006 Bob Ippolito and others. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Position');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+ dojo.require('MochiKit.Style');
+}
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use('MochiKit.Base', []);
+ JSAN.use('MochiKit.DOM', []);
+ JSAN.use('MochiKit.Style', []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined' ||
+ typeof(MochiKit.Style) == 'undefined' ||
+ typeof(MochiKit.DOM) == 'undefined') {
+ throw '';
+ }
+} catch (e) {
+ throw 'MochiKit.Style depends on MochiKit.Base, MochiKit.DOM, and MochiKit.Style!';
+}
+
+if (typeof(MochiKit.Position) == 'undefined') {
+ MochiKit.Position = {};
+}
+
+MochiKit.Position.NAME = 'MochiKit.Position';
+MochiKit.Position.VERSION = '1.4';
+MochiKit.Position.__repr__ = function () {
+ return '[' + this.NAME + ' ' + this.VERSION + ']';
+};
+MochiKit.Position.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.Position.EXPORT_OK = [];
+
+MochiKit.Position.EXPORT = [
+];
+
+
+MochiKit.Base.update(MochiKit.Position, {
+ // set to true if needed, warning: firefox performance problems
+ // NOT neeeded for page scrolling, only if draggable contained in
+ // scrollable elements
+ includeScrollOffsets: false,
+
+ /** @id MochiKit.Position.prepare */
+ prepare: function () {
+ var deltaX = window.pageXOffset
+ || document.documentElement.scrollLeft
+ || document.body.scrollLeft
+ || 0;
+ var deltaY = window.pageYOffset
+ || document.documentElement.scrollTop
+ || document.body.scrollTop
+ || 0;
+ this.windowOffset = new MochiKit.Style.Coordinates(deltaX, deltaY);
+ },
+
+ /** @id MochiKit.Position.cumulativeOffset */
+ cumulativeOffset: function (element) {
+ var valueT = 0;
+ var valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ } while (element);
+ return new MochiKit.Style.Coordinates(valueL, valueT);
+ },
+
+ /** @id MochiKit.Position.realOffset */
+ realOffset: function (element) {
+ var valueT = 0;
+ var valueL = 0;
+ do {
+ valueT += element.scrollTop || 0;
+ valueL += element.scrollLeft || 0;
+ element = element.parentNode;
+ } while (element);
+ return new MochiKit.Style.Coordinates(valueL, valueT);
+ },
+
+ /** @id MochiKit.Position.within */
+ within: function (element, x, y) {
+ if (this.includeScrollOffsets) {
+ return this.withinIncludingScrolloffsets(element, x, y);
+ }
+ this.xcomp = x;
+ this.ycomp = y;
+ this.offset = this.cumulativeOffset(element);
+ if (element.style.position == "fixed") {
+ this.offset.x += this.windowOffset.x;
+ this.offset.y += this.windowOffset.y;
+ }
+
+ return (y >= this.offset.y &&
+ y < this.offset.y + element.offsetHeight &&
+ x >= this.offset.x &&
+ x < this.offset.x + element.offsetWidth);
+ },
+
+ /** @id MochiKit.Position.withinIncludingScrolloffsets */
+ withinIncludingScrolloffsets: function (element, x, y) {
+ var offsetcache = this.realOffset(element);
+
+ this.xcomp = x + offsetcache.x - this.windowOffset.x;
+ this.ycomp = y + offsetcache.y - this.windowOffset.y;
+ this.offset = this.cumulativeOffset(element);
+
+ return (this.ycomp >= this.offset.y &&
+ this.ycomp < this.offset.y + element.offsetHeight &&
+ this.xcomp >= this.offset.x &&
+ this.xcomp < this.offset.x + element.offsetWidth);
+ },
+
+ // within must be called directly before
+ /** @id MochiKit.Position.overlap */
+ overlap: function (mode, element) {
+ if (!mode) {
+ return 0;
+ }
+ if (mode == 'vertical') {
+ return ((this.offset.y + element.offsetHeight) - this.ycomp) /
+ element.offsetHeight;
+ }
+ if (mode == 'horizontal') {
+ return ((this.offset.x + element.offsetWidth) - this.xcomp) /
+ element.offsetWidth;
+ }
+ },
+
+ /** @id MochiKit.Position.absolutize */
+ absolutize: function (element) {
+ element = MochiKit.DOM.getElement(element);
+ if (element.style.position == 'absolute') {
+ return;
+ }
+ MochiKit.Position.prepare();
+
+ var offsets = MochiKit.Position.positionedOffset(element);
+ var width = element.clientWidth;
+ var height = element.clientHeight;
+
+ var oldStyle = {
+ 'position': element.style.position,
+ 'left': offsets.x - parseFloat(element.style.left || 0),
+ 'top': offsets.y - parseFloat(element.style.top || 0),
+ 'width': element.style.width,
+ 'height': element.style.height
+ };
+
+ element.style.position = 'absolute';
+ element.style.top = offsets.y + 'px';
+ element.style.left = offsets.x + 'px';
+ element.style.width = width + 'px';
+ element.style.height = height + 'px';
+
+ return oldStyle;
+ },
+
+ /** @id MochiKit.Position.positionedOffset */
+ positionedOffset: function (element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ if (element) {
+ p = MochiKit.Style.getStyle(element, 'position');
+ if (p == 'relative' || p == 'absolute') {
+ break;
+ }
+ }
+ } while (element);
+ return new MochiKit.Style.Coordinates(valueL, valueT);
+ },
+
+ /** @id MochiKit.Position.relativize */
+ relativize: function (element, oldPos) {
+ element = MochiKit.DOM.getElement(element);
+ if (element.style.position == 'relative') {
+ return;
+ }
+ MochiKit.Position.prepare();
+
+ var top = parseFloat(element.style.top || 0) -
+ (oldPos['top'] || 0);
+ var left = parseFloat(element.style.left || 0) -
+ (oldPos['left'] || 0);
+
+ element.style.position = oldPos['position'];
+ element.style.top = top + 'px';
+ element.style.left = left + 'px';
+ element.style.width = oldPos['width'];
+ element.style.height = oldPos['height'];
+ },
+
+ /** @id MochiKit.Position.clone */
+ clone: function (source, target) {
+ source = MochiKit.DOM.getElement(source);
+ target = MochiKit.DOM.getElement(target);
+ target.style.position = 'absolute';
+ var offsets = this.cumulativeOffset(source);
+ target.style.top = offsets.y + 'px';
+ target.style.left = offsets.x + 'px';
+ target.style.width = source.offsetWidth + 'px';
+ target.style.height = source.offsetHeight + 'px';
+ },
+
+ /** @id MochiKit.Position.page */
+ page: function (forElement) {
+ var valueT = 0;
+ var valueL = 0;
+
+ var element = forElement;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+
+ // Safari fix
+ if (element.offsetParent == document.body && MochiKit.Style.getStyle(element, 'position') == 'absolute') {
+ break;
+ }
+ } while (element = element.offsetParent);
+
+ element = forElement;
+ do {
+ valueT -= element.scrollTop || 0;
+ valueL -= element.scrollLeft || 0;
+ } while (element = element.parentNode);
+
+ return new MochiKit.Style.Coordinates(valueL, valueT);
+ }
+});
+
+MochiKit.Position.__new__ = function (win) {
+ var m = MochiKit.Base;
+ this.EXPORT_TAGS = {
+ ':common': this.EXPORT,
+ ':all': m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+};
+
+MochiKit.Position.__new__(this); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Selector.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Selector.js
new file mode 100644
index 0000000000..f5d1afac31
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Selector.js
@@ -0,0 +1,431 @@
+/***
+
+MochiKit.Selector 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito and others. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Selector');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+ dojo.require('MochiKit.Iter');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+ JSAN.use("MochiKit.DOM", []);
+ JSAN.use("MochiKit.Iter", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) === 'undefined' ||
+ typeof(MochiKit.DOM) === 'undefined' ||
+ typeof(MochiKit.Iter) === 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Selector depends on MochiKit.Base, MochiKit.DOM and MochiKit.Iter!";
+}
+
+if (typeof(MochiKit.Selector) == 'undefined') {
+ MochiKit.Selector = {};
+}
+
+MochiKit.Selector.NAME = "MochiKit.Selector";
+
+MochiKit.Selector.VERSION = "1.4";
+
+MochiKit.Selector.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+MochiKit.Selector.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.Selector.EXPORT = [
+ "Selector",
+ "findChildElements",
+ "findDocElements",
+ "$$"
+];
+
+MochiKit.Selector.EXPORT_OK = [
+];
+
+MochiKit.Selector.Selector = function (expression) {
+ this.params = {classNames: [], pseudoClassNames: []};
+ this.expression = expression.toString().replace(/(^\s+|\s+$)/g, '');
+ this.parseExpression();
+ this.compileMatcher();
+};
+
+MochiKit.Selector.Selector.prototype = {
+ /***
+
+ Selector class: convenient object to make CSS selections.
+
+ ***/
+ __class__: MochiKit.Selector.Selector,
+
+ /** @id MochiKit.Selector.Selector.prototype.parseExpression */
+ parseExpression: function () {
+ function abort(message) {
+ throw 'Parse error in selector: ' + message;
+ }
+
+ if (this.expression == '') {
+ abort('empty expression');
+ }
+
+ var repr = MochiKit.Base.repr;
+ var params = this.params;
+ var expr = this.expression;
+ var match, modifier, clause, rest;
+ while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!^$*]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
+ params.attributes = params.attributes || [];
+ params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
+ expr = match[1];
+ }
+
+ if (expr == '*') {
+ return this.params.wildcard = true;
+ }
+
+ while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+(?:\([^)]*\))?)(.*)/i)) {
+ modifier = match[1];
+ clause = match[2];
+ rest = match[3];
+ switch (modifier) {
+ case '#':
+ params.id = clause;
+ break;
+ case '.':
+ params.classNames.push(clause);
+ break;
+ case ':':
+ params.pseudoClassNames.push(clause);
+ break;
+ case '':
+ case undefined:
+ params.tagName = clause.toUpperCase();
+ break;
+ default:
+ abort(repr(expr));
+ }
+ expr = rest;
+ }
+
+ if (expr.length > 0) {
+ abort(repr(expr));
+ }
+ },
+
+ /** @id MochiKit.Selector.Selector.prototype.buildMatchExpression */
+ buildMatchExpression: function () {
+ var repr = MochiKit.Base.repr;
+ var params = this.params;
+ var conditions = [];
+ var clause, i;
+
+ function childElements(element) {
+ return "MochiKit.Base.filter(function (node) { return node.nodeType == 1; }, " + element + ".childNodes)";
+ }
+
+ if (params.wildcard) {
+ conditions.push('true');
+ }
+ if (clause = params.id) {
+ conditions.push('element.id == ' + repr(clause));
+ }
+ if (clause = params.tagName) {
+ conditions.push('element.tagName.toUpperCase() == ' + repr(clause));
+ }
+ if ((clause = params.classNames).length > 0) {
+ for (i = 0; i < clause.length; i++) {
+ conditions.push('MochiKit.DOM.hasElementClass(element, ' + repr(clause[i]) + ')');
+ }
+ }
+ if ((clause = params.pseudoClassNames).length > 0) {
+ for (i = 0; i < clause.length; i++) {
+ var match = clause[i].match(/^([^(]+)(?:\((.*)\))?$/);
+ var pseudoClass = match[1];
+ var pseudoClassArgument = match[2];
+ switch (pseudoClass) {
+ case 'root':
+ conditions.push('element.nodeType == 9 || element === element.ownerDocument.documentElement'); break;
+ case 'nth-child':
+ case 'nth-last-child':
+ case 'nth-of-type':
+ case 'nth-last-of-type':
+ match = pseudoClassArgument.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/);
+ if (!match) {
+ throw "Invalid argument to pseudo element nth-child: " + pseudoClassArgument;
+ }
+ var a, b;
+ if (match[0] == 'odd') {
+ a = 2;
+ b = 1;
+ } else if (match[0] == 'even') {
+ a = 2;
+ b = 0;
+ } else {
+ a = match[2] && parseInt(match) || null;
+ b = parseInt(match[3]);
+ }
+ conditions.push('this.nthChild(element,' + a + ',' + b
+ + ',' + !!pseudoClass.match('^nth-last') // Reverse
+ + ',' + !!pseudoClass.match('of-type$') // Restrict to same tagName
+ + ')');
+ break;
+ case 'first-child':
+ conditions.push('this.nthChild(element, null, 1)');
+ break;
+ case 'last-child':
+ conditions.push('this.nthChild(element, null, 1, true)');
+ break;
+ case 'first-of-type':
+ conditions.push('this.nthChild(element, null, 1, false, true)');
+ break;
+ case 'last-of-type':
+ conditions.push('this.nthChild(element, null, 1, true, true)');
+ break;
+ case 'only-child':
+ conditions.push(childElements('element.parentNode') + '.length == 1');
+ break;
+ case 'only-of-type':
+ conditions.push('MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, ' + childElements('element.parentNode') + ').length == 1');
+ break;
+ case 'empty':
+ conditions.push('element.childNodes.length == 0');
+ break;
+ case 'enabled':
+ conditions.push('(this.isUIElement(element) && element.disabled === false)');
+ break;
+ case 'disabled':
+ conditions.push('(this.isUIElement(element) && element.disabled === true)');
+ break;
+ case 'checked':
+ conditions.push('(this.isUIElement(element) && element.checked === true)');
+ break;
+ case 'not':
+ var subselector = new MochiKit.Selector.Selector(pseudoClassArgument);
+ conditions.push('!( ' + subselector.buildMatchExpression() + ')')
+ break;
+ }
+ }
+ }
+ if (clause = params.attributes) {
+ MochiKit.Base.map(function (attribute) {
+ var value = 'MochiKit.DOM.getNodeAttribute(element, ' + repr(attribute.name) + ')';
+ var splitValueBy = function (delimiter) {
+ return value + '.split(' + repr(delimiter) + ')';
+ }
+
+ switch (attribute.operator) {
+ case '=':
+ conditions.push(value + ' == ' + repr(attribute.value));
+ break;
+ case '~=':
+ conditions.push(value + ' && MochiKit.Base.findValue(' + splitValueBy(' ') + ', ' + repr(attribute.value) + ') > -1');
+ break;
+ case '^=':
+ conditions.push(value + '.substring(0, ' + attribute.value.length + ') == ' + repr(attribute.value));
+ break;
+ case '$=':
+ conditions.push(value + '.substring(' + value + '.length - ' + attribute.value.length + ') == ' + repr(attribute.value));
+ break;
+ case '*=':
+ conditions.push(value + '.match(' + repr(attribute.value) + ')');
+ break;
+ case '|=':
+ conditions.push(
+ value + ' && ' + splitValueBy('-') + '[0].toUpperCase() == ' + repr(attribute.value.toUpperCase())
+ );
+ break;
+ case '!=':
+ conditions.push(value + ' != ' + repr(attribute.value));
+ break;
+ case '':
+ case undefined:
+ conditions.push(value + ' != null');
+ break;
+ default:
+ throw 'Unknown operator ' + attribute.operator + ' in selector';
+ }
+ }, clause);
+ }
+
+ return conditions.join(' && ');
+ },
+
+ /** @id MochiKit.Selector.Selector.prototype.compileMatcher */
+ compileMatcher: function () {
+ this.match = new Function('element', 'if (!element.tagName) return false; \
+ return ' + this.buildMatchExpression());
+ },
+
+ /** @id MochiKit.Selector.Selector.prototype.nthChild */
+ nthChild: function (element, a, b, reverse, sametag){
+ var siblings = MochiKit.Base.filter(function (node) {
+ return node.nodeType == 1;
+ }, element.parentNode.childNodes);
+ if (sametag) {
+ siblings = MochiKit.Base.filter(function (node) {
+ return node.tagName == element.tagName;
+ }, siblings);
+ }
+ if (reverse) {
+ siblings = MochiKit.Iter.reversed(siblings);
+ }
+ if (a) {
+ var actualIndex = MochiKit.Base.findIdentical(siblings, element);
+ return ((actualIndex + 1 - b) / a) % 1 == 0;
+ } else {
+ return b == MochiKit.Base.findIdentical(siblings, element) + 1;
+ }
+ },
+
+ /** @id MochiKit.Selector.Selector.prototype.isUIElement */
+ isUIElement: function (element) {
+ return MochiKit.Base.findValue(['input', 'button', 'select', 'option', 'textarea', 'object'],
+ element.tagName.toLowerCase()) > -1;
+ },
+
+ /** @id MochiKit.Selector.Selector.prototype.findElements */
+ findElements: function (scope, axis) {
+ var element;
+
+ if (axis == undefined) {
+ axis = "";
+ }
+
+ function inScope(element, scope) {
+ if (axis == "") {
+ return MochiKit.DOM.isChildNode(element, scope);
+ } else if (axis == ">") {
+ return element.parentNode == scope;
+ } else if (axis == "+") {
+ return element == nextSiblingElement(scope);
+ } else if (axis == "~") {
+ var sibling = scope;
+ while (sibling = nextSiblingElement(sibling)) {
+ if (element == sibling) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ throw "Invalid axis: " + axis;
+ }
+ }
+
+ if (element = MochiKit.DOM.getElement(this.params.id)) {
+ if (this.match(element)) {
+ if (!scope || inScope(element, scope)) {
+ return [element];
+ }
+ }
+ }
+
+ function nextSiblingElement(node) {
+ node = node.nextSibling;
+ while (node && node.nodeType != 1) {
+ node = node.nextSibling;
+ }
+ return node;
+ }
+
+ if (axis == "") {
+ scope = (scope || MochiKit.DOM.currentDocument()).getElementsByTagName(this.params.tagName || '*');
+ } else if (axis == ">") {
+ if (!scope) {
+ throw "> combinator not allowed without preceeding expression";
+ }
+ scope = MochiKit.Base.filter(function (node) {
+ return node.nodeType == 1;
+ }, scope.childNodes);
+ } else if (axis == "+") {
+ if (!scope) {
+ throw "+ combinator not allowed without preceeding expression";
+ }
+ scope = nextSiblingElement(scope) && [nextSiblingElement(scope)];
+ } else if (axis == "~") {
+ if (!scope) {
+ throw "~ combinator not allowed without preceeding expression";
+ }
+ var newscope = [];
+ while (nextSiblingElement(scope)) {
+ scope = nextSiblingElement(scope);
+ newscope.push(scope);
+ }
+ scope = newscope;
+ }
+
+ if (!scope) {
+ return [];
+ }
+
+ var results = MochiKit.Base.filter(MochiKit.Base.bind(function (scopeElt) {
+ return this.match(scopeElt);
+ }, this), scope);
+
+ return results;
+ },
+
+ /** @id MochiKit.Selector.Selector.prototype.repr */
+ repr: function () {
+ return 'Selector(' + this.expression + ')';
+ },
+
+ toString: MochiKit.Base.forwardCall("repr")
+};
+
+MochiKit.Base.update(MochiKit.Selector, {
+
+ /** @id MochiKit.Selector.findChildElements */
+ findChildElements: function (element, expressions) {
+ return MochiKit.Base.flattenArray(MochiKit.Base.map(function (expression) {
+ var nextScope = "";
+ return MochiKit.Iter.reduce(function (results, expr) {
+ if (match = expr.match(/^[>+~]$/)) {
+ nextScope = match[0];
+ return results;
+ } else {
+ var selector = new MochiKit.Selector.Selector(expr);
+ var elements = MochiKit.Iter.reduce(function (elements, result) {
+ return MochiKit.Base.extend(elements, selector.findElements(result || element, nextScope));
+ }, results, []);
+ nextScope = "";
+ return elements;
+ }
+ }, expression.replace(/(^\s+|\s+$)/g, '').split(/\s+/), [null]);
+ }, expressions));
+ },
+
+ findDocElements: function () {
+ return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(), arguments);
+ },
+
+ __new__: function () {
+ var m = MochiKit.Base;
+
+ this.$$ = this.findDocElements;
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+ }
+});
+
+MochiKit.Selector.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.Selector);
+
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Signal.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Signal.js
new file mode 100644
index 0000000000..fd267a994e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Signal.js
@@ -0,0 +1,899 @@
+/***
+
+MochiKit.Signal 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2006 Jonathan Gardner, Beau Hartshorne, Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Signal');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+ dojo.require('MochiKit.Style');
+}
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use('MochiKit.Base', []);
+ JSAN.use('MochiKit.DOM', []);
+ JSAN.use('MochiKit.Style', []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw '';
+ }
+} catch (e) {
+ throw 'MochiKit.Signal depends on MochiKit.Base!';
+}
+
+try {
+ if (typeof(MochiKit.DOM) == 'undefined') {
+ throw '';
+ }
+} catch (e) {
+ throw 'MochiKit.Signal depends on MochiKit.DOM!';
+}
+
+try {
+ if (typeof(MochiKit.Style) == 'undefined') {
+ throw '';
+ }
+} catch (e) {
+ throw 'MochiKit.Signal depends on MochiKit.Style!';
+}
+
+if (typeof(MochiKit.Signal) == 'undefined') {
+ MochiKit.Signal = {};
+}
+
+MochiKit.Signal.NAME = 'MochiKit.Signal';
+MochiKit.Signal.VERSION = '1.4';
+
+MochiKit.Signal._observers = [];
+
+/** @id MochiKit.Signal.Event */
+MochiKit.Signal.Event = function (src, e) {
+ this._event = e || window.event;
+ this._src = src;
+};
+
+MochiKit.Base.update(MochiKit.Signal.Event.prototype, {
+
+ __repr__: function () {
+ var repr = MochiKit.Base.repr;
+ var str = '{event(): ' + repr(this.event()) +
+ ', src(): ' + repr(this.src()) +
+ ', type(): ' + repr(this.type()) +
+ ', target(): ' + repr(this.target());
+
+ if (this.type() &&
+ this.type().indexOf('key') === 0 ||
+ this.type().indexOf('mouse') === 0 ||
+ this.type().indexOf('click') != -1 ||
+ this.type() == 'contextmenu') {
+ str += ', modifier(): ' + '{alt: ' + repr(this.modifier().alt) +
+ ', ctrl: ' + repr(this.modifier().ctrl) +
+ ', meta: ' + repr(this.modifier().meta) +
+ ', shift: ' + repr(this.modifier().shift) +
+ ', any: ' + repr(this.modifier().any) + '}';
+ }
+
+ if (this.type() && this.type().indexOf('key') === 0) {
+ str += ', key(): {code: ' + repr(this.key().code) +
+ ', string: ' + repr(this.key().string) + '}';
+ }
+
+ if (this.type() && (
+ this.type().indexOf('mouse') === 0 ||
+ this.type().indexOf('click') != -1 ||
+ this.type() == 'contextmenu')) {
+
+ str += ', mouse(): {page: ' + repr(this.mouse().page) +
+ ', client: ' + repr(this.mouse().client);
+
+ if (this.type() != 'mousemove') {
+ str += ', button: {left: ' + repr(this.mouse().button.left) +
+ ', middle: ' + repr(this.mouse().button.middle) +
+ ', right: ' + repr(this.mouse().button.right) + '}}';
+ } else {
+ str += '}';
+ }
+ }
+ if (this.type() == 'mouseover' || this.type() == 'mouseout') {
+ str += ', relatedTarget(): ' + repr(this.relatedTarget());
+ }
+ str += '}';
+ return str;
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.toString */
+ toString: function () {
+ return this.__repr__();
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.src */
+ src: function () {
+ return this._src;
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.event */
+ event: function () {
+ return this._event;
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.type */
+ type: function () {
+ return this._event.type || undefined;
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.target */
+ target: function () {
+ return this._event.target || this._event.srcElement;
+ },
+
+ _relatedTarget: null,
+ /** @id MochiKit.Signal.Event.prototype.relatedTarget */
+ relatedTarget: function () {
+ if (this._relatedTarget !== null) {
+ return this._relatedTarget;
+ }
+
+ var elem = null;
+ if (this.type() == 'mouseover') {
+ elem = (this._event.relatedTarget ||
+ this._event.fromElement);
+ } else if (this.type() == 'mouseout') {
+ elem = (this._event.relatedTarget ||
+ this._event.toElement);
+ }
+ if (elem !== null) {
+ this._relatedTarget = elem;
+ return elem;
+ }
+
+ return undefined;
+ },
+
+ _modifier: null,
+ /** @id MochiKit.Signal.Event.prototype.modifier */
+ modifier: function () {
+ if (this._modifier !== null) {
+ return this._modifier;
+ }
+ var m = {};
+ m.alt = this._event.altKey;
+ m.ctrl = this._event.ctrlKey;
+ m.meta = this._event.metaKey || false; // IE and Opera punt here
+ m.shift = this._event.shiftKey;
+ m.any = m.alt || m.ctrl || m.shift || m.meta;
+ this._modifier = m;
+ return m;
+ },
+
+ _key: null,
+ /** @id MochiKit.Signal.Event.prototype.key */
+ key: function () {
+ if (this._key !== null) {
+ return this._key;
+ }
+ var k = {};
+ if (this.type() && this.type().indexOf('key') === 0) {
+
+ /*
+
+ If you're looking for a special key, look for it in keydown or
+ keyup, but never keypress. If you're looking for a Unicode
+ chracter, look for it with keypress, but never keyup or
+ keydown.
+
+ Notes:
+
+ FF key event behavior:
+ key event charCode keyCode
+ DOWN ku,kd 0 40
+ DOWN kp 0 40
+ ESC ku,kd 0 27
+ ESC kp 0 27
+ a ku,kd 0 65
+ a kp 97 0
+ shift+a ku,kd 0 65
+ shift+a kp 65 0
+ 1 ku,kd 0 49
+ 1 kp 49 0
+ shift+1 ku,kd 0 0
+ shift+1 kp 33 0
+
+ IE key event behavior:
+ (IE doesn't fire keypress events for special keys.)
+ key event keyCode
+ DOWN ku,kd 40
+ DOWN kp undefined
+ ESC ku,kd 27
+ ESC kp 27
+ a ku,kd 65
+ a kp 97
+ shift+a ku,kd 65
+ shift+a kp 65
+ 1 ku,kd 49
+ 1 kp 49
+ shift+1 ku,kd 49
+ shift+1 kp 33
+
+ Safari key event behavior:
+ (Safari sets charCode and keyCode to something weird for
+ special keys.)
+ key event charCode keyCode
+ DOWN ku,kd 63233 40
+ DOWN kp 63233 63233
+ ESC ku,kd 27 27
+ ESC kp 27 27
+ a ku,kd 97 65
+ a kp 97 97
+ shift+a ku,kd 65 65
+ shift+a kp 65 65
+ 1 ku,kd 49 49
+ 1 kp 49 49
+ shift+1 ku,kd 33 49
+ shift+1 kp 33 33
+
+ */
+
+ /* look for special keys here */
+ if (this.type() == 'keydown' || this.type() == 'keyup') {
+ k.code = this._event.keyCode;
+ k.string = (MochiKit.Signal._specialKeys[k.code] ||
+ 'KEY_UNKNOWN');
+ this._key = k;
+ return k;
+
+ /* look for characters here */
+ } else if (this.type() == 'keypress') {
+
+ /*
+
+ Special key behavior:
+
+ IE: does not fire keypress events for special keys
+ FF: sets charCode to 0, and sets the correct keyCode
+ Safari: sets keyCode and charCode to something stupid
+
+ */
+
+ k.code = 0;
+ k.string = '';
+
+ if (typeof(this._event.charCode) != 'undefined' &&
+ this._event.charCode !== 0 &&
+ !MochiKit.Signal._specialMacKeys[this._event.charCode]) {
+ k.code = this._event.charCode;
+ k.string = String.fromCharCode(k.code);
+ } else if (this._event.keyCode &&
+ typeof(this._event.charCode) == 'undefined') { // IE
+ k.code = this._event.keyCode;
+ k.string = String.fromCharCode(k.code);
+ }
+
+ this._key = k;
+ return k;
+ }
+ }
+ return undefined;
+ },
+
+ _mouse: null,
+ /** @id MochiKit.Signal.Event.prototype.mouse */
+ mouse: function () {
+ if (this._mouse !== null) {
+ return this._mouse;
+ }
+
+ var m = {};
+ var e = this._event;
+
+ if (this.type() && (
+ this.type().indexOf('mouse') === 0 ||
+ this.type().indexOf('click') != -1 ||
+ this.type() == 'contextmenu')) {
+
+ m.client = new MochiKit.Style.Coordinates(0, 0);
+ if (e.clientX || e.clientY) {
+ m.client.x = (!e.clientX || e.clientX < 0) ? 0 : e.clientX;
+ m.client.y = (!e.clientY || e.clientY < 0) ? 0 : e.clientY;
+ }
+
+ m.page = new MochiKit.Style.Coordinates(0, 0);
+ if (e.pageX || e.pageY) {
+ m.page.x = (!e.pageX || e.pageX < 0) ? 0 : e.pageX;
+ m.page.y = (!e.pageY || e.pageY < 0) ? 0 : e.pageY;
+ } else {
+ /*
+
+ The IE shortcut can be off by two. We fix it. See:
+ http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp
+
+ This is similar to the method used in
+ MochiKit.Style.getElementPosition().
+
+ */
+ var de = MochiKit.DOM._document.documentElement;
+ var b = MochiKit.DOM._document.body;
+
+ m.page.x = e.clientX +
+ (de.scrollLeft || b.scrollLeft) -
+ (de.clientLeft || 0);
+
+ m.page.y = e.clientY +
+ (de.scrollTop || b.scrollTop) -
+ (de.clientTop || 0);
+
+ }
+ if (this.type() != 'mousemove') {
+ m.button = {};
+ m.button.left = false;
+ m.button.right = false;
+ m.button.middle = false;
+
+ /* we could check e.button, but which is more consistent */
+ if (e.which) {
+ m.button.left = (e.which == 1);
+ m.button.middle = (e.which == 2);
+ m.button.right = (e.which == 3);
+
+ /*
+
+ Mac browsers and right click:
+
+ - Safari doesn't fire any click events on a right
+ click:
+ http://bugs.webkit.org/show_bug.cgi?id=6595
+
+ - Firefox fires the event, and sets ctrlKey = true
+
+ - Opera fires the event, and sets metaKey = true
+
+ oncontextmenu is fired on right clicks between
+ browsers and across platforms.
+
+ */
+
+ } else {
+ m.button.left = !!(e.button & 1);
+ m.button.right = !!(e.button & 2);
+ m.button.middle = !!(e.button & 4);
+ }
+ }
+ this._mouse = m;
+ return m;
+ }
+ return undefined;
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.stop */
+ stop: function () {
+ this.stopPropagation();
+ this.preventDefault();
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.stopPropagation */
+ stopPropagation: function () {
+ if (this._event.stopPropagation) {
+ this._event.stopPropagation();
+ } else {
+ this._event.cancelBubble = true;
+ }
+ },
+
+ /** @id MochiKit.Signal.Event.prototype.preventDefault */
+ preventDefault: function () {
+ if (this._event.preventDefault) {
+ this._event.preventDefault();
+ } else if (this._confirmUnload === null) {
+ this._event.returnValue = false;
+ }
+ },
+
+ _confirmUnload: null,
+
+ /** @id MochiKit.Signal.Event.prototype.confirmUnload */
+ confirmUnload: function (msg) {
+ if (this.type() == 'beforeunload') {
+ this._confirmUnload = msg;
+ this._event.returnValue = msg;
+ }
+ }
+});
+
+/* Safari sets keyCode to these special values onkeypress. */
+MochiKit.Signal._specialMacKeys = {
+ 3: 'KEY_ENTER',
+ 63289: 'KEY_NUM_PAD_CLEAR',
+ 63276: 'KEY_PAGE_UP',
+ 63277: 'KEY_PAGE_DOWN',
+ 63275: 'KEY_END',
+ 63273: 'KEY_HOME',
+ 63234: 'KEY_ARROW_LEFT',
+ 63232: 'KEY_ARROW_UP',
+ 63235: 'KEY_ARROW_RIGHT',
+ 63233: 'KEY_ARROW_DOWN',
+ 63302: 'KEY_INSERT',
+ 63272: 'KEY_DELETE'
+};
+
+/* for KEY_F1 - KEY_F12 */
+(function () {
+ var _specialMacKeys = MochiKit.Signal._specialMacKeys;
+ for (i = 63236; i <= 63242; i++) {
+ // no F0
+ _specialMacKeys[i] = 'KEY_F' + (i - 63236 + 1);
+ }
+})();
+
+/* Standard keyboard key codes. */
+MochiKit.Signal._specialKeys = {
+ 8: 'KEY_BACKSPACE',
+ 9: 'KEY_TAB',
+ 12: 'KEY_NUM_PAD_CLEAR', // weird, for Safari and Mac FF only
+ 13: 'KEY_ENTER',
+ 16: 'KEY_SHIFT',
+ 17: 'KEY_CTRL',
+ 18: 'KEY_ALT',
+ 19: 'KEY_PAUSE',
+ 20: 'KEY_CAPS_LOCK',
+ 27: 'KEY_ESCAPE',
+ 32: 'KEY_SPACEBAR',
+ 33: 'KEY_PAGE_UP',
+ 34: 'KEY_PAGE_DOWN',
+ 35: 'KEY_END',
+ 36: 'KEY_HOME',
+ 37: 'KEY_ARROW_LEFT',
+ 38: 'KEY_ARROW_UP',
+ 39: 'KEY_ARROW_RIGHT',
+ 40: 'KEY_ARROW_DOWN',
+ 44: 'KEY_PRINT_SCREEN',
+ 45: 'KEY_INSERT',
+ 46: 'KEY_DELETE',
+ 59: 'KEY_SEMICOLON', // weird, for Safari and IE only
+ 91: 'KEY_WINDOWS_LEFT',
+ 92: 'KEY_WINDOWS_RIGHT',
+ 93: 'KEY_SELECT',
+ 106: 'KEY_NUM_PAD_ASTERISK',
+ 107: 'KEY_NUM_PAD_PLUS_SIGN',
+ 109: 'KEY_NUM_PAD_HYPHEN-MINUS',
+ 110: 'KEY_NUM_PAD_FULL_STOP',
+ 111: 'KEY_NUM_PAD_SOLIDUS',
+ 144: 'KEY_NUM_LOCK',
+ 145: 'KEY_SCROLL_LOCK',
+ 186: 'KEY_SEMICOLON',
+ 187: 'KEY_EQUALS_SIGN',
+ 188: 'KEY_COMMA',
+ 189: 'KEY_HYPHEN-MINUS',
+ 190: 'KEY_FULL_STOP',
+ 191: 'KEY_SOLIDUS',
+ 192: 'KEY_GRAVE_ACCENT',
+ 219: 'KEY_LEFT_SQUARE_BRACKET',
+ 220: 'KEY_REVERSE_SOLIDUS',
+ 221: 'KEY_RIGHT_SQUARE_BRACKET',
+ 222: 'KEY_APOSTROPHE'
+ // undefined: 'KEY_UNKNOWN'
+};
+
+(function () {
+ /* for KEY_0 - KEY_9 */
+ var _specialKeys = MochiKit.Signal._specialKeys;
+ for (var i = 48; i <= 57; i++) {
+ _specialKeys[i] = 'KEY_' + (i - 48);
+ }
+
+ /* for KEY_A - KEY_Z */
+ for (i = 65; i <= 90; i++) {
+ _specialKeys[i] = 'KEY_' + String.fromCharCode(i);
+ }
+
+ /* for KEY_NUM_PAD_0 - KEY_NUM_PAD_9 */
+ for (i = 96; i <= 105; i++) {
+ _specialKeys[i] = 'KEY_NUM_PAD_' + (i - 96);
+ }
+
+ /* for KEY_F1 - KEY_F12 */
+ for (i = 112; i <= 123; i++) {
+ // no F0
+ _specialKeys[i] = 'KEY_F' + (i - 112 + 1);
+ }
+})();
+
+/* Internal object to keep track of created signals. */
+MochiKit.Signal.Ident = function (ident) {
+ this.source = ident.source;
+ this.signal = ident.signal;
+ this.listener = ident.listener;
+ this.isDOM = ident.isDOM;
+ this.objOrFunc = ident.objOrFunc;
+ this.funcOrStr = ident.funcOrStr;
+ this.connected = ident.connected;
+};
+
+MochiKit.Signal.Ident.prototype = {};
+
+MochiKit.Base.update(MochiKit.Signal, {
+
+ __repr__: function () {
+ return '[' + this.NAME + ' ' + this.VERSION + ']';
+ },
+
+ toString: function () {
+ return this.__repr__();
+ },
+
+ _unloadCache: function () {
+ var self = MochiKit.Signal;
+ var observers = self._observers;
+
+ for (var i = 0; i < observers.length; i++) {
+ if (observers[i].signal !== 'onload' && observers[i].signal !== 'onunload') {
+ self._disconnect(observers[i]);
+ }
+ }
+ },
+
+ _listener: function (src, sig, func, obj, isDOM) {
+ var self = MochiKit.Signal;
+ var E = self.Event;
+ if (!isDOM) {
+ return MochiKit.Base.bind(func, obj);
+ }
+ obj = obj || src;
+ if (typeof(func) == "string") {
+ if (sig === 'onload' || sig === 'onunload') {
+ return function (nativeEvent) {
+ obj[func].apply(obj, [new E(src, nativeEvent)]);
+
+ var ident = new MochiKit.Signal.Ident({
+ source: src, signal: sig, objOrFunc: obj, funcOrStr: func});
+
+ MochiKit.Signal._disconnect(ident);
+ };
+ } else {
+ return function (nativeEvent) {
+ obj[func].apply(obj, [new E(src, nativeEvent)]);
+ };
+ }
+ } else {
+ if (sig === 'onload' || sig === 'onunload') {
+ return function (nativeEvent) {
+ func.apply(obj, [new E(src, nativeEvent)]);
+ MochiKit.Signal.disconnect(src, sig, func);
+
+ var ident = new MochiKit.Signal.Ident({
+ source: src, signal: sig, objOrFunc: func});
+
+ MochiKit.Signal._disconnect(ident);
+ };
+ } else {
+ return function (nativeEvent) {
+ func.apply(obj, [new E(src, nativeEvent)]);
+ };
+ }
+ }
+ },
+
+ _browserAlreadyHasMouseEnterAndLeave: function () {
+ return /MSIE/.test(navigator.userAgent);
+ },
+
+ _mouseEnterListener: function (src, sig, func, obj) {
+ var E = MochiKit.Signal.Event;
+ return function (nativeEvent) {
+ var e = new E(src, nativeEvent);
+ try {
+ e.relatedTarget().nodeName;
+ } catch (err) {
+ /* probably hit a permission denied error; possibly one of
+ * firefox's screwy anonymous DIVs inside an input element.
+ * Allow this event to propogate up.
+ */
+ return;
+ }
+ e.stop();
+ if (MochiKit.DOM.isChildNode(e.relatedTarget(), src)) {
+ /* We've moved between our node and a child. Ignore. */
+ return;
+ }
+ e.type = function () { return sig; };
+ if (typeof(func) == "string") {
+ return obj[func].apply(obj, [e]);
+ } else {
+ return func.apply(obj, [e]);
+ }
+ };
+ },
+
+ _getDestPair: function (objOrFunc, funcOrStr) {
+ var obj = null;
+ var func = null;
+ if (typeof(funcOrStr) != 'undefined') {
+ obj = objOrFunc;
+ func = funcOrStr;
+ if (typeof(funcOrStr) == 'string') {
+ if (typeof(objOrFunc[funcOrStr]) != "function") {
+ throw new Error("'funcOrStr' must be a function on 'objOrFunc'");
+ }
+ } else if (typeof(funcOrStr) != 'function') {
+ throw new Error("'funcOrStr' must be a function or string");
+ }
+ } else if (typeof(objOrFunc) != "function") {
+ throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given");
+ } else {
+ func = objOrFunc;
+ }
+ return [obj, func];
+ },
+
+ /** @id MochiKit.Signal.connect */
+ connect: function (src, sig, objOrFunc/* optional */, funcOrStr) {
+ src = MochiKit.DOM.getElement(src);
+ var self = MochiKit.Signal;
+
+ if (typeof(sig) != 'string') {
+ throw new Error("'sig' must be a string");
+ }
+
+ var destPair = self._getDestPair(objOrFunc, funcOrStr);
+ var obj = destPair[0];
+ var func = destPair[1];
+ if (typeof(obj) == 'undefined' || obj === null) {
+ obj = src;
+ }
+
+ var isDOM = !!(src.addEventListener || src.attachEvent);
+ if (isDOM && (sig === "onmouseenter" || sig === "onmouseleave")
+ && !self._browserAlreadyHasMouseEnterAndLeave()) {
+ var listener = self._mouseEnterListener(src, sig.substr(2), func, obj);
+ if (sig === "onmouseenter") {
+ sig = "onmouseover";
+ } else {
+ sig = "onmouseout";
+ }
+ } else {
+ var listener = self._listener(src, sig, func, obj, isDOM);
+ }
+
+ if (src.addEventListener) {
+ src.addEventListener(sig.substr(2), listener, false);
+ } else if (src.attachEvent) {
+ src.attachEvent(sig, listener); // useCapture unsupported
+ }
+
+ var ident = new MochiKit.Signal.Ident({
+ source: src,
+ signal: sig,
+ listener: listener,
+ isDOM: isDOM,
+ objOrFunc: objOrFunc,
+ funcOrStr: funcOrStr,
+ connected: true
+ });
+ self._observers.push(ident);
+
+ if (!isDOM && typeof(src.__connect__) == 'function') {
+ var args = MochiKit.Base.extend([ident], arguments, 1);
+ src.__connect__.apply(src, args);
+ }
+
+ return ident;
+ },
+
+ _disconnect: function (ident) {
+ // already disconnected
+ if (!ident.connected) {
+ return;
+ }
+ ident.connected = false;
+ // check isDOM
+ if (!ident.isDOM) {
+ return;
+ }
+ var src = ident.source;
+ var sig = ident.signal;
+ var listener = ident.listener;
+
+ if (src.removeEventListener) {
+ src.removeEventListener(sig.substr(2), listener, false);
+ } else if (src.detachEvent) {
+ src.detachEvent(sig, listener); // useCapture unsupported
+ } else {
+ throw new Error("'src' must be a DOM element");
+ }
+ },
+
+ /** @id MochiKit.Signal.disconnect */
+ disconnect: function (ident) {
+ var self = MochiKit.Signal;
+ var observers = self._observers;
+ var m = MochiKit.Base;
+ if (arguments.length > 1) {
+ // compatibility API
+ var src = MochiKit.DOM.getElement(arguments[0]);
+ var sig = arguments[1];
+ var obj = arguments[2];
+ var func = arguments[3];
+ for (var i = observers.length - 1; i >= 0; i--) {
+ var o = observers[i];
+ if (o.source === src && o.signal === sig && o.objOrFunc === obj && o.funcOrStr === func) {
+ self._disconnect(o);
+ if (!self._lock) {
+ observers.splice(i, 1);
+ } else {
+ self._dirty = true;
+ }
+ return true;
+ }
+ }
+ } else {
+ var idx = m.findIdentical(observers, ident);
+ if (idx >= 0) {
+ self._disconnect(ident);
+ if (!self._lock) {
+ observers.splice(idx, 1);
+ } else {
+ self._dirty = true;
+ }
+ return true;
+ }
+ }
+ return false;
+ },
+
+ /** @id MochiKit.Signal.disconnectAllTo */
+ disconnectAllTo: function (objOrFunc, /* optional */funcOrStr) {
+ var self = MochiKit.Signal;
+ var observers = self._observers;
+ var disconnect = self._disconnect;
+ var locked = self._lock;
+ var dirty = self._dirty;
+ if (typeof(funcOrStr) === 'undefined') {
+ funcOrStr = null;
+ }
+ for (var i = observers.length - 1; i >= 0; i--) {
+ var ident = observers[i];
+ if (ident.objOrFunc === objOrFunc &&
+ (funcOrStr === null || ident.funcOrStr === funcOrStr)) {
+ disconnect(ident);
+ if (locked) {
+ dirty = true;
+ } else {
+ observers.splice(i, 1);
+ }
+ }
+ }
+ self._dirty = dirty;
+ },
+
+ /** @id MochiKit.Signal.disconnectAll */
+ disconnectAll: function (src/* optional */, sig) {
+ src = MochiKit.DOM.getElement(src);
+ var m = MochiKit.Base;
+ var signals = m.flattenArguments(m.extend(null, arguments, 1));
+ var self = MochiKit.Signal;
+ var disconnect = self._disconnect;
+ var observers = self._observers;
+ var i, ident;
+ var locked = self._lock;
+ var dirty = self._dirty;
+ if (signals.length === 0) {
+ // disconnect all
+ for (i = observers.length - 1; i >= 0; i--) {
+ ident = observers[i];
+ if (ident.source === src) {
+ disconnect(ident);
+ if (!locked) {
+ observers.splice(i, 1);
+ } else {
+ dirty = true;
+ }
+ }
+ }
+ } else {
+ var sigs = {};
+ for (i = 0; i < signals.length; i++) {
+ sigs[signals[i]] = true;
+ }
+ for (i = observers.length - 1; i >= 0; i--) {
+ ident = observers[i];
+ if (ident.source === src && ident.signal in sigs) {
+ disconnect(ident);
+ if (!locked) {
+ observers.splice(i, 1);
+ } else {
+ dirty = true;
+ }
+ }
+ }
+ }
+ self._dirty = dirty;
+ },
+
+ /** @id MochiKit.Signal.signal */
+ signal: function (src, sig) {
+ var self = MochiKit.Signal;
+ var observers = self._observers;
+ src = MochiKit.DOM.getElement(src);
+ var args = MochiKit.Base.extend(null, arguments, 2);
+ var errors = [];
+ self._lock = true;
+ for (var i = 0; i < observers.length; i++) {
+ var ident = observers[i];
+ if (ident.source === src && ident.signal === sig &&
+ ident.connected) {
+ try {
+ ident.listener.apply(src, args);
+ } catch (e) {
+ errors.push(e);
+ }
+ }
+ }
+ self._lock = false;
+ if (self._dirty) {
+ self._dirty = false;
+ for (var i = observers.length - 1; i >= 0; i--) {
+ if (!observers[i].connected) {
+ observers.splice(i, 1);
+ }
+ }
+ }
+ if (errors.length == 1) {
+ throw errors[0];
+ } else if (errors.length > 1) {
+ var e = new Error("Multiple errors thrown in handling 'sig', see errors property");
+ e.errors = errors;
+ throw e;
+ }
+ }
+
+});
+
+MochiKit.Signal.EXPORT_OK = [];
+
+MochiKit.Signal.EXPORT = [
+ 'connect',
+ 'disconnect',
+ 'signal',
+ 'disconnectAll',
+ 'disconnectAllTo'
+];
+
+MochiKit.Signal.__new__ = function (win) {
+ var m = MochiKit.Base;
+ this._document = document;
+ this._window = win;
+ this._lock = false;
+ this._dirty = false;
+
+ try {
+ this.connect(window, 'onunload', this._unloadCache);
+ } catch (e) {
+ // pass: might not be a browser
+ }
+
+ this.EXPORT_TAGS = {
+ ':common': this.EXPORT,
+ ':all': m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+};
+
+MochiKit.Signal.__new__(this);
+
+//
+// XXX: Internet Explorer blows
+//
+if (MochiKit.__export__) {
+ connect = MochiKit.Signal.connect;
+ disconnect = MochiKit.Signal.disconnect;
+ disconnectAll = MochiKit.Signal.disconnectAll;
+ signal = MochiKit.Signal.signal;
+}
+
+MochiKit.Base._exportSymbols(this, MochiKit.Signal);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Sortable.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Sortable.js
new file mode 100644
index 0000000000..8976ec0b27
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Sortable.js
@@ -0,0 +1,589 @@
+/***
+Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+ Mochi-ized By Thomas Herve (_firstname_@nimail.org)
+
+See scriptaculous.js for full license.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Sortable');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+ dojo.require('MochiKit.Iter');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+ JSAN.use("MochiKit.DOM", []);
+ JSAN.use("MochiKit.Iter", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined' ||
+ typeof(MochiKit.DOM) == 'undefined' ||
+ typeof(MochiKit.Iter) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.DragAndDrop depends on MochiKit.Base, MochiKit.DOM and MochiKit.Iter!";
+}
+
+if (typeof(MochiKit.Sortable) == 'undefined') {
+ MochiKit.Sortable = {};
+}
+
+MochiKit.Sortable.NAME = 'MochiKit.Sortable';
+MochiKit.Sortable.VERSION = '1.4';
+
+MochiKit.Sortable.__repr__ = function () {
+ return '[' + this.NAME + ' ' + this.VERSION + ']';
+};
+
+MochiKit.Sortable.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.Sortable.EXPORT = [
+];
+
+MochiKit.Sortable.EXPORT_OK = [
+];
+
+MochiKit.Base.update(MochiKit.Sortable, {
+ /***
+
+ Manage sortables. Mainly use the create function to add a sortable.
+
+ ***/
+ sortables: {},
+
+ _findRootElement: function (element) {
+ while (element.tagName.toUpperCase() != "BODY") {
+ if (element.id && MochiKit.Sortable.sortables[element.id]) {
+ return element;
+ }
+ element = element.parentNode;
+ }
+ },
+
+ /** @id MochiKit.Sortable.options */
+ options: function (element) {
+ element = MochiKit.Sortable._findRootElement(MochiKit.DOM.getElement(element));
+ if (!element) {
+ return;
+ }
+ return MochiKit.Sortable.sortables[element.id];
+ },
+
+ /** @id MochiKit.Sortable.destroy */
+ destroy: function (element){
+ var s = MochiKit.Sortable.options(element);
+ var b = MochiKit.Base;
+ var d = MochiKit.DragAndDrop;
+
+ if (s) {
+ MochiKit.Signal.disconnect(s.startHandle);
+ MochiKit.Signal.disconnect(s.endHandle);
+ b.map(function (dr) {
+ d.Droppables.remove(dr);
+ }, s.droppables);
+ b.map(function (dr) {
+ dr.destroy();
+ }, s.draggables);
+
+ delete MochiKit.Sortable.sortables[s.element.id];
+ }
+ },
+
+ /** @id MochiKit.Sortable.create */
+ create: function (element, options) {
+ element = MochiKit.DOM.getElement(element);
+ var self = MochiKit.Sortable;
+
+ /** @id MochiKit.Sortable.options */
+ options = MochiKit.Base.update({
+
+ /** @id MochiKit.Sortable.element */
+ element: element,
+
+ /** @id MochiKit.Sortable.tag */
+ tag: 'li', // assumes li children, override with tag: 'tagname'
+
+ /** @id MochiKit.Sortable.dropOnEmpty */
+ dropOnEmpty: false,
+
+ /** @id MochiKit.Sortable.tree */
+ tree: false,
+
+ /** @id MochiKit.Sortable.treeTag */
+ treeTag: 'ul',
+
+ /** @id MochiKit.Sortable.overlap */
+ overlap: 'vertical', // one of 'vertical', 'horizontal'
+
+ /** @id MochiKit.Sortable.constraint */
+ constraint: 'vertical', // one of 'vertical', 'horizontal', false
+ // also takes array of elements (or ids); or false
+
+ /** @id MochiKit.Sortable.containment */
+ containment: [element],
+
+ /** @id MochiKit.Sortable.handle */
+ handle: false, // or a CSS class
+
+ /** @id MochiKit.Sortable.only */
+ only: false,
+
+ /** @id MochiKit.Sortable.hoverclass */
+ hoverclass: null,
+
+ /** @id MochiKit.Sortable.ghosting */
+ ghosting: false,
+
+ /** @id MochiKit.Sortable.scroll */
+ scroll: false,
+
+ /** @id MochiKit.Sortable.scrollSensitivity */
+ scrollSensitivity: 20,
+
+ /** @id MochiKit.Sortable.scrollSpeed */
+ scrollSpeed: 15,
+
+ /** @id MochiKit.Sortable.format */
+ format: /^[^_]*_(.*)$/,
+
+ /** @id MochiKit.Sortable.onChange */
+ onChange: MochiKit.Base.noop,
+
+ /** @id MochiKit.Sortable.onUpdate */
+ onUpdate: MochiKit.Base.noop,
+
+ /** @id MochiKit.Sortable.accept */
+ accept: null
+ }, options);
+
+ // clear any old sortable with same element
+ self.destroy(element);
+
+ // build options for the draggables
+ var options_for_draggable = {
+ revert: true,
+ ghosting: options.ghosting,
+ scroll: options.scroll,
+ scrollSensitivity: options.scrollSensitivity,
+ scrollSpeed: options.scrollSpeed,
+ constraint: options.constraint,
+ handle: options.handle
+ };
+
+ if (options.starteffect) {
+ options_for_draggable.starteffect = options.starteffect;
+ }
+
+ if (options.reverteffect) {
+ options_for_draggable.reverteffect = options.reverteffect;
+ } else if (options.ghosting) {
+ options_for_draggable.reverteffect = function (innerelement) {
+ innerelement.style.top = 0;
+ innerelement.style.left = 0;
+ };
+ }
+
+ if (options.endeffect) {
+ options_for_draggable.endeffect = options.endeffect;
+ }
+
+ if (options.zindex) {
+ options_for_draggable.zindex = options.zindex;
+ }
+
+ // build options for the droppables
+ var options_for_droppable = {
+ overlap: options.overlap,
+ containment: options.containment,
+ hoverclass: options.hoverclass,
+ onhover: self.onHover,
+ tree: options.tree,
+ accept: options.accept
+ }
+
+ var options_for_tree = {
+ onhover: self.onEmptyHover,
+ overlap: options.overlap,
+ containment: options.containment,
+ hoverclass: options.hoverclass,
+ accept: options.accept
+ }
+
+ // fix for gecko engine
+ MochiKit.DOM.removeEmptyTextNodes(element);
+
+ options.draggables = [];
+ options.droppables = [];
+
+ // drop on empty handling
+ if (options.dropOnEmpty || options.tree) {
+ new MochiKit.DragAndDrop.Droppable(element, options_for_tree);
+ options.droppables.push(element);
+ }
+ MochiKit.Base.map(function (e) {
+ // handles are per-draggable
+ var handle = options.handle ?
+ MochiKit.DOM.getFirstElementByTagAndClassName(null,
+ options.handle, e) : e;
+ options.draggables.push(
+ new MochiKit.DragAndDrop.Draggable(e,
+ MochiKit.Base.update(options_for_draggable,
+ {handle: handle})));
+ new MochiKit.DragAndDrop.Droppable(e, options_for_droppable);
+ if (options.tree) {
+ e.treeNode = element;
+ }
+ options.droppables.push(e);
+ }, (self.findElements(element, options) || []));
+
+ if (options.tree) {
+ MochiKit.Base.map(function (e) {
+ new MochiKit.DragAndDrop.Droppable(e, options_for_tree);
+ e.treeNode = element;
+ options.droppables.push(e);
+ }, (self.findTreeElements(element, options) || []));
+ }
+
+ // keep reference
+ self.sortables[element.id] = options;
+
+ options.lastValue = self.serialize(element);
+ options.startHandle = MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables, 'start',
+ MochiKit.Base.partial(self.onStart, element));
+ options.endHandle = MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables, 'end',
+ MochiKit.Base.partial(self.onEnd, element));
+ },
+
+ /** @id MochiKit.Sortable.onStart */
+ onStart: function (element, draggable) {
+ var self = MochiKit.Sortable;
+ var options = self.options(element);
+ options.lastValue = self.serialize(options.element);
+ },
+
+ /** @id MochiKit.Sortable.onEnd */
+ onEnd: function (element, draggable) {
+ var self = MochiKit.Sortable;
+ self.unmark();
+ var options = self.options(element);
+ if (options.lastValue != self.serialize(options.element)) {
+ options.onUpdate(options.element);
+ }
+ },
+
+ // return all suitable-for-sortable elements in a guaranteed order
+
+ /** @id MochiKit.Sortable.findElements */
+ findElements: function (element, options) {
+ return MochiKit.Sortable.findChildren(
+ element, options.only, options.tree ? true : false, options.tag);
+ },
+
+ /** @id MochiKit.Sortable.findTreeElements */
+ findTreeElements: function (element, options) {
+ return MochiKit.Sortable.findChildren(
+ element, options.only, options.tree ? true : false, options.treeTag);
+ },
+
+ /** @id MochiKit.Sortable.findChildren */
+ findChildren: function (element, only, recursive, tagName) {
+ if (!element.hasChildNodes()) {
+ return null;
+ }
+ tagName = tagName.toUpperCase();
+ if (only) {
+ only = MochiKit.Base.flattenArray([only]);
+ }
+ var elements = [];
+ MochiKit.Base.map(function (e) {
+ if (e.tagName &&
+ e.tagName.toUpperCase() == tagName &&
+ (!only ||
+ MochiKit.Iter.some(only, function (c) {
+ return MochiKit.DOM.hasElementClass(e, c);
+ }))) {
+ elements.push(e);
+ }
+ if (recursive) {
+ var grandchildren = MochiKit.Sortable.findChildren(e, only, recursive, tagName);
+ if (grandchildren && grandchildren.length > 0) {
+ elements = elements.concat(grandchildren);
+ }
+ }
+ }, element.childNodes);
+ return elements;
+ },
+
+ /** @id MochiKit.Sortable.onHover */
+ onHover: function (element, dropon, overlap) {
+ if (MochiKit.DOM.isParent(dropon, element)) {
+ return;
+ }
+ var self = MochiKit.Sortable;
+
+ if (overlap > .33 && overlap < .66 && self.options(dropon).tree) {
+ return;
+ } else if (overlap > 0.5) {
+ self.mark(dropon, 'before');
+ if (dropon.previousSibling != element) {
+ var oldParentNode = element.parentNode;
+ element.style.visibility = 'hidden'; // fix gecko rendering
+ dropon.parentNode.insertBefore(element, dropon);
+ if (dropon.parentNode != oldParentNode) {
+ self.options(oldParentNode).onChange(element);
+ }
+ self.options(dropon.parentNode).onChange(element);
+ }
+ } else {
+ self.mark(dropon, 'after');
+ var nextElement = dropon.nextSibling || null;
+ if (nextElement != element) {
+ var oldParentNode = element.parentNode;
+ element.style.visibility = 'hidden'; // fix gecko rendering
+ dropon.parentNode.insertBefore(element, nextElement);
+ if (dropon.parentNode != oldParentNode) {
+ self.options(oldParentNode).onChange(element);
+ }
+ self.options(dropon.parentNode).onChange(element);
+ }
+ }
+ },
+
+ _offsetSize: function (element, type) {
+ if (type == 'vertical' || type == 'height') {
+ return element.offsetHeight;
+ } else {
+ return element.offsetWidth;
+ }
+ },
+
+ /** @id MochiKit.Sortable.onEmptyHover */
+ onEmptyHover: function (element, dropon, overlap) {
+ var oldParentNode = element.parentNode;
+ var self = MochiKit.Sortable;
+ var droponOptions = self.options(dropon);
+
+ if (!MochiKit.DOM.isParent(dropon, element)) {
+ var index;
+
+ var children = self.findElements(dropon, {tag: droponOptions.tag,
+ only: droponOptions.only});
+ var child = null;
+
+ if (children) {
+ var offset = self._offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
+
+ for (index = 0; index < children.length; index += 1) {
+ if (offset - self._offsetSize(children[index], droponOptions.overlap) >= 0) {
+ offset -= self._offsetSize(children[index], droponOptions.overlap);
+ } else if (offset - (self._offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
+ child = index + 1 < children.length ? children[index + 1] : null;
+ break;
+ } else {
+ child = children[index];
+ break;
+ }
+ }
+ }
+
+ dropon.insertBefore(element, child);
+
+ self.options(oldParentNode).onChange(element);
+ droponOptions.onChange(element);
+ }
+ },
+
+ /** @id MochiKit.Sortable.unmark */
+ unmark: function () {
+ var m = MochiKit.Sortable._marker;
+ if (m) {
+ MochiKit.Style.hideElement(m);
+ }
+ },
+
+ /** @id MochiKit.Sortable.mark */
+ mark: function (dropon, position) {
+ // mark on ghosting only
+ var d = MochiKit.DOM;
+ var self = MochiKit.Sortable;
+ var sortable = self.options(dropon.parentNode);
+ if (sortable && !sortable.ghosting) {
+ return;
+ }
+
+ if (!self._marker) {
+ self._marker = d.getElement('dropmarker') ||
+ document.createElement('DIV');
+ MochiKit.Style.hideElement(self._marker);
+ d.addElementClass(self._marker, 'dropmarker');
+ self._marker.style.position = 'absolute';
+ document.getElementsByTagName('body').item(0).appendChild(self._marker);
+ }
+ var offsets = MochiKit.Position.cumulativeOffset(dropon);
+ self._marker.style.left = offsets.x + 'px';
+ self._marker.style.top = offsets.y + 'px';
+
+ if (position == 'after') {
+ if (sortable.overlap == 'horizontal') {
+ self._marker.style.left = (offsets.x + dropon.clientWidth) + 'px';
+ } else {
+ self._marker.style.top = (offsets.y + dropon.clientHeight) + 'px';
+ }
+ }
+ MochiKit.Style.showElement(self._marker);
+ },
+
+ _tree: function (element, options, parent) {
+ var self = MochiKit.Sortable;
+ var children = self.findElements(element, options) || [];
+
+ for (var i = 0; i < children.length; ++i) {
+ var match = children[i].id.match(options.format);
+
+ if (!match) {
+ continue;
+ }
+
+ var child = {
+ id: encodeURIComponent(match ? match[1] : null),
+ element: element,
+ parent: parent,
+ children: [],
+ position: parent.children.length,
+ container: self._findChildrenElement(children[i], options.treeTag.toUpperCase())
+ }
+
+ /* Get the element containing the children and recurse over it */
+ if (child.container) {
+ self._tree(child.container, options, child)
+ }
+
+ parent.children.push (child);
+ }
+
+ return parent;
+ },
+
+ /* Finds the first element of the given tag type within a parent element.
+ Used for finding the first LI[ST] within a L[IST]I[TEM].*/
+ _findChildrenElement: function (element, containerTag) {
+ if (element && element.hasChildNodes) {
+ containerTag = containerTag.toUpperCase();
+ for (var i = 0; i < element.childNodes.length; ++i) {
+ if (element.childNodes[i].tagName.toUpperCase() == containerTag) {
+ return element.childNodes[i];
+ }
+ }
+ }
+ return null;
+ },
+
+ /** @id MochiKit.Sortable.tree */
+ tree: function (element, options) {
+ element = MochiKit.DOM.getElement(element);
+ var sortableOptions = MochiKit.Sortable.options(element);
+ options = MochiKit.Base.update({
+ tag: sortableOptions.tag,
+ treeTag: sortableOptions.treeTag,
+ only: sortableOptions.only,
+ name: element.id,
+ format: sortableOptions.format
+ }, options || {});
+
+ var root = {
+ id: null,
+ parent: null,
+ children: new Array,
+ container: element,
+ position: 0
+ }
+
+ return MochiKit.Sortable._tree(element, options, root);
+ },
+
+ /**
+ * Specifies the sequence for the Sortable.
+ * @param {Node} element Element to use as the Sortable.
+ * @param {Object} newSequence New sequence to use.
+ * @param {Object} options Options to use fro the Sortable.
+ */
+ setSequence: function (element, newSequence, options) {
+ var self = MochiKit.Sortable;
+ var b = MochiKit.Base;
+ element = MochiKit.DOM.getElement(element);
+ options = b.update(self.options(element), options || {});
+
+ var nodeMap = {};
+ b.map(function (n) {
+ var m = n.id.match(options.format);
+ if (m) {
+ nodeMap[m[1]] = [n, n.parentNode];
+ }
+ n.parentNode.removeChild(n);
+ }, self.findElements(element, options));
+
+ b.map(function (ident) {
+ var n = nodeMap[ident];
+ if (n) {
+ n[1].appendChild(n[0]);
+ delete nodeMap[ident];
+ }
+ }, newSequence);
+ },
+
+ /* Construct a [i] index for a particular node */
+ _constructIndex: function (node) {
+ var index = '';
+ do {
+ if (node.id) {
+ index = '[' + node.position + ']' + index;
+ }
+ } while ((node = node.parent) != null);
+ return index;
+ },
+
+ /** @id MochiKit.Sortable.sequence */
+ sequence: function (element, options) {
+ element = MochiKit.DOM.getElement(element);
+ var self = MochiKit.Sortable;
+ var options = MochiKit.Base.update(self.options(element), options || {});
+
+ return MochiKit.Base.map(function (item) {
+ return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
+ }, MochiKit.DOM.getElement(self.findElements(element, options) || []));
+ },
+
+ /**
+ * Serializes the content of a Sortable. Useful to send this content through a XMLHTTPRequest.
+ * These options override the Sortable options for the serialization only.
+ * @param {Node} element Element to serialize.
+ * @param {Object} options Serialization options.
+ */
+ serialize: function (element, options) {
+ element = MochiKit.DOM.getElement(element);
+ var self = MochiKit.Sortable;
+ options = MochiKit.Base.update(self.options(element), options || {});
+ var name = encodeURIComponent(options.name || element.id);
+
+ if (options.tree) {
+ return MochiKit.Base.flattenArray(MochiKit.Base.map(function (item) {
+ return [name + self._constructIndex(item) + "[id]=" +
+ encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
+ }, self.tree(element, options).children)).join('&');
+ } else {
+ return MochiKit.Base.map(function (item) {
+ return name + "[]=" + encodeURIComponent(item);
+ }, self.sequence(element, options)).join('&');
+ }
+ }
+});
+
+// trunk compatibility
+MochiKit.Sortable.Sortable = MochiKit.Sortable;
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Style.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Style.js
new file mode 100644
index 0000000000..93e77862af
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Style.js
@@ -0,0 +1,445 @@
+/***
+
+MochiKit.Style 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005-2006 Bob Ippolito, Beau Hartshorne. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Style');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+}
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use('MochiKit.Base', []);
+ JSAN.use('MochiKit.DOM', []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw '';
+ }
+} catch (e) {
+ throw 'MochiKit.Style depends on MochiKit.Base!';
+}
+
+try {
+ if (typeof(MochiKit.DOM) == 'undefined') {
+ throw '';
+ }
+} catch (e) {
+ throw 'MochiKit.Style depends on MochiKit.DOM!';
+}
+
+
+if (typeof(MochiKit.Style) == 'undefined') {
+ MochiKit.Style = {};
+}
+
+MochiKit.Style.NAME = 'MochiKit.Style';
+MochiKit.Style.VERSION = '1.4';
+MochiKit.Style.__repr__ = function () {
+ return '[' + this.NAME + ' ' + this.VERSION + ']';
+};
+MochiKit.Style.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.Style.EXPORT_OK = [];
+
+MochiKit.Style.EXPORT = [
+ 'setStyle',
+ 'setOpacity',
+ 'getStyle',
+ 'getElementDimensions',
+ 'elementDimensions', // deprecated
+ 'setElementDimensions',
+ 'getElementPosition',
+ 'elementPosition', // deprecated
+ 'setElementPosition',
+ 'setDisplayForElement',
+ 'hideElement',
+ 'showElement',
+ 'getViewportDimensions',
+ 'getViewportPosition',
+ 'Dimensions',
+ 'Coordinates'
+];
+
+
+/*
+
+ Dimensions
+
+*/
+/** @id MochiKit.Style.Dimensions */
+MochiKit.Style.Dimensions = function (w, h) {
+ this.w = w;
+ this.h = h;
+};
+
+MochiKit.Style.Dimensions.prototype.__repr__ = function () {
+ var repr = MochiKit.Base.repr;
+ return '{w: ' + repr(this.w) + ', h: ' + repr(this.h) + '}';
+};
+
+MochiKit.Style.Dimensions.prototype.toString = function () {
+ return this.__repr__();
+};
+
+
+/*
+
+ Coordinates
+
+*/
+/** @id MochiKit.Style.Coordinates */
+MochiKit.Style.Coordinates = function (x, y) {
+ this.x = x;
+ this.y = y;
+};
+
+MochiKit.Style.Coordinates.prototype.__repr__ = function () {
+ var repr = MochiKit.Base.repr;
+ return '{x: ' + repr(this.x) + ', y: ' + repr(this.y) + '}';
+};
+
+MochiKit.Style.Coordinates.prototype.toString = function () {
+ return this.__repr__();
+};
+
+
+MochiKit.Base.update(MochiKit.Style, {
+
+ /** @id MochiKit.Style.getStyle */
+ getStyle: function (elem, cssProperty) {
+ var dom = MochiKit.DOM;
+ var d = dom._document;
+
+ elem = dom.getElement(elem);
+ cssProperty = MochiKit.Base.camelize(cssProperty);
+
+ if (!elem || elem == d) {
+ return undefined;
+ }
+ if (cssProperty == 'opacity' && elem.filters) {
+ var opacity = (MochiKit.Style.getStyle(elem, 'filter') || '').match(/alpha\(opacity=(.*)\)/);
+ if (opacity && opacity[1]) {
+ return parseFloat(opacity[1]) / 100;
+ }
+ return 1.0;
+ }
+ var value = elem.style ? elem.style[cssProperty] : null;
+ if (!value) {
+ if (d.defaultView && d.defaultView.getComputedStyle) {
+ var css = d.defaultView.getComputedStyle(elem, null);
+ cssProperty = cssProperty.replace(/([A-Z])/g, '-$1'
+ ).toLowerCase(); // from dojo.style.toSelectorCase
+ value = css ? css.getPropertyValue(cssProperty) : null;
+ } else if (elem.currentStyle) {
+ value = elem.currentStyle[cssProperty];
+ }
+ }
+ if (cssProperty == 'opacity') {
+ value = parseFloat(value);
+ }
+
+ if (/Opera/.test(navigator.userAgent) && (MochiKit.Base.find(['left', 'top', 'right', 'bottom'], cssProperty) != -1)) {
+ if (MochiKit.Style.getStyle(elem, 'position') == 'static') {
+ value = 'auto';
+ }
+ }
+
+ return value == 'auto' ? null : value;
+ },
+
+ /** @id MochiKit.Style.setStyle */
+ setStyle: function (elem, style) {
+ elem = MochiKit.DOM.getElement(elem);
+ for (var name in style) {
+ if (name == 'opacity') {
+ MochiKit.Style.setOpacity(elem, style[name]);
+ } else {
+ elem.style[MochiKit.Base.camelize(name)] = style[name];
+ }
+ }
+ },
+
+ /** @id MochiKit.Style.setOpacity */
+ setOpacity: function (elem, o) {
+ elem = MochiKit.DOM.getElement(elem);
+ var self = MochiKit.Style;
+ if (o == 1) {
+ var toSet = /Gecko/.test(navigator.userAgent) && !(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent));
+ elem.style["opacity"] = toSet ? 0.999999 : 1.0;
+ if (/MSIE/.test(navigator.userAgent)) {
+ elem.style['filter'] =
+ self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, '');
+ }
+ } else {
+ if (o < 0.00001) {
+ o = 0;
+ }
+ elem.style["opacity"] = o;
+ if (/MSIE/.test(navigator.userAgent)) {
+ elem.style['filter'] =
+ self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, '') + 'alpha(opacity=' + o * 100 + ')';
+ }
+ }
+ },
+
+ /*
+
+ getElementPosition is adapted from YAHOO.util.Dom.getXY v0.9.0.
+ Copyright: Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+ License: BSD, http://developer.yahoo.net/yui/license.txt
+
+ */
+
+ /** @id MochiKit.Style.getElementPosition */
+ getElementPosition: function (elem, /* optional */relativeTo) {
+ var self = MochiKit.Style;
+ var dom = MochiKit.DOM;
+ elem = dom.getElement(elem);
+
+ if (!elem ||
+ (!(elem.x && elem.y) &&
+ (!elem.parentNode === null ||
+ self.getStyle(elem, 'display') == 'none'))) {
+ return undefined;
+ }
+
+ var c = new self.Coordinates(0, 0);
+ var box = null;
+ var parent = null;
+
+ var d = MochiKit.DOM._document;
+ var de = d.documentElement;
+ var b = d.body;
+
+ if (!elem.parentNode && elem.x && elem.y) {
+ /* it's just a MochiKit.Style.Coordinates object */
+ c.x += elem.x || 0;
+ c.y += elem.y || 0;
+ } else if (elem.getBoundingClientRect) { // IE shortcut
+ /*
+
+ The IE shortcut can be off by two. We fix it. See:
+ http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp
+
+ This is similar to the method used in
+ MochiKit.Signal.Event.mouse().
+
+ */
+ box = elem.getBoundingClientRect();
+
+ c.x += box.left +
+ (de.scrollLeft || b.scrollLeft) -
+ (de.clientLeft || 0);
+
+ c.y += box.top +
+ (de.scrollTop || b.scrollTop) -
+ (de.clientTop || 0);
+
+ } else if (elem.offsetParent) {
+ c.x += elem.offsetLeft;
+ c.y += elem.offsetTop;
+ parent = elem.offsetParent;
+
+ if (parent != elem) {
+ while (parent) {
+ c.x += parent.offsetLeft;
+ c.y += parent.offsetTop;
+ parent = parent.offsetParent;
+ }
+ }
+
+ /*
+
+ Opera < 9 and old Safari (absolute) incorrectly account for
+ body offsetTop and offsetLeft.
+
+ */
+ var ua = navigator.userAgent.toLowerCase();
+ if ((typeof(opera) != 'undefined' &&
+ parseFloat(opera.version()) < 9) ||
+ (ua.indexOf('AppleWebKit') != -1 &&
+ self.getStyle(elem, 'position') == 'absolute')) {
+
+ c.x -= b.offsetLeft;
+ c.y -= b.offsetTop;
+
+ }
+ }
+
+ if (typeof(relativeTo) != 'undefined') {
+ relativeTo = arguments.callee(relativeTo);
+ if (relativeTo) {
+ c.x -= (relativeTo.x || 0);
+ c.y -= (relativeTo.y || 0);
+ }
+ }
+
+ if (elem.parentNode) {
+ parent = elem.parentNode;
+ } else {
+ parent = null;
+ }
+
+ while (parent) {
+ var tagName = parent.tagName.toUpperCase();
+ if (tagName === 'BODY' || tagName === 'HTML') {
+ break;
+ }
+ var disp = self.getStyle(parent, 'display');
+ // Handle strange Opera bug for some display
+ if (disp != 'inline' && disp != 'table-row') {
+ c.x -= parent.scrollLeft;
+ c.y -= parent.scrollTop;
+ }
+ if (parent.parentNode) {
+ parent = parent.parentNode;
+ } else {
+ parent = null;
+ }
+ }
+
+ return c;
+ },
+
+ /** @id MochiKit.Style.setElementPosition */
+ setElementPosition: function (elem, newPos/* optional */, units) {
+ elem = MochiKit.DOM.getElement(elem);
+ if (typeof(units) == 'undefined') {
+ units = 'px';
+ }
+ var newStyle = {};
+ var isUndefNull = MochiKit.Base.isUndefinedOrNull;
+ if (!isUndefNull(newPos.x)) {
+ newStyle['left'] = newPos.x + units;
+ }
+ if (!isUndefNull(newPos.y)) {
+ newStyle['top'] = newPos.y + units;
+ }
+ MochiKit.DOM.updateNodeAttributes(elem, {'style': newStyle});
+ },
+
+ /** @id MochiKit.Style.getElementDimensions */
+ getElementDimensions: function (elem) {
+ var self = MochiKit.Style;
+ var dom = MochiKit.DOM;
+ if (typeof(elem.w) == 'number' || typeof(elem.h) == 'number') {
+ return new self.Dimensions(elem.w || 0, elem.h || 0);
+ }
+ elem = dom.getElement(elem);
+ if (!elem) {
+ return undefined;
+ }
+ var disp = self.getStyle(elem, 'display');
+ // display can be empty/undefined on WebKit/KHTML
+ if (disp != 'none' && disp !== '' && typeof(disp) != 'undefined') {
+ return new self.Dimensions(elem.offsetWidth || 0,
+ elem.offsetHeight || 0);
+ }
+ var s = elem.style;
+ var originalVisibility = s.visibility;
+ var originalPosition = s.position;
+ s.visibility = 'hidden';
+ s.position = 'absolute';
+ s.display = '';
+ var originalWidth = elem.offsetWidth;
+ var originalHeight = elem.offsetHeight;
+ s.display = 'none';
+ s.position = originalPosition;
+ s.visibility = originalVisibility;
+ return new self.Dimensions(originalWidth, originalHeight);
+ },
+
+ /** @id MochiKit.Style.setElementDimensions */
+ setElementDimensions: function (elem, newSize/* optional */, units) {
+ elem = MochiKit.DOM.getElement(elem);
+ if (typeof(units) == 'undefined') {
+ units = 'px';
+ }
+ var newStyle = {};
+ var isUndefNull = MochiKit.Base.isUndefinedOrNull;
+ if (!isUndefNull(newSize.w)) {
+ newStyle['width'] = newSize.w + units;
+ }
+ if (!isUndefNull(newSize.h)) {
+ newStyle['height'] = newSize.h + units;
+ }
+ MochiKit.DOM.updateNodeAttributes(elem, {'style': newStyle});
+ },
+
+ /** @id MochiKit.Style.setDisplayForElement */
+ setDisplayForElement: function (display, element/*, ...*/) {
+ var elements = MochiKit.Base.extend(null, arguments, 1);
+ var getElement = MochiKit.DOM.getElement;
+ for (var i = 0; i < elements.length; i++) {
+ element = getElement(elements[i]);
+ if (element) {
+ element.style.display = display;
+ }
+ }
+ },
+
+ /** @id MochiKit.Style.getViewportDimensions */
+ getViewportDimensions: function () {
+ var d = new MochiKit.Style.Dimensions();
+
+ var w = MochiKit.DOM._window;
+ var b = MochiKit.DOM._document.body;
+
+ if (w.innerWidth) {
+ d.w = w.innerWidth;
+ d.h = w.innerHeight;
+ } else if (b.parentElement.clientWidth) {
+ d.w = b.parentElement.clientWidth;
+ d.h = b.parentElement.clientHeight;
+ } else if (b && b.clientWidth) {
+ d.w = b.clientWidth;
+ d.h = b.clientHeight;
+ }
+ return d;
+ },
+
+ /** @id MochiKit.Style.getViewportPosition */
+ getViewportPosition: function () {
+ var c = new MochiKit.Style.Coordinates(0, 0);
+ var d = MochiKit.DOM._document;
+ var de = d.documentElement;
+ var db = d.body;
+ if (de && (de.scrollTop || de.scrollLeft)) {
+ c.x = de.scrollLeft;
+ c.y = de.scrollTop;
+ } else if (db) {
+ c.x = db.scrollLeft;
+ c.y = db.scrollTop;
+ }
+ return c;
+ },
+
+ __new__: function () {
+ var m = MochiKit.Base;
+
+ this.elementPosition = this.getElementPosition;
+ this.elementDimensions = this.getElementDimensions;
+
+ this.hideElement = m.partial(this.setDisplayForElement, 'none');
+ this.showElement = m.partial(this.setDisplayForElement, 'block');
+
+ this.EXPORT_TAGS = {
+ ':common': this.EXPORT,
+ ':all': m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+ }
+});
+
+MochiKit.Style.__new__();
+MochiKit.Base._exportSymbols(this, MochiKit.Style);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Test.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Test.js
new file mode 100644
index 0000000000..494a5b440c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Test.js
@@ -0,0 +1,181 @@
+/***
+
+MochiKit.Test 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Test');
+ dojo.require('MochiKit.Base');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) == 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Test depends on MochiKit.Base!";
+}
+
+if (typeof(MochiKit.Test) == 'undefined') {
+ MochiKit.Test = {};
+}
+
+MochiKit.Test.NAME = "MochiKit.Test";
+MochiKit.Test.VERSION = "1.4";
+MochiKit.Test.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+MochiKit.Test.toString = function () {
+ return this.__repr__();
+};
+
+
+MochiKit.Test.EXPORT = ["runTests"];
+MochiKit.Test.EXPORT_OK = [];
+
+MochiKit.Test.runTests = function (obj) {
+ if (typeof(obj) == "string") {
+ obj = JSAN.use(obj);
+ }
+ var suite = new MochiKit.Test.Suite();
+ suite.run(obj);
+};
+
+MochiKit.Test.Suite = function () {
+ this.testIndex = 0;
+ MochiKit.Base.bindMethods(this);
+};
+
+MochiKit.Test.Suite.prototype = {
+ run: function (obj) {
+ try {
+ obj(this);
+ } catch (e) {
+ this.traceback(e);
+ }
+ },
+ traceback: function (e) {
+ var items = MochiKit.Iter.sorted(MochiKit.Base.items(e));
+ print("not ok " + this.testIndex + " - Error thrown");
+ for (var i = 0; i < items.length; i++) {
+ var kv = items[i];
+ if (kv[0] == "stack") {
+ kv[1] = kv[1].split(/\n/)[0];
+ }
+ this.print("# " + kv.join(": "));
+ }
+ },
+ print: function (s) {
+ print(s);
+ },
+ is: function (got, expected, /* optional */message) {
+ var res = 1;
+ var msg = null;
+ try {
+ res = MochiKit.Base.compare(got, expected);
+ } catch (e) {
+ msg = "Can not compare " + typeof(got) + ":" + typeof(expected);
+ }
+ if (res) {
+ msg = "Expected value did not compare equal";
+ }
+ if (!res) {
+ return this.testResult(true, message);
+ }
+ return this.testResult(false, message,
+ [[msg], ["got:", got], ["expected:", expected]]);
+ },
+
+ testResult: function (pass, msg, failures) {
+ this.testIndex += 1;
+ if (pass) {
+ this.print("ok " + this.testIndex + " - " + msg);
+ return;
+ }
+ this.print("not ok " + this.testIndex + " - " + msg);
+ if (failures) {
+ for (var i = 0; i < failures.length; i++) {
+ this.print("# " + failures[i].join(" "));
+ }
+ }
+ },
+
+ isDeeply: function (got, expected, /* optional */message) {
+ var m = MochiKit.Base;
+ var res = 1;
+ try {
+ res = m.compare(got, expected);
+ } catch (e) {
+ // pass
+ }
+ if (res === 0) {
+ return this.ok(true, message);
+ }
+ var gk = m.keys(got);
+ var ek = m.keys(expected);
+ gk.sort();
+ ek.sort();
+ if (m.compare(gk, ek)) {
+ // differing keys
+ var cmp = {};
+ var i;
+ for (i = 0; i < gk.length; i++) {
+ cmp[gk[i]] = "got";
+ }
+ for (i = 0; i < ek.length; i++) {
+ if (ek[i] in cmp) {
+ delete cmp[ek[i]];
+ } else {
+ cmp[ek[i]] = "expected";
+ }
+ }
+ var diffkeys = m.keys(cmp);
+ diffkeys.sort();
+ var gotkeys = [];
+ var expkeys = [];
+ while (diffkeys.length) {
+ var k = diffkeys.shift();
+ if (k in Object.prototype) {
+ continue;
+ }
+ (cmp[k] == "got" ? gotkeys : expkeys).push(k);
+ }
+
+
+ }
+
+ return this.testResult((!res), msg,
+ (msg ? [["got:", got], ["expected:", expected]] : undefined)
+ );
+ },
+
+ ok: function (res, message) {
+ return this.testResult(res, message);
+ }
+};
+
+MochiKit.Test.__new__ = function () {
+ var m = MochiKit.Base;
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+ m.nameFunctions(this);
+
+};
+
+MochiKit.Test.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.Test);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/Visual.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/Visual.js
new file mode 100644
index 0000000000..b7d8d87b22
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Visual.js
@@ -0,0 +1,1981 @@
+/***
+
+MochiKit.Visual 1.4
+
+See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+(c) 2005 Bob Ippolito and others. All rights Reserved.
+
+***/
+
+if (typeof(dojo) != 'undefined') {
+ dojo.provide('MochiKit.Visual');
+ dojo.require('MochiKit.Base');
+ dojo.require('MochiKit.DOM');
+ dojo.require('MochiKit.Style');
+ dojo.require('MochiKit.Color');
+ dojo.require('MochiKit.Position');
+}
+
+if (typeof(JSAN) != 'undefined') {
+ JSAN.use("MochiKit.Base", []);
+ JSAN.use("MochiKit.DOM", []);
+ JSAN.use("MochiKit.Style", []);
+ JSAN.use("MochiKit.Color", []);
+ JSAN.use("MochiKit.Position", []);
+}
+
+try {
+ if (typeof(MochiKit.Base) === 'undefined' ||
+ typeof(MochiKit.DOM) === 'undefined' ||
+ typeof(MochiKit.Style) === 'undefined' ||
+ typeof(MochiKit.Position) === 'undefined' ||
+ typeof(MochiKit.Color) === 'undefined') {
+ throw "";
+ }
+} catch (e) {
+ throw "MochiKit.Visual depends on MochiKit.Base, MochiKit.DOM, MochiKit.Style, MochiKit.Position and MochiKit.Color!";
+}
+
+if (typeof(MochiKit.Visual) == "undefined") {
+ MochiKit.Visual = {};
+}
+
+MochiKit.Visual.NAME = "MochiKit.Visual";
+MochiKit.Visual.VERSION = "1.4";
+
+MochiKit.Visual.__repr__ = function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+MochiKit.Visual.toString = function () {
+ return this.__repr__();
+};
+
+MochiKit.Visual._RoundCorners = function (e, options) {
+ e = MochiKit.DOM.getElement(e);
+ this._setOptions(options);
+ if (this.options.__unstable__wrapElement) {
+ e = this._doWrap(e);
+ }
+
+ var color = this.options.color;
+ var C = MochiKit.Color.Color;
+ if (this.options.color === "fromElement") {
+ color = C.fromBackground(e);
+ } else if (!(color instanceof C)) {
+ color = C.fromString(color);
+ }
+ this.isTransparent = (color.asRGB().a <= 0);
+
+ var bgColor = this.options.bgColor;
+ if (this.options.bgColor === "fromParent") {
+ bgColor = C.fromBackground(e.offsetParent);
+ } else if (!(bgColor instanceof C)) {
+ bgColor = C.fromString(bgColor);
+ }
+
+ this._roundCornersImpl(e, color, bgColor);
+};
+
+MochiKit.Visual._RoundCorners.prototype = {
+ _doWrap: function (e) {
+ var parent = e.parentNode;
+ var doc = MochiKit.DOM.currentDocument();
+ if (typeof(doc.defaultView) === "undefined"
+ || doc.defaultView === null) {
+ return e;
+ }
+ var style = doc.defaultView.getComputedStyle(e, null);
+ if (typeof(style) === "undefined" || style === null) {
+ return e;
+ }
+ var wrapper = MochiKit.DOM.DIV({"style": {
+ display: "block",
+ // convert padding to margin
+ marginTop: style.getPropertyValue("padding-top"),
+ marginRight: style.getPropertyValue("padding-right"),
+ marginBottom: style.getPropertyValue("padding-bottom"),
+ marginLeft: style.getPropertyValue("padding-left"),
+ // remove padding so the rounding looks right
+ padding: "0px"
+ /*
+ paddingRight: "0px",
+ paddingLeft: "0px"
+ */
+ }});
+ wrapper.innerHTML = e.innerHTML;
+ e.innerHTML = "";
+ e.appendChild(wrapper);
+ return e;
+ },
+
+ _roundCornersImpl: function (e, color, bgColor) {
+ if (this.options.border) {
+ this._renderBorder(e, bgColor);
+ }
+ if (this._isTopRounded()) {
+ this._roundTopCorners(e, color, bgColor);
+ }
+ if (this._isBottomRounded()) {
+ this._roundBottomCorners(e, color, bgColor);
+ }
+ },
+
+ _renderBorder: function (el, bgColor) {
+ var borderValue = "1px solid " + this._borderColor(bgColor);
+ var borderL = "border-left: " + borderValue;
+ var borderR = "border-right: " + borderValue;
+ var style = "style='" + borderL + ";" + borderR + "'";
+ el.innerHTML = "<div " + style + ">" + el.innerHTML + "</div>";
+ },
+
+ _roundTopCorners: function (el, color, bgColor) {
+ var corner = this._createCorner(bgColor);
+ for (var i = 0; i < this.options.numSlices; i++) {
+ corner.appendChild(
+ this._createCornerSlice(color, bgColor, i, "top")
+ );
+ }
+ el.style.paddingTop = 0;
+ el.insertBefore(corner, el.firstChild);
+ },
+
+ _roundBottomCorners: function (el, color, bgColor) {
+ var corner = this._createCorner(bgColor);
+ for (var i = (this.options.numSlices - 1); i >= 0; i--) {
+ corner.appendChild(
+ this._createCornerSlice(color, bgColor, i, "bottom")
+ );
+ }
+ el.style.paddingBottom = 0;
+ el.appendChild(corner);
+ },
+
+ _createCorner: function (bgColor) {
+ var dom = MochiKit.DOM;
+ return dom.DIV({style: {backgroundColor: bgColor.toString()}});
+ },
+
+ _createCornerSlice: function (color, bgColor, n, position) {
+ var slice = MochiKit.DOM.SPAN();
+
+ var inStyle = slice.style;
+ inStyle.backgroundColor = color.toString();
+ inStyle.display = "block";
+ inStyle.height = "1px";
+ inStyle.overflow = "hidden";
+ inStyle.fontSize = "1px";
+
+ var borderColor = this._borderColor(color, bgColor);
+ if (this.options.border && n === 0) {
+ inStyle.borderTopStyle = "solid";
+ inStyle.borderTopWidth = "1px";
+ inStyle.borderLeftWidth = "0px";
+ inStyle.borderRightWidth = "0px";
+ inStyle.borderBottomWidth = "0px";
+ // assumes css compliant box model
+ inStyle.height = "0px";
+ inStyle.borderColor = borderColor.toString();
+ } else if (borderColor) {
+ inStyle.borderColor = borderColor.toString();
+ inStyle.borderStyle = "solid";
+ inStyle.borderWidth = "0px 1px";
+ }
+
+ if (!this.options.compact && (n == (this.options.numSlices - 1))) {
+ inStyle.height = "2px";
+ }
+
+ this._setMargin(slice, n, position);
+ this._setBorder(slice, n, position);
+
+ return slice;
+ },
+
+ _setOptions: function (options) {
+ this.options = {
+ corners: "all",
+ color: "fromElement",
+ bgColor: "fromParent",
+ blend: true,
+ border: false,
+ compact: false,
+ __unstable__wrapElement: false
+ };
+ MochiKit.Base.update(this.options, options);
+
+ this.options.numSlices = (this.options.compact ? 2 : 4);
+ },
+
+ _whichSideTop: function () {
+ var corners = this.options.corners;
+ if (this._hasString(corners, "all", "top")) {
+ return "";
+ }
+
+ var has_tl = (corners.indexOf("tl") != -1);
+ var has_tr = (corners.indexOf("tr") != -1);
+ if (has_tl && has_tr) {
+ return "";
+ }
+ if (has_tl) {
+ return "left";
+ }
+ if (has_tr) {
+ return "right";
+ }
+ return "";
+ },
+
+ _whichSideBottom: function () {
+ var corners = this.options.corners;
+ if (this._hasString(corners, "all", "bottom")) {
+ return "";
+ }
+
+ var has_bl = (corners.indexOf('bl') != -1);
+ var has_br = (corners.indexOf('br') != -1);
+ if (has_bl && has_br) {
+ return "";
+ }
+ if (has_bl) {
+ return "left";
+ }
+ if (has_br) {
+ return "right";
+ }
+ return "";
+ },
+
+ _borderColor: function (color, bgColor) {
+ if (color == "transparent") {
+ return bgColor;
+ } else if (this.options.border) {
+ return this.options.border;
+ } else if (this.options.blend) {
+ return bgColor.blendedColor(color);
+ }
+ return "";
+ },
+
+
+ _setMargin: function (el, n, corners) {
+ var marginSize = this._marginSize(n) + "px";
+ var whichSide = (
+ corners == "top" ? this._whichSideTop() : this._whichSideBottom()
+ );
+ var style = el.style;
+
+ if (whichSide == "left") {
+ style.marginLeft = marginSize;
+ style.marginRight = "0px";
+ } else if (whichSide == "right") {
+ style.marginRight = marginSize;
+ style.marginLeft = "0px";
+ } else {
+ style.marginLeft = marginSize;
+ style.marginRight = marginSize;
+ }
+ },
+
+ _setBorder: function (el, n, corners) {
+ var borderSize = this._borderSize(n) + "px";
+ var whichSide = (
+ corners == "top" ? this._whichSideTop() : this._whichSideBottom()
+ );
+
+ var style = el.style;
+ if (whichSide == "left") {
+ style.borderLeftWidth = borderSize;
+ style.borderRightWidth = "0px";
+ } else if (whichSide == "right") {
+ style.borderRightWidth = borderSize;
+ style.borderLeftWidth = "0px";
+ } else {
+ style.borderLeftWidth = borderSize;
+ style.borderRightWidth = borderSize;
+ }
+ },
+
+ _marginSize: function (n) {
+ if (this.isTransparent) {
+ return 0;
+ }
+
+ var o = this.options;
+ if (o.compact && o.blend) {
+ var smBlendedMarginSizes = [1, 0];
+ return smBlendedMarginSizes[n];
+ } else if (o.compact) {
+ var compactMarginSizes = [2, 1];
+ return compactMarginSizes[n];
+ } else if (o.blend) {
+ var blendedMarginSizes = [3, 2, 1, 0];
+ return blendedMarginSizes[n];
+ } else {
+ var marginSizes = [5, 3, 2, 1];
+ return marginSizes[n];
+ }
+ },
+
+ _borderSize: function (n) {
+ var o = this.options;
+ var borderSizes;
+ if (o.compact && (o.blend || this.isTransparent)) {
+ return 1;
+ } else if (o.compact) {
+ borderSizes = [1, 0];
+ } else if (o.blend) {
+ borderSizes = [2, 1, 1, 1];
+ } else if (o.border) {
+ borderSizes = [0, 2, 0, 0];
+ } else if (this.isTransparent) {
+ borderSizes = [5, 3, 2, 1];
+ } else {
+ return 0;
+ }
+ return borderSizes[n];
+ },
+
+ _hasString: function (str) {
+ for (var i = 1; i< arguments.length; i++) {
+ if (str.indexOf(arguments[i]) != -1) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ _isTopRounded: function () {
+ return this._hasString(this.options.corners,
+ "all", "top", "tl", "tr"
+ );
+ },
+
+ _isBottomRounded: function () {
+ return this._hasString(this.options.corners,
+ "all", "bottom", "bl", "br"
+ );
+ },
+
+ _hasSingleTextChild: function (el) {
+ return (el.childNodes.length == 1 && el.childNodes[0].nodeType == 3);
+ }
+};
+
+/** @id MochiKit.Visual.roundElement */
+MochiKit.Visual.roundElement = function (e, options) {
+ new MochiKit.Visual._RoundCorners(e, options);
+};
+
+/** @id MochiKit.Visual.roundClass */
+MochiKit.Visual.roundClass = function (tagName, className, options) {
+ var elements = MochiKit.DOM.getElementsByTagAndClassName(
+ tagName, className
+ );
+ for (var i = 0; i < elements.length; i++) {
+ MochiKit.Visual.roundElement(elements[i], options);
+ }
+};
+
+/** @id MochiKit.Visual.tagifyText */
+MochiKit.Visual.tagifyText = function (element, /* optional */tagifyStyle) {
+ /***
+
+ Change a node text to character in tags.
+
+ @param tagifyStyle: the style to apply to character nodes, default to
+ 'position: relative'.
+
+ ***/
+ tagifyStyle = tagifyStyle || 'position:relative';
+ if (/MSIE/.test(navigator.userAgent)) {
+ tagifyStyle += ';zoom:1';
+ }
+ element = MochiKit.DOM.getElement(element);
+ var ma = MochiKit.Base.map;
+ ma(function (child) {
+ if (child.nodeType == 3) {
+ ma(function (character) {
+ element.insertBefore(
+ MochiKit.DOM.SPAN({style: tagifyStyle},
+ character == ' ' ? String.fromCharCode(160) : character), child);
+ }, child.nodeValue.split(''));
+ MochiKit.DOM.removeElement(child);
+ }
+ }, element.childNodes);
+};
+
+/** @id MochiKit.Visual.forceRerendering */
+MochiKit.Visual.forceRerendering = function (element) {
+ try {
+ element = MochiKit.DOM.getElement(element);
+ var n = document.createTextNode(' ');
+ element.appendChild(n);
+ element.removeChild(n);
+ } catch(e) {
+ }
+};
+
+/** @id MochiKit.Visual.multiple */
+MochiKit.Visual.multiple = function (elements, effect, /* optional */options) {
+ /***
+
+ Launch the same effect subsequently on given elements.
+
+ ***/
+ options = MochiKit.Base.update({
+ speed: 0.1, delay: 0.0
+ }, options || {});
+ var masterDelay = options.delay;
+ var index = 0;
+ MochiKit.Base.map(function (innerelement) {
+ options.delay = index * options.speed + masterDelay;
+ new effect(innerelement, options);
+ index += 1;
+ }, elements);
+};
+
+MochiKit.Visual.PAIRS = {
+ 'slide': ['slideDown', 'slideUp'],
+ 'blind': ['blindDown', 'blindUp'],
+ 'appear': ['appear', 'fade'],
+ 'size': ['grow', 'shrink']
+};
+
+/** @id MochiKit.Visual.toggle */
+MochiKit.Visual.toggle = function (element, /* optional */effect, /* optional */options) {
+ /***
+
+ Toggle an item between two state depending of its visibility, making
+ a effect between these states. Default effect is 'appear', can be
+ 'slide' or 'blind'.
+
+ ***/
+ element = MochiKit.DOM.getElement(element);
+ effect = (effect || 'appear').toLowerCase();
+ options = MochiKit.Base.update({
+ queue: {position: 'end', scope: (element.id || 'global'), limit: 1}
+ }, options || {});
+ var v = MochiKit.Visual;
+ v[MochiKit.Style.getStyle(element, 'display') != 'none' ?
+ v.PAIRS[effect][1] : v.PAIRS[effect][0]](element, options);
+};
+
+/***
+
+Transitions: define functions calculating variations depending of a position.
+
+***/
+
+MochiKit.Visual.Transitions = {};
+
+/** @id MochiKit.Visual.Transitions.linear */
+MochiKit.Visual.Transitions.linear = function (pos) {
+ return pos;
+};
+
+/** @id MochiKit.Visual.Transitions.sinoidal */
+MochiKit.Visual.Transitions.sinoidal = function (pos) {
+ return (-Math.cos(pos*Math.PI)/2) + 0.5;
+};
+
+/** @id MochiKit.Visual.Transitions.reverse */
+MochiKit.Visual.Transitions.reverse = function (pos) {
+ return 1 - pos;
+};
+
+/** @id MochiKit.Visual.Transitions.flicker */
+MochiKit.Visual.Transitions.flicker = function (pos) {
+ return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
+};
+
+/** @id MochiKit.Visual.Transitions.wobble */
+MochiKit.Visual.Transitions.wobble = function (pos) {
+ return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+};
+
+/** @id MochiKit.Visual.Transitions.pulse */
+MochiKit.Visual.Transitions.pulse = function (pos, pulses) {
+ if (!pulses) {
+ return (Math.floor(pos*10) % 2 === 0 ?
+ (pos*10 - Math.floor(pos*10)) : 1 - (pos*10 - Math.floor(pos*10)));
+ }
+ return (Math.round((pos % (1/pulses)) * pulses) == 0 ?
+ ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) :
+ 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2)));
+};
+
+/** @id MochiKit.Visual.Transitions.none */
+MochiKit.Visual.Transitions.none = function (pos) {
+ return 0;
+};
+
+/** @id MochiKit.Visual.Transitions.full */
+MochiKit.Visual.Transitions.full = function (pos) {
+ return 1;
+};
+
+/***
+
+Core effects
+
+***/
+
+MochiKit.Visual.ScopedQueue = function () {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls();
+ }
+ this.__init__();
+};
+
+MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype, {
+ __init__: function () {
+ this.effects = [];
+ this.interval = null;
+ },
+
+ /** @id MochiKit.Visual.ScopedQueue.prototype.add */
+ add: function (effect) {
+ var timestamp = new Date().getTime();
+
+ var position = (typeof(effect.options.queue) == 'string') ?
+ effect.options.queue : effect.options.queue.position;
+
+ var ma = MochiKit.Base.map;
+ switch (position) {
+ case 'front':
+ // move unstarted effects after this effect
+ ma(function (e) {
+ if (e.state == 'idle') {
+ e.startOn += effect.finishOn;
+ e.finishOn += effect.finishOn;
+ }
+ }, this.effects);
+ break;
+ case 'end':
+ var finish;
+ // start effect after last queued effect has finished
+ ma(function (e) {
+ var i = e.finishOn;
+ if (i >= (finish || i)) {
+ finish = i;
+ }
+ }, this.effects);
+ timestamp = finish || timestamp;
+ break;
+ case 'break':
+ ma(function (e) {
+ e.finalize();
+ }, this.effects);
+ break;
+ }
+
+ effect.startOn += timestamp;
+ effect.finishOn += timestamp;
+ if (!effect.options.queue.limit ||
+ this.effects.length < effect.options.queue.limit) {
+ this.effects.push(effect);
+ }
+
+ if (!this.interval) {
+ this.interval = this.startLoop(MochiKit.Base.bind(this.loop, this),
+ 40);
+ }
+ },
+
+ /** @id MochiKit.Visual.ScopedQueue.prototype.startLoop */
+ startLoop: function (func, interval) {
+ return setInterval(func, interval);
+ },
+
+ /** @id MochiKit.Visual.ScopedQueue.prototype.remove */
+ remove: function (effect) {
+ this.effects = MochiKit.Base.filter(function (e) {
+ return e != effect;
+ }, this.effects);
+ if (!this.effects.length) {
+ this.stopLoop(this.interval);
+ this.interval = null;
+ }
+ },
+
+ /** @id MochiKit.Visual.ScopedQueue.prototype.stopLoop */
+ stopLoop: function (interval) {
+ clearInterval(interval);
+ },
+
+ /** @id MochiKit.Visual.ScopedQueue.prototype.loop */
+ loop: function () {
+ var timePos = new Date().getTime();
+ MochiKit.Base.map(function (effect) {
+ effect.loop(timePos);
+ }, this.effects);
+ }
+});
+
+MochiKit.Visual.Queues = {
+ instances: {},
+
+ get: function (queueName) {
+ if (typeof(queueName) != 'string') {
+ return queueName;
+ }
+
+ if (!this.instances[queueName]) {
+ this.instances[queueName] = new MochiKit.Visual.ScopedQueue();
+ }
+ return this.instances[queueName];
+ }
+};
+
+MochiKit.Visual.Queue = MochiKit.Visual.Queues.get('global');
+
+MochiKit.Visual.DefaultOptions = {
+ transition: MochiKit.Visual.Transitions.sinoidal,
+ duration: 1.0, // seconds
+ fps: 25.0, // max. 25fps due to MochiKit.Visual.Queue implementation
+ sync: false, // true for combining
+ from: 0.0,
+ to: 1.0,
+ delay: 0.0,
+ queue: 'parallel'
+};
+
+MochiKit.Visual.Base = function () {};
+
+MochiKit.Visual.Base.prototype = {
+ /***
+
+ Basic class for all Effects. Define a looping mechanism called for each step
+ of an effect. Don't instantiate it, only subclass it.
+
+ ***/
+
+ __class__ : MochiKit.Visual.Base,
+
+ /** @id MochiKit.Visual.Base.prototype.start */
+ start: function (options) {
+ var v = MochiKit.Visual;
+ this.options = MochiKit.Base.setdefault(options || {},
+ v.DefaultOptions);
+ this.currentFrame = 0;
+ this.state = 'idle';
+ this.startOn = this.options.delay*1000;
+ this.finishOn = this.startOn + (this.options.duration*1000);
+ this.event('beforeStart');
+ if (!this.options.sync) {
+ v.Queues.get(typeof(this.options.queue) == 'string' ?
+ 'global' : this.options.queue.scope).add(this);
+ }
+ },
+
+ /** @id MochiKit.Visual.Base.prototype.loop */
+ loop: function (timePos) {
+ if (timePos >= this.startOn) {
+ if (timePos >= this.finishOn) {
+ return this.finalize();
+ }
+ var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
+ var frame =
+ Math.round(pos * this.options.fps * this.options.duration);
+ if (frame > this.currentFrame) {
+ this.render(pos);
+ this.currentFrame = frame;
+ }
+ }
+ },
+
+ /** @id MochiKit.Visual.Base.prototype.render */
+ render: function (pos) {
+ if (this.state == 'idle') {
+ this.state = 'running';
+ this.event('beforeSetup');
+ this.setup();
+ this.event('afterSetup');
+ }
+ if (this.state == 'running') {
+ if (this.options.transition) {
+ pos = this.options.transition(pos);
+ }
+ pos *= (this.options.to - this.options.from);
+ pos += this.options.from;
+ this.event('beforeUpdate');
+ this.update(pos);
+ this.event('afterUpdate');
+ }
+ },
+
+ /** @id MochiKit.Visual.Base.prototype.cancel */
+ cancel: function () {
+ if (!this.options.sync) {
+ MochiKit.Visual.Queues.get(typeof(this.options.queue) == 'string' ?
+ 'global' : this.options.queue.scope).remove(this);
+ }
+ this.state = 'finished';
+ },
+
+ /** @id MochiKit.Visual.Base.prototype.finalize */
+ finalize: function () {
+ this.render(1.0);
+ this.cancel();
+ this.event('beforeFinish');
+ this.finish();
+ this.event('afterFinish');
+ },
+
+ setup: function () {
+ },
+
+ finish: function () {
+ },
+
+ update: function (position) {
+ },
+
+ /** @id MochiKit.Visual.Base.prototype.event */
+ event: function (eventName) {
+ if (this.options[eventName + 'Internal']) {
+ this.options[eventName + 'Internal'](this);
+ }
+ if (this.options[eventName]) {
+ this.options[eventName](this);
+ }
+ },
+
+ /** @id MochiKit.Visual.Base.prototype.repr */
+ repr: function () {
+ return '[' + this.__class__.NAME + ', options:' +
+ MochiKit.Base.repr(this.options) + ']';
+ }
+};
+
+ /** @id MochiKit.Visual.Parallel */
+MochiKit.Visual.Parallel = function (effects, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(effects, options);
+ }
+
+ this.__init__(effects, options);
+};
+
+MochiKit.Visual.Parallel.prototype = new MochiKit.Visual.Base();
+
+MochiKit.Base.update(MochiKit.Visual.Parallel.prototype, {
+ /***
+
+ Run multiple effects at the same time.
+
+ ***/
+
+ __class__ : MochiKit.Visual.Parallel,
+
+ __init__: function (effects, options) {
+ this.effects = effects || [];
+ this.start(options);
+ },
+
+ /** @id MochiKit.Visual.Parallel.prototype.update */
+ update: function (position) {
+ MochiKit.Base.map(function (effect) {
+ effect.render(position);
+ }, this.effects);
+ },
+
+ /** @id MochiKit.Visual.Parallel.prototype.finish */
+ finish: function () {
+ MochiKit.Base.map(function (effect) {
+ effect.finalize();
+ }, this.effects);
+ }
+});
+
+/** @id MochiKit.Visual.Opacity */
+MochiKit.Visual.Opacity = function (element, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, options);
+ }
+ this.__init__(element, options);
+};
+
+MochiKit.Visual.Opacity.prototype = new MochiKit.Visual.Base();
+
+MochiKit.Base.update(MochiKit.Visual.Opacity.prototype, {
+ /***
+
+ Change the opacity of an element.
+
+ @param options: 'from' and 'to' change the starting and ending opacities.
+ Must be between 0.0 and 1.0. Default to current opacity and 1.0.
+
+ ***/
+
+ __class__ : MochiKit.Visual.Opacity,
+
+ __init__: function (element, /* optional */options) {
+ var b = MochiKit.Base;
+ var s = MochiKit.Style;
+ this.element = MochiKit.DOM.getElement(element);
+ // make this work on IE on elements without 'layout'
+ if (this.element.currentStyle &&
+ (!this.element.currentStyle.hasLayout)) {
+ s.setStyle(this.element, {zoom: 1});
+ }
+ options = b.update({
+ from: s.getStyle(this.element, 'opacity') || 0.0,
+ to: 1.0
+ }, options || {});
+ this.start(options);
+ },
+
+ /** @id MochiKit.Visual.Opacity.prototype.update */
+ update: function (position) {
+ MochiKit.Style.setStyle(this.element, {'opacity': position});
+ }
+});
+
+/** @id MochiKit.Visual.Move.prototype */
+MochiKit.Visual.Move = function (element, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, options);
+ }
+ this.__init__(element, options);
+};
+
+MochiKit.Visual.Move.prototype = new MochiKit.Visual.Base();
+
+MochiKit.Base.update(MochiKit.Visual.Move.prototype, {
+ /***
+
+ Move an element between its current position to a defined position
+
+ @param options: 'x' and 'y' for final positions, default to 0, 0.
+
+ ***/
+
+ __class__ : MochiKit.Visual.Move,
+
+ __init__: function (element, /* optional */options) {
+ this.element = MochiKit.DOM.getElement(element);
+ options = MochiKit.Base.update({
+ x: 0,
+ y: 0,
+ mode: 'relative'
+ }, options || {});
+ this.start(options);
+ },
+
+ /** @id MochiKit.Visual.Move.prototype.setup */
+ setup: function () {
+ // Bug in Opera: Opera returns the 'real' position of a static element
+ // or relative element that does not have top/left explicitly set.
+ // ==> Always set top and left for position relative elements in your
+ // stylesheets (to 0 if you do not need them)
+ MochiKit.DOM.makePositioned(this.element);
+
+ var s = this.element.style;
+ var originalVisibility = s.visibility;
+ var originalDisplay = s.display;
+ if (originalDisplay == 'none') {
+ s.visibility = 'hidden';
+ s.display = '';
+ }
+
+ this.originalLeft = parseFloat(MochiKit.Style.getStyle(this.element, 'left') || '0');
+ this.originalTop = parseFloat(MochiKit.Style.getStyle(this.element, 'top') || '0');
+
+ if (this.options.mode == 'absolute') {
+ // absolute movement, so we need to calc deltaX and deltaY
+ this.options.x -= this.originalLeft;
+ this.options.y -= this.originalTop;
+ }
+ if (originalDisplay == 'none') {
+ s.visibility = originalVisibility;
+ s.display = originalDisplay;
+ }
+ },
+
+ /** @id MochiKit.Visual.Move.prototype.update */
+ update: function (position) {
+ MochiKit.Style.setStyle(this.element, {
+ left: Math.round(this.options.x * position + this.originalLeft) + 'px',
+ top: Math.round(this.options.y * position + this.originalTop) + 'px'
+ });
+ }
+});
+
+/** @id MochiKit.Visual.Scale */
+MochiKit.Visual.Scale = function (element, percent, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, percent, options);
+ }
+ this.__init__(element, percent, options);
+};
+
+MochiKit.Visual.Scale.prototype = new MochiKit.Visual.Base();
+
+MochiKit.Base.update(MochiKit.Visual.Scale.prototype, {
+ /***
+
+ Change the size of an element.
+
+ @param percent: final_size = percent*original_size
+
+ @param options: several options changing scale behaviour
+
+ ***/
+
+ __class__ : MochiKit.Visual.Scale,
+
+ __init__: function (element, percent, /* optional */options) {
+ this.element = MochiKit.DOM.getElement(element);
+ options = MochiKit.Base.update({
+ scaleX: true,
+ scaleY: true,
+ scaleContent: true,
+ scaleFromCenter: false,
+ scaleMode: 'box', // 'box' or 'contents' or {} with provided values
+ scaleFrom: 100.0,
+ scaleTo: percent
+ }, options || {});
+ this.start(options);
+ },
+
+ /** @id MochiKit.Visual.Scale.prototype.setup */
+ setup: function () {
+ this.restoreAfterFinish = this.options.restoreAfterFinish || false;
+ this.elementPositioning = MochiKit.Style.getStyle(this.element,
+ 'position');
+
+ var ma = MochiKit.Base.map;
+ var b = MochiKit.Base.bind;
+ this.originalStyle = {};
+ ma(b(function (k) {
+ this.originalStyle[k] = this.element.style[k];
+ }, this), ['top', 'left', 'width', 'height', 'fontSize']);
+
+ this.originalTop = this.element.offsetTop;
+ this.originalLeft = this.element.offsetLeft;
+
+ var fontSize = MochiKit.Style.getStyle(this.element,
+ 'font-size') || '100%';
+ ma(b(function (fontSizeType) {
+ if (fontSize.indexOf(fontSizeType) > 0) {
+ this.fontSize = parseFloat(fontSize);
+ this.fontSizeType = fontSizeType;
+ }
+ }, this), ['em', 'px', '%']);
+
+ this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
+
+ if (/^content/.test(this.options.scaleMode)) {
+ this.dims = [this.element.scrollHeight, this.element.scrollWidth];
+ } else if (this.options.scaleMode == 'box') {
+ this.dims = [this.element.offsetHeight, this.element.offsetWidth];
+ } else {
+ this.dims = [this.options.scaleMode.originalHeight,
+ this.options.scaleMode.originalWidth];
+ }
+ },
+
+ /** @id MochiKit.Visual.Scale.prototype.update */
+ update: function (position) {
+ var currentScale = (this.options.scaleFrom/100.0) +
+ (this.factor * position);
+ if (this.options.scaleContent && this.fontSize) {
+ MochiKit.Style.setStyle(this.element, {
+ fontSize: this.fontSize * currentScale + this.fontSizeType
+ });
+ }
+ this.setDimensions(this.dims[0] * currentScale,
+ this.dims[1] * currentScale);
+ },
+
+ /** @id MochiKit.Visual.Scale.prototype.finish */
+ finish: function () {
+ if (this.restoreAfterFinish) {
+ MochiKit.Style.setStyle(this.element, this.originalStyle);
+ }
+ },
+
+ /** @id MochiKit.Visual.Scale.prototype.setDimensions */
+ setDimensions: function (height, width) {
+ var d = {};
+ var r = Math.round;
+ if (/MSIE/.test(navigator.userAgent)) {
+ r = Math.ceil;
+ }
+ if (this.options.scaleX) {
+ d.width = r(width) + 'px';
+ }
+ if (this.options.scaleY) {
+ d.height = r(height) + 'px';
+ }
+ if (this.options.scaleFromCenter) {
+ var topd = (height - this.dims[0])/2;
+ var leftd = (width - this.dims[1])/2;
+ if (this.elementPositioning == 'absolute') {
+ if (this.options.scaleY) {
+ d.top = this.originalTop - topd + 'px';
+ }
+ if (this.options.scaleX) {
+ d.left = this.originalLeft - leftd + 'px';
+ }
+ } else {
+ if (this.options.scaleY) {
+ d.top = -topd + 'px';
+ }
+ if (this.options.scaleX) {
+ d.left = -leftd + 'px';
+ }
+ }
+ }
+ MochiKit.Style.setStyle(this.element, d);
+ }
+});
+
+/** @id MochiKit.Visual.Highlight */
+MochiKit.Visual.Highlight = function (element, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, options);
+ }
+ this.__init__(element, options);
+};
+
+MochiKit.Visual.Highlight.prototype = new MochiKit.Visual.Base();
+
+MochiKit.Base.update(MochiKit.Visual.Highlight.prototype, {
+ /***
+
+ Highlight an item of the page.
+
+ @param options: 'startcolor' for choosing highlighting color, default
+ to '#ffff99'.
+
+ ***/
+
+ __class__ : MochiKit.Visual.Highlight,
+
+ __init__: function (element, /* optional */options) {
+ this.element = MochiKit.DOM.getElement(element);
+ options = MochiKit.Base.update({
+ startcolor: '#ffff99'
+ }, options || {});
+ this.start(options);
+ },
+
+ /** @id MochiKit.Visual.Highlight.prototype.setup */
+ setup: function () {
+ var b = MochiKit.Base;
+ var s = MochiKit.Style;
+ // Prevent executing on elements not in the layout flow
+ if (s.getStyle(this.element, 'display') == 'none') {
+ this.cancel();
+ return;
+ }
+ // Disable background image during the effect
+ this.oldStyle = {
+ backgroundImage: s.getStyle(this.element, 'background-image')
+ };
+ s.setStyle(this.element, {
+ backgroundImage: 'none'
+ });
+
+ if (!this.options.endcolor) {
+ this.options.endcolor =
+ MochiKit.Color.Color.fromBackground(this.element).toHexString();
+ }
+ if (b.isUndefinedOrNull(this.options.restorecolor)) {
+ this.options.restorecolor = s.getStyle(this.element,
+ 'background-color');
+ }
+ // init color calculations
+ this._base = b.map(b.bind(function (i) {
+ return parseInt(
+ this.options.startcolor.slice(i*2 + 1, i*2 + 3), 16);
+ }, this), [0, 1, 2]);
+ this._delta = b.map(b.bind(function (i) {
+ return parseInt(this.options.endcolor.slice(i*2 + 1, i*2 + 3), 16)
+ - this._base[i];
+ }, this), [0, 1, 2]);
+ },
+
+ /** @id MochiKit.Visual.Highlight.prototype.update */
+ update: function (position) {
+ var m = '#';
+ MochiKit.Base.map(MochiKit.Base.bind(function (i) {
+ m += MochiKit.Color.toColorPart(Math.round(this._base[i] +
+ this._delta[i]*position));
+ }, this), [0, 1, 2]);
+ MochiKit.Style.setStyle(this.element, {
+ backgroundColor: m
+ });
+ },
+
+ /** @id MochiKit.Visual.Highlight.prototype.finish */
+ finish: function () {
+ MochiKit.Style.setStyle(this.element,
+ MochiKit.Base.update(this.oldStyle, {
+ backgroundColor: this.options.restorecolor
+ }));
+ }
+});
+
+/** @id MochiKit.Visual.ScrollTo */
+MochiKit.Visual.ScrollTo = function (element, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, options);
+ }
+ this.__init__(element, options);
+};
+
+MochiKit.Visual.ScrollTo.prototype = new MochiKit.Visual.Base();
+
+MochiKit.Base.update(MochiKit.Visual.ScrollTo.prototype, {
+ /***
+
+ Scroll to an element in the page.
+
+ ***/
+
+ __class__ : MochiKit.Visual.ScrollTo,
+
+ __init__: function (element, /* optional */options) {
+ this.element = MochiKit.DOM.getElement(element);
+ this.start(options || {});
+ },
+
+ /** @id MochiKit.Visual.ScrollTo.prototype.setup */
+ setup: function () {
+ var p = MochiKit.Position;
+ p.prepare();
+ var offsets = p.cumulativeOffset(this.element);
+ if (this.options.offset) {
+ offsets.y += this.options.offset;
+ }
+ var max;
+ if (window.innerHeight) {
+ max = window.innerHeight - window.height;
+ } else if (document.documentElement &&
+ document.documentElement.clientHeight) {
+ max = document.documentElement.clientHeight -
+ document.body.scrollHeight;
+ } else if (document.body) {
+ max = document.body.clientHeight - document.body.scrollHeight;
+ }
+ this.scrollStart = p.windowOffset.y;
+ this.delta = (offsets.y > max ? max : offsets.y) - this.scrollStart;
+ },
+
+ /** @id MochiKit.Visual.ScrollTo.prototype.update */
+ update: function (position) {
+ var p = MochiKit.Position;
+ p.prepare();
+ window.scrollTo(p.windowOffset.x, this.scrollStart + (position * this.delta));
+ }
+});
+
+MochiKit.Visual.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
+
+MochiKit.Visual.Morph = function (element, options) {
+ var cls = arguments.callee;
+ if (!(this instanceof cls)) {
+ return new cls(element, options);
+ }
+ this.__init__(element, options);
+};
+
+MochiKit.Visual.Morph.prototype = new MochiKit.Visual.Base();
+
+MochiKit.Base.update(MochiKit.Visual.Morph.prototype, {
+ /***
+
+ Morph effect: make a transformation from current style to the given style,
+ automatically making a transition between the two.
+
+ ***/
+
+ __class__ : MochiKit.Visual.Morph,
+
+ __init__: function (element, /* optional */options) {
+ this.element = MochiKit.DOM.getElement(element);
+ this.start(options || {});
+ },
+
+ /** @id MochiKit.Visual.Morph.prototype.setup */
+ setup: function () {
+ var b = MochiKit.Base;
+ var style = this.options.style;
+ this.styleStart = {};
+ this.styleEnd = {};
+ this.units = {};
+ var value, unit;
+ for (var s in style) {
+ value = style[s];
+ s = b.camelize(s);
+ if (MochiKit.Visual.CSS_LENGTH.test(value)) {
+ var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
+ value = parseFloat(components[1]);
+ unit = (components.length == 3) ? components[2] : null;
+ this.styleEnd[s] = value;
+ this.units[s] = unit;
+ value = MochiKit.Style.getStyle(this.element, s);
+ components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
+ value = parseFloat(components[1]);
+ this.styleStart[s] = value;
+ } else {
+ var c = MochiKit.Color.Color;
+ value = c.fromString(value);
+ if (value) {
+ this.units[s] = "color";
+ this.styleEnd[s] = value.toHexString();
+ value = MochiKit.Style.getStyle(this.element, s);
+ this.styleStart[s] = c.fromString(value).toHexString();
+
+ this.styleStart[s] = b.map(b.bind(function (i) {
+ return parseInt(
+ this.styleStart[s].slice(i*2 + 1, i*2 + 3), 16);
+ }, this), [0, 1, 2]);
+ this.styleEnd[s] = b.map(b.bind(function (i) {
+ return parseInt(
+ this.styleEnd[s].slice(i*2 + 1, i*2 + 3), 16);
+ }, this), [0, 1, 2]);
+ }
+ }
+ }
+ },
+
+ /** @id MochiKit.Visual.Morph.prototype.update */
+ update: function (position) {
+ var value;
+ for (var s in this.styleStart) {
+ if (this.units[s] == "color") {
+ var m = '#';
+ var start = this.styleStart[s];
+ var end = this.styleEnd[s];
+ MochiKit.Base.map(MochiKit.Base.bind(function (i) {
+ m += MochiKit.Color.toColorPart(Math.round(start[i] +
+ (end[i] - start[i])*position));
+ }, this), [0, 1, 2]);
+ this.element.style[s] = m;
+ } else {
+ value = this.styleStart[s] + Math.round((this.styleEnd[s] - this.styleStart[s]) * position * 1000) / 1000 + this.units[s];
+ this.element.style[s] = value;
+ }
+ }
+ }
+});
+
+/***
+
+Combination effects.
+
+***/
+
+/** @id MochiKit.Visual.fade */
+MochiKit.Visual.fade = function (element, /* optional */ options) {
+ /***
+
+ Fade a given element: change its opacity and hide it in the end.
+
+ @param options: 'to' and 'from' to change opacity.
+
+ ***/
+ var s = MochiKit.Style;
+ var oldOpacity = s.getStyle(element, 'opacity');
+ options = MochiKit.Base.update({
+ from: s.getStyle(element, 'opacity') || 1.0,
+ to: 0.0,
+ afterFinishInternal: function (effect) {
+ if (effect.options.to !== 0) {
+ return;
+ }
+ s.hideElement(effect.element);
+ s.setStyle(effect.element, {'opacity': oldOpacity});
+ }
+ }, options || {});
+ return new MochiKit.Visual.Opacity(element, options);
+};
+
+/** @id MochiKit.Visual.appear */
+MochiKit.Visual.appear = function (element, /* optional */ options) {
+ /***
+
+ Make an element appear.
+
+ @param options: 'to' and 'from' to change opacity.
+
+ ***/
+ var s = MochiKit.Style;
+ var v = MochiKit.Visual;
+ options = MochiKit.Base.update({
+ from: (s.getStyle(element, 'display') == 'none' ? 0.0 :
+ s.getStyle(element, 'opacity') || 0.0),
+ to: 1.0,
+ // force Safari to render floated elements properly
+ afterFinishInternal: function (effect) {
+ v.forceRerendering(effect.element);
+ },
+ beforeSetupInternal: function (effect) {
+ s.setStyle(effect.element, {'opacity': effect.options.from});
+ s.showElement(effect.element);
+ }
+ }, options || {});
+ return new v.Opacity(element, options);
+};
+
+/** @id MochiKit.Visual.puff */
+MochiKit.Visual.puff = function (element, /* optional */ options) {
+ /***
+
+ 'Puff' an element: grow it to double size, fading it and make it hidden.
+
+ ***/
+ var s = MochiKit.Style;
+ var v = MochiKit.Visual;
+ element = MochiKit.DOM.getElement(element);
+ var oldStyle = {
+ position: s.getStyle(element, 'position'),
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height,
+ opacity: s.getStyle(element, 'opacity')
+ };
+ options = MochiKit.Base.update({
+ beforeSetupInternal: function (effect) {
+ MochiKit.Position.absolutize(effect.effects[0].element);
+ },
+ afterFinishInternal: function (effect) {
+ s.hideElement(effect.effects[0].element);
+ s.setStyle(effect.effects[0].element, oldStyle);
+ },
+ scaleContent: true,
+ scaleFromCenter: true
+ }, options || {});
+ return new v.Parallel(
+ [new v.Scale(element, 200,
+ {sync: true, scaleFromCenter: options.scaleFromCenter,
+ scaleContent: options.scaleContent, restoreAfterFinish: true}),
+ new v.Opacity(element, {sync: true, to: 0.0 })],
+ options);
+};
+
+/** @id MochiKit.Visual.blindUp */
+MochiKit.Visual.blindUp = function (element, /* optional */ options) {
+ /***
+
+ Blind an element up: change its vertical size to 0.
+
+ ***/
+ var d = MochiKit.DOM;
+ element = d.getElement(element);
+ var elemClip = d.makeClipping(element);
+ options = MochiKit.Base.update({
+ scaleContent: false,
+ scaleX: false,
+ restoreAfterFinish: true,
+ afterFinishInternal: function (effect) {
+ MochiKit.Style.hideElement(effect.element);
+ d.undoClipping(effect.element, elemClip);
+ }
+ }, options || {});
+
+ return new MochiKit.Visual.Scale(element, 0, options);
+};
+
+/** @id MochiKit.Visual.blindDown */
+MochiKit.Visual.blindDown = function (element, /* optional */ options) {
+ /***
+
+ Blind an element down: restore its vertical size.
+
+ ***/
+ var d = MochiKit.DOM;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ var elementDimensions = s.getElementDimensions(element);
+ var elemClip;
+ options = MochiKit.Base.update({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: 0,
+ scaleMode: {originalHeight: elementDimensions.h,
+ originalWidth: elementDimensions.w},
+ restoreAfterFinish: true,
+ afterSetupInternal: function (effect) {
+ elemClip = d.makeClipping(effect.element);
+ s.setStyle(effect.element, {height: '0px'});
+ s.showElement(effect.element);
+ },
+ afterFinishInternal: function (effect) {
+ d.undoClipping(effect.element, elemClip);
+ }
+ }, options || {});
+ return new MochiKit.Visual.Scale(element, 100, options);
+};
+
+/** @id MochiKit.Visual.switchOff */
+MochiKit.Visual.switchOff = function (element, /* optional */ options) {
+ /***
+
+ Apply a switch-off-like effect.
+
+ ***/
+ var d = MochiKit.DOM;
+ element = d.getElement(element);
+ var oldOpacity = MochiKit.Style.getStyle(element, 'opacity');
+ var elemClip;
+ options = MochiKit.Base.update({
+ duration: 0.3,
+ scaleFromCenter: true,
+ scaleX: false,
+ scaleContent: false,
+ restoreAfterFinish: true,
+ beforeSetupInternal: function (effect) {
+ d.makePositioned(effect.element);
+ elemClip = d.makeClipping(effect.element);
+ },
+ afterFinishInternal: function (effect) {
+ MochiKit.Style.hideElement(effect.element);
+ d.undoClipping(effect.element, elemClip);
+ d.undoPositioned(effect.element);
+ MochiKit.Style.setStyle(effect.element, {'opacity': oldOpacity});
+ }
+ }, options || {});
+ var v = MochiKit.Visual;
+ return new v.appear(element, {
+ duration: 0.4,
+ from: 0,
+ transition: v.Transitions.flicker,
+ afterFinishInternal: function (effect) {
+ new v.Scale(effect.element, 1, options);
+ }
+ });
+};
+
+/** @id MochiKit.Visual.dropOut */
+MochiKit.Visual.dropOut = function (element, /* optional */ options) {
+ /***
+
+ Make an element fall and disappear.
+
+ ***/
+ var d = MochiKit.DOM;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ var oldStyle = {
+ top: s.getStyle(element, 'top'),
+ left: s.getStyle(element, 'left'),
+ opacity: s.getStyle(element, 'opacity')
+ };
+
+ options = MochiKit.Base.update({
+ duration: 0.5,
+ distance: 100,
+ beforeSetupInternal: function (effect) {
+ d.makePositioned(effect.effects[0].element);
+ },
+ afterFinishInternal: function (effect) {
+ s.hideElement(effect.effects[0].element);
+ d.undoPositioned(effect.effects[0].element);
+ s.setStyle(effect.effects[0].element, oldStyle);
+ }
+ }, options || {});
+ var v = MochiKit.Visual;
+ return new v.Parallel(
+ [new v.Move(element, {x: 0, y: options.distance, sync: true}),
+ new v.Opacity(element, {sync: true, to: 0.0})],
+ options);
+};
+
+/** @id MochiKit.Visual.shake */
+MochiKit.Visual.shake = function (element, /* optional */ options) {
+ /***
+
+ Move an element from left to right several times.
+
+ ***/
+ var d = MochiKit.DOM;
+ var v = MochiKit.Visual;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ options = MochiKit.Base.update({
+ x: -20,
+ y: 0,
+ duration: 0.05,
+ afterFinishInternal: function (effect) {
+ d.undoPositioned(effect.element);
+ s.setStyle(effect.element, oldStyle);
+ }
+ }, options || {});
+ var oldStyle = {
+ top: s.getStyle(element, 'top'),
+ left: s.getStyle(element, 'left') };
+ return new v.Move(element,
+ {x: 20, y: 0, duration: 0.05, afterFinishInternal: function (effect) {
+ new v.Move(effect.element,
+ {x: -40, y: 0, duration: 0.1, afterFinishInternal: function (effect) {
+ new v.Move(effect.element,
+ {x: 40, y: 0, duration: 0.1, afterFinishInternal: function (effect) {
+ new v.Move(effect.element,
+ {x: -40, y: 0, duration: 0.1, afterFinishInternal: function (effect) {
+ new v.Move(effect.element,
+ {x: 40, y: 0, duration: 0.1, afterFinishInternal: function (effect) {
+ new v.Move(effect.element, options
+ ) }}) }}) }}) }}) }});
+};
+
+/** @id MochiKit.Visual.slideDown */
+MochiKit.Visual.slideDown = function (element, /* optional */ options) {
+ /***
+
+ Slide an element down.
+ It needs to have the content of the element wrapped in a container
+ element with fixed height.
+
+ ***/
+ var d = MochiKit.DOM;
+ var b = MochiKit.Base;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ if (!element.firstChild) {
+ throw "MochiKit.Visual.slideDown must be used on a element with a child";
+ }
+ d.removeEmptyTextNodes(element);
+ var oldInnerBottom = s.getStyle(element.firstChild, 'bottom') || 0;
+ var elementDimensions = s.getElementDimensions(element);
+ var elemClip;
+ options = b.update({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: 0,
+ scaleMode: {originalHeight: elementDimensions.h,
+ originalWidth: elementDimensions.w},
+ restoreAfterFinish: true,
+ afterSetupInternal: function (effect) {
+ d.makePositioned(effect.element);
+ d.makePositioned(effect.element.firstChild);
+ if (/Opera/.test(navigator.userAgent)) {
+ s.setStyle(effect.element, {top: ''});
+ }
+ elemClip = d.makeClipping(effect.element);
+ s.setStyle(effect.element, {height: '0px'});
+ s.showElement(effect.element);
+ },
+ afterUpdateInternal: function (effect) {
+ s.setStyle(effect.element.firstChild,
+ {bottom: (effect.dims[0] - effect.element.clientHeight) + 'px'});
+ },
+ afterFinishInternal: function (effect) {
+ d.undoClipping(effect.element, elemClip);
+ // IE will crash if child is undoPositioned first
+ if (/MSIE/.test(navigator.userAgent)) {
+ d.undoPositioned(effect.element);
+ d.undoPositioned(effect.element.firstChild);
+ } else {
+ d.undoPositioned(effect.element.firstChild);
+ d.undoPositioned(effect.element);
+ }
+ s.setStyle(effect.element.firstChild,
+ {bottom: oldInnerBottom});
+ }
+ }, options || {});
+
+ return new MochiKit.Visual.Scale(element, 100, options);
+};
+
+/** @id MochiKit.Visual.slideUp */
+MochiKit.Visual.slideUp = function (element, /* optional */ options) {
+ /***
+
+ Slide an element up.
+ It needs to have the content of the element wrapped in a container
+ element with fixed height.
+
+ ***/
+ var d = MochiKit.DOM;
+ var b = MochiKit.Base;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ if (!element.firstChild) {
+ throw "MochiKit.Visual.slideUp must be used on a element with a child";
+ }
+ d.removeEmptyTextNodes(element);
+ var oldInnerBottom = s.getStyle(element.firstChild, 'bottom');
+ var elemClip;
+ options = b.update({
+ scaleContent: false,
+ scaleX: false,
+ scaleMode: 'box',
+ scaleFrom: 100,
+ restoreAfterFinish: true,
+ beforeStartInternal: function (effect) {
+ d.makePositioned(effect.element);
+ d.makePositioned(effect.element.firstChild);
+ if (/Opera/.test(navigator.userAgent)) {
+ s.setStyle(effect.element, {top: ''});
+ }
+ elemClip = d.makeClipping(effect.element);
+ s.showElement(effect.element);
+ },
+ afterUpdateInternal: function (effect) {
+ s.setStyle(effect.element.firstChild,
+ {bottom: (effect.dims[0] - effect.element.clientHeight) + 'px'});
+ },
+ afterFinishInternal: function (effect) {
+ s.hideElement(effect.element);
+ d.undoClipping(effect.element, elemClip);
+ d.undoPositioned(effect.element.firstChild);
+ d.undoPositioned(effect.element);
+ s.setStyle(effect.element.firstChild, {bottom: oldInnerBottom});
+ }
+ }, options || {});
+ return new MochiKit.Visual.Scale(element, 0, options);
+};
+
+// Bug in opera makes the TD containing this element expand for a instance
+// after finish
+/** @id MochiKit.Visual.squish */
+MochiKit.Visual.squish = function (element, /* optional */ options) {
+ /***
+
+ Reduce an element and make it disappear.
+
+ ***/
+ var d = MochiKit.DOM;
+ var b = MochiKit.Base;
+ var elemClip;
+ options = b.update({
+ restoreAfterFinish: true,
+ beforeSetupInternal: function (effect) {
+ elemClip = d.makeClipping(effect.element);
+ },
+ afterFinishInternal: function (effect) {
+ MochiKit.Style.hideElement(effect.element);
+ d.undoClipping(effect.element, elemClip);
+ }
+ }, options || {});
+
+ return new MochiKit.Visual.Scale(element, /Opera/.test(navigator.userAgent) ? 1 : 0, options);
+};
+
+/** @id MochiKit.Visual.grow */
+MochiKit.Visual.grow = function (element, /* optional */ options) {
+ /***
+
+ Grow an element to its original size. Make it zero-sized before
+ if necessary.
+
+ ***/
+ var d = MochiKit.DOM;
+ var v = MochiKit.Visual;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ options = MochiKit.Base.update({
+ direction: 'center',
+ moveTransition: v.Transitions.sinoidal,
+ scaleTransition: v.Transitions.sinoidal,
+ opacityTransition: v.Transitions.full,
+ scaleContent: true,
+ scaleFromCenter: false
+ }, options || {});
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: s.getStyle(element, 'opacity')
+ };
+
+ var dims = s.getElementDimensions(element);
+ var initialMoveX, initialMoveY;
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ initialMoveX = initialMoveY = moveX = moveY = 0;
+ break;
+ case 'top-right':
+ initialMoveX = dims.w;
+ initialMoveY = moveY = 0;
+ moveX = -dims.w;
+ break;
+ case 'bottom-left':
+ initialMoveX = moveX = 0;
+ initialMoveY = dims.h;
+ moveY = -dims.h;
+ break;
+ case 'bottom-right':
+ initialMoveX = dims.w;
+ initialMoveY = dims.h;
+ moveX = -dims.w;
+ moveY = -dims.h;
+ break;
+ case 'center':
+ initialMoveX = dims.w / 2;
+ initialMoveY = dims.h / 2;
+ moveX = -dims.w / 2;
+ moveY = -dims.h / 2;
+ break;
+ }
+
+ var optionsParallel = MochiKit.Base.update({
+ beforeSetupInternal: function (effect) {
+ s.setStyle(effect.effects[0].element, {height: '0px'});
+ s.showElement(effect.effects[0].element);
+ },
+ afterFinishInternal: function (effect) {
+ d.undoClipping(effect.effects[0].element);
+ d.undoPositioned(effect.effects[0].element);
+ s.setStyle(effect.effects[0].element, oldStyle);
+ }
+ }, options || {});
+
+ return new v.Move(element, {
+ x: initialMoveX,
+ y: initialMoveY,
+ duration: 0.01,
+ beforeSetupInternal: function (effect) {
+ s.hideElement(effect.element);
+ d.makeClipping(effect.element);
+ d.makePositioned(effect.element);
+ },
+ afterFinishInternal: function (effect) {
+ new v.Parallel(
+ [new v.Opacity(effect.element, {
+ sync: true, to: 1.0, from: 0.0,
+ transition: options.opacityTransition
+ }),
+ new v.Move(effect.element, {
+ x: moveX, y: moveY, sync: true,
+ transition: options.moveTransition
+ }),
+ new v.Scale(effect.element, 100, {
+ scaleMode: {originalHeight: dims.h,
+ originalWidth: dims.w},
+ sync: true,
+ scaleFrom: /Opera/.test(navigator.userAgent) ? 1 : 0,
+ transition: options.scaleTransition,
+ scaleContent: options.scaleContent,
+ scaleFromCenter: options.scaleFromCenter,
+ restoreAfterFinish: true
+ })
+ ], optionsParallel
+ );
+ }
+ });
+};
+
+/** @id MochiKit.Visual.shrink */
+MochiKit.Visual.shrink = function (element, /* optional */ options) {
+ /***
+
+ Shrink an element and make it disappear.
+
+ ***/
+ var d = MochiKit.DOM;
+ var v = MochiKit.Visual;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ options = MochiKit.Base.update({
+ direction: 'center',
+ moveTransition: v.Transitions.sinoidal,
+ scaleTransition: v.Transitions.sinoidal,
+ opacityTransition: v.Transitions.none,
+ scaleContent: true,
+ scaleFromCenter: false
+ }, options || {});
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: s.getStyle(element, 'opacity')
+ };
+
+ var dims = s.getElementDimensions(element);
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ moveX = moveY = 0;
+ break;
+ case 'top-right':
+ moveX = dims.w;
+ moveY = 0;
+ break;
+ case 'bottom-left':
+ moveX = 0;
+ moveY = dims.h;
+ break;
+ case 'bottom-right':
+ moveX = dims.w;
+ moveY = dims.h;
+ break;
+ case 'center':
+ moveX = dims.w / 2;
+ moveY = dims.h / 2;
+ break;
+ }
+ var elemClip;
+
+ var optionsParallel = MochiKit.Base.update({
+ beforeStartInternal: function (effect) {
+ elemClip = d.makePositioned(effect.effects[0].element);
+ d.makeClipping(effect.effects[0].element);
+ },
+ afterFinishInternal: function (effect) {
+ s.hideElement(effect.effects[0].element);
+ d.undoClipping(effect.effects[0].element, elemClip);
+ d.undoPositioned(effect.effects[0].element);
+ s.setStyle(effect.effects[0].element, oldStyle);
+ }
+ }, options || {});
+
+ return new v.Parallel(
+ [new v.Opacity(element, {
+ sync: true, to: 0.0, from: 1.0,
+ transition: options.opacityTransition
+ }),
+ new v.Scale(element, /Opera/.test(navigator.userAgent) ? 1 : 0, {
+ sync: true, transition: options.scaleTransition,
+ scaleContent: options.scaleContent,
+ scaleFromCenter: options.scaleFromCenter,
+ restoreAfterFinish: true
+ }),
+ new v.Move(element, {
+ x: moveX, y: moveY, sync: true, transition: options.moveTransition
+ })
+ ], optionsParallel
+ );
+};
+
+/** @id MochiKit.Visual.pulsate */
+MochiKit.Visual.pulsate = function (element, /* optional */ options) {
+ /***
+
+ Pulse an element between appear/fade.
+
+ ***/
+ var d = MochiKit.DOM;
+ var v = MochiKit.Visual;
+ var b = MochiKit.Base;
+ var oldOpacity = MochiKit.Style.getStyle(element, 'opacity');
+ options = b.update({
+ duration: 3.0,
+ from: 0,
+ afterFinishInternal: function (effect) {
+ MochiKit.Style.setStyle(effect.element, {'opacity': oldOpacity});
+ }
+ }, options || {});
+ var transition = options.transition || v.Transitions.sinoidal;
+ var reverser = b.bind(function (pos) {
+ return transition(1 - v.Transitions.pulse(pos, options.pulses));
+ }, transition);
+ b.bind(reverser, transition);
+ return new v.Opacity(element, b.update({
+ transition: reverser}, options));
+};
+
+/** @id MochiKit.Visual.fold */
+MochiKit.Visual.fold = function (element, /* optional */ options) {
+ /***
+
+ Fold an element, first vertically, then horizontally.
+
+ ***/
+ var d = MochiKit.DOM;
+ var v = MochiKit.Visual;
+ var s = MochiKit.Style;
+ element = d.getElement(element);
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height
+ };
+ var elemClip = d.makeClipping(element);
+ options = MochiKit.Base.update({
+ scaleContent: false,
+ scaleX: false,
+ afterFinishInternal: function (effect) {
+ new v.Scale(element, 1, {
+ scaleContent: false,
+ scaleY: false,
+ afterFinishInternal: function (effect) {
+ s.hideElement(effect.element);
+ d.undoClipping(effect.element, elemClip);
+ s.setStyle(effect.element, oldStyle);
+ }
+ });
+ }
+ }, options || {});
+ return new v.Scale(element, 5, options);
+};
+
+
+// Compatibility with MochiKit 1.0
+MochiKit.Visual.Color = MochiKit.Color.Color;
+MochiKit.Visual.getElementsComputedStyle = MochiKit.DOM.computedStyle;
+
+/* end of Rico adaptation */
+
+MochiKit.Visual.__new__ = function () {
+ var m = MochiKit.Base;
+
+ m.nameFunctions(this);
+
+ this.EXPORT_TAGS = {
+ ":common": this.EXPORT,
+ ":all": m.concat(this.EXPORT, this.EXPORT_OK)
+ };
+
+};
+
+MochiKit.Visual.EXPORT = [
+ "roundElement",
+ "roundClass",
+ "tagifyText",
+ "multiple",
+ "toggle",
+ "Parallel",
+ "Opacity",
+ "Move",
+ "Scale",
+ "Highlight",
+ "ScrollTo",
+ "Morph",
+ "fade",
+ "appear",
+ "puff",
+ "blindUp",
+ "blindDown",
+ "switchOff",
+ "dropOut",
+ "shake",
+ "slideDown",
+ "slideUp",
+ "squish",
+ "grow",
+ "shrink",
+ "pulsate",
+ "fold"
+];
+
+MochiKit.Visual.EXPORT_OK = [
+ "Base",
+ "PAIRS"
+];
+
+MochiKit.Visual.__new__();
+
+MochiKit.Base._exportSymbols(this, MochiKit.Visual);
diff --git a/dom/tests/mochitest/ajax/mochikit/MochiKit/__package__.js b/dom/tests/mochitest/ajax/mochikit/MochiKit/__package__.js
new file mode 100644
index 0000000000..8d644b19e9
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/__package__.js
@@ -0,0 +1,18 @@
+dojo.kwCompoundRequire({
+ "common": [
+ "MochiKit.Base",
+ "MochiKit.Iter",
+ "MochiKit.Logging",
+ "MochiKit.DateTime",
+ "MochiKit.Format",
+ "MochiKit.Async",
+ "MochiKit.DOM",
+ "MochiKit.Style",
+ "MochiKit.LoggingPane",
+ "MochiKit.Color",
+ "MochiKit.Signal",
+ "MochiKit.Position",
+ "MochiKit.Visual"
+ ]
+});
+dojo.provide("MochiKit.*");
diff --git a/dom/tests/mochitest/ajax/mochikit/manifest.json b/dom/tests/mochitest/ajax/mochikit/manifest.json
new file mode 100644
index 0000000000..5bf0e943de
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/manifest.json
@@ -0,0 +1 @@
+{testcases:['tests/MochiKit-Async.html','tests/MochiKit-Base.html','tests/MochiKit-DateTime.html','tests/MochiKit-DOM.html','tests/MochiKit-Style.html','tests/MochiKit-Format.html','tests/MochiKit-Iter.html','tests/MochiKit-Logging.html','tests/MochiKit-MochiKit.html','tests/MochiKit-Color.html','tests/MochiKit-Selector.html','tests/MochiKit-Signal.html','tests/MochiKit-Visual.html']}
diff --git a/dom/tests/mochitest/ajax/mochikit/mochitest.ini b/dom/tests/mochitest/ajax/mochikit/mochitest.ini
new file mode 100644
index 0000000000..25f301e302
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/mochitest.ini
@@ -0,0 +1,26 @@
+[DEFAULT]
+support-files =
+ manifest.json
+ MochiKit/Async.js
+ MochiKit/Base.js
+ MochiKit/Color.js
+ MochiKit/Controls.js
+ MochiKit/DOM.js
+ MochiKit/DateTime.js
+ MochiKit/DragAndDrop.js
+ MochiKit/Format.js
+ MochiKit/Iter.js
+ MochiKit/Logging.js
+ MochiKit/LoggingPane.js
+ MochiKit/MochiKit.js
+ MochiKit/MockDOM.js
+ MochiKit/Position.js
+ MochiKit/Selector.js
+ MochiKit/Signal.js
+ MochiKit/Sortable.js
+ MochiKit/Style.js
+ MochiKit/Test.js
+ MochiKit/Visual.js
+ MochiKit/__package__.js
+
+[test_Mochikit.html]
diff --git a/dom/tests/mochitest/ajax/mochikit/test_Mochikit.html b/dom/tests/mochitest/ajax/mochikit/test_Mochikit.html
new file mode 100644
index 0000000000..a94ce14a4f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/test_Mochikit.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Mochikit</title>
+ <script src="/MochiKit/Base.js"></script>
+ <script src="/MochiKit/Async.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="../lib/AJAX_setup.js"></script>
+ <link rel="stylesheet" type="text/css" href="../lib/test.css" />
+</head>
+<body>
+ <iframe width="100%" height="500" id="testframe" src=""></iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/FakeJSAN.js b/dom/tests/mochitest/ajax/mochikit/tests/FakeJSAN.js
new file mode 100644
index 0000000000..639519ecf0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/FakeJSAN.js
@@ -0,0 +1,40 @@
+var JSAN = {
+ global: this,
+ use: function (module, symbols) {
+ var components = module.split(/\./);
+ var fn = components.join('/') + '.js';
+ var o = JSAN.global;
+ var i, c;
+ for (i = 0; i < components.length; i++) {
+ o = o[components[i]];
+ if (typeof(o) == 'undefined') {
+ break;
+ }
+ }
+ if (typeof(o) != 'undefined') {
+ return o;
+ }
+
+ load(fn);
+ o = JSAN.global;
+ for (i = 0; i < components.length; i++) {
+ o = o[components[i]];
+ if (typeof(o) == 'undefined') {
+ return undefined;
+ }
+ }
+ if (!symbols) {
+ var tags = o.EXPORT_TAGS;
+ if (tags) {
+ symbols = tags[':common'] || tags[':all'];
+ }
+ }
+ if (symbols) {
+ for (i = 0; i < symbols.length; i++) {
+ c = symbols[i];
+ JSAN.global[c] = o[c];
+ }
+ }
+ return o;
+ }
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Async.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Async.html
new file mode 100644
index 0000000000..32889ea821
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Async.html
@@ -0,0 +1,408 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Async.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript">
+try {
+
+ var increment = function (res) {
+ return res + 1;
+ }
+
+ var throwStuff = function (res) {
+ throw new GenericError(res);
+ }
+
+ var catchStuff = function (res) {
+ return res.message;
+ }
+
+ var returnError = function (res) {
+ return new GenericError(res);
+ }
+
+ var anythingOkCallback = function (msg) {
+ return function (res) {
+ ok(true, msg);
+ return res;
+ }
+ }
+
+ var testEqCallback = function () {
+ /*
+ sort of emulate how deferreds work in Twisted
+ for "convenient" testing
+ */
+ var args = [];
+ for (var i = 0; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+ return function (res) {
+ var nargs = args.slice();
+ nargs.unshift(res);
+ is.apply(this, nargs);
+ return res;
+ }
+ }
+
+ var neverHappen = function (d) {
+ ok(false, "this should never happen");
+ }
+
+ /*
+ Test normal Deferred operation
+ */
+ var d = new Deferred();
+ d.addCallback(testEqCallback(1, "pre-deferred callback"));
+ d.callback(1);
+ d.addCallback(increment);
+ d.addCallback(testEqCallback(2, "post-deferred callback"));
+ d.addCallback(throwStuff);
+ d.addCallback(neverHappen);
+ d.addErrback(catchStuff);
+ d.addCallback(testEqCallback(2, "throw -> err, catch -> success"));
+ d.addCallback(returnError);
+ d.addCallback(neverHappen);
+ d.addErrback(catchStuff);
+ d.addCallback(testEqCallback(2, "return -> err, catch -> succcess"));
+
+ /*
+ Test Deferred cancellation
+ */
+ var cancelled = function (d) {
+ ok(true, "canceller called!");
+ }
+
+ var cancelledError = function (res) {
+ ok(res instanceof CancelledError, "CancelledError here");
+ }
+
+ d = new Deferred(cancelled);
+ d.addCallback(neverHappen);
+ d.addErrback(cancelledError);
+ d.cancel();
+
+ /*
+ Test succeed / fail
+ */
+
+ d = succeed(1).addCallback(testEqCallback(1, "succeed"));
+
+ // default error
+ d = fail().addCallback(neverHappen);
+ d = d.addErrback(anythingOkCallback("default fail"));
+
+ // default wrapped error
+ d = fail("web taco").addCallback(neverHappen).addErrback(catchStuff);
+ d = d.addCallback(testEqCallback("web taco", "wrapped fail"));
+
+ // default unwrapped error
+ d = fail(new GenericError("ugh")).addCallback(neverHappen).addErrback(catchStuff);
+ d = d.addCallback(testEqCallback("ugh", "unwrapped fail"));
+
+ /*
+ Test deferred dependencies
+ */
+
+ var deferredIncrement = function (res) {
+ var rval = succeed(res);
+ rval.addCallback(increment);
+ return rval;
+ }
+
+ d = succeed(1).addCallback(deferredIncrement);
+ d = d.addCallback(testEqCallback(2, "dependent deferred succeed"));
+
+ var deferredFailure = function (res) {
+ return fail(res);
+ }
+
+ d = succeed("ugh").addCallback(deferredFailure).addErrback(catchStuff);
+ d = d.addCallback(testEqCallback("ugh", "dependent deferred fail"));
+
+ /*
+ Test double-calling, double-failing, etc.
+ */
+ try {
+ succeed(1).callback(2);
+ neverHappen();
+ } catch (e) {
+ ok(e instanceof AlreadyCalledError, "double-call");
+ }
+ try {
+ fail(1).errback(2);
+ neverHappen();
+ } catch (e) {
+ ok(e instanceof AlreadyCalledError, "double-fail");
+ }
+ try {
+ d = succeed(1);
+ d.cancel();
+ d = d.callback(2);
+ ok(true, "swallowed one callback, no canceller");
+ d.callback(3);
+ neverHappen();
+ } catch (e) {
+ ok(e instanceof AlreadyCalledError, "swallow cancel");
+ }
+ try {
+ d = new Deferred(cancelled);
+ d.cancel();
+ d = d.callback(1);
+ neverHappen();
+ } catch (e) {
+ ok(e instanceof AlreadyCalledError, "non-swallowed cancel");
+ }
+
+ /* Test incorrect Deferred usage */
+
+ d = new Deferred();
+ try {
+ d.callback(new Deferred());
+ neverHappen();
+ } catch (e) {
+ ok (e instanceof Error, "deferred not allowed for callback");
+ }
+ d = new Deferred();
+ try {
+ d.errback(new Deferred());
+ neverHappen();
+ } catch (e) {
+ ok (e instanceof Error, "deferred not allowed for errback");
+ }
+
+ d = new Deferred();
+ (new Deferred()).addCallback(function () { return d; }).callback(1);
+ try {
+ d.addCallback(function () {});
+ neverHappen();
+ } catch (e) {
+ ok (e instanceof Error, "chained deferred not allowed to be re-used");
+ }
+
+ /*
+ evalJSONRequest test
+ */
+ var fakeReq = {"responseText":'[1,2,3,4,"asdf",{"a":["b", "c"]}]'};
+ var obj = [1,2,3,4,"asdf",{"a":["b", "c"]}];
+ isDeeply(obj, evalJSONRequest(fakeReq), "evalJSONRequest");
+
+ try {
+ MochiKit.Async.getXMLHttpRequest();
+ ok(true, "getXMLHttpRequest");
+ } catch (e) {
+ ok(false, "no love from getXMLHttpRequest");
+ }
+
+ var lock = new DeferredLock();
+ var lst = [];
+ var pushNumber = function (x) {
+ return function (res) { lst.push(x); }
+ };
+ lock.acquire().addCallback(pushNumber(1));
+ is( compare(lst, [1]), 0, "lock acquired" );
+ lock.acquire().addCallback(pushNumber(2));
+ is( compare(lst, [1]), 0, "lock waiting for release" );
+ lock.acquire().addCallback(pushNumber(3));
+ is( compare(lst, [1]), 0, "lock waiting for release" );
+ lock.release();
+ is( compare(lst, [1, 2]), 0, "lock passed on" );
+ lock.release();
+ is( compare(lst, [1, 2, 3]), 0, "lock passed on" );
+ lock.release();
+ try {
+ lock.release();
+ ok( false, "over-release didn't raise" );
+ } catch (e) {
+ ok( true, "over-release raised" );
+ }
+ lock.acquire().addCallback(pushNumber(1));
+ is( compare(lst, [1, 2, 3, 1]), 0, "lock acquired" );
+ lock.release();
+ is( compare(lst, [1, 2, 3, 1]), 0, "lock released" );
+
+ var d = new Deferred();
+ lst = [];
+ d.addCallback(operator.add, 2);
+ d.addBoth(operator.add, 4);
+ d.addCallback(bind(lst.push, lst));
+ d.callback(1);
+ is( lst[0], 7, "auto-partial addCallback addBoth" );
+ d.addCallback(function () { throw new Error(); });
+ ebTest = function(a, b) {
+ map(bind(lst.push, lst), arguments);
+ };
+ d.addErrback(ebTest, "foo");
+ is( lst[1], "foo", "auto-partial errback" );
+ is( lst.length, 3, "auto-partial errback" );
+
+ /*
+ Test DeferredList
+ */
+
+ var callList = [new Deferred(), new Deferred(), new Deferred()];
+ callList[0].addCallback(increment);
+ callList[1].addCallback(increment);
+ callList[2].addCallback(increment);
+ var defList = new DeferredList(callList);
+ ok(defList instanceof Deferred, "DeferredList looks like a Deferred");
+
+ callList[0].callback(3);
+ callList[1].callback(5);
+ callList[2].callback(4);
+
+ defList.addCallback(function (lst) {
+ is( arrayEqual(lst, [[true, 4], [true, 6], [true, 5]]), 1,
+ "deferredlist result ok" );
+ });
+
+ /*
+ Test fireOnOneCallback
+ */
+
+ var callList2 = [new Deferred(), new Deferred(), new Deferred()];
+ callList2[0].addCallback(increment);
+ callList2[1].addCallback(increment);
+ callList2[2].addCallback(increment);
+ var defList2 = new DeferredList(callList2, true);
+ callList2[1].callback(5);
+ callList2[0].callback(3);
+ callList2[2].callback(4);
+
+ defList2.addCallback(function (lst) {
+ is( arrayEqual(lst, [1, 6]), 1, "deferredlist fireOnOneCallback ok" );
+ });
+
+ /*
+ Test fireOnOneErrback
+ */
+
+ var callList3 = [new Deferred(), new Deferred(), new Deferred()];
+ callList3[0].addCallback(increment);
+ callList3[1].addCallback(throwStuff);
+ callList3[2].addCallback(increment);
+ var defList3 = new DeferredList(callList3, false, true);
+ defList3.callback = neverHappen;
+ callList3[0].callback(3);
+ callList3[1].callback("foo");
+ callList3[2].callback(4);
+
+ defList3.addErrback(function (err) {
+ is( err.message, "foo", "deferredlist fireOnOneErrback ok" );
+ });
+
+ /*
+ Test consumeErrors
+ */
+
+ var callList4 = [new Deferred(), new Deferred(), new Deferred()];
+ callList4[0].addCallback(increment);
+ callList4[1].addCallback(throwStuff);
+ callList4[2].addCallback(increment);
+ var defList4 = new DeferredList(callList4, false, false, true);
+ defList4.addErrback(neverHappen);
+ callList4[1].addCallback(function (arg) {
+ is(arg, null, "deferredlist consumeErrors ok" );
+ });
+ callList4[0].callback(3);
+ callList4[1].callback("foo");
+ callList4[2].callback(4);
+
+ /*
+ Test gatherResults
+ */
+
+ var callList5 = [new Deferred(), new Deferred(), new Deferred()];
+ callList5[0].addCallback(increment);
+ callList5[1].addCallback(increment);
+ callList5[2].addCallback(increment);
+ var gatherRet = gatherResults(callList5);
+ callList5[0].callback(3);
+ callList5[1].callback(5);
+ callList5[2].callback(4);
+
+ gatherRet.addCallback(function (lst) {
+ is( arrayEqual(lst, [4, 6, 5]), 1,
+ "gatherResults result ok" );
+ });
+
+ /*
+ Test maybeDeferred
+ */
+
+ var maybeDef = maybeDeferred(increment, 4);
+ maybeDef.addCallback(testEqCallback(5, "maybeDeferred sync ok"));
+
+ var maybeDef2 = deferredIncrement(8);
+ maybeDef2.addCallback(testEqCallback(9, "maybeDeferred async ok"));
+
+ ok( true, "synchronous test suite finished!");
+
+ var t = (new Date().getTime());
+ SimpleTest.waitForExplicitFinish();
+ checkCallLater = function (originalTime) {
+ is(originalTime, t, "argument passed in OK");
+ is(arguments.length, 1, "argument count right");
+ };
+ var lock = new DeferredLock();
+ withLock = function (msg) {
+ var cb = partial.apply(null, extend(null, arguments, 1));
+ var d = lock.acquire().addCallback(cb);
+ d.addErrback(ok, false, msg);
+ d.addCallback(function () {
+ ok(true, msg);
+ lock.release();
+ });
+ return d;
+ }
+ withLock("callLater", function () {
+ return callLater(0.05, checkCallLater, t);
+ });
+ withLock("wait", function () {
+ return wait(0.05, t).addCallback(checkCallLater);
+ });
+ withLock("loadJSONDoc", function () {
+ var d = loadJSONDoc("test_MochiKit-Async.json");
+ d.addCallback(function (doc) {
+ is(doc.passed, true, "loadJSONDoc passed");
+ });
+ d.addErrback(function (doc) {
+ ok(false, "loadJSONDoc failed");
+ });
+ return d;
+ });
+ lock.acquire().addCallback(function () {
+ ok(true, "async suite finished");
+ SimpleTest.finish();
+ });
+
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+ SimpleTest.finish();
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Base.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Base.html
new file mode 100644
index 0000000000..3db71e1e75
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Base.html
@@ -0,0 +1,34 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript" src="test_Base.js"></script>
+<script type="text/javascript">
+try {
+ tests.test_Base({ok:ok,is:is});
+ ok( true, "test suite finished!");
+} catch (err) {
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Color.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Color.html
new file mode 100644
index 0000000000..bad32dfb18
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Color.html
@@ -0,0 +1,84 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="../MochiKit/Logging.js"></script>
+ <script type="text/javascript" src="../MochiKit/Color.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+ <style type="text/css">.redtext {color: red}</style>
+</head>
+<body>
+<div style="position:absolute; top: 0px; left:0px; width:0px; height:0px">
+ <span style="color: red" id="c_direct"></span>
+ <span class="redtext" id="c_indirect"></span>
+</div>
+<pre id="test">
+<script type="text/javascript" src="test_Color.js"></script>
+<script type="text/javascript">
+try {
+
+ var t = {ok:ok, is:is};
+ tests.test_Color({ok:ok, is:is});
+ is(
+ Color.fromText(SPAN()).toHexString(),
+ "#000000",
+ "fromText no style"
+ );
+
+ is(
+ Color.fromText("c_direct").toHexString(),
+ Color.fromName("red").toHexString(),
+ "fromText direct style"
+ );
+
+ is(
+ Color.fromText("c_indirect").toHexString(),
+ Color.fromName("red").toHexString(),
+ "fromText indirect style"
+ );
+
+ is(
+ Color.fromComputedStyle("c_direct", "color").toHexString(),
+ Color.fromName("red").toHexString(),
+ "fromComputedStyle direct style"
+ );
+
+ is(
+ Color.fromComputedStyle("c_indirect", "color").toHexString(),
+ Color.fromName("red").toHexString(),
+ "fromComputedStyle indirect style"
+ );
+
+ is(
+ Color.fromBackground((SPAN(null, 'test'))).toHexString(),
+ Color.fromName("white").toHexString(),
+ "fromBackground with DOM"
+ );
+
+
+ // Done!
+
+ ok( true, "test suite finished!");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DOM.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DOM.html
new file mode 100644
index 0000000000..45036d9c74
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DOM.html
@@ -0,0 +1,316 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/MockDOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body>
+
+<div style="display: none;">
+ <form id="form_test">
+ <select name="select">
+ <option value="foo" selected="selected">foo</option>
+ <option value="bar">bar</option>
+ <option value="baz">baz</option>
+ </select>
+ <select name="selmultiple" multiple="multiple">
+ <option value="bar" selected="selected">bar</option>
+ <option value="baz" selected="selected">baz</option>
+ <option value="foo">foo</option>
+ </select>
+ <input type="hidden" name="hidden" value="test" />
+ <input type="radio" name="radio_off" value="1" />
+ <input type="radio" name="radio_off" value="2" />
+ <input type="radio" name="radio_off" value="3" />
+ <input type="radio" name="radio_on" value="1" />
+ <input type="radio" name="radio_on" value="2" checked="checked" />
+ <input type="radio" name="radio_on" value="3" />
+ </form>
+ <form id="form_test2">
+ <select name="selempty">
+ <option value="" selected="selected">foo</option>
+ </select>
+ <select name="selempty2">
+ <option selected="selected">foo</option>
+ </select>
+ </form>
+ <div id="parentTwo" class="two">
+ <div id="parentOne" class="one">
+ <div id="parentZero" class="zero">
+ <span id="child">child</span>
+ </div>
+ </div>
+ </div>
+</div>
+
+<pre id="test">
+<script type="text/javascript">
+try {
+
+ lst = [];
+ o = {"blah": function () { lst.push("original"); }};
+ addToCallStack(o, "blah", function () { lst.push("new"); }, true);
+ addToCallStack(o, "blah", function () { lst.push("stuff"); }, true);
+ is( typeof(o.blah), 'function', 'addToCallStack has a function' );
+ is( o.blah.callStack.length, 3, 'callStack length 3' );
+ o.blah();
+ is( lst.join(" "), "original new stuff", "callStack in correct order" );
+ is( o.blah, null, "set to null" );
+ lst = [];
+ o = {"blah": function () { lst.push("original"); }};
+ addToCallStack(o, "blah",
+ function () { lst.push("new"); return false;}, false);
+ addToCallStack(o, "blah", function () { lst.push("stuff"); }, false);
+ o.blah();
+ is( lst.join(" "), "original new", "callStack in correct order (abort)" );
+ o.blah();
+ is( lst.join(" "), "original new original new", "callStack in correct order (again)" );
+
+
+ is( escapeHTML("<>\"&bar"), "&lt;&gt;&quot;&amp;bar", "escapeHTML" ); // for emacs highlighting: "
+
+ var isDOM = function (value, expected, message) {
+ is( escapeHTML(toHTML(value)), escapeHTML(expected), message );
+ };
+
+ var d = document.createElement('span');
+ updateNodeAttributes(d, {"foo": "bar", "baz": "wibble"});
+ isDOM( d, '<span baz="wibble" foo="bar"/>', "updateNodeAttributes" );
+
+ var d = document.createElement('span');
+ appendChildNodes(d, 'word up', [document.createElement('span')]);
+ isDOM( d, '<span>word up<span/></span>', 'appendChildNodes' );
+
+ replaceChildNodes(d, 'Think Different');
+ isDOM( d, '<span>Think Different</span>', 'replaceChildNodes' );
+
+
+ insertSiblingNodesBefore(d.childNodes[0], 'word up', document.createElement('span'));
+ isDOM( d, '<span>word up<span/>Think Different</span>', 'insertSiblingNodesBefore' );
+
+ insertSiblingNodesAfter(d.childNodes[0], 'purple monkey', document.createElement('span'));
+ isDOM( d, '<span>word uppurple monkey<span/><span/>Think Different</span>', 'insertSiblingNodesAfter' );
+
+ d = createDOM("span");
+ isDOM( d, "<span/>", "createDOM empty" );
+
+
+ d = createDOM("span", {"foo": "bar", "baz": "wibble"});
+ isDOM( d, '<span baz="wibble" foo="bar"/>', "createDOM attributes" );
+
+ d = createDOM("span", {"foo": "bar", "baz": "wibble", "spam": "egg"}, "one", "two", "three");
+ is( getNodeAttribute(d, 'foo'), "bar", "createDOM attribute" );
+ is( getNodeAttribute(d, 'baz'), "wibble", "createDOM attribute" );
+ removeNodeAttribute(d, "spam");
+ is( scrapeText(d), "onetwothree", "createDOM contents" );
+
+ isDOM( d, '<span baz="wibble" foo="bar">onetwothree</span>', "createDOM contents" );
+
+ d = createDOM("span", null, function (f) {
+ return this.nodeName.toLowerCase() + "hi" + f.nodeName.toLowerCase();});
+ isDOM( d, '<span>spanhispan</span>', 'createDOM function call' );
+
+ d = createDOM("span", null, {msg: "hi", dom: function (f) {
+ return f.nodeName.toLowerCase() + this.msg; }});
+ isDOM( d, '<span>spanhi</span>', 'createDOM this.dom() call' );
+
+ d = createDOM("span", null, {msg: "hi", __dom__: function (f) {
+ return f.nodeName.toLowerCase() + this.msg; }});
+ isDOM( d, '<span>spanhi</span>', 'createDOM this.__dom__() call' );
+
+ d = createDOM("span", null, range(4));
+ isDOM( d, '<span>0123</span>', 'createDOM iterable' );
+
+
+ var d = {"taco": "pork"};
+ registerDOMConverter("taco",
+ function (o) { return !isUndefinedOrNull(o.taco); },
+ function (o) { return "Goddamn, I like " + o.taco + " tacos"; }
+ );
+ d = createDOM("span", null, d);
+ // not yet public API
+ domConverters.unregister("taco");
+
+ isDOM( d, "<span>Goddamn, I like pork tacos</span>", "createDOM with custom converter" );
+
+ is(
+ escapeHTML(toHTML(SPAN(null))),
+ escapeHTML(toHTML(createDOM("span", null))),
+ "createDOMFunc vs createDOM"
+ );
+
+ is( scrapeText(d), "Goddamn, I like pork tacos", "scrape OK" );
+ is( scrapeText(d, true).join(""), "Goddamn, I like pork tacos", "scrape Array OK" );
+
+ var st = DIV(null, STRONG(null, "d"), "oor ", STRONG(null, "f", SPAN(null, "r"), "a"), "me");
+ is( scrapeText(st), "door frame", "scrape in-order" );
+
+
+ ok( !isUndefinedOrNull(getElement("test")), "getElement might work" );
+ ok( !isUndefinedOrNull($("test")), "$alias$$ CASH MONEY alias might work" );
+
+ d = createDOM("span", null, "one", "two");
+ swapDOM(d.childNodes[0], document.createTextNode("uno"));
+ isDOM( d, "<span>unotwo</span>", "swapDOM" );
+
+ is( scrapeText(d, true).join(" "), "uno two", "multi-node scrapeText" );
+ /*
+
+ TODO:
+ addLoadEvent (async test?)
+
+ */
+
+ d = createDOM("span", {"class": "foo"});
+ setElementClass(d, "bar baz");
+ ok( d.className == "bar baz", "setElementClass");
+ toggleElementClass("bar", d);
+ ok( d.className == "baz", "toggleElementClass: " + d.className);
+ toggleElementClass("bar", d);
+ ok( hasElementClass(d, "baz", "bar"),
+ "toggleElementClass 2: " + d.className);
+ addElementClass(d, "bar");
+ ok( hasElementClass(d, "baz", "bar"),
+ "toggleElementClass 3: " + d.className);
+ ok( addElementClass(d, "blah"), "addElementClass return");
+ ok( hasElementClass(d, "baz", "bar", "blah"), "addElementClass action");
+ ok( !hasElementClass(d, "not"), "hasElementClass single");
+ ok( !hasElementClass(d, "baz", "not"), "hasElementClass multiple");
+ ok( removeElementClass(d, "blah"), "removeElementClass" );
+ ok( !removeElementClass(d, "blah"), "removeElementClass again" );
+ ok( !hasElementClass(d, "blah"), "removeElementClass again (hasElement)" );
+ removeElementClass(d, "baz");
+ ok( !swapElementClass(d, "blah", "baz"), "false swapElementClass" );
+ ok( !hasElementClass(d, "baz"), "false swapElementClass from" );
+ ok( !hasElementClass(d, "blah"), "false swapElementClass to" );
+ addElementClass(d, "blah");
+ ok( swapElementClass(d, "blah", "baz"), "swapElementClass" );
+ ok( hasElementClass(d, "baz"), "swapElementClass has toClass" );
+ ok( !hasElementClass(d, "blah"), "swapElementClass !has fromClass" );
+ ok( !swapElementClass(d, "blah", "baz"), "swapElementClass twice" );
+ ok( hasElementClass(d, "baz"), "swapElementClass has toClass" );
+ ok( !hasElementClass(d, "blah"), "swapElementClass !has fromClass" );
+
+ TABLE;
+ TBODY;
+ TR;
+ var t = TABLE(null,
+ TBODY({"class": "foo bar", "id":"tbody0"},
+ TR({"class": "foo", "id":"tr0"}),
+ TR({"class": "bar", "id":"tr1"})
+ )
+ );
+
+ var matchElements = getElementsByTagAndClassName;
+ is(
+ map(itemgetter("id"), matchElements(null, "foo", t)).join(" "),
+ "tbody0 tr0",
+ "getElementsByTagAndClassName found all tags with foo class"
+ );
+ is(
+ map(itemgetter("id"), matchElements("tr", "foo", t)).join(" "),
+ "tr0",
+ "getElementsByTagAndClassName found all tr tags with foo class"
+ );
+ is(
+ map(itemgetter("id"), matchElements("tr", null, t)).join(" "),
+ "tr0 tr1",
+ "getElementsByTagAndClassName found all tr tags"
+ );
+
+ var oldDoc = document;
+ var doc = MochiKit.MockDOM.createDocument();
+ is( currentDocument(), document, "currentDocument() correct" );
+ withDocument(doc, function () {
+ ok( document != doc, "global doc unchanged" );
+ is( currentDocument(), doc, "currentDocument() correct" );
+ var h1 = H1();
+ var span = SPAN(null, "foo", h1);
+ appendChildNodes(currentDocument().body, span);
+ });
+ is( document, oldDoc, "doc restored" );
+ is( doc.childNodes.length, 1, "doc has one child" );
+ is( doc.body.childNodes.length, 1, "body has one child" );
+ var sp = doc.body.childNodes[0];
+ is( sp.nodeName, "SPAN", "only child is SPAN" );
+ is( sp.childNodes.length, 2, "SPAN has two childNodes" );
+ is( sp.childNodes[0].nodeValue, "foo", "first node is text" );
+ is( sp.childNodes[1].nodeName, "H1", "second child is H1" );
+
+ is( currentDocument(), document, "currentDocument() correct" );
+ try {
+ withDocument(doc, function () {
+ ok( document != doc, "global doc unchanged" );
+ is( currentDocument(), doc, "currentDocument() correct" );
+ throw new Error("foo");
+ });
+ ok( false, "didn't throw" );
+ } catch (e) {
+ ok( true, "threw" );
+ }
+
+ var mockWindow = {"foo": "bar"};
+ is (currentWindow(), window, "currentWindow ok");
+ withWindow(mockWindow, function () {
+ is(currentWindow(), mockWindow, "withWindow ok");
+ });
+ is (currentWindow(), window, "currentWindow ok");
+
+ doc = MochiKit.MockDOM.createDocument();
+ var frm;
+ withDocument(doc, function () {
+ frm = FORM({name: "ignore"},
+ INPUT({name:"foo", value:"bar"}),
+ INPUT({name:"foo", value:"bar"}),
+ INPUT({name:"baz", value:"bar"})
+ );
+ });
+ var kv = formContents(frm);
+ is( kv[0].join(","), "foo,foo,baz", "mock formContents names" );
+ is( kv[1].join(","), "bar,bar,bar", "mock formContents values" );
+ is( queryString(frm), "foo=bar&foo=bar&baz=bar", "mock queryString hook" );
+
+ var kv = formContents("form_test");
+ is( kv[0].join(","), "select,selmultiple,selmultiple,hidden,radio_on", "formContents names" );
+ is( kv[1].join(","), "foo,bar,baz,test,2", "formContents values" );
+ is( queryString("form_test"), "select=foo&selmultiple=bar&selmultiple=baz&hidden=test&radio_on=2", "queryString hook" );
+ kv = formContents("form_test2");
+ is( kv[0].join(","), "selempty,selempty2", "formContents names empty option values" );
+ is( kv[1].join(","), ",foo", "formContents empty option values" );
+ is( queryString("form_test2"), "selempty=&selempty2=foo", "queryString empty option values" );
+
+ var d = DIV(null, SPAN(), " \n\t", SPAN(), "foo", SPAN(), " ");
+ is( d.childNodes.length, 6, "removeEmptyNodes test conditions correct" );
+ removeEmptyTextNodes(d);
+ is( d.childNodes.length, 4, "removeEmptyNodes" );
+
+ is( getFirstParentByTagAndClassName('child', 'div', 'two'), getElement("parentTwo"), "getFirstParentByTagAndClassName found parent" );
+ is( getFirstParentByTagAndClassName('child', 'div'), getElement("parentZero"), "getFirstParentByTagAndClassName found parent (any class)" );
+ is( getFirstParentByTagAndClassName('child', '*', 'two'), getElement("parentTwo"), "getFirstParentByTagAndClassName found parent (any tag)" );
+
+ ok( true, "test suite finished!");
+
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DateTime.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DateTime.html
new file mode 100644
index 0000000000..43ad9d4abd
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DateTime.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/DateTime.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript" src="test_DateTime.js"></script>
+<script type="text/javascript">
+try {
+
+ tests.test_DateTime({ok:ok, is:is});
+ ok( true, "test suite finished!");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DragAndDrop.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DragAndDrop.html
new file mode 100644
index 0000000000..a191a53bee
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-DragAndDrop.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="../MochiKit/Color.js"></script>
+ <script type="text/javascript" src="../MochiKit/Signal.js"></script>
+ <script type="text/javascript" src="../MochiKit/Visual.js"></script>
+ <script type="text/javascript" src="../MochiKit/DragAndDrop.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+ <style type="text/css">
+ .drop-hover {
+ }
+ #drag1 {
+ visibility: hidden;
+ }
+ #drop1 {
+ visibility: hidden;
+ }
+ </style>
+</head>
+<body>
+<div id='drag1'>drag1</div>
+<div id='drop1'>drop1</div>
+<pre id="test">
+<script type="text/javascript" src="test_DragAndDrop.js"></script>
+<script type="text/javascript">
+try {
+
+ // Counting the number of tests is really lame
+ tests.test_DragAndDrop({ok:ok, is:is});
+ ok( true, "test suite finished!");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Format.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Format.html
new file mode 100644
index 0000000000..58bffa6bf8
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Format.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Format.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript" src="test_Format.js"></script>
+<script type="text/javascript">
+try {
+
+ tests.test_Format({ok:ok, is:is});
+ ok( true, "test suite finished!");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Iter.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Iter.html
new file mode 100644
index 0000000000..8086acc2db
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Iter.html
@@ -0,0 +1,38 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript" src="test_Iter.js"></script>
+<script type="text/javascript">
+try {
+
+ tests.test_Iter({ok:ok, is:is});
+ ok( true, "test suite finished!");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-JSAN.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-JSAN.html
new file mode 100644
index 0000000000..53a0e0ed04
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-JSAN.html
@@ -0,0 +1,32 @@
+<html>
+<head>
+ <script type="text/javascript" src="JSAN.js"></script>
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript">
+ // TODO: Make this a harness for the other tests
+ JSAN.use('Test.More');
+ JSAN.addRepository('..');
+ var lst = [];
+ plan({"tests": 1});
+ var wc = {};
+ wc['MochiKit'] = true;
+ for (var k in window) { wc[k] = true; }
+ for (var k in window) { wc[k] = true; }
+ JSAN.use('MochiKit.MochiKit', []);
+ for (var k in window) {
+ if (!(k in wc) && !(k.charAt(0) == '[')) {
+ lst.push(k);
+ }
+ }
+ lst.sort();
+ pollution = lst.join(" ");
+ is(pollution, "compare reduce", "namespace pollution?");
+ JSAN.use('MochiKit.MochiKit');
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Logging.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Logging.html
new file mode 100644
index 0000000000..d92229a6e0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Logging.html
@@ -0,0 +1,40 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Logging.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript" src="test_Logging.js"></script>
+<script type="text/javascript">
+try {
+
+ tests.test_Logging({ok:ok, is:is});
+ ok( true, "test suite finished!");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-MochiKit.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-MochiKit.html
new file mode 100644
index 0000000000..d1a8b60d89
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-MochiKit.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body>
+
+<pre id="test">
+<script type="text/javascript">
+ is( isUndefined(null), false, "null is not undefined" );
+ is( isUndefined(""), false, "empty string is not undefined" );
+ is( isUndefined(undefined), true, "undefined is undefined" );
+ is( isUndefined({}.foo), true, "missing property is undefined" );
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Selector.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Selector.html
new file mode 100644
index 0000000000..503acef071
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Selector.html
@@ -0,0 +1,274 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/MockDOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="../MochiKit/Selector.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+ <style type="text/css">
+ p, #sequence {
+ display: none;
+ }
+ </style>
+</head>
+<body>
+ <p>Test originally from <a href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a>.</p>
+
+ <p>Here are some links in a normal paragraph: <a href="http://www.google.com/" title="Google!">Google</a>, <a href="http://groups.google.com/">Google Groups</a>. This link has <code>class="blog"</code>: <a href="http://diveintomark.org/" class="blog" fakeattribute="bla">diveintomark</a></p>
+ <div id="foo">
+ <p>Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
+ <p>This is a normal link: <a href="http://www.yahoo.com/">Yahoo</a></p>
+
+ <a style="display: none" href="http://www.example.com/outsidep">This a is not inside a p</a>
+
+ <p>This link has <code>class="blog"</code>: <a href="http://simon.incutio.com/" class="blog">Simon Willison's Weblog</a></p>
+ <p>This <span><a href="http://www.example.com/insidespan">link</a></span> is inside a span, not directly child of p</p>
+ <p lang="en-us">Nonninn</p>
+ <p lang="is-IS">Sniðugt</p>
+ <p>
+ <input type="button" name="enabled" value="enabled" id="enabled">
+ <input type="button" name="disabled" value="disabled" id="disabled" disabled="1" />
+ <input type="checkbox" name="checked" value="checked" id="checked" checked="1" />
+ </p>
+ </div>
+
+ <div id="sequence">
+ <a href="http://www.example.com/link1">Link 1</a>
+ <a href="http://www.example.com/link2">Link 2</a>
+ <a href="http://www.example.com/link3">Link 3</a>
+ <a href="http://www.example.com/link4">Link 4</a>
+ <p>Something else</p>
+ <a href="http://www.example.com/link5">Link 5</a>
+ <a href="http://www.example.com/link6">Link 6</a>
+ <a href="http://www.example.com/link7">Link 7</a>
+ <a href="http://www.example.com/link8">Link 8</a>
+ </div>
+
+ <div id="multiclass" class="multiple classnames here"></div>
+<pre id="test">
+<script type="text/javascript">
+try {
+
+ var testExpected = function (res, exp, lbl) {
+ for (var i=0; i < res.length; i ++) {
+ is( res[i].href, exp[i], lbl + ' (' + i + ')');
+ }
+ };
+
+ var expected = ['http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector',
+ 'http://www.google.com/',
+ 'http://groups.google.com/',
+ 'http://diveintomark.org/',
+ 'http://www.yahoo.com/',
+ 'http://www.example.com/outsidep',
+ 'http://simon.incutio.com/',
+ 'http://www.example.com/insidespan',
+ 'http://www.example.com/link1',
+ 'http://www.example.com/link2',
+ 'http://www.example.com/link3',
+ 'http://www.example.com/link4',
+ 'http://www.example.com/link5',
+ 'http://www.example.com/link6',
+ 'http://www.example.com/link7',
+ 'http://www.example.com/link8'];
+ var results = $$('a');
+ testExpected(results, expected, "'a' selector");
+
+ expected = ['http://diveintomark.org/', 'http://simon.incutio.com/'];
+ results = $$('p a.blog');
+ testExpected(results, expected, "'p a.blog' selector");
+
+ expected = ['http://www.yahoo.com/',
+ 'http://www.example.com/outsidep',
+ 'http://simon.incutio.com/',
+ 'http://www.example.com/insidespan',
+ 'http://www.example.com/link1',
+ 'http://www.example.com/link2',
+ 'http://www.example.com/link3',
+ 'http://www.example.com/link4',
+ 'http://www.example.com/link5',
+ 'http://www.example.com/link6',
+ 'http://www.example.com/link7',
+ 'http://www.example.com/link8'];
+ results = $$('div a');
+ testExpected(results, expected, "'div a' selector");
+
+ expected = ['http://www.yahoo.com/',
+ 'http://www.example.com/outsidep',
+ 'http://simon.incutio.com/',
+ 'http://www.example.com/insidespan'];
+ results = $$('div#foo a');
+ testExpected(results, expected, "'div#foo a' selector");
+
+ expected = ['http://simon.incutio.com/',
+ 'http://www.example.com/insidespan'];
+ results = $$('#foo a.blog');
+ testExpected(results, expected, "'#foo a.blog' selector");
+
+ expected = ['http://diveintomark.org/',
+ 'http://simon.incutio.com/',
+ 'http://www.example.com/insidespan'];
+ results = $$('.blog');
+ testExpected(results, expected, "'.blog' selector");
+
+ expected = ['http://www.google.com/',
+ 'http://www.yahoo.com/',
+ 'http://www.example.com/outsidep',
+ 'http://www.example.com/insidespan',
+ 'http://www.example.com/link1',
+ 'http://www.example.com/link2',
+ 'http://www.example.com/link3',
+ 'http://www.example.com/link4',
+ 'http://www.example.com/link5',
+ 'http://www.example.com/link6',
+ 'http://www.example.com/link7',
+ 'http://www.example.com/link8'];
+ results = $$('a[href^="http://www"]');
+ testExpected(results, expected, "'a[href^=http://www]' selector");
+
+ expected = ['http://diveintomark.org/'];
+ results = $$('a[href$="org/"]');
+ testExpected(results, expected, "'a[href$=org/]' selector");
+
+ expected = ['http://www.google.com/',
+ 'http://groups.google.com/'];
+ results = $$('a[href*="google"]');
+ testExpected(results, expected, "'a[href*=google]' selector");
+
+ expected = ['http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector'];
+ results = $$('a[rel="bookmark"]');
+ testExpected(results, expected, "'a[rel=bookmark]' selector");
+
+ expected = ['http://diveintomark.org/'];
+ results = $$('a[fakeattribute]');
+ testExpected(results, expected, "'a[fakeattribute]' selector");
+
+ /* This doesn't work in IE due to silly DOM implementation
+ expected = ['http://www.google.com/'];
+ results = $$('a[title]');
+ testExpected(results, expected, "'a[title]' selector");
+ */
+
+ results = $$('p[lang|="en"]');
+ is( results[0].firstChild.nodeValue, 'Nonninn', "'p[lang|=en]' selector");
+
+ expected = ['http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector',
+ 'http://www.google.com/',
+ 'http://groups.google.com/',
+ 'http://diveintomark.org/',
+ 'http://www.yahoo.com/',
+ 'http://simon.incutio.com/',
+ 'http://www.example.com/insidespan'];
+ results = $$('p > a');
+ testExpected(results, expected, "'p > a' selector");
+
+ expected = ['http://www.example.com/insidespan'];
+ results = $$('span > a');
+ testExpected(results, expected, "'span > a' selector");
+
+ expected = ['http://groups.google.com/',
+ 'http://www.example.com/link2',
+ 'http://www.example.com/link3',
+ 'http://www.example.com/link4',
+ 'http://www.example.com/link6',
+ 'http://www.example.com/link7',
+ 'http://www.example.com/link8'];
+ results = $$('a + a');
+ testExpected(results, expected, "'a + a' selector");
+
+ expected = ['http://www.example.com/link1',
+ 'http://www.example.com/link3',
+ 'http://www.example.com/link6',
+ 'http://www.example.com/link8'];
+ results = $$('#sequence a:nth-child(odd)');
+ testExpected(results, expected, "'#sequence a:nth-child(odd)' selector");
+
+ expected = ['http://www.example.com/link1',
+ 'http://www.example.com/link3',
+ 'http://www.example.com/link5',
+ 'http://www.example.com/link7'];
+ results = $$('#sequence a:nth-of-type(odd)');
+ testExpected(results, expected, "'#sequence a:nth-of-type(odd)' selector");
+
+ expected = ['http://www.example.com/link1',
+ 'http://www.example.com/link4',
+ 'http://www.example.com/link7'];
+ results = $$('#sequence a:nth-of-type(3n+1)');
+ testExpected(results, expected, "'#sequence a:nth-of-type(3n+1)' selector");
+
+ expected = ['http://www.example.com/link5'];
+ results = $$('#sequence a:nth-child(6)');
+ testExpected(results, expected, "'#sequence a:nth-child(6)' selector");
+
+ expected = ['http://www.example.com/link5'];
+ results = $$('#sequence a:nth-of-type(5)');
+ testExpected(results, expected, "'#sequence a:nth-of-type(5)' selector");
+
+ expected = [$('enabled'), $('checked')];
+ results = $$('body :enabled');
+ for (var i=0; i < results.length; i ++) {
+ is( results[i], expected[i], "'body :enabled" + ' (' + i + ')');
+ }
+
+ expected = [$('disabled')];
+ results = $$('body :disabled');
+ for (var i=0; i < results.length; i ++) {
+ is( results[i], expected[i], "'body :disabled" + ' (' + i + ')');
+ }
+
+ expected = [$('checked')];
+ results = $$('body :checked');
+ for (var i=0; i < results.length; i ++) {
+ is( results[i], expected[i], "'body :checked" + ' (' + i + ')');
+ }
+
+ expected = document.getElementsByTagName('p');
+ results = $$('a[href$=outsidep] ~ *');
+ for (var i=0; i < results.length; i ++) {
+ is( results[i], expected[i+4], "'a[href$=outsidep] ~ *' selector" + ' (' + i + ')');
+ }
+
+ expected = [document.documentElement];
+ results = $$(':root');
+ for (var i=0; i < results.length; i ++) {
+ is( results[i], expected[i], "':root' selector" + ' (' + i + ')');
+ }
+
+ expected = [$('multiclass')];
+ results = $$('[class~=classnames]');
+ for (var i=0; i < results.length; i ++) {
+ is( results[i], expected[i], "'~=' attribute test" + ' (' + i + ')');
+ }
+
+ var doc = MochiKit.MockDOM.createDocument();
+ appendChildNodes(doc.body, A({"href": "http://www.example.com/insideAnotherDocument"}, "Inside a document"));
+ withDocument(doc, function(){
+ is( $$(":root")[0], doc, ":root on a different document" );
+ is( $$("a")[0], doc.body.firstChild, "a inside a different document" );
+ });
+
+ ok( true, "test suite finished!");
+
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Signal.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Signal.html
new file mode 100644
index 0000000000..9c37416d68
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Signal.html
@@ -0,0 +1,43 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="../MochiKit/Signal.js"></script>
+ <script type="text/javascript" src="../MochiKit/Logging.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+
+</head>
+<body>
+
+Please ignore this button: <input type="submit" id="submit" /><br />
+
+<pre id="test">
+<script type="text/javascript" src="test_Signal.js"></script>
+<script type="text/javascript">
+try {
+
+ tests.test_Signal({ok:ok, is:is});
+ ok(true, "test suite finished!");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok(false, s);
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Style.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Style.html
new file mode 100644
index 0000000000..b01adc6e7e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Style.html
@@ -0,0 +1,141 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/MockDOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="../MochiKit/Color.js"></script>
+ <script type="text/javascript" src="../MochiKit/Logging.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+</head>
+<body style="border: 0; margin: 0; padding: 0;">
+
+<div id="styleTest" style="position: absolute; left: 400px; top: 100px; width: 100px; height: 100px; background: rgb(255, 0, 0); opacity: 0.5; filter: alpha(opacity=50); font-size: 10px">TEST<span id="styleSubTest">SUB</span></div>
+
+<pre id="test">
+<script type="text/javascript">
+
+try {
+
+ // initial
+ var pos = getElementPosition('styleTest');
+ is(pos.x, 400, 'initial x position');
+ is(pos.y, 100, 'initial y position');
+
+ // moved
+ var newPos = new MochiKit.Style.Coordinates(500, 200);
+ setElementPosition('styleTest', newPos);
+ pos = getElementPosition('styleTest');
+ is(pos.x, 500, 'updated x position');
+ is(pos.y, 200, 'updated y position');
+
+ // moved with relativeTo
+ anotherPos = new MochiKit.Style.Coordinates(100, 100);
+ pos = getElementPosition('styleTest', anotherPos);
+ is(pos.x, 400, 'updated x position (using relativeTo parameter)');
+ is(pos.y, 100, 'updated y position (using relativeTo parameter)');
+
+ // Coordinates object
+ pos = getElementPosition({x: 123, y: 321});
+ is(pos.x, 123, 'passthrough x position');
+ is(pos.y, 321, 'passthrough y position');
+
+ // Coordinates object with relativeTo
+ pos = getElementPosition({x: 123, y: 321}, {x: 100, y: 50});
+ is(pos.x, 23, 'passthrough x position (using relativeTo parameter)');
+ is(pos.y, 271, 'passthrough y position (using relativeTo parameter)');
+
+ pos = getElementPosition('garbage');
+ is(typeof(pos), 'undefined',
+ 'invalid element should return an undefined position');
+
+ // Only set one coordinate
+ setElementPosition('styleTest', {'x': 300});
+ pos = getElementPosition('styleTest');
+ is(pos.x, 300, 'updated only x position');
+ is(pos.y, 200, 'not updated y position');
+
+ var mc = MochiKit.Color.Color;
+ var red = mc.fromString('rgb(255,0,0)');
+ var color = null;
+
+ color = mc.fromString(getStyle('styleTest', 'background-color'));
+ is(color.toHexString(), red.toHexString(),
+ 'test getStyle selector case');
+
+ color = mc.fromString(getStyle('styleTest', 'backgroundColor'));
+ is(color.toHexString(), red.toHexString(),
+ 'test getStyle camel case');
+
+ is(getStyle('styleSubTest', 'font-size'), '10px',
+ 'test computed getStyle selector case');
+
+ is(getStyle('styleSubTest', 'fontSize'), '10px',
+ 'test computed getStyle camel case');
+
+ is(eval(getStyle('styleTest', 'opacity')), 0.5,
+ 'test getStyle opacity');
+
+ is(getStyle('styleTest', 'opacity'), 0.5, 'test getOpacity');
+
+ setStyle('styleTest', {'opacity': 0.2});
+ is(getStyle('styleTest', 'opacity'), 0.2, 'test setOpacity');
+
+ setStyle('styleTest', {'opacity': 0});
+ is(getStyle('styleTest', 'opacity'), 0, 'test setOpacity');
+
+ setStyle('styleTest', {'opacity': 1});
+ var t = getStyle('styleTest', 'opacity');
+ ok(t > 0.999 && t <= 1, 'test setOpacity');
+
+ var dims = getElementDimensions('styleTest');
+ is(dims.w, 100, 'getElementDimensions w ok');
+ is(dims.h, 100, 'getElementDimensions h ok');
+
+ setElementDimensions('styleTest', {'w': 200, 'h': 150});
+ dims = getElementDimensions('styleTest');
+ is(dims.w, 200, 'setElementDimensions w ok');
+ is(dims.h, 150, 'setElementDimensions h ok');
+
+ setElementDimensions('styleTest', {'w': 150});
+ dims = getElementDimensions('styleTest');
+ is(dims.w, 150, 'setElementDimensions only w ok');
+ is(dims.h, 150, 'setElementDimensions h not updated ok');
+
+ hideElement('styleTest');
+ dims = getElementDimensions('styleTest');
+ is(dims.w, 150, 'getElementDimensions w ok when display none');
+ is(dims.h, 150, 'getElementDimensions h ok when display none');
+
+ dims = getViewportDimensions();
+ is(dims.w > 0, true, 'test getViewportDimensions w');
+ is(dims.h > 0, true, 'test getViewportDimensions h');
+
+ pos = getViewportPosition();
+ is(pos.x, 0, 'test getViewportPosition x');
+ is(pos.y, 0, 'test getViewportPosition y');
+
+ ok( true, "test suite finished!");
+
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Visual.html b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Visual.html
new file mode 100644
index 0000000000..e4a40c7e48
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/MochiKit-Visual.html
@@ -0,0 +1,190 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/Base.js"></script>
+ <script type="text/javascript" src="../MochiKit/Iter.js"></script>
+ <script type="text/javascript" src="../MochiKit/DOM.js"></script>
+ <script type="text/javascript" src="../MochiKit/Async.js"></script>
+ <script type="text/javascript" src="../MochiKit/Style.js"></script>
+ <script type="text/javascript" src="../MochiKit/Color.js"></script>
+ <script type="text/javascript" src="../MochiKit/Signal.js"></script>
+ <script type="text/javascript" src="../MochiKit/Position.js"></script>
+ <script type="text/javascript" src="../MochiKit/Visual.js"></script>
+ <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script>
+
+ <link rel="stylesheet" type="text/css" href="SimpleTest/test.css">
+ <style type="text/css">
+ #elt1, #elt2, #ctn1 {
+ visibility: hidden;
+ font-size: 1em;
+ margin: 2px;
+ }
+ #elt3 {
+ display: none;
+ }
+ #ctn1 {
+ height: 2px;
+ }
+ </style>
+</head>
+<body>
+
+<div id='elt1'>elt1</div>
+<div id='ctn1'><div id='elt2'></div></div>
+<div id='elt3'>elt3</div>
+<pre id="test">
+<script type="text/javascript">
+try {
+ var TestQueue = function () {
+ };
+
+ TestQueue.prototype = new MochiKit.Visual.ScopedQueue();
+
+ MochiKit.Base.update(TestQueue.prototype, {
+ startLoop: function (func, interval) {
+ this.started = true;
+ var timePos = new Date().getTime();
+ while (this.started) {
+ timePos += interval;
+ MochiKit.Base.map(function (effect) {
+ effect.loop(timePos);
+ }, this.effects);
+ }
+ },
+ stopLoop: function () {
+ this.started = false;
+ }
+ });
+
+ var gl = new TestQueue();
+ MochiKit.Visual.Queues.instances['global'] = gl;
+ MochiKit.Visual.Queues.instances['elt1'] = gl;
+ MochiKit.Visual.Queues.instances['elt2'] = gl;
+ MochiKit.Visual.Queues.instances['elt3'] = gl;
+ MochiKit.Visual.Queues.instances['ctn1'] = gl;
+ MochiKit.Visual.Queue = gl;
+
+ pulsate("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display != 'none', true, "pulsate ok");
+ }});
+
+ pulsate("elt1", {pulses: 2, afterFinish: function () {
+ is(getElement('elt1').style.display != 'none', true, "pulsate with numbered pulses ok");
+ }});
+
+ shake("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display != 'none', true, "shake ok");
+ }});
+
+ fade("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "fade ok");
+ }});
+
+ appear("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display != 'none', true, "appear ok");
+ }});
+
+ toggle("elt1", "size", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "toggle size ok");
+ }});
+
+ toggle("elt1", "size", {afterFinish: function () {
+ is(getElement('elt1').style.display != 'none', true, "toggle size reverse ok");
+ }});
+
+ Morph("elt1", {"style": {"font-size": "2em"}, afterFinish: function () {
+ is(getStyle("elt1", "font-size"), "2em", "Morph OK");
+ }});
+
+ Morph("elt1", {"style": {"font-size": "1em", "margin-left": "4px"}, afterFinish: function () {
+ is(getStyle("elt1", "font-size"), "1em", "Morph multiple (font) OK");
+ is(getStyle("elt1", "margin-left"), "4px", "Morph multiple (margin) OK");
+ }});
+
+ switchOff("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "switchOff ok");
+ }});
+
+ grow("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display != 'none', true, "grow ok");
+ }});
+
+ shrink("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "shrink ok");
+ }});
+
+ showElement('elt1');
+ dropOut("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "dropOut ok");
+ }});
+
+ showElement('elt1');
+ puff("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "puff ok");
+ }});
+
+ showElement('elt1');
+ fold("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "fold ok");
+ }});
+
+ showElement('elt1');
+ squish("elt1", {afterFinish: function () {
+ is(getElement('elt1').style.display, 'none', "squish ok");
+ }});
+
+ slideUp("ctn1", {afterFinish: function () {
+ is(getElement('ctn1').style.display, 'none', "slideUp ok");
+ }});
+
+ slideDown("ctn1", {afterFinish: function () {
+ is(getElement('ctn1').style.display != 'none', true, "slideDown ok");
+ }});
+
+ blindDown("ctn1", {afterFinish: function () {
+ is(getElement('ctn1').style.display != 'none', true, "blindDown ok");
+ }});
+
+ blindUp("ctn1", {afterFinish: function () {
+ is(getElement('ctn1').style.display, 'none', "blindUp ok");
+ }});
+
+ multiple(["elt1", "ctn1"], appear, {afterFinish: function (effect) {
+ is(effect.element.style.display != 'none', true, "multiple ok");
+ }});
+
+ toggle("elt3", "size", {afterFinish: function () {
+ is(getElement('elt3').style.display != 'none', true, "toggle with css ok");
+ }});
+
+ toggle("elt3", "size", {afterFinish: function () {
+ is(getElement('elt3').style.display, 'none', "toggle with css ok");
+ }});
+
+ var toTests = [roundElement, roundClass, tagifyText, Opacity, Move, Scale, Highlight, ScrollTo, Morph];
+ for (var m in toTests) {
+ toTests[m]("elt1");
+ ok(true, toTests[m].NAME + " doesn't need 'new' keyword");
+ }
+ ok(true, "visual suite finished");
+
+} catch (err) {
+
+ var s = "test suite failure!\n";
+ var o = {};
+ var k = null;
+ for (k in err) {
+ // ensure unique keys?!
+ if (!o[k]) {
+ s += k + ": " + err[k] + "\n";
+ o[k] = err[k];
+ }
+ }
+ ok ( false, s );
+ SimpleTest.finish();
+
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/SimpleTest.js b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/SimpleTest.js
new file mode 100644
index 0000000000..53c2a87939
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/SimpleTest.js
@@ -0,0 +1,473 @@
+/**
+ * SimpleTest, a partial Test.Simple/Test.More API compatible test library.
+ *
+ * Why?
+ *
+ * Test.Simple doesn't work on IE < 6.
+ * TODO:
+ * * Support the Test.Simple API used by MochiKit, to be able to test MochiKit
+ * itself against IE 5.5
+ *
+**/
+
+if (typeof(SimpleTest) == "undefined") {
+ var SimpleTest = {};
+}
+
+var parentRunner = null;
+if (typeof(parent) != "undefined" && parent.TestRunner) {
+ parentRunner = parent.TestRunner;
+} else if (parent && parent.wrappedJSObject &&
+ parent.wrappedJSObject.TestRunner) {
+ parentRunner = parent.wrappedJSObject.TestRunner;
+}
+
+// Check to see if the TestRunner is present and has logging
+if (parentRunner) {
+ SimpleTest._logEnabled = parentRunner.logEnabled;
+}
+
+SimpleTest._tests = [];
+SimpleTest._stopOnLoad = true;
+
+/**
+ * Something like assert.
+**/
+SimpleTest.ok = function (condition, name) {
+ if (arguments.length > 2) {
+ const diag = "Too many arguments passed to `ok(condition, name)`";
+ SimpleTest.record(false, name, diag);
+ } else {
+ SimpleTest.record(condition, name);
+ }
+}
+
+SimpleTest.record = function (condition, name, diag) {
+ var test = {'result': !!condition, 'name': name, 'diag': diag || ""};
+ if (SimpleTest._logEnabled)
+ SimpleTest._logResult(test, "TEST-PASS", "TEST-UNEXPECTED-FAIL");
+ SimpleTest._tests.push(test);
+};
+
+/**
+ * Roughly equivalent to ok(a==b, name)
+**/
+SimpleTest.is = function (a, b, name) {
+ var repr = MochiKit.Base.repr;
+ SimpleTest.record(a == b, name, "got " + repr(a) + ", expected " + repr(b));
+};
+
+SimpleTest.isnot = function (a, b, name) {
+ var repr = MochiKit.Base.repr;
+ SimpleTest.record(a != b, name, "Didn't expect " + repr(a) + ", but got it.");
+};
+
+// --------------- Test.Builder/Test.More todo() -----------------
+
+SimpleTest.todo = function(condition, name, diag) {
+ var test = {'result': !!condition, 'name': name, 'diag': diag || "", todo: true};
+ if (SimpleTest._logEnabled)
+ SimpleTest._logResult(test, "TEST-UNEXPECTED-PASS", "TEST-KNOWN-FAIL");
+ SimpleTest._tests.push(test);
+};
+
+SimpleTest._logResult = function(test, passString, failString) {
+ var msg = test.result ? passString : failString;
+ msg += " | ";
+ if (parentRunner.currentTestURL)
+ msg += parentRunner.currentTestURL;
+ msg += " | " + test.name;
+ var diag = "";
+ if (test.diag)
+ diag = " - " + test.diag;
+ if (test.result) {
+ if (test.todo)
+ parentRunner.logger.error(msg + diag);
+ else
+ parentRunner.logger.log(msg);
+ } else {
+ if (test.todo)
+ parentRunner.logger.log(msg);
+ else
+ parentRunner.logger.error(msg + diag);
+ }
+};
+
+/**
+ * Copies of is and isnot with the call to ok replaced by a call to todo.
+**/
+
+SimpleTest.todo_is = function (a, b, name) {
+ var repr = MochiKit.Base.repr;
+ SimpleTest.todo(a == b, name, "got " + repr(a) + ", expected " + repr(b));
+};
+
+SimpleTest.todo_isnot = function (a, b, name) {
+ var repr = MochiKit.Base.repr;
+ SimpleTest.todo(a != b, name, "Didn't expect " + repr(a) + ", but got it.");
+};
+
+
+/**
+ * Makes a test report, returns it as a DIV element.
+**/
+SimpleTest.report = function () {
+ var DIV = MochiKit.DOM.DIV;
+ var passed = 0;
+ var failed = 0;
+ var todo = 0;
+ var results = MochiKit.Base.map(
+ function (test) {
+ var cls, msg;
+ if (test.todo && !test.result) {
+ todo++;
+ cls = "test_todo";
+ msg = "todo - " + test.name + " " + test.diag;
+ } else if (test.result &&!test.todo) {
+ passed++;
+ cls = "test_ok";
+ msg = "ok - " + test.name;
+ } else {
+ failed++;
+ cls = "test_not_ok";
+ msg = "not ok - " + test.name + " " + test.diag;
+ }
+ return DIV({"class": cls}, msg);
+ },
+ SimpleTest._tests
+ );
+ var summary_class = ((failed == 0) ? 'all_pass' : 'some_fail');
+ return DIV({'class': 'tests_report'},
+ DIV({'class': 'tests_summary ' + summary_class},
+ DIV({'class': 'tests_passed'}, "Passed: " + passed),
+ DIV({'class': 'tests_failed'}, "Failed: " + failed),
+ DIV({'class': 'tests_todo'}, "Todo: " + todo)),
+ results
+ );
+};
+
+/**
+ * Toggle element visibility
+**/
+SimpleTest.toggle = function(el) {
+ if (MochiKit.Style.computedStyle(el, 'display') == 'block') {
+ el.style.display = 'none';
+ } else {
+ el.style.display = 'block';
+ }
+};
+
+/**
+ * Toggle visibility for divs with a specific class.
+**/
+SimpleTest.toggleByClass = function (cls, evt) {
+ var elems = getElementsByTagAndClassName('div', cls);
+ MochiKit.Base.map(SimpleTest.toggle, elems);
+ if (evt)
+ evt.preventDefault();
+};
+
+/**
+ * Shows the report in the browser
+**/
+
+SimpleTest.showReport = function() {
+ var togglePassed = A({'href': '#'}, "Toggle passed tests");
+ var toggleFailed = A({'href': '#'}, "Toggle failed tests");
+ togglePassed.onclick = partial(SimpleTest.toggleByClass, 'test_ok');
+ toggleFailed.onclick = partial(SimpleTest.toggleByClass, 'test_not_ok');
+ var body = document.body; // Handles HTML documents
+ if (!body) {
+ // Do the XML thing
+ body = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml",
+ "body")[0]
+ }
+ var firstChild = body.childNodes[0];
+ var addNode;
+ if (firstChild) {
+ addNode = function (el) {
+ body.insertBefore(el, firstChild);
+ };
+ } else {
+ addNode = function (el) {
+ body.appendChild(el)
+ };
+ }
+ addNode(togglePassed);
+ addNode(SPAN(null, " "));
+ addNode(toggleFailed);
+ addNode(SimpleTest.report());
+};
+
+/**
+ * Tells SimpleTest to don't finish the test when the document is loaded,
+ * useful for asynchronous tests.
+ *
+ * When SimpleTest.waitForExplicitFinish is called,
+ * explicit SimpleTest.finish() is required.
+**/
+SimpleTest.waitForExplicitFinish = function () {
+ SimpleTest._stopOnLoad = false;
+};
+
+/**
+ * Talks to the TestRunner if being ran on a iframe and the parent has a
+ * TestRunner object.
+**/
+SimpleTest.talkToRunner = function () {
+ if (parentRunner) {
+ parentRunner.testFinished(document);
+ }
+};
+
+/**
+ * Finishes the tests. This is automatically called, except when
+ * SimpleTest.waitForExplicitFinish() has been invoked.
+**/
+SimpleTest.finish = function () {
+ SimpleTest.showReport();
+ SimpleTest.talkToRunner();
+};
+
+
+addLoadEvent(function() {
+ if (SimpleTest._stopOnLoad) {
+ SimpleTest.finish();
+ }
+});
+
+// --------------- Test.Builder/Test.More isDeeply() -----------------
+
+
+SimpleTest.DNE = {dne: 'Does not exist'};
+SimpleTest.LF = "\r\n";
+SimpleTest._isRef = function (object) {
+ var type = typeof(object);
+ return type == 'object' || type == 'function';
+};
+
+
+SimpleTest._deepCheck = function (e1, e2, stack, seen) {
+ var ok = false;
+ // Either they're both references or both not.
+ var sameRef = !(!SimpleTest._isRef(e1) ^ !SimpleTest._isRef(e2));
+ if (e1 == null && e2 == null) {
+ ok = true;
+ } else if (e1 != null ^ e2 != null) {
+ ok = false;
+ } else if (e1 == SimpleTest.DNE ^ e2 == SimpleTest.DNE) {
+ ok = false;
+ } else if (sameRef && e1 == e2) {
+ // Handles primitives and any variables that reference the same
+ // object, including functions.
+ ok = true;
+ } else if (SimpleTest.isa(e1, 'Array') && SimpleTest.isa(e2, 'Array')) {
+ ok = SimpleTest._eqArray(e1, e2, stack, seen);
+ } else if (typeof e1 == "object" && typeof e2 == "object") {
+ ok = SimpleTest._eqAssoc(e1, e2, stack, seen);
+ } else {
+ // If we get here, they're not the same (function references must
+ // always simply rererence the same function).
+ stack.push({ vals: [e1, e2] });
+ ok = false;
+ }
+ return ok;
+};
+
+SimpleTest._eqArray = function (a1, a2, stack, seen) {
+ // Return if they're the same object.
+ if (a1 == a2) return true;
+
+ // JavaScript objects have no unique identifiers, so we have to store
+ // references to them all in an array, and then compare the references
+ // directly. It's slow, but probably won't be much of an issue in
+ // practice. Start by making a local copy of the array to as to avoid
+ // confusing a reference seen more than once (such as [a, a]) for a
+ // circular reference.
+ for (var j = 0; j < seen.length; j++) {
+ if (seen[j][0] == a1) {
+ return seen[j][1] == a2;
+ }
+ }
+
+ // If we get here, we haven't seen a1 before, so store it with reference
+ // to a2.
+ seen.push([ a1, a2 ]);
+
+ var ok = true;
+ // Only examines enumerable attributes. Only works for numeric arrays!
+ // Associative arrays return 0. So call _eqAssoc() for them, instead.
+ var max = a1.length > a2.length ? a1.length : a2.length;
+ if (max == 0) return SimpleTest._eqAssoc(a1, a2, stack, seen);
+ for (var i = 0; i < max; i++) {
+ var e1 = i > a1.length - 1 ? SimpleTest.DNE : a1[i];
+ var e2 = i > a2.length - 1 ? SimpleTest.DNE : a2[i];
+ stack.push({ type: 'Array', idx: i, vals: [e1, e2] });
+ if (ok = SimpleTest._deepCheck(e1, e2, stack, seen)) {
+ stack.pop();
+ } else {
+ break;
+ }
+ }
+ return ok;
+};
+
+SimpleTest._eqAssoc = function (o1, o2, stack, seen) {
+ // Return if they're the same object.
+ if (o1 == o2) return true;
+
+ // JavaScript objects have no unique identifiers, so we have to store
+ // references to them all in an array, and then compare the references
+ // directly. It's slow, but probably won't be much of an issue in
+ // practice. Start by making a local copy of the array to as to avoid
+ // confusing a reference seen more than once (such as [a, a]) for a
+ // circular reference.
+ seen = seen.slice(0);
+ for (var j = 0; j < seen.length; j++) {
+ if (seen[j][0] == o1) {
+ return seen[j][1] == o2;
+ }
+ }
+
+ // If we get here, we haven't seen o1 before, so store it with reference
+ // to o2.
+ seen.push([ o1, o2 ]);
+
+ // They should be of the same class.
+
+ var ok = true;
+ // Only examines enumerable attributes.
+ var o1Size = 0; for (var i in o1) o1Size++;
+ var o2Size = 0; for (var i in o2) o2Size++;
+ var bigger = o1Size > o2Size ? o1 : o2;
+ for (var i in bigger) {
+ var e1 = o1[i] == undefined ? SimpleTest.DNE : o1[i];
+ var e2 = o2[i] == undefined ? SimpleTest.DNE : o2[i];
+ stack.push({ type: 'Object', idx: i, vals: [e1, e2] });
+ if (ok = SimpleTest._deepCheck(e1, e2, stack, seen)) {
+ stack.pop();
+ } else {
+ break;
+ }
+ }
+ return ok;
+};
+
+SimpleTest._formatStack = function (stack) {
+ var variable = '$Foo';
+ for (var i = 0; i < stack.length; i++) {
+ var entry = stack[i];
+ var type = entry['type'];
+ var idx = entry['idx'];
+ if (idx != null) {
+ if (/^\d+$/.test(idx)) {
+ // Numeric array index.
+ variable += '[' + idx + ']';
+ } else {
+ // Associative array index.
+ idx = idx.replace("'", "\\'");
+ variable += "['" + idx + "']";
+ }
+ }
+ }
+
+ var vals = stack[stack.length-1]['vals'].slice(0, 2);
+ var vars = [
+ variable.replace('$Foo', 'got'),
+ variable.replace('$Foo', 'expected')
+ ];
+
+ var out = "Structures begin differing at:" + SimpleTest.LF;
+ for (var i = 0; i < vals.length; i++) {
+ var val = vals[i];
+ if (val == null) {
+ val = 'undefined';
+ } else {
+ val == SimpleTest.DNE ? "Does not exist" : "'" + val + "'";
+ }
+ }
+
+ out += vars[0] + ' = ' + vals[0] + SimpleTest.LF;
+ out += vars[1] + ' = ' + vals[1] + SimpleTest.LF;
+
+ return ' ' + out;
+};
+
+
+SimpleTest.isDeeply = function (it, as, name) {
+ var ok;
+ // ^ is the XOR operator.
+ if (SimpleTest._isRef(it) ^ SimpleTest._isRef(as)) {
+ // One's a reference, one isn't.
+ ok = false;
+ } else if (!SimpleTest._isRef(it) && !SimpleTest._isRef(as)) {
+ // Neither is an object.
+ ok = SimpleTest.is(it, as, name);
+ } else {
+ // We have two objects. Do a deep comparison.
+ var stack = [], seen = [];
+ if ( SimpleTest._deepCheck(it, as, stack, seen)) {
+ ok = SimpleTest.ok(true, name);
+ } else {
+ ok = SimpleTest.ok(false, name, SimpleTest._formatStack(stack));
+ }
+ }
+ return ok;
+};
+
+SimpleTest.typeOf = function (object) {
+ var c = Object.prototype.toString.apply(object);
+ var name = c.substring(8, c.length - 1);
+ if (name != 'Object') return name;
+ // It may be a non-core class. Try to extract the class name from
+ // the constructor function. This may not work in all implementations.
+ if (/function ([^(\s]+)/.test(Function.toString.call(object.constructor))) {
+ return RegExp.$1;
+ }
+ // No idea. :-(
+ return name;
+};
+
+SimpleTest.isa = function (object, clas) {
+ return SimpleTest.typeOf(object) == clas;
+};
+
+if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
+ var oldRecord = SimpleTest.record;
+
+ SimpleTest.record = function(condition, name, diag, stack) {
+ parent.SimpleTest.record( condition, name, diag, stack );
+ return oldRecord( condition, name, diag, stack );
+ };
+
+ var oldFinish = SimpleTest.finish;
+
+ SimpleTest.finish = function() {
+ oldFinish();
+ parent.runAJAXTest();
+ };
+})();
+
+// Global symbols:
+var ok = SimpleTest.ok;
+var record = SimpleTest.record;
+var is = SimpleTest.is;
+var isnot = SimpleTest.isnot;
+var todo = SimpleTest.todo;
+var todo_is = SimpleTest.todo_is;
+var todo_isnot = SimpleTest.todo_isnot;
+var isDeeply = SimpleTest.isDeeply;
+var oldOnError = window.onerror;
+window.onerror = function (ev) {
+ is(0, 1, "Error thrown during test: " + ev);
+ if (oldOnError) {
+ try {
+ oldOnError(ev);
+ } catch (e) {
+ }
+ }
+ if (SimpleTest._stopOnLoad == false) {
+ // Need to finish() manually here
+ SimpleTest.finish();
+ }
+}
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/TestRunner.js b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/TestRunner.js
new file mode 100644
index 0000000000..a4e3130759
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/TestRunner.js
@@ -0,0 +1,177 @@
+/**
+ * TestRunner: A test runner for SimpleTest
+ * TODO:
+ *
+ * * Avoid moving iframes: That causes reloads on mozilla and opera.
+ *
+ *
+**/
+var TestRunner = {};
+TestRunner.logEnabled = false;
+TestRunner._iframes = {};
+TestRunner._iframeDocuments = {};
+TestRunner._iframeRows = {};
+TestRunner._currentTest = 0;
+TestRunner._urls = [];
+TestRunner._testsDiv = DIV();
+TestRunner._progressDiv = DIV();
+TestRunner._summaryDiv = DIV(null,
+ H1(null, "Tests Summary"),
+ TABLE(null,
+ THEAD(null,
+ TR(null,
+ TH(null, "Test"),
+ TH(null, "Passed"),
+ TH(null, "Failed")
+ )
+ ),
+ TBODY()
+ )
+);
+
+/**
+ * This function is called after generating the summary.
+**/
+TestRunner.onComplete = null;
+
+/**
+ * If logEnabled is true, this is the logger that will be used.
+**/
+TestRunner.logger = MochiKit.Logging.logger;
+
+/**
+ * Toggle element visibility
+**/
+TestRunner._toggle = function(el) {
+ if (el.className == "noshow") {
+ el.className = "";
+ el.style.cssText = "";
+ } else {
+ el.className = "noshow";
+ el.style.cssText = "width:0px; height:0px; border:0px;";
+ }
+};
+
+
+/**
+ * Creates the iframe that contains a test
+**/
+TestRunner._makeIframe = function (url) {
+ var iframe = document.createElement('iframe');
+ iframe.src = url;
+ iframe.name = url;
+ iframe.width = "500";
+ var tbody = TestRunner._summaryDiv.getElementsByTagName("tbody")[0];
+ var tr = TR(null, TD({'colspan': '3'}, iframe));
+ iframe._row = tr;
+ tbody.appendChild(tr);
+ return iframe;
+};
+
+/**
+ * TestRunner entry point.
+ *
+ * The arguments are the URLs of the test to be ran.
+ *
+**/
+TestRunner.runTests = function (/*url...*/) {
+ if (TestRunner.logEnabled)
+ TestRunner.logger.log("SimpleTest START");
+
+ var body = document.getElementsByTagName("body")[0];
+ appendChildNodes(body,
+ TestRunner._testsDiv,
+ TestRunner._progressDiv,
+ TestRunner._summaryDiv
+ );
+ for (var i = 0; i < arguments.length; i++) {
+ TestRunner._urls.push(arguments[i]);
+ }
+ TestRunner.runNextTest();
+};
+
+/**
+ * Run the next test. If no test remains, calls makeSummary
+**/
+TestRunner.runNextTest = function() {
+ if (TestRunner._currentTest < TestRunner._urls.length) {
+ var url = TestRunner._urls[TestRunner._currentTest];
+ var progress = SPAN(null,
+ "Running ", A({href:url}, url), "..."
+ );
+
+ if (TestRunner.logEnabled)
+ TestRunner.logger.log(scrapeText(progress));
+
+ TestRunner._progressDiv.appendChild(progress);
+ TestRunner._iframes[url] = TestRunner._makeIframe(url);
+ } else {
+ TestRunner.makeSummary();
+ if (TestRunner.onComplete)
+ TestRunner.onComplete();
+ }
+};
+
+/**
+ * This stub is called by SimpleTest when a test is finished.
+**/
+TestRunner.testFinished = function (doc) {
+ appendChildNodes(TestRunner._progressDiv, SPAN(null, "Done"), BR());
+ var finishedURL = TestRunner._urls[TestRunner._currentTest];
+
+ if (TestRunner.logEnabled)
+ TestRunner.logger.debug("SimpleTest finished " + finishedURL);
+
+ TestRunner._iframeDocuments[finishedURL] = doc;
+ // TestRunner._iframes[finishedURL].style.display = "none";
+ TestRunner._toggle(TestRunner._iframes[finishedURL]);
+ TestRunner._currentTest++;
+ TestRunner.runNextTest();
+};
+
+/**
+ * Display the summary in the browser
+**/
+TestRunner.makeSummary = function() {
+ if (TestRunner.logEnabled)
+ TestRunner.logger.log("SimpleTest FINISHED");
+ var rows = [];
+ for (var url in TestRunner._iframeDocuments) {
+ var doc = TestRunner._iframeDocuments[url];
+ var nOK = withDocument(doc,
+ partial(getElementsByTagAndClassName, 'div', 'test_ok')
+ ).length;
+ var nNotOK = withDocument(doc,
+ partial(getElementsByTagAndClassName, 'div', 'test_not_ok')
+ ).length;
+ var toggle = partial(TestRunner._toggle, TestRunner._iframes[url]);
+ var jsurl = "TestRunner._toggle(TestRunner._iframes['" + url + "'])";
+ var row = TR(
+ {'style': {'backgroundColor': nNotOK > 0 ? "#f00":"#0f0"}},
+ TD(null, url),
+ TD(null, nOK),
+ TD(null, nNotOK)
+ );
+ row.onclick = toggle;
+ var tbody = TestRunner._summaryDiv.getElementsByTagName("tbody")[0];
+ tbody.insertBefore(row, TestRunner._iframes[url]._row)
+ }
+};
+
+if ( parent.SimpleTest && parent.runAJAXTest ) {
+ TestRunner.makeSummary = function() {
+ for (var url in TestRunner._iframeDocuments) {
+ var doc = TestRunner._iframeDocuments[url];
+
+ var OK = withDocument(doc, partial(getElementsByTagAndClassName, 'div', 'test_ok'));
+ for ( var i = 0; i < OK.length; i++ )
+ parent.SimpleTest.ok( true, OK[i].innerHTML );
+
+ var NotOK = withDocument(doc, partial(getElementsByTagAndClassName, 'div', 'test_not_ok'));
+ for ( var i = 0; i < NotOK.length; i++ )
+ parent.SimpleTest.ok( false, NotOK[i].innerHTML );
+ }
+
+ parent.runAJAXTest();
+ };
+}
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/test.css b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/test.css
new file mode 100644
index 0000000000..38a401402f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/test.css
@@ -0,0 +1,28 @@
+.test_ok {
+ color: green;
+ display: none;
+}
+.test_not_ok {
+ color: red;
+ display: block;
+}
+
+.test_ok, .test_not_ok {
+ border-bottom-width: 2px;
+ border-bottom-style: solid;
+ border-bottom-color: black;
+}
+
+.all_pass {
+ background-color: lime;
+}
+
+.some_fail {
+ background-color: red;
+}
+
+.tests_report {
+ border-width: 2px;
+ border-style: solid;
+ width: 20em;
+}
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/cli.js b/dom/tests/mochitest/ajax/mochikit/tests/cli.js
new file mode 100644
index 0000000000..18434604c8
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/cli.js
@@ -0,0 +1,6 @@
+MochiKit = {__export__: true};
+load('tests/FakeJSAN.js')
+JSAN.use('MochiKit.MockDOM');
+var window = this;
+var document = MochiKit.MockDOM.document;
+JSAN.use('MochiKit.MochiKit');
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/index.html b/dom/tests/mochitest/ajax/mochikit/tests/index.html
new file mode 100644
index 0000000000..da46bd32ce
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/index.html
@@ -0,0 +1,25 @@
+<html>
+<head>
+ <script type="text/javascript" src="../MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" src="SimpleTest/TestRunner.js"></script>
+</head>
+<body>
+<script type="text/javascript">
+TestRunner.runTests(
+ 'MochiKit-Async.html',
+ 'MochiKit-Base.html',
+ 'MochiKit-DateTime.html',
+ 'MochiKit-DOM.html',
+ 'MochiKit-Style.html',
+ 'MochiKit-Format.html',
+ 'MochiKit-Iter.html',
+ 'MochiKit-Logging.html',
+ 'MochiKit-MochiKit.html',
+ 'MochiKit-Color.html',
+ 'MochiKit-Selector.html',
+ 'MochiKit-Signal.html',
+ 'MochiKit-Visual.html'
+);
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/standalone.js b/dom/tests/mochitest/ajax/mochikit/tests/standalone.js
new file mode 100644
index 0000000000..d48571238f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/standalone.js
@@ -0,0 +1,16 @@
+load('tests/cli.js');
+
+JSAN.use('MochiKit.Test');
+
+print("[[ MochiKit.Base ]]");
+runTests('tests.test_Base');
+print("[[ MochiKit.Color ]]");
+runTests('tests.test_Color');
+print("[[ MochiKit.DateTime ]]");
+runTests('tests.test_DateTime');
+print("[[ MochiKit.Format ]]");
+runTests('tests.test_Format');
+print("[[ MochiKit.Iter ]]");
+runTests('tests.test_Iter');
+print("[[ MochiKit.Logging ]]");
+runTests('tests.test_Logging');
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_Base.js b/dom/tests/mochitest/ajax/mochikit/tests/test_Base.js
new file mode 100644
index 0000000000..2cbf2848d1
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_Base.js
@@ -0,0 +1,509 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Base'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Base'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_Base = function (t) {
+ // test bind
+ var not_self = {"toString": function () { return "not self"; } };
+ var self = {"toString": function () { return "self"; } };
+ var func = function (arg) { return this.toString() + " " + arg; };
+ var boundFunc = bind(func, self);
+ not_self.boundFunc = boundFunc;
+
+ t.is( isEmpty([], [], ""), true, "isEmpty true" )
+ t.is( isEmpty([], [1], ""), true, "isEmpty true" )
+ t.is( isNotEmpty([], [], ""), false, "isNotEmpty false" )
+ t.is( isNotEmpty([], [1], ""), false, "isNotEmpty false" )
+
+ t.is( isEmpty([1], [1], "1"), false, "isEmpty false" )
+ t.is( isEmpty([1], [1], "1"), false, "isEmpty false" )
+ t.is( isNotEmpty([1], [1], "1"), true, "isNotEmpty true" )
+ t.is( isNotEmpty([1], [1], "1"), true, "isNotEmpty true" )
+
+ t.is( boundFunc("foo"), "self foo", "boundFunc bound to self properly" );
+ t.is( not_self.boundFunc("foo"), "self foo", "boundFunc bound to self on another obj" );
+ t.is( bind(boundFunc, not_self)("foo"), "not self foo", "boundFunc successfully rebound!" );
+ t.is( bind(boundFunc, undefined, "foo")(), "self foo", "boundFunc partial no self change" );
+ t.is( bind(boundFunc, not_self, "foo")(), "not self foo", "boundFunc partial self change" );
+
+ // test method
+ not_self = {"toString": function () { return "not self"; } };
+ self = {"toString": function () { return "self"; } };
+ func = function (arg) { return this.toString() + " " + arg; };
+ var boundMethod = method(self, func);
+ not_self.boundMethod = boundMethod;
+
+ t.is( boundMethod("foo"), "self foo", "boundMethod bound to self properly" );
+ t.is( not_self.boundMethod("foo"), "self foo", "boundMethod bound to self on another obj" );
+ t.is( method(not_self, boundMethod)("foo"), "not self foo", "boundMethod successfully rebound!" );
+ t.is( method(undefined, boundMethod, "foo")(), "self foo", "boundMethod partial no self change" );
+ t.is( method(not_self, boundMethod, "foo")(), "not self foo", "boundMethod partial self change" );
+
+
+
+
+ // test bindMethods
+
+ var O = function (value) {
+ bindMethods(this);
+ this.value = value;
+ };
+ O.prototype.func = function () {
+ return this.value;
+ };
+
+ var o = new O("boring");
+ var p = {};
+ p.func = o.func;
+ var func = o.func;
+ t.is( o.func(), "boring", "bindMethods doesn't break shit" );
+ t.is( p.func(), "boring", "bindMethods works on other objects" );
+ t.is( func(), "boring", "bindMethods works on functions" );
+
+ var p = clone(o);
+ t.ok( p instanceof O, "cloned correct inheritance" );
+ var q = clone(p);
+ t.ok( q instanceof O, "clone-cloned correct inheritance" );
+ q.foo = "bar";
+ t.is( p.foo, undefined, "clone-clone is copy-on-write" );
+ p.bar = "foo";
+ t.is( o.bar, undefined, "clone is copy-on-write" );
+ t.is( q.bar, "foo", "clone-clone has proper delegation" );
+ // unbind
+ p.func = bind(p.func, null);
+ t.is( p.func(), "boring", "clone function calls correct" );
+ q.value = "awesome";
+ t.is( q.func(), "awesome", "clone really does work" );
+
+ // test boring boolean funcs
+
+ t.is( isCallable(isCallable), true, "isCallable returns true on itself" );
+ t.is( isCallable(1), false, "isCallable returns false on numbers" );
+
+ t.is( isUndefined(null), false, "null is not undefined" );
+ t.is( isUndefined(""), false, "empty string is not undefined" );
+ t.is( isUndefined(undefined), true, "undefined is undefined" );
+ t.is( isUndefined({}.foo), true, "missing property is undefined" );
+
+ t.is( isUndefinedOrNull(null), true, "null is undefined or null" );
+ t.is( isUndefinedOrNull(""), false, "empty string is not undefined or null" );
+ t.is( isUndefinedOrNull(undefined), true, "undefined is undefined or null" );
+ t.is( isUndefinedOrNull({}.foo), true, "missing property is undefined or null" );
+
+ // test extension of arrays
+ var a = [];
+ var b = [];
+ var three = [1, 2, 3];
+
+ extend(a, three, 1);
+ t.ok( objEqual(a, [2, 3]), "extend to an empty array" );
+ extend(a, three, 1)
+ t.ok( objEqual(a, [2, 3, 2, 3]), "extend to a non-empty array" );
+
+ extend(b, three);
+ t.ok( objEqual(b, three), "extend of an empty array" );
+
+ t.is( compare(1, 2), -1, "numbers compare lt" );
+ t.is( compare(2, 1), 1, "numbers compare gt" );
+ t.is( compare(1, 1), 0, "numbers compare eq" );
+ t.is( compare([1], [1]), 0, "arrays compare eq" );
+ t.is( compare([1], [1, 2]), -1, "arrays compare lt (length)" );
+ t.is( compare([1, 2], [2, 1]), -1, "arrays compare lt (contents)" );
+ t.is( compare([1, 2], [1]), 1, "arrays compare gt (length)" );
+ t.is( compare([2, 1], [1, 1]), 1, "arrays compare gt (contents)" );
+
+ // test partial application
+ var a = [];
+ var func = function (a, b) {
+ if (arguments.length != 2) {
+ return "bad args";
+ } else {
+ return this.value + a + b;
+ }
+ };
+ var self = {"value": 1, "func": func};
+ var self2 = {"value": 2};
+ t.is( self.func(2, 3), 6, "setup for test is correct" );
+ self.funcTwo = partial(self.func, 2);
+ t.is( self.funcTwo(3), 6, "partial application works" );
+ t.is( self.funcTwo(3), 6, "partial application works still" );
+ t.is( bind(self.funcTwo, self2)(3), 7, "rebinding partial works" );
+ self.funcTwo = bind(bind(self.funcTwo, self2), null);
+ t.is( self.funcTwo(3), 6, "re-unbinding partial application works" );
+
+
+ // nodeWalk test
+ // ... looks a lot like a DOM tree on purpose
+ var tree = {
+ "id": "nodeWalkTestTree",
+ "test:int": "1",
+ "childNodes": [
+ {
+ "test:int": "2",
+ "childNodes": [
+ {"test:int": "5"},
+ "ignored string",
+ {"ignored": "object"},
+ ["ignored", "list"],
+ {
+ "test:skipchildren": "1",
+ "childNodes": [{"test:int": 6}]
+ }
+ ]
+ },
+ {"test:int": "3"},
+ {"test:int": "4"}
+ ]
+ }
+
+ var visitedNodes = [];
+ nodeWalk(tree, function (node) {
+ var attr = node["test:int"];
+ if (attr) {
+ visitedNodes.push(attr);
+ }
+ if (node["test:skipchildren"]) {
+ return;
+ }
+ return node.childNodes;
+ });
+
+ t.ok( objEqual(visitedNodes, ["1", "2", "3", "4", "5"]), "nodeWalk looks like it works");
+
+ // test map
+ var minusOne = function (x) { return x - 1; };
+ var res = map(minusOne, [1, 2, 3]);
+ t.ok( objEqual(res, [0, 1, 2]), "map works" );
+
+ var res2 = xmap(minusOne, 1, 2, 3);
+ t.ok( objEqual(res2, res), "xmap works" );
+
+ res = map(operator.add, [1, 2, 3], [2, 4, 6]);
+ t.ok( objEqual(res, [3, 6, 9]), "map(fn, p, q) works" );
+
+ res = map(operator.add, [1, 2, 3], [2, 4, 6, 8]);
+ t.ok( objEqual(res, [3, 6, 9]), "map(fn, p, q) works (q long)" );
+
+ res = map(operator.add, [1, 2, 3, 4], [2, 4, 6]);
+ t.ok( objEqual(res, [3, 6, 9]), "map(fn, p, q) works (p long)" );
+
+ res = map(null, [1, 2, 3], [2, 4, 6]);
+ t.ok( objEqual(res, [[1, 2], [2, 4], [3, 6]]), "map(null, p, q) works" );
+
+ res = zip([1, 2, 3], [2, 4, 6]);
+ t.ok( objEqual(res, [[1, 2], [2, 4], [3, 6]]), "zip(p, q) works" );
+
+ res = map(null, [1, 2, 3]);
+ t.ok( objEqual(res, [1, 2, 3]), "map(null, lst) works" );
+
+
+
+
+ t.is( isNotEmpty("foo"), true, "3 char string is not empty" );
+ t.is( isNotEmpty(""), false, "0 char string is empty" );
+ t.is( isNotEmpty([1, 2, 3]), true, "3 element list is not empty" );
+ t.is( isNotEmpty([]), false, "0 element list is empty" );
+
+ // test filter
+ var greaterThanThis = function (x) { return x > this; };
+ var greaterThanOne = function (x) { return x > 1; };
+ var res = filter(greaterThanOne, [-1, 0, 1, 2, 3]);
+ t.ok( objEqual(res, [2, 3]), "filter works" );
+ var res = filter(greaterThanThis, [-1, 0, 1, 2, 3], 1);
+ t.ok( objEqual(res, [2, 3]), "filter self works" );
+ var res2 = xfilter(greaterThanOne, -1, 0, 1, 2, 3);
+ t.ok( objEqual(res2, res), "xfilter works" );
+
+ t.is(objMax(1, 2, 9, 12, 42, -16, 16), 42, "objMax works (with numbers)");
+ t.is(objMin(1, 2, 9, 12, 42, -16, 16), -16, "objMin works (with numbers)");
+
+ // test adapter registry
+
+ var R = new AdapterRegistry();
+ R.register("callable", isCallable, function () { return "callable"; });
+ R.register("arrayLike", isArrayLike, function () { return "arrayLike"; });
+ t.is( R.match(function () {}), "callable", "registry found callable" );
+ t.is( R.match([]), "arrayLike", "registry found ArrayLike" );
+ try {
+ R.match(null);
+ t.ok( false, "non-matching didn't raise!" );
+ } catch (e) {
+ t.is( e, NotFound, "non-matching raised correctly" );
+ }
+ R.register("undefinedOrNull", isUndefinedOrNull, function () { return "undefinedOrNull" });
+ R.register("undefined", isUndefined, function () { return "undefined" });
+ t.is( R.match(undefined), "undefinedOrNull", "priorities are as documented" );
+ t.ok( R.unregister("undefinedOrNull"), "removed adapter" );
+ t.is( R.match(undefined), "undefined", "adapter was removed" );
+ R.register("undefinedOrNull", isUndefinedOrNull, function () { return "undefinedOrNull" }, true);
+ t.is( R.match(undefined), "undefinedOrNull", "override works" );
+
+ var a1 = {"a": 1, "b": 2, "c": 2};
+ var a2 = {"a": 2, "b": 1, "c": 2};
+ t.is( keyComparator("a")(a1, a2), -1, "keyComparator 1 lt" );
+ t.is( keyComparator("c")(a1, a2), 0, "keyComparator 1 eq" );
+ t.is( keyComparator("c", "b")(a1, a2), 1, "keyComparator 2 eq gt" );
+ t.is( keyComparator("c", "a")(a1, a2), -1, "keyComparator 2 eq lt" );
+ t.is( reverseKeyComparator("a")(a1, a2), 1, "reverseKeyComparator" );
+ t.is( compare(concat([1], [2], [3]), [1, 2, 3]), 0, "concat" );
+ t.is( repr("foo"), '"foo"', "string repr" );
+ t.is( repr(1), '1', "number repr" );
+ t.is( listMin([1, 3, 5, 3, -1]), -1, "listMin" );
+ t.is( objMin(1, 3, 5, 3, -1), -1, "objMin" );
+ t.is( listMax([1, 3, 5, 3, -1]), 5, "listMax" );
+ t.is( objMax(1, 3, 5, 3, -1), 5, "objMax" );
+
+ var v = keys(a1);
+ v.sort();
+ t.is( compare(v, ["a", "b", "c"]), 0, "keys" );
+ v = items(a1);
+ v.sort();
+ t.is( compare(v, [["a", 1], ["b", 2], ["c", 2]]), 0, "items" );
+
+ var StringMap = function() {};
+ a = new StringMap();
+ a.foo = "bar";
+ b = new StringMap();
+ b.foo = "bar";
+ try {
+ compare(a, b);
+ t.ok( false, "bad comparison registered!?" );
+ } catch (e) {
+ t.ok( e instanceof TypeError, "bad comparison raised TypeError" );
+ }
+
+ t.is( repr(a), "[object Object]", "default repr for StringMap" );
+ var isStringMap = function () {
+ for (var i = 0; i < arguments.length; i++) {
+ if (!(arguments[i] instanceof StringMap)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ registerRepr("stringMap",
+ isStringMap,
+ function (obj) {
+ return "StringMap(" + repr(items(obj)) + ")";
+ }
+ );
+
+ t.is( repr(a), 'StringMap([["foo", "bar"]])', "repr worked" );
+
+ // not public API
+ MochiKit.Base.reprRegistry.unregister("stringMap");
+
+ t.is( repr(a), "[object Object]", "default repr for StringMap" );
+
+ registerComparator("stringMap",
+ isStringMap,
+ function (a, b) {
+ // no sorted(...) in base
+ a = items(a);
+ b = items(b);
+ a.sort(compare);
+ b.sort(compare);
+ return compare(a, b);
+ }
+ );
+
+ t.is( compare(a, b), 0, "registerComparator" );
+
+ update(a, {"foo": "bar"}, {"wibble": "baz"}, undefined, null, {"grr": 1});
+ t.is( a.foo, "bar", "update worked (first obj)" );
+ t.is( a.wibble, "baz", "update worked (second obj)" );
+ t.is( a.grr, 1, "update worked (skipped undefined and null)" );
+ t.is( compare(a, b), 1, "update worked (comparison)" );
+
+
+ setdefault(a, {"foo": "unf"}, {"bar": "web taco"} );
+ t.is( a.foo, "bar", "setdefault worked (skipped existing)" );
+ t.is( a.bar, "web taco", "setdefault worked (set non-existing)" );
+
+ var c = items(merge({"foo": "bar"}, {"wibble": "baz"}));
+ c.sort(compare);
+ t.is( compare(c, [["foo", "bar"], ["wibble", "baz"]]), 0, "merge worked" );
+
+ // not public API
+ MochiKit.Base.comparatorRegistry.unregister("stringMap");
+
+ try {
+ compare(a, b);
+ t.ok( false, "bad comparison registered!?" );
+ } catch (e) {
+ t.ok( e instanceof TypeError, "bad comparison raised TypeError" );
+ }
+
+ var o = {"__repr__": function () { return "__repr__"; }};
+ t.is( repr(o), "__repr__", "__repr__ protocol" );
+ t.is( repr(MochiKit.Base), MochiKit.Base.__repr__(), "__repr__ protocol when repr is defined" );
+ var o = {"NAME": "NAME"};
+ t.is( repr(o), "NAME", "NAME protocol (obj)" );
+ o = function () { return "TACO" };
+ o.NAME = "NAME";
+ t.is( repr(o), "NAME", "NAME protocol (func)" );
+
+ t.is( repr(MochiKit.Base.nameFunctions), "MochiKit.Base.nameFunctions", "test nameFunctions" );
+ // Done!
+
+ t.is( urlEncode("1+2=2").toUpperCase(), "1%2B2%3D2", "urlEncode" );
+ t.is( queryString(["a", "b"], [1, "two"]), "a=1&b=two", "queryString");
+ t.is( queryString({"a": 1}), "a=1", "one item alternate form queryString" );
+ var o = {"a": 1, "b": 2, "c": function() {}};
+ var res = queryString(o).split("&");
+ res.sort();
+ t.is( res.join("&"), "a=1&b=2", "two item alternate form queryString, function skip" );
+ var res = parseQueryString("1+1=2&b=3%3D2");
+ t.is( res["1 1"], "2", "parseQueryString pathological name" );
+ t.is( res.b, "3=2", "parseQueryString second name:value pair" );
+ var res = parseQueryString("foo=one&foo=two", true);
+ t.is( res["foo"].join(" "), "one two", "parseQueryString useArrays" );
+ var res = parseQueryString("?foo=2&bar=1");
+ t.is( res["foo"], "2", "parseQueryString strip leading question mark");
+
+ t.is( serializeJSON("foo\n\r\b\f\t"), "\"foo\\n\\r\\b\\f\\t\"", "string JSON" );
+ t.is( serializeJSON(null), "null", "null JSON");
+ try {
+ serializeJSON(undefined);
+ t.ok(false, "undefined should not be serializable");
+ } catch (e) {
+ t.ok(e instanceof TypeError, "undefined not serializable");
+ }
+ t.is( serializeJSON(1), "1", "1 JSON");
+ t.is( serializeJSON(1.23), "1.23", "1.23 JSON");
+ t.is( serializeJSON(serializeJSON), null, "function JSON (null, not string)" );
+ t.is( serializeJSON([1, "2", 3.3]), "[1, \"2\", 3.3]", "array JSON" );
+ var res = evalJSON(serializeJSON({"a":1, "b":2}));
+ t.is( res.a, 1, "evalJSON on an object (1)" );
+ t.is( res.b, 2, "evalJSON on an object (2)" );
+ var res = {"a": 1, "b": 2, "json": function () { return this; }};
+ var res = evalJSON(serializeJSON(res));
+ t.is( res.a, 1, "evalJSON on an object that jsons self (1)" );
+ t.is( res.b, 2, "evalJSON on an object that jsons self (2)" );
+ var strJSON = {"a": 1, "b": 2, "json": function () { return "json"; }};
+ t.is( serializeJSON(strJSON), "\"json\"", "json serialization calling" );
+ t.is( serializeJSON([strJSON]), "[\"json\"]", "json serialization calling in a structure" );
+ t.is( evalJSON('/* {"result": 1} */').result, 1, "json comment stripping" );
+ t.is( evalJSON('/* {"*/ /*": 1} */')['*/ /*'], 1, "json comment stripping" );
+ registerJSON("isDateLike",
+ isDateLike,
+ function (d) {
+ return "this was a date";
+ }
+ );
+ t.is( serializeJSON(new Date()), "\"this was a date\"", "json registry" );
+ MochiKit.Base.jsonRegistry.unregister("isDateLike");
+
+ var a = {"foo": {"bar": 12, "wibble": 13}};
+ var b = {"foo": {"baz": 4, "bar": 16}, "bar": 4};
+ updatetree(a, b);
+ var expect = [["bar", 16], ["baz", 4], ["wibble", 13]];
+ var got = items(a.foo);
+ got.sort(compare);
+ t.is( repr(got), repr(expect), "updatetree merge" );
+ t.is( a.bar, 4, "updatetree insert" );
+
+ var c = counter();
+ t.is( c(), 1, "counter starts at 1" );
+ t.is( c(), 2, "counter increases" );
+ c = counter(2);
+ t.is( c(), 2, "counter starts at 2" );
+ t.is( c(), 3, "counter increases" );
+
+ t.is( findValue([1, 2, 3], 4), -1, "findValue returns -1 on not found");
+ t.is( findValue([1, 2, 3], 1), 0, "findValue returns correct index");
+ t.is( findValue([1, 2, 3], 1, 1), -1, "findValue honors start");
+ t.is( findValue([1, 2, 3], 2, 0, 1), -1, "findValue honors end");
+ t.is( findIdentical([1, 2, 3], 4), -1, "findIdentical returns -1");
+ t.is( findIdentical([1, 2, 3], 1), 0, "findIdentical returns correct index");
+ t.is( findIdentical([1, 2, 3], 1, 1), -1, "findIdentical honors start");
+ t.is( findIdentical([1, 2, 3], 2, 0, 1), -1, "findIdentical honors end");
+ t.is( isNull(undefined), false, "isNull doesn't match undefined" );
+
+ var flat = flattenArguments(1, "2", 3, [4, [5, [6, 7], 8, [], 9]]);
+ var expect = [1, "2", 3, 4, 5, 6, 7, 8, 9];
+ t.is( repr(flat), repr(expect), "flattenArguments" );
+
+ var fn = function () {
+ return [this, concat(arguments)];
+ }
+ t.is( methodcaller("toLowerCase")("FOO"), "foo", "methodcaller with a method name" );
+ t.is( repr(methodcaller(fn, 2, 3)(1)), "[1, [2, 3]]", "methodcaller with a function" );
+
+ var f1 = function (x) { return [1, x]; };
+ var f2 = function (x) { return [2, x]; };
+ var f3 = function (x) { return [3, x]; };
+ t.is( repr(f1(f2(f3(4)))), "[1, [2, [3, 4]]]", "test the compose test" );
+ t.is( repr(compose(f1,f2,f3)(4)), "[1, [2, [3, 4]]]", "three fn composition works" );
+ t.is( repr(compose(compose(f1,f2),f3)(4)), "[1, [2, [3, 4]]]", "associative left" );
+ t.is( repr(compose(f1,compose(f2,f3))(4)), "[1, [2, [3, 4]]]", "associative right" );
+
+ try {
+ compose(f1, "foo");
+ t.ok( false, "wrong compose argument not raised!" );
+ } catch (e) {
+ t.is( e.name, 'TypeError', "wrong compose argument raised correctly" );
+ }
+
+ t.is(camelize('one'), 'one', 'one word');
+ t.is(camelize('one-two'), 'oneTwo', 'two words');
+ t.is(camelize('one-two-three'), 'oneTwoThree', 'three words');
+ t.is(camelize('1-one'), '1One', 'letter and word');
+ t.is(camelize('one-'), 'one', 'trailing hyphen');
+ t.is(camelize('-one'), 'One', 'starting hyphen');
+ t.is(camelize('o-two'), 'oTwo', 'one character and word');
+
+ var flat = flattenArray([1, "2", 3, [4, [5, [6, 7], 8, [], 9]]]);
+ var expect = [1, "2", 3, 4, 5, 6, 7, 8, 9];
+ t.is( repr(flat), repr(expect), "flattenArray" );
+
+ /* mean */
+ try {
+ mean();
+ t.ok( false, "no arguments didn't raise!" );
+ } catch (e) {
+ t.is( e.name, 'TypeError', "no arguments raised correctly" );
+ }
+ t.is( mean(1), 1, 'single argument (arg list)');
+ t.is( mean([1]), 1, 'single argument (array)');
+ t.is( mean(1,2,3), 2, 'three arguments (arg list)');
+ t.is( mean([1,2,3]), 2, 'three arguments (array)');
+ t.is( average(1), 1, 'test the average alias');
+
+ /* median */
+ try {
+ median();
+ t.ok( false, "no arguments didn't raise!" );
+ } catch (e) {
+ t.is( e.name, 'TypeError', "no arguments raised correctly" );
+ }
+ t.is( median(1), 1, 'single argument (arg list)');
+ t.is( median([1]), 1, 'single argument (array)');
+ t.is( median(3,1,2), 2, 'three arguments (arg list)');
+ t.is( median([3,1,2]), 2, 'three arguments (array)');
+ t.is( median(3,1,2,4), 2.5, 'four arguments (arg list)');
+ t.is( median([3,1,2,4]), 2.5, 'four arguments (array)');
+
+ /* #185 */
+ t.is( serializeJSON(parseQueryString("")), "{}", "parseQueryString('')" );
+ t.is( serializeJSON(parseQueryString("", true)), "{}", "parseQueryString('', true)" );
+
+ /* #109 */
+ t.is( queryString({ids: [1,2,3]}), "ids=1&ids=2&ids=3", "queryString array value" );
+ t.is( queryString({ids: "123"}), "ids=123", "queryString string value" );
+
+ /* test values */
+ var o = {a: 1, b: 2, c: 4, d: -1};
+ var got = values(o);
+ got.sort();
+ t.is( repr(got), repr([-1, 1, 2, 4]), "values()" );
+
+ t.is( queryString([["foo", "bar"], ["baz", "wibble"]]), "foo=baz&bar=wibble" );
+ o = parseQueryString("foo=1=1=1&bar=2&baz&wibble=");
+ t.is( o.foo, "1=1=1", "parseQueryString multiple = first" );
+ t.is( o.bar, "2", "parseQueryString multiple = second" );
+ t.is( o.baz, "", "parseQueryString multiple = third" );
+ t.is( o.wibble, "", "parseQueryString multiple = fourth" );
+
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_Color.js b/dom/tests/mochitest/ajax/mochikit/tests/test_Color.js
new file mode 100644
index 0000000000..c736c8db34
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_Color.js
@@ -0,0 +1,137 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Color'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Color'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_Color = function (t) {
+ var approx = function (a, b, msg) {
+ return t.is(a.toPrecision(4), b.toPrecision(4), msg);
+ };
+
+ t.is( Color.whiteColor().toHexString(), "#ffffff", "whiteColor has right hex" );
+ t.is( Color.blackColor().toHexString(), "#000000", "blackColor has right hex" );
+ t.is( Color.blueColor().toHexString(), "#0000ff", "blueColor has right hex" );
+ t.is( Color.redColor().toHexString(), "#ff0000", "redColor has right hex" );
+ t.is( Color.greenColor().toHexString(), "#00ff00", "greenColor has right hex" );
+ t.is( compare(Color.whiteColor(), Color.whiteColor()), 0, "default colors compare right" );
+ t.ok( Color.whiteColor() == Color.whiteColor(), "default colors are interned" );
+ t.is( Color.whiteColor().toRGBString(), "rgb(255,255,255)", "toRGBString white" );
+ t.is( Color.blueColor().toRGBString(), "rgb(0,0,255)", "toRGBString blue" );
+ t.is( Color.fromRGB(190/255, 222/255, 173/255).toHexString(), "#bedead", "fromRGB works" );
+ t.is( Color.fromRGB(226/255, 15.9/255, 182/255).toHexString(), "#e210b6", "fromRGB < 16 works" );
+ t.is( Color.fromRGB({r:190/255,g:222/255,b:173/255}).toHexString(), "#bedead", "alt fromRGB works" );
+ t.is( Color.fromHexString("#bedead").toHexString(), "#bedead", "round-trip hex" );
+ t.is( Color.fromString("#bedead").toHexString(), "#bedead", "round-trip string(hex)" );
+ t.is( Color.fromRGBString("rgb(190,222,173)").toHexString(), "#bedead", "round-trip rgb" );
+ t.is( Color.fromString("rgb(190,222,173)").toHexString(), "#bedead", "round-trip rgb" );
+
+ var hsl = Color.redColor().asHSL();
+ approx( hsl.h, 0.0, "red hsl.h" );
+ approx( hsl.s, 1.0, "red hsl.s" );
+ approx( hsl.l, 0.5, "red hsl.l" );
+ hsl = Color.fromRGB(0, 0, 0.5).asHSL();
+ approx( hsl.h, 2/3, "darkblue hsl.h" );
+ approx( hsl.s, 1.0, "darkblue hsl.s" );
+ approx( hsl.l, 0.25, "darkblue hsl.l" );
+ hsl = Color.fromString("#4169E1").asHSL();
+ approx( hsl.h, (5/8), "4169e1 h");
+ approx( hsl.s, (8/11), "4169e1 s");
+ approx( hsl.l, (29/51), "4169e1 l");
+ hsl = Color.fromString("#555544").asHSL();
+ approx( hsl.h, (1/6), "555544 h" );
+ approx( hsl.s, (1/9), "555544 s" );
+ approx( hsl.l, (3/10), "555544 l" );
+ hsl = Color.fromRGB(0.5, 1, 0.5).asHSL();
+ approx( hsl.h, 1/3, "aqua hsl.h" );
+ approx( hsl.s, 1.0, "aqua hsl.s" );
+ approx( hsl.l, 0.75, "aqua hsl.l" );
+ t.is(
+ Color.fromHSL(hsl.h, hsl.s, hsl.l).toHexString(),
+ Color.fromRGB(0.5, 1, 0.5).toHexString(),
+ "fromHSL works with components"
+ );
+ t.is(
+ Color.fromHSL(hsl).toHexString(),
+ Color.fromRGB(0.5, 1, 0.5).toHexString(),
+ "fromHSL alt form"
+ );
+ t.is(
+ Color.fromString("hsl(120,100%,75%)").toHexString(),
+ "#80ff80",
+ "fromHSLString"
+ );
+ t.is(
+ Color.fromRGB(0.5, 1, 0.5).toHSLString(),
+ "hsl(120,100.0%,75.00%)",
+ "toHSLString"
+ );
+ t.is( Color.fromHSL(0, 0, 0).toHexString(), "#000000", "fromHSL to black" );
+ hsl = Color.blackColor().asHSL();
+ approx( hsl.h, 0.0, "black hsl.h" );
+ approx( hsl.s, 0.0, "black hsl.s" );
+ approx( hsl.l, 0.0, "black hsl.l" );
+ hsl.h = 1.0;
+ hsl = Color.blackColor().asHSL();
+ approx( hsl.h, 0.0, "asHSL returns copy" );
+ var rgb = Color.brownColor().asRGB();
+ approx( rgb.r, 153/255, "brown rgb.r" );
+ approx( rgb.g, 102/255, "brown rgb.g" );
+ approx( rgb.b, 51/255, "brown rgb.b" );
+ rgb.r = 0;
+ rgb = Color.brownColor().asRGB();
+ approx( rgb.r, 153/255, "asRGB returns copy" );
+
+ t.is( Color.fromName("aqua").toHexString(), "#00ffff", "aqua fromName" );
+ t.is( Color.fromString("aqua").toHexString(), "#00ffff", "aqua fromString" );
+ t.is( Color.fromName("transparent"), Color.transparentColor(), "transparent fromName" );
+ t.is( Color.fromString("transparent"), Color.transparentColor(), "transparent fromString" );
+ t.is( Color.transparentColor().toRGBString(), "rgba(0,0,0,0)", "transparent toRGBString" );
+ t.is( Color.fromRGBString("rgba( 0, 255, 255, 50%)").asRGB().a, 0.5, "rgba parsing alpha correctly" );
+ t.is( Color.fromRGBString("rgba( 0, 255, 255, 50%)").toRGBString(), "rgba(0,255,255,0.5)", "rgba output correctly" );
+ t.is( Color.fromRGBString("rgba( 0, 255, 255, 1)").toHexString(), "#00ffff", "fromRGBString with spaces and alpha" );
+ t.is( Color.fromRGBString("rgb( 0, 255, 255)").toHexString(), "#00ffff", "fromRGBString with spaces" );
+ t.is( Color.fromRGBString("rgb( 0, 100%, 255)").toHexString(), "#00ffff", "fromRGBString with percents" );
+
+ var hsv = Color.redColor().asHSV();
+ approx( hsv.h, 0.0, "red hsv.h" );
+ approx( hsv.s, 1.0, "red hsv.s" );
+ approx( hsv.v, 1.0, "red hsv.v" );
+ t.is( Color.fromHSV(hsv).toHexString(), Color.redColor().toHexString(), "red hexstring" );
+ hsv = Color.fromRGB(0, 0, 0.5).asHSV();
+ approx( hsv.h, 2/3, "darkblue hsv.h" );
+ approx( hsv.s, 1.0, "darkblue hsv.s" );
+ approx( hsv.v, 0.5, "darkblue hsv.v" );
+ t.is( Color.fromHSV(hsv).toHexString(), Color.fromRGB(0, 0, 0.5).toHexString(), "darkblue hexstring" );
+ hsv = Color.fromString("#4169E1").asHSV();
+ approx( hsv.h, 5/8, "4169e1 h");
+ approx( hsv.s, 32/45, "4169e1 s");
+ approx( hsv.v, 15/17, "4169e1 l");
+ t.is( Color.fromHSV(hsv).toHexString(), "#4169e1", "4169e1 hexstring" );
+ hsv = Color.fromString("#555544").asHSV();
+ approx( hsv.h, 1/6, "555544 h" );
+ approx( hsv.s, 1/5, "555544 s" );
+ approx( hsv.v, 1/3, "555544 l" );
+ t.is( Color.fromHSV(hsv).toHexString(), "#555544", "555544 hexstring" );
+ hsv = Color.fromRGB(0.5, 1, 0.5).asHSV();
+ approx( hsv.h, 1/3, "aqua hsv.h" );
+ approx( hsv.s, 0.5, "aqua hsv.s" );
+ approx( hsv.v, 1, "aqua hsv.v" );
+ t.is(
+ Color.fromHSV(hsv.h, hsv.s, hsv.v).toHexString(),
+ Color.fromRGB(0.5, 1, 0.5).toHexString(),
+ "fromHSV works with components"
+ );
+ t.is(
+ Color.fromHSV(hsv).toHexString(),
+ Color.fromRGB(0.5, 1, 0.5).toHexString(),
+ "fromHSV alt form"
+ );
+ hsv = Color.fromRGB(1, 1, 1).asHSV()
+ approx( hsv.h, 0, 'white hsv.h' );
+ approx( hsv.s, 0, 'white hsv.s' );
+ approx( hsv.v, 1, 'white hsv.v' );
+ t.is(
+ Color.fromHSV(0, 0, 1).toHexString(),
+ '#ffffff',
+ 'HSV saturation'
+ );
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_DateTime.js b/dom/tests/mochitest/ajax/mochikit/tests/test_DateTime.js
new file mode 100644
index 0000000000..cc2d958e3c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_DateTime.js
@@ -0,0 +1,45 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.DateTime'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.DateTime'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_DateTime = function (t) {
+ var testDate = isoDate('2005-2-3');
+ t.is(testDate.getFullYear(), 2005, "isoDate year ok");
+ t.is(testDate.getDate(), 3, "isoDate day ok");
+ t.is(testDate.getMonth(), 1, "isoDate month ok");
+ t.ok(objEqual(testDate, new Date("February 3, 2005")), "matches string date");
+ t.is(toISODate(testDate), '2005-02-03', 'toISODate ok');
+
+ var testDate = isoDate('2005-06-08');
+ t.is(testDate.getFullYear(), 2005, "isoDate year ok");
+ t.is(testDate.getDate(), 8, "isoDate day ok");
+ t.is(testDate.getMonth(), 5, "isoDate month ok");
+ t.ok(objEqual(testDate, new Date("June 8, 2005")), "matches string date");
+ t.is(toISODate(testDate), '2005-06-08', 'toISODate ok');
+
+ t.is(compare(new Date("February 3, 2005"), new Date(2005, 1, 3)), 0, "dates compare eq");
+ t.is(compare(new Date("February 3, 2005"), new Date(2005, 2, 3)), -1, "dates compare lt");
+ t.is(compare(new Date("February 3, 2005"), new Date(2005, 0, 3)), 1, "dates compare gt");
+
+ var testDate = isoDate('2005-2-3');
+ t.is(compare(americanDate('2/3/2005'), testDate), 0, "americanDate eq");
+ t.is(compare('2/3/2005', toAmericanDate(testDate)), 0, "toAmericanDate eq");
+
+ var testTimestamp = isoTimestamp('2005-2-3 22:01:03');
+ t.is(compare(testTimestamp, new Date(2005,1,3,22,1,3)), 0, "isoTimestamp eq");
+ t.is(compare(testTimestamp, isoTimestamp('2005-2-3T22:01:03')), 0, "isoTimestamp (real ISO) eq");
+ t.is(compare(toISOTimestamp(testTimestamp), '2005-02-03 22:01:03'), 0, "toISOTimestamp eq");
+ testTimestamp = isoTimestamp('2005-2-3T22:01:03Z');
+ t.is(toISOTimestamp(testTimestamp, true), '2005-02-03T22:01:03Z', "toISOTimestamp (real ISO) eq");
+
+ var localTZ = Math.round((new Date(2005,1,3,22,1,3)).getTimezoneOffset()/60)
+ var direction = (localTZ < 0) ? "+" : "-";
+ localTZ = Math.abs(localTZ);
+ localTZ = direction + ((localTZ < 10) ? "0" : "") + localTZ;
+ testTimestamp = isoTimestamp("2005-2-3T22:01:03" + localTZ);
+ var testDateTimestamp = new Date(2005,1,3,22,1,3);
+ t.is(compare(testTimestamp, testDateTimestamp), 0, "equal with local tz");
+ testTimestamp = isoTimestamp("2005-2-3T17:01:03-05");
+ var testDateTimestamp = new Date(Date.UTC(2005,1,3,22,1,3));
+ t.is(compare(testTimestamp, testDateTimestamp), 0, "equal with specific tz");
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_DragAndDrop.js b/dom/tests/mochitest/ajax/mochikit/tests/test_DragAndDrop.js
new file mode 100644
index 0000000000..d3a3c58379
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_DragAndDrop.js
@@ -0,0 +1,30 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Signal'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Signal'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_DragAndDrop = function (t) {
+
+ var drag1 = new MochiKit.DragAndDrop.Draggable('drag1', {'revert': true, 'ghosting': true});
+
+ var drop1 = new MochiKit.DragAndDrop.Droppable('drop1', {'hoverclass': 'drop-hover'});
+ drop1.activate();
+ t.is(hasElementClass('drop1', 'drop-hover'), true, "hoverclass ok");
+ drop1.deactivate();
+ t.is(hasElementClass('drop1', 'drop-hover'), false, "remove hoverclass ok");
+ drop1.destroy();
+
+ t.is( isEmpty(MochiKit.DragAndDrop.Droppables.drops), true, "Unregister droppable ok");
+
+ var onhover = function (element) {
+ t.is(element, getElement('drag1'), 'onhover ok');
+ };
+ var drop2 = new MochiKit.DragAndDrop.Droppable('drop1', {'onhover': onhover});
+ var pos = getElementPosition('drop1');
+ pos = {"x": pos.x + 5, "y": pos.y + 5};
+ MochiKit.DragAndDrop.Droppables.show({"page": pos}, getElement('drag1'));
+
+ drag1.destroy();
+ t.is( isEmpty(MochiKit.DragAndDrop.Draggables.drops), true, "Unregister draggable ok");
+
+};
+
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_Format.js b/dom/tests/mochitest/ajax/mochikit/tests/test_Format.js
new file mode 100644
index 0000000000..785cebf823
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_Format.js
@@ -0,0 +1,80 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Format'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Format'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_Format = function (t) {
+ t.is( truncToFixed(0.1234, 3), "0.123", "truncToFixed truncate" );
+ t.is( truncToFixed(0.12, 3), "0.120", "truncToFixed trailing zeros" );
+ t.is( truncToFixed(0.15, 1), "0.1", "truncToFixed no round" );
+ t.is( truncToFixed(0.15, 0), "0", "truncToFixed zero (edge case)" );
+
+ t.is( roundToFixed(0.1234, 3), "0.123", "roundToFixed truncate" );
+ t.is( roundToFixed(0.12, 3), "0.120", "roundToFixed trailing zeros" );
+ t.is( roundToFixed(0.15, 1), "0.2", "roundToFixed round" );
+ t.is( roundToFixed(0.15, 0), "0", "roundToFixed zero (edge case)" );
+
+ t.is( twoDigitFloat(-0.1234), "-0.12", "twoDigitFloat -0.1234 correct");
+ t.is( twoDigitFloat(-0.1), "-0.1", "twoDigitFloat -0.1 correct");
+ t.is( twoDigitFloat(-0), "0", "twoDigitFloat -0 correct");
+ t.is( twoDigitFloat(0), "0", "twoDigitFloat 0 correct");
+ t.is( twoDigitFloat(1), "1", "twoDigitFloat 1 correct");
+ t.is( twoDigitFloat(1.0), "1", "twoDigitFloat 1.0 correct");
+ t.is( twoDigitFloat(1.2), "1.2", "twoDigitFloat 1.2 correct");
+ t.is( twoDigitFloat(1.234), "1.23", "twoDigitFloat 1.234 correct");
+ t.is( percentFormat(123), "12300%", "percentFormat 123 correct");
+ t.is( percentFormat(1.23), "123%", "percentFormat 123 correct");
+ t.is( twoDigitAverage(1, 0), "0", "twoDigitAverage dbz correct");
+ t.is( twoDigitAverage(1, 1), "1", "twoDigitAverage 1 correct");
+ t.is( twoDigitAverage(1, 10), "0.1", "twoDigitAverage .1 correct");
+ function reprIs(a, b) {
+ arguments[0] = repr(a);
+ arguments[1] = repr(b);
+ t.is.apply(this, arguments);
+ }
+ reprIs( lstrip("\r\t\n foo \n\t\r"), "foo \n\t\r", "lstrip whitespace chars" );
+ reprIs( rstrip("\r\t\n foo \n\t\r"), "\r\t\n foo", "rstrip whitespace chars" );
+ reprIs( strip("\r\t\n foo \n\t\r"), "foo", "strip whitespace chars" );
+ reprIs( lstrip("\r\n\t \r", "\r"), "\n\t \r", "lstrip custom chars" );
+ reprIs( rstrip("\r\n\t \r", "\r"), "\r\n\t ", "rstrip custom chars" );
+ reprIs( strip("\r\n\t \r", "\r"), "\n\t ", "strip custom chars" );
+
+ var nf = numberFormatter("$###,###.00 footer");
+ t.is( nf(1000.1), "$1,000.10 footer", "trailing zeros" );
+ t.is( nf(1000000.1), "$1,000,000.10 footer", "two seps" );
+ t.is( nf(100), "$100.00 footer", "shorter than sep" );
+ t.is( nf(100.555), "$100.56 footer", "rounding" );
+ t.is( nf(-100.555), "$-100.56 footer", "default neg" );
+ nf = numberFormatter("-$###,###.00");
+ t.is( nf(-100.555), "-$100.56", "custom neg" );
+ nf = numberFormatter("0000.0000");
+ t.is( nf(0), "0000.0000", "leading and trailing" );
+ t.is( nf(1.1), "0001.1000", "leading and trailing" );
+ t.is( nf(12345.12345), "12345.1235", "no need for leading/trailing" );
+ nf = numberFormatter("0000.0000");
+ t.is( nf("taco"), "", "default placeholder" );
+ nf = numberFormatter("###,###.00", "foo", "de_DE");
+ t.is( nf("taco"), "foo", "custom placeholder" );
+ t.is( nf(12345.12345), "12.345,12", "de_DE locale" );
+ nf = numberFormatter("#%");
+ t.is( nf(1), "100%", "trivial percent" );
+ t.is( nf(0.55), "55%", "percent" );
+
+ var customLocale = {
+ separator: " apples and ",
+ decimal: " bagels at ",
+ percent: "am for breakfast"};
+ var customFormatter = numberFormatter("###,###.0%", "No breakfast", customLocale);
+ t.is( customFormatter(23.458), "2 apples and 345 bagels at 8am for breakfast", "custom locale" );
+
+ nf = numberFormatter("###,###");
+ t.is( nf(123), "123", "large number format" );
+ t.is( nf(1234), "1,234", "large number format" );
+ t.is( nf(12345), "12,345", "large number format" );
+ t.is( nf(123456), "123,456", "large number format" );
+ t.is( nf(1234567), "1,234,567", "large number format" );
+ t.is( nf(12345678), "12,345,678", "large number format" );
+ t.is( nf(123456789), "123,456,789", "large number format" );
+ t.is( nf(1234567890), "1,234,567,890", "large number format" );
+ t.is( nf(12345678901), "12,345,678,901", "large number format" );
+ t.is( nf(123456789012), "123,456,789,012", "large number format" );
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_Iter.js b/dom/tests/mochitest/ajax/mochikit/tests/test_Iter.js
new file mode 100644
index 0000000000..d0ff146ad1
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_Iter.js
@@ -0,0 +1,176 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Iter'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Iter'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_Iter = function (t) {
+ t.is( sum([1, 2, 3, 4, 5]), 15, "sum works on Arrays" );
+ t.is( compare(list([1, 2, 3]), [1, 2, 3]), 0, "list([x]) == [x]" );
+ t.is( compare(list(range(6, 0, -1)), [6, 5, 4, 3, 2, 1]), 0, "list(range(6, 0, -1)");
+ t.is( compare(list(range(6)), [0, 1, 2, 3, 4, 5]), 0, "list(range(6))" );
+ var moreThanTwo = partial(operator.lt, 2);
+ t.is( sum(ifilter(moreThanTwo, range(6))), 12, "sum(ifilter(, range()))" );
+ t.is( sum(ifilterfalse(moreThanTwo, range(6))), 3, "sum(ifilterfalse(, range()))" );
+
+ var c = count(10);
+ t.is( compare([c.next(), c.next(), c.next()], [10, 11, 12]), 0, "count()" );
+ c = cycle([1, 2]);
+ t.is( compare([c.next(), c.next(), c.next()], [1, 2, 1]), 0, "cycle()" );
+ c = repeat("foo", 3);
+ t.is( compare(list(c), ["foo", "foo", "foo"]), 0, "repeat()" );
+ c = izip([1, 2], [3, 4, 5], repeat("foo"));
+ t.is( compare(list(c), [[1, 3, "foo"], [2, 4, "foo"]]), 0, "izip()" );
+
+ t.is( compare(list(range(5)), [0, 1, 2, 3, 4]), 0, "range(x)" );
+ c = islice(range(10), 0, 10, 2);
+ t.is( compare(list(c), [0, 2, 4, 6, 8]), 0, "islice(x, y, z)" );
+
+ c = imap(operator.add, [1, 2, 3], [2, 4, 6]);
+ t.is( compare(list(c), [3, 6, 9]), 0, "imap(fn, p, q)" );
+
+ c = filter(partial(operator.lt, 1), iter([1, 2, 3]));
+ t.is( compare(c, [2, 3]), 0, "filter(fn, iterable)" );
+
+ c = map(partial(operator.add, -1), iter([1, 2, 3]));
+ t.is( compare(c, [0, 1, 2]), 0, "map(fn, iterable)" );
+
+ c = map(operator.add, iter([1, 2, 3]), [2, 4, 6]);
+ t.is( compare(c, [3, 6, 9]), 0, "map(fn, iterable, q)" );
+
+ c = map(operator.add, iter([1, 2, 3]), iter([2, 4, 6]));
+ t.is( compare(c, [3, 6, 9]), 0, "map(fn, iterable, iterable)" );
+
+ c = applymap(operator.add, [[1, 2], [2, 4], [3, 6]]);
+ t.is( compare(list(c), [3, 6, 9]), 0, "applymap()" );
+
+ c = applymap(function (a) { return [this, a]; }, [[1], [2]], 1);
+ t.is( compare(list(c), [[1, 1], [1, 2]]), 0, "applymap(self)" );
+
+ c = chain(range(2), range(3));
+ t.is( compare(list(c), [0, 1, 0, 1, 2]), 0, "chain(p, q)" );
+
+ var lessThanFive = partial(operator.gt, 5);
+ c = takewhile(lessThanFive, count());
+ t.is( compare(list(c), [0, 1, 2, 3, 4]), 0, "takewhile()" );
+
+ c = dropwhile(lessThanFive, range(10));
+ t.is( compare(list(c), [5, 6, 7, 8, 9]), 0, "dropwhile()" );
+
+ c = tee(range(5), 3);
+ t.is( compare(list(c[0]), list(c[1])), 0, "tee(..., 3) p0 == p1" );
+ t.is( compare(list(c[2]), [0, 1, 2, 3, 4]), 0, "tee(..., 3) p2 == fixed" );
+
+ t.is( compare(reduce(operator.add, range(10)), 45), 0, "reduce(op.add)" );
+
+ try {
+ reduce(operator.add, []);
+ t.ok( false, "reduce didn't raise anything with empty list and no start?!" );
+ } catch (e) {
+ if (e instanceof TypeError) {
+ t.ok( true, "reduce raised TypeError correctly" );
+ } else {
+ t.ok( false, "reduce raised the wrong exception?" );
+ }
+ }
+
+ t.is( reduce(operator.add, [], 10), 10, "range initial value OK empty" );
+ t.is( reduce(operator.add, [1], 10), 11, "range initial value OK populated" );
+
+ t.is( compare(iextend([1], range(2)), [1, 0, 1]), 0, "iextend(...)" );
+
+ var x = [];
+ exhaust(imap(bind(x.push, x), range(5)));
+ t.is( compare(x, [0, 1, 2, 3, 4]), 0, "exhaust(...)" );
+
+ t.is( every([1, 2, 3, 4, 5, 4], lessThanFive), false, "every false" );
+ t.is( every([1, 2, 3, 4, 4], lessThanFive), true, "every true" );
+ t.is( some([1, 2, 3, 4, 4], lessThanFive), true, "some true" );
+ t.is( some([5, 6, 7, 8, 9], lessThanFive), false, "some false" );
+ t.is( some([5, 6, 7, 8, 4], lessThanFive), true, "some true" );
+
+ var rval = [];
+ forEach(range(2), rval.push, rval);
+ t.is( compare(rval, [0, 1]), 0, "forEach works bound" );
+
+ function foo(o) {
+ rval.push(o);
+ }
+ forEach(range(2), foo);
+ t.is( compare(rval, [0, 1, 0, 1]), 0, "forEach works unbound" );
+
+ t.is( compare(sorted([3, 2, 1]), [1, 2, 3]), 0, "sorted default" );
+ rval = sorted(["aaa", "bb", "c"], keyComparator("length"));
+ t.is(compare(rval, ["c", "bb", "aaa"]), 0, "sorted custom");
+
+ t.is( compare(reversed(range(4)), [3, 2, 1, 0]), 0, "reversed iterator" );
+ t.is( compare(reversed([5, 6, 7]), [7, 6, 5]), 0, "reversed list" );
+
+ var o = {lst: [1, 2, 3], iterateNext: function () { return this.lst.shift(); }};
+ t.is( compare(list(o), [1, 2, 3]), 0, "iterateNext" );
+
+
+ function except(exc, func) {
+ try {
+ func();
+ t.ok(false, exc.name + " was not raised.");
+ } catch (e) {
+ if (e == exc) {
+ t.ok( true, "raised " + exc.name + " correctly" );
+ } else {
+ t.ok( false, "raised the wrong exception?" );
+ }
+ }
+ }
+
+ odd = partial(operator.and, 1)
+
+ // empty
+ grouped = groupby([]);
+ except(StopIteration, grouped.next);
+
+ // exhaust sub-iterator
+ grouped = groupby([2,4,6,7], odd);
+ kv = grouped.next(); k = kv[0], subiter = kv[1];
+ t.is(k, 0, "odd(2) = odd(4) = odd(6) == 0");
+ t.is(subiter.next(), 2, "sub-iterator.next() == 2");
+ t.is(subiter.next(), 4, "sub-iterator.next() == 4");
+ t.is(subiter.next(), 6, "sub-iterator.next() == 6");
+ except(StopIteration, subiter.next);
+ kv = grouped.next(); key = kv[0], subiter = kv[1];
+ t.is(key, 1, "odd(7) == 1");
+ t.is(subiter.next(), 7, "sub-iterator.next() == 7");
+ except(StopIteration, subiter.next);
+
+ // not consume sub-iterator
+ grouped = groupby([2,4,6,7], odd);
+ kv = grouped.next(); key = kv[0], subiter = kv[1];
+ t.is(key, 0, "0 = odd(2) = odd(4) = odd(6)");
+ kv = grouped.next(); key = kv[0], subiter = kv[1];
+ t.is(key, 1, "1 = odd(7)");
+ except(StopIteration, grouped.next);
+
+ // consume sub-iterator partially
+ grouped = groupby([3,1,1,2], odd);
+ kv = grouped.next(); key = kv[0], subiter = kv[1];
+ t.is(key, 1, "odd(1) == 1");
+ t.is(subiter.next(), 3, "sub-iterator.next() == 3");
+ kv = grouped.next(); key = kv[0], v = kv[1];
+ t.is(key, 0, "skip (1,1), odd(2) == 0");
+ except(StopIteration, grouped.next);
+
+ // null
+ grouped = groupby([null,null]);
+ kv = grouped.next(); k = kv[0], v = kv[1];
+ t.is(k, null, "null ok");
+
+ // groupby - array version
+ isEqual = (t.isDeeply || function (a, b, msg) {
+ return t.ok(compare(a, b) == 0, msg);
+ });
+ isEqual(groupby_as_array([ ] ), [ ], "empty");
+ isEqual(groupby_as_array([1,1,1]), [ [1,[1,1,1]] ], "[1,1,1]: [1,1,1]");
+ isEqual(groupby_as_array([1,2,2]), [ [1,[1] ], [2,[2,2]] ], "[1,2,2]: [1], [2,2]");
+ isEqual(groupby_as_array([1,1,2]), [ [1,[1,1] ], [2,[2 ]] ], "[1,1,2]: [1,1], [2]");
+ isEqual(groupby_as_array([null,null] ), [ [null,[null,null]] ], "[null,null]: [null,null]");
+ grouped = groupby_as_array([1,1,3,2,4,6,8], odd);
+ isEqual(grouped, [[1, [1,1,3]], [0,[2,4,6,8]]], "[1,1,3,2,4,6,7] odd: [1,1,3], [2,4,6,8]");
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_Logging.js b/dom/tests/mochitest/ajax/mochikit/tests/test_Logging.js
new file mode 100644
index 0000000000..66f4989b02
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_Logging.js
@@ -0,0 +1,75 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Logging'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Logging'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_Logging = function (t) {
+
+ // just in case
+ logger.clear();
+
+ t.is( logLevelAtLeast('DEBUG')('INFO'), false, 'logLevelAtLeast false' );
+ t.is( logLevelAtLeast('WARNING')('INFO'), false, 'logLevelAtLeast true' );
+ t.ok( logger instanceof Logger, "global logger installed" );
+
+ var allMessages = [];
+ logger.addListener("allMessages", null,
+ bind(allMessages.push, allMessages));
+
+ var fatalMessages = [];
+ logger.addListener("fatalMessages", "FATAL",
+ bind(fatalMessages.push, fatalMessages));
+
+ var firstTwo = [];
+ logger.addListener("firstTwo", null,
+ bind(firstTwo.push, firstTwo));
+
+
+ log("foo");
+ var msgs = logger.getMessages();
+ t.is( msgs.length, 1, 'global log() put one message in queue' );
+ t.is( compare(allMessages, msgs), 0, "allMessages listener" );
+ var msg = msgs.pop();
+ t.is( compare(msg.info, ["foo"]), 0, "info matches" );
+ t.is( msg.level, "INFO", "level matches" );
+
+ logDebug("debugFoo");
+ t.is( msgs.length, 0, 'getMessages() returns copy' );
+ msgs = logger.getMessages();
+ t.is( compare(allMessages, msgs), 0, "allMessages listener" );
+ t.is( msgs.length, 2, 'logDebug()' );
+ msg = msgs.pop();
+ t.is( compare(msg.info, ["debugFoo"]), 0, "info matches" );
+ t.is( msg.level, "DEBUG", "level matches" );
+
+ logger.removeListener("firstTwo");
+
+ logError("errorFoo");
+ msgs = logger.getMessages();
+ t.is( compare(allMessages, msgs), 0, "allMessages listener" );
+ t.is( msgs.length, 3, 'logError()' );
+ msg = msgs.pop();
+ t.is( compare(msg.info, ["errorFoo"]), 0, "info matches" );
+ t.is( msg.level, "ERROR", "level matches" );
+
+ logWarning("warningFoo");
+ msgs = logger.getMessages();
+ t.is( compare(allMessages, msgs), 0, "allMessages listener" );
+ t.is( msgs.length, 4, 'logWarning()' );
+ msg = msgs.pop();
+ t.is( compare(msg.info, ["warningFoo"]), 0, "info matches" );
+ t.is( msg.level, "WARNING", "level matches" );
+
+ logFatal("fatalFoo");
+ msgs = logger.getMessages();
+ t.is( compare(allMessages, msgs), 0, "allMessages listener" );
+ t.is( msgs.length, 5, 'logFatal()' );
+ msg = msgs.pop();
+ t.is( compare(fatalMessages, [msg]), 0, "fatalMessages listener" );
+ t.is( compare(msg.info, ["fatalFoo"]), 0, "info matches" );
+ t.is( msg.level, "FATAL", "level matches" );
+
+ logger.removeListener("allMessages");
+ logger.removeListener("fatalMessages");
+
+ t.is( compare(firstTwo, logger.getMessages().slice(0, 2)), 0, "firstTwo" );
+};
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_MochiKit-Async.json b/dom/tests/mochitest/ajax/mochikit/tests/test_MochiKit-Async.json
new file mode 100644
index 0000000000..037e18c818
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_MochiKit-Async.json
@@ -0,0 +1 @@
+{"passed": true}
diff --git a/dom/tests/mochitest/ajax/mochikit/tests/test_Signal.js b/dom/tests/mochitest/ajax/mochikit/tests/test_Signal.js
new file mode 100644
index 0000000000..6a905952f7
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/test_Signal.js
@@ -0,0 +1,441 @@
+if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Signal'); }
+if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Signal'); }
+if (typeof(tests) == 'undefined') { tests = {}; }
+
+tests.test_Signal = function (t) {
+
+ var submit = MochiKit.DOM.getElement('submit');
+ var ident = null;
+ var i = 0;
+ var aFunction = function() {
+ t.ok(this === submit, "aFunction should have 'this' as submit");
+ i++;
+ if (typeof(this.someVar) != 'undefined') {
+ i += this.someVar;
+ }
+ };
+
+ var aObject = {};
+ aObject.aMethod = function() {
+ t.ok(this === aObject, "aMethod should have 'this' as aObject");
+ i++;
+ };
+
+ ident = connect('submit', 'onclick', aFunction);
+ MochiKit.DOM.getElement('submit').click();
+ t.is(i, 1, 'HTML onclick event can be connected to a function');
+
+ disconnect(ident);
+ MochiKit.DOM.getElement('submit').click();
+ t.is(i, 1, 'HTML onclick can be disconnected from a function');
+
+ var submit = MochiKit.DOM.getElement('submit');
+
+ ident = connect(submit, 'onclick', aFunction);
+ submit.click();
+ t.is(i, 2, 'Checking that a DOM element can be connected to a function');
+
+ disconnect(ident);
+ submit.click();
+ t.is(i, 2, '...and then disconnected');
+
+ if (MochiKit.DOM.getElement('submit').fireEvent ||
+ (document.createEvent &&
+ typeof(document.createEvent('MouseEvents').initMouseEvent) == 'function')) {
+
+ /*
+
+ Adapted from:
+ http://www.devdaily.com/java/jwarehouse/jforum/tests/selenium/javascript/htmlutils.js.shtml
+ License: Apache
+ Copyright: Copyright 2004 ThoughtWorks, Inc
+
+ */
+ var triggerMouseEvent = function(element, eventType, canBubble) {
+ element = MochiKit.DOM.getElement(element);
+ canBubble = (typeof(canBubble) == 'undefined') ? true : canBubble;
+ if (element.fireEvent) {
+ var newEvt = document.createEventObject();
+ newEvt.clientX = 1;
+ newEvt.clientY = 1;
+ newEvt.button = 1;
+ element.fireEvent('on' + eventType, newEvt);
+ } else if (document.createEvent && (typeof(document.createEvent('MouseEvents').initMouseEvent) == 'function')) {
+ var evt = document.createEvent('MouseEvents');
+ evt.initMouseEvent(eventType, canBubble, true, // event, bubbles, cancelable
+ document.defaultView, 1, // view, # of clicks
+ 1, 0, 0, 0, // screenX, screenY, clientX, clientY
+ false, false, false, false, // ctrlKey, altKey, shiftKey, metaKey
+ 0, null); // buttonCode, relatedTarget
+ element.dispatchEvent(evt);
+ }
+ };
+
+ var eventTest = function(e) {
+ i++;
+ t.ok((typeof(e.event()) === 'object'), 'checking that event() is an object');
+ t.ok((typeof(e.type()) === 'string'), 'checking that type() is a string');
+ t.ok((e.target() === MochiKit.DOM.getElement('submit')), 'checking that target is "submit"');
+ t.ok((typeof(e.modifier()) === 'object'), 'checking that modifier() is an object');
+ t.ok(e.modifier().alt === false, 'checking that modifier().alt is defined, but false');
+ t.ok(e.modifier().ctrl === false, 'checking that modifier().ctrl is defined, but false');
+ t.ok(e.modifier().meta === false, 'checking that modifier().meta is defined, but false');
+ t.ok(e.modifier().shift === false, 'checking that modifier().shift is defined, but false');
+ t.ok((typeof(e.mouse()) === 'object'), 'checking that mouse() is an object');
+ t.ok((typeof(e.mouse().button) === 'object'), 'checking that mouse().button is an object');
+ t.ok(e.mouse().button.left === true, 'checking that mouse().button.left is true');
+ t.ok(e.mouse().button.middle === false, 'checking that mouse().button.middle is false');
+ t.ok(e.mouse().button.right === false, 'checking that mouse().button.right is false');
+ t.ok((typeof(e.mouse().page) === 'object'), 'checking that mouse().page is an object');
+ t.ok((typeof(e.mouse().page.x) === 'number'), 'checking that mouse().page.x is a number');
+ t.ok((typeof(e.mouse().page.y) === 'number'), 'checking that mouse().page.y is a number');
+ t.ok((typeof(e.mouse().client) === 'object'), 'checking that mouse().client is an object');
+ t.ok((typeof(e.mouse().client.x) === 'number'), 'checking that mouse().client.x is a number');
+ t.ok((typeof(e.mouse().client.y) === 'number'), 'checking that mouse().client.y is a number');
+
+ /* these should not be defined */
+ t.ok((typeof(e.relatedTarget()) === 'undefined'), 'checking that relatedTarget() is undefined');
+ t.ok((typeof(e.key()) === 'undefined'), 'checking that key() is undefined');
+ };
+
+
+ ident = connect('submit', 'onmousedown', eventTest);
+ triggerMouseEvent('submit', 'mousedown', false);
+ t.is(i, 3, 'Connecting an event to an HTML object and firing a synthetic event');
+
+ disconnect(ident);
+ triggerMouseEvent('submit', 'mousedown', false);
+ t.is(i, 3, 'Disconnecting an event to an HTML object and firing a synthetic event');
+
+
+
+ }
+
+ // non-DOM tests
+
+ var hasNoSignals = {};
+
+ var hasSignals = {someVar: 1};
+
+ var i = 0;
+
+ var aFunction = function() {
+ i++;
+ if (typeof(this.someVar) != 'undefined') {
+ i += this.someVar;
+ }
+ };
+
+ var bFunction = function(someArg, someOtherArg) {
+ i += someArg + someOtherArg;
+ };
+
+
+ var aObject = {};
+ aObject.aMethod = function() {
+ i++;
+ };
+
+ aObject.bMethod = function() {
+ i++;
+ };
+
+ var bObject = {};
+ bObject.bMethod = function() {
+ i++;
+ };
+
+
+ ident = connect(hasSignals, 'signalOne', aFunction);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 2, 'Connecting function');
+ i = 0;
+
+ disconnect(ident);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'New style disconnecting function');
+ i = 0;
+
+
+ ident = connect(hasSignals, 'signalOne', bFunction);
+ signal(hasSignals, 'signalOne', 1, 2);
+ t.is(i, 3, 'Connecting function');
+ i = 0;
+
+ disconnect(ident);
+ signal(hasSignals, 'signalOne', 1, 2);
+ t.is(i, 0, 'New style disconnecting function');
+ i = 0;
+
+
+ connect(hasSignals, 'signalOne', aFunction);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 2, 'Connecting function');
+ i = 0;
+
+ disconnect(hasSignals, 'signalOne', aFunction);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'Old style disconnecting function');
+ i = 0;
+
+
+ ident = connect(hasSignals, 'signalOne', aObject, aObject.aMethod);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 1, 'Connecting obj-function');
+ i = 0;
+
+ disconnect(ident);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'New style disconnecting obj-function');
+ i = 0;
+
+ connect(hasSignals, 'signalOne', aObject, aObject.aMethod);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 1, 'Connecting obj-function');
+ i = 0;
+
+ disconnect(hasSignals, 'signalOne', aObject, aObject.aMethod);
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'Disconnecting obj-function');
+ i = 0;
+
+
+ ident = connect(hasSignals, 'signalTwo', aObject, 'aMethod');
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 1, 'Connecting obj-string');
+ i = 0;
+
+ disconnect(ident);
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 0, 'New style disconnecting obj-string');
+ i = 0;
+
+
+ connect(hasSignals, 'signalTwo', aObject, 'aMethod');
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 1, 'Connecting obj-string');
+ i = 0;
+
+ disconnect(hasSignals, 'signalTwo', aObject, 'aMethod');
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 0, 'Old style disconnecting obj-string');
+ i = 0;
+
+
+ var shouldRaise = function() { return undefined.attr; };
+
+ try {
+ connect(hasSignals, 'signalOne', shouldRaise);
+ signal(hasSignals, 'signalOne');
+ t.ok(false, 'An exception was not raised');
+ } catch (e) {
+ t.ok(true, 'An exception was raised');
+ }
+ disconnect(hasSignals, 'signalOne', shouldRaise);
+ t.is(i, 0, 'Exception raised, signal should not have fired');
+ i = 0;
+
+
+ connect(hasSignals, 'signalOne', aObject, 'aMethod');
+ connect(hasSignals, 'signalOne', aObject, 'bMethod');
+ signal(hasSignals, 'signalOne');
+ t.is(i, 2, 'Connecting one signal to two slots in one object');
+ i = 0;
+
+ disconnect(hasSignals, 'signalOne', aObject, 'aMethod');
+ disconnect(hasSignals, 'signalOne', aObject, 'bMethod');
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'Disconnecting one signal from two slots in one object');
+ i = 0;
+
+
+ connect(hasSignals, 'signalOne', aObject, 'aMethod');
+ connect(hasSignals, 'signalOne', bObject, 'bMethod');
+ signal(hasSignals, 'signalOne');
+ t.is(i, 2, 'Connecting one signal to two slots in two objects');
+ i = 0;
+
+ disconnect(hasSignals, 'signalOne', aObject, 'aMethod');
+ disconnect(hasSignals, 'signalOne', bObject, 'bMethod');
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'Disconnecting one signal from two slots in two objects');
+ i = 0;
+
+
+ try {
+ connect(nothing, 'signalOne', aObject, 'aMethod');
+ signal(nothing, 'signalOne');
+ t.ok(false, 'An exception was not raised when connecting undefined');
+ } catch (e) {
+ t.ok(true, 'An exception was raised when connecting undefined');
+ }
+
+ try {
+ disconnect(nothing, 'signalOne', aObject, 'aMethod');
+ t.ok(false, 'An exception was not raised when disconnecting undefined');
+ } catch (e) {
+ t.ok(true, 'An exception was raised when disconnecting undefined');
+ }
+
+
+ try {
+ connect(hasSignals, 'signalOne', nothing);
+ signal(hasSignals, 'signalOne');
+ t.ok(false, 'An exception was not raised when connecting an undefined function');
+ } catch (e) {
+ t.ok(true, 'An exception was raised when connecting an undefined function');
+ }
+
+ try {
+ disconnect(hasSignals, 'signalOne', nothing);
+ t.ok(false, 'An exception was not raised when disconnecting an undefined function');
+ } catch (e) {
+ t.ok(true, 'An exception was raised when disconnecting an undefined function');
+ }
+
+
+ try {
+ connect(hasSignals, 'signalOne', aObject, aObject.nothing);
+ signal(hasSignals, 'signalOne');
+ t.ok(false, 'An exception was not raised when connecting an undefined method');
+ } catch (e) {
+ t.ok(true, 'An exception was raised when connecting an undefined method');
+ }
+
+ try {
+ connect(hasSignals, 'signalOne', aObject, 'nothing');
+ signal(hasSignals, 'signalOne');
+ t.ok(false, 'An exception was not raised when connecting an undefined method (as string)');
+ } catch (e) {
+ t.ok(true, 'An exception was raised when connecting an undefined method (as string)');
+ }
+
+ t.is(i, 0, 'Signals should not have fired');
+
+ connect(hasSignals, 'signalOne', aFunction);
+ connect(hasSignals, 'signalOne', aObject, 'aMethod');
+ disconnectAll(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'disconnectAll works with single explicit signal');
+ i = 0;
+
+ connect(hasSignals, 'signalOne', aFunction);
+ connect(hasSignals, 'signalOne', aObject, 'aMethod');
+ connect(hasSignals, 'signalTwo', aFunction);
+ connect(hasSignals, 'signalTwo', aObject, 'aMethod');
+ disconnectAll(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalOne');
+ t.is(i, 0, 'disconnectAll works with single explicit signal');
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 3, 'disconnectAll does not disconnect unrelated signals');
+ i = 0;
+
+ connect(hasSignals, 'signalOne', aFunction);
+ connect(hasSignals, 'signalOne', aObject, 'aMethod');
+ connect(hasSignals, 'signalTwo', aFunction);
+ connect(hasSignals, 'signalTwo', aObject, 'aMethod');
+ disconnectAll(hasSignals, 'signalOne', 'signalTwo');
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 0, 'disconnectAll works with two explicit signals');
+ i = 0;
+
+ connect(hasSignals, 'signalOne', aFunction);
+ connect(hasSignals, 'signalOne', aObject, 'aMethod');
+ connect(hasSignals, 'signalTwo', aFunction);
+ connect(hasSignals, 'signalTwo', aObject, 'aMethod');
+ disconnectAll(hasSignals, ['signalOne', 'signalTwo']);
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 0, 'disconnectAll works with two explicit signals as a list');
+ i = 0;
+
+ connect(hasSignals, 'signalOne', aFunction);
+ connect(hasSignals, 'signalOne', aObject, 'aMethod');
+ connect(hasSignals, 'signalTwo', aFunction);
+ connect(hasSignals, 'signalTwo', aObject, 'aMethod');
+ disconnectAll(hasSignals);
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 0, 'disconnectAll works with implicit signals');
+ i = 0;
+
+ var toggle = function() {
+ disconnectAll(hasSignals, 'signalOne');
+ connect(hasSignals, 'signalOne', aFunction);
+ i++;
+ };
+
+ connect(hasSignals, 'signalOne', aFunction);
+ connect(hasSignals, 'signalTwo', function() { i++; });
+ connect(hasSignals, 'signalTwo', toggle);
+ connect(hasSignals, 'signalTwo', function() { i++; }); // #147
+ connect(hasSignals, 'signalTwo', function() { i++; });
+ signal(hasSignals, 'signalTwo');
+ t.is(i, 4, 'disconnectAll fired in a signal loop works');
+ i = 0;
+ disconnectAll('signalOne');
+ disconnectAll('signalTwo');
+
+ var testfunc = function () { arguments.callee.count++; };
+ testfunc.count = 0;
+ var testObj = {
+ methOne: function () { this.countOne++; }, countOne: 0,
+ methTwo: function () { this.countTwo++; }, countTwo: 0
+ };
+ connect(hasSignals, 'signalOne', testfunc);
+ connect(hasSignals, 'signalTwo', testfunc);
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(testfunc.count, 2, 'disconnectAllTo func precondition');
+ disconnectAllTo(testfunc);
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(testfunc.count, 2, 'disconnectAllTo func');
+
+ connect(hasSignals, 'signalOne', testObj, 'methOne');
+ connect(hasSignals, 'signalTwo', testObj, 'methTwo');
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(testObj.countOne, 1, 'disconnectAllTo obj precondition');
+ t.is(testObj.countTwo, 1, 'disconnectAllTo obj precondition');
+ disconnectAllTo(testObj);
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(testObj.countOne, 1, 'disconnectAllTo obj');
+ t.is(testObj.countTwo, 1, 'disconnectAllTo obj');
+
+ testObj.countOne = testObj.countTwo = 0;
+ connect(hasSignals, 'signalOne', testObj, 'methOne');
+ connect(hasSignals, 'signalTwo', testObj, 'methTwo');
+ disconnectAllTo(testObj, 'methOne');
+ signal(hasSignals, 'signalOne');
+ signal(hasSignals, 'signalTwo');
+ t.is(testObj.countOne, 0, 'disconnectAllTo obj+str');
+ t.is(testObj.countTwo, 1, 'disconnectAllTo obj+str');
+
+ has__Connect = {
+ count: 0,
+ __connect__: function (ident) {
+ this.count += arguments.length;
+ disconnect(ident);
+ }
+ };
+
+ connect(has__Connect, 'signalOne', aFunction);
+ t.is(has__Connect.count, 3, '__connect__ is called when it exists');
+ signal(has__Connect, 'signalOne');
+ t.is(has__Connect.count, 3, '__connect__ can disconnect the signal');
+
+ var events = {};
+ var test_ident = connect(events, "test", function() {
+ var fail_ident = connect(events, "fail", function () {
+ events.failed = true;
+ });
+ disconnect(fail_ident);
+ signal(events, "fail");
+ });
+ signal(events, "test");
+ t.is(events.failed, undefined, 'disconnected slots do not fire');
+
+};
diff --git a/dom/tests/mochitest/ajax/prototype/dist/prototype.js b/dom/tests/mochitest/ajax/prototype/dist/prototype.js
new file mode 100644
index 0000000000..69f82032a8
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/dist/prototype.js
@@ -0,0 +1,4681 @@
+/* Prototype JavaScript framework, version 1.6.0.2
+ * (c) 2005-2007 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+ Version: '1.6.0.2',
+
+ Browser: {
+ IE: !!(window.attachEvent && !window.opera),
+ Opera: !!window.opera,
+ WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
+ Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
+ MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
+ },
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+ SelectorsAPI: !!document.querySelector,
+ ElementExtensions: !!window.HTMLElement,
+ SpecificElementExtensions:
+ document.createElement('div')['__proto__'] &&
+ document.createElement('div')['__proto__'] !==
+ document.createElement('form')['__proto__']
+ },
+
+ ScriptFragment: '<script[^>]*>([^\\x00]*?)<\/script>',
+ JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
+
+ emptyFunction: function() { },
+ K: function(x) { return x }
+};
+
+if (Prototype.Browser.MobileSafari)
+ Prototype.BrowserFeatures.SpecificElementExtensions = false;
+
+
+/* Based on Alex Arnell's inheritance implementation. */
+var Class = {
+ create: function() {
+ var parent = null, properties = $A(arguments);
+ if (Object.isFunction(properties[0]))
+ parent = properties.shift();
+
+ function klass() {
+ this.initialize.apply(this, arguments);
+ }
+
+ Object.extend(klass, Class.Methods);
+ klass.superclass = parent;
+ klass.subclasses = [];
+
+ if (parent) {
+ var subclass = function() { };
+ subclass.prototype = parent.prototype;
+ klass.prototype = new subclass;
+ parent.subclasses.push(klass);
+ }
+
+ for (var i = 0; i < properties.length; i++)
+ klass.addMethods(properties[i]);
+
+ if (!klass.prototype.initialize)
+ klass.prototype.initialize = Prototype.emptyFunction;
+
+ klass.prototype.constructor = klass;
+
+ return klass;
+ }
+};
+
+Class.Methods = {
+ addMethods: function(source) {
+ var ancestor = this.superclass && this.superclass.prototype;
+ var properties = Object.keys(source);
+
+ if (!Object.keys({ toString: true }).length)
+ properties.push("toString", "valueOf");
+
+ for (var i = 0, length = properties.length; i < length; i++) {
+ var property = properties[i], value = source[property];
+ if (ancestor && Object.isFunction(value) &&
+ value.argumentNames().first() == "$super") {
+ var method = value, value = (function(m) {
+ return function() { return ancestor[m].apply(this, arguments) };
+ })(property).wrap(method);
+
+ value.valueOf = method.valueOf.bind(method);
+ value.toString = method.toString.bind(method);
+ }
+ this.prototype[property] = value;
+ }
+
+ return this;
+ }
+};
+
+var Abstract = { };
+
+Object.extend = function(destination, source) {
+ for (var property in source)
+ destination[property] = source[property];
+ return destination;
+};
+
+Object.extend(Object, {
+ inspect: function(object) {
+ try {
+ if (Object.isUndefined(object)) return 'undefined';
+ if (object === null) return 'null';
+ return object.inspect ? object.inspect() : String(object);
+ } catch (e) {
+ if (e instanceof RangeError) return '...';
+ throw e;
+ }
+ },
+
+ toJSON: function(object) {
+ var type = typeof object;
+ switch (type) {
+ case 'undefined':
+ case 'function':
+ case 'unknown': return;
+ case 'boolean': return object.toString();
+ }
+
+ if (object === null) return 'null';
+ if (object.toJSON) return object.toJSON();
+ if (Object.isElement(object)) return;
+
+ var results = [];
+ for (var property in object) {
+ var value = Object.toJSON(object[property]);
+ if (!Object.isUndefined(value))
+ results.push(property.toJSON() + ': ' + value);
+ }
+
+ return '{' + results.join(', ') + '}';
+ },
+
+ toQueryString: function(object) {
+ return $H(object).toQueryString();
+ },
+
+ toHTML: function(object) {
+ return object && object.toHTML ? object.toHTML() : String.interpret(object);
+ },
+
+ keys: function(object) {
+ var keys = [];
+ for (var property in object)
+ keys.push(property);
+ return keys;
+ },
+
+ values: function(object) {
+ var values = [];
+ for (var property in object)
+ values.push(object[property]);
+ return values;
+ },
+
+ clone: function(object) {
+ return Object.extend({ }, object);
+ },
+
+ isElement: function(object) {
+ return !!(object && object.nodeType == 1);
+ },
+
+ isArray: function(object) {
+ return object != null && typeof object == "object" &&
+ 'splice' in object && 'join' in object;
+ },
+
+ isHash: function(object) {
+ return object && object instanceof Hash;
+ },
+
+ isFunction: function(object) {
+ return typeof object == "function" && typeof object.call == "function";
+ },
+
+ isString: function(object) {
+ return typeof object == "string";
+ },
+
+ isNumber: function(object) {
+ return typeof object == "number";
+ },
+
+ isUndefined: function(object) {
+ return typeof object == "undefined";
+ }
+});
+
+Object.extend(Function.prototype, {
+ argumentNames: function() {
+ var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
+ .replace(/\s+/g, '').split(',');
+ return names.length == 1 && !names[0] ? [] : names;
+ },
+
+ bind: function() {
+ if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function() {
+ return __method.apply(object, args.concat($A(arguments)));
+ }
+ },
+
+ bindAsEventListener: function() {
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function(event) {
+ return __method.apply(object, [event || window.event].concat(args));
+ }
+ },
+
+ curry: function() {
+ if (!arguments.length) return this;
+ var __method = this, args = $A(arguments);
+ return function() {
+ return __method.apply(this, args.concat($A(arguments)));
+ }
+ },
+
+ delay: function() {
+ var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
+ return window.setTimeout(function() {
+ return __method.apply(__method, args);
+ }, timeout);
+ },
+
+ defer: function() {
+ var args = [0.01].concat($A(arguments));
+ return this.delay.apply(this, args);
+ },
+
+ wrap: function(wrapper) {
+ var __method = this;
+ return function() {
+ return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
+ }
+ },
+
+ methodize: function() {
+ if (this._methodized) return this._methodized;
+ var __method = this;
+ return this._methodized = function() {
+ return __method.apply(null, [this].concat($A(arguments)));
+ };
+ }
+});
+
+Date.prototype.toJSON = function() {
+ return '"' + this.getUTCFullYear() + '-' +
+ (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
+ this.getUTCDate().toPaddedString(2) + 'T' +
+ this.getUTCHours().toPaddedString(2) + ':' +
+ this.getUTCMinutes().toPaddedString(2) + ':' +
+ this.getUTCSeconds().toPaddedString(2) + 'Z"';
+};
+
+var Try = {
+ these: function() {
+ var returnValue;
+
+ for (var i = 0, length = arguments.length; i < length; i++) {
+ var lambda = arguments[i];
+ try {
+ returnValue = lambda();
+ break;
+ } catch (e) { }
+ }
+
+ return returnValue;
+ }
+};
+
+RegExp.prototype.match = RegExp.prototype.test;
+
+RegExp.escape = function(str) {
+ return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+};
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create({
+ initialize: function(callback, frequency) {
+ this.callback = callback;
+ this.frequency = frequency;
+ this.currentlyExecuting = false;
+
+ this.registerCallback();
+ },
+
+ registerCallback: function() {
+ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ execute: function() {
+ this.callback(this);
+ },
+
+ stop: function() {
+ if (!this.timer) return;
+ clearInterval(this.timer);
+ this.timer = null;
+ },
+
+ onTimerEvent: function() {
+ if (!this.currentlyExecuting) {
+ try {
+ this.currentlyExecuting = true;
+ this.execute();
+ } finally {
+ this.currentlyExecuting = false;
+ }
+ }
+ }
+});
+Object.extend(String, {
+ interpret: function(value) {
+ return value == null ? '' : String(value);
+ },
+ specialChar: {
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '\\': '\\\\'
+ }
+});
+
+Object.extend(String.prototype, {
+ gsub: function(pattern, replacement) {
+ var result = '', source = this, match;
+ replacement = arguments.callee.prepareReplacement(replacement);
+
+ while (source.length > 0) {
+ if (match = source.match(pattern)) {
+ result += source.slice(0, match.index);
+ result += String.interpret(replacement(match));
+ source = source.slice(match.index + match[0].length);
+ } else {
+ result += source, source = '';
+ }
+ }
+ return result;
+ },
+
+ sub: function(pattern, replacement, count) {
+ replacement = this.gsub.prepareReplacement(replacement);
+ count = Object.isUndefined(count) ? 1 : count;
+
+ return this.gsub(pattern, function(match) {
+ if (--count < 0) return match[0];
+ return replacement(match);
+ });
+ },
+
+ scan: function(pattern, iterator) {
+ this.gsub(pattern, iterator);
+ return String(this);
+ },
+
+ truncate: function(length, truncation) {
+ length = length || 30;
+ truncation = Object.isUndefined(truncation) ? '...' : truncation;
+ return this.length > length ?
+ this.slice(0, length - truncation.length) + truncation : String(this);
+ },
+
+ strip: function() {
+ return this.replace(/^\s+/, '').replace(/\s+$/, '');
+ },
+
+ stripTags: function() {
+ return this.replace(/<\/?[^>]+>/gi, '');
+ },
+
+ stripScripts: function() {
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+ },
+
+ extractScripts: (function() {
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'ig');
+ var matchOne = new RegExp(Prototype.ScriptFragment, 'i');
+ var matchComments = new RegExp('<!--\\s*' + Prototype.ScriptFragment + '\\s*-->', 'i');
+
+ return function() {
+ if (this.indexOf('<script') == -1) return [];
+ return (this.replace(matchComments, '').match(matchAll) || []).map(function(scriptTag) {
+ return (scriptTag.match(matchOne) || ['', ''])[1];
+ });
+ }
+ })(),
+
+ evalScripts: function() {
+ return this.extractScripts().map(function(script) { return eval(script) });
+ },
+
+ escapeHTML: function() {
+ var self = arguments.callee;
+ self.text.data = this;
+ return self.container.innerHTML.replace(/"/g, '&quot;');
+ },
+
+ unescapeHTML: function() {
+ var div = new Element('div');
+ // Safari requires the text nested inside another element to render correctly
+ div.innerHTML = '<pre>' + this.stripTags() + '</pre>';
+ div = div.firstChild;
+ return div.childNodes[0] ? (div.childNodes.length > 1 ?
+ $A(div.childNodes).inject('', function(memo, node) { return memo + node.nodeValue }) :
+ div.childNodes[0].nodeValue) : '';
+ },
+
+ toQueryParams: function(separator) {
+ var match = this.strip().match(/([^?#]*)(#.*)?$/);
+ if (!match) return { };
+
+ return match[1].split(separator || '&').inject({ }, function(hash, pair) {
+ if ((pair = pair.split('='))[0]) {
+ var key = decodeURIComponent(pair.shift());
+ var value = pair.length > 1 ? pair.join('=') : pair[0];
+ if (value != undefined) value = decodeURIComponent(value);
+
+ if (key in hash) {
+ if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
+ hash[key].push(value);
+ }
+ else hash[key] = value;
+ }
+ return hash;
+ });
+ },
+
+ toArray: function() {
+ return this.split('');
+ },
+
+ succ: function() {
+ return this.slice(0, this.length - 1) +
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+ },
+
+ times: function(count) {
+ return count < 1 ? '' : new Array(count + 1).join(this);
+ },
+
+ camelize: function() {
+ var parts = this.split('-'), len = parts.length;
+ if (len == 1) return parts[0];
+
+ var camelized = this.charAt(0) == '-'
+ ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
+ : parts[0];
+
+ for (var i = 1; i < len; i++)
+ camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
+
+ return camelized;
+ },
+
+ capitalize: function() {
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+ },
+
+ underscore: function() {
+ return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
+ },
+
+ dasherize: function() {
+ return this.gsub(/_/,'-');
+ },
+
+ inspect: function(useDoubleQuotes) {
+ var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
+ var character = String.specialChar[match[0]];
+ return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
+ });
+ if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
+ return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+ },
+
+ toJSON: function() {
+ return this.inspect(true);
+ },
+
+ unfilterJSON: function(filter) {
+ return this.sub(filter || Prototype.JSONFilter, '#{1}');
+ },
+
+ isJSON: function() {
+ var str = this;
+ if (str.blank()) return false;
+ str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+ return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
+ },
+
+ evalJSON: function(sanitize) {
+ var json = this.unfilterJSON();
+ try {
+ if (!sanitize || json.isJSON()) return eval('(' + json + ')');
+ } catch (e) { }
+ throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
+ },
+
+ include: function(pattern) {
+ return this.indexOf(pattern) > -1;
+ },
+
+ startsWith: function(pattern) {
+ return this.indexOf(pattern) === 0;
+ },
+
+ endsWith: function(pattern) {
+ var d = this.length - pattern.length;
+ return d >= 0 && this.lastIndexOf(pattern) === d;
+ },
+
+ empty: function() {
+ return this == '';
+ },
+
+ blank: function() {
+ return /^\s*$/.test(this);
+ },
+
+ interpolate: function(object, pattern) {
+ return new Template(this, pattern).evaluate(object);
+ }
+});
+
+String.prototype.gsub.prepareReplacement = function(replacement) {
+ if (Object.isFunction(replacement)) return replacement;
+ var template = new Template(replacement);
+ return function(match) { return template.evaluate(match) };
+};
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+Object.extend(String.prototype.escapeHTML, {
+ container: document.createElement('pre'),
+ text: document.createTextNode('')
+});
+
+String.prototype.escapeHTML.container.appendChild(String.prototype.escapeHTML.text);
+
+if (Prototype.Browser.IE) {
+ // IE converts all newlines to carriage returns so we swap them back
+ String.prototype.unescapeHTML = String.prototype.unescapeHTML.wrap(function(proceed) {
+ return proceed().replace(/\r/g, '\n')
+ });
+}
+
+if ('>'.escapeHTML() !== '&gt;') {
+ // Safari 3.x has issues with escaping the ">" character
+ (function() {
+ var escapeHTML = String.prototype.escapeHTML;
+ Object.extend(
+ String.prototype.escapeHTML = escapeHTML.wrap(function(proceed) {
+ return proceed().replace(/>/g, "&gt;")
+ }), {
+ container: escapeHTML.container,
+ text: escapeHTML.text
+ })
+ })();
+}
+
+if ('&'.escapeHTML() !== '&amp;') {
+ // Safari 2.x has issues with escaping html inside a "pre" element so we use the deprecated "xmp" element instead
+ Object.extend(String.prototype.escapeHTML, {
+ container: document.createElement('xmp'),
+ text: document.createTextNode('')
+ });
+ String.prototype.escapeHTML.container.appendChild(String.prototype.escapeHTML.text);
+}
+
+var Template = Class.create({
+ initialize: function(template, pattern) {
+ this.template = template.toString();
+ this.pattern = pattern || Template.Pattern;
+ },
+
+ evaluate: function(object) {
+ if (Object.isFunction(object.toTemplateReplacements))
+ object = object.toTemplateReplacements();
+
+ return this.template.gsub(this.pattern, function(match) {
+ if (object == null) return '';
+
+ var before = match[1] || '';
+ if (before == '\\') return match[2];
+
+ var ctx = object, expr = match[3];
+ var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
+ match = pattern.exec(expr);
+ if (match == null) return before;
+
+ while (match != null) {
+ var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
+ ctx = ctx[comp];
+ if (null == ctx || '' == match[3]) break;
+ expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
+ match = pattern.exec(expr);
+ }
+
+ return before + String.interpret(ctx);
+ });
+ }
+});
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+
+var $break = { };
+
+var Enumerable = {
+ each: function(iterator, context) {
+ var index = 0;
+ try {
+ this._each(function(value) {
+ iterator.call(context, value, index++);
+ });
+ } catch (e) {
+ if (e != $break) throw e;
+ }
+ return this;
+ },
+
+ eachSlice: function(number, iterator, context) {
+ var index = -number, slices = [], array = this.toArray();
+ if (number < 1) return array;
+ while ((index += number) < array.length)
+ slices.push(array.slice(index, index+number));
+ return slices.collect(iterator, context);
+ },
+
+ all: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result = true;
+ this.each(function(value, index) {
+ result = result && !!iterator.call(context, value, index);
+ if (!result) throw $break;
+ });
+ return result;
+ },
+
+ any: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result = false;
+ this.each(function(value, index) {
+ if (result = !!iterator.call(context, value, index))
+ throw $break;
+ });
+ return result;
+ },
+
+ collect: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var results = [];
+ this.each(function(value, index) {
+ results.push(iterator.call(context, value, index));
+ });
+ return results;
+ },
+
+ detect: function(iterator, context) {
+ var result;
+ this.each(function(value, index) {
+ if (iterator.call(context, value, index)) {
+ result = value;
+ throw $break;
+ }
+ });
+ return result;
+ },
+
+ findAll: function(iterator, context) {
+ var results = [];
+ this.each(function(value, index) {
+ if (iterator.call(context, value, index))
+ results.push(value);
+ });
+ return results;
+ },
+
+ grep: function(filter, iterator, context) {
+ iterator = iterator || Prototype.K;
+ var results = [];
+
+ if (Object.isString(filter))
+ filter = new RegExp(filter);
+
+ this.each(function(value, index) {
+ if (filter.match(value))
+ results.push(iterator.call(context, value, index));
+ });
+ return results;
+ },
+
+ include: function(object) {
+ if (Object.isFunction(this.indexOf))
+ if (this.indexOf(object) != -1) return true;
+
+ var found = false;
+ this.each(function(value) {
+ if (value == object) {
+ found = true;
+ throw $break;
+ }
+ });
+ return found;
+ },
+
+ inGroupsOf: function(number, fillWith) {
+ fillWith = Object.isUndefined(fillWith) ? null : fillWith;
+ return this.eachSlice(number, function(slice) {
+ while (slice.length < number) slice.push(fillWith);
+ return slice;
+ });
+ },
+
+ inject: function(memo, iterator, context) {
+ this.each(function(value, index) {
+ memo = iterator.call(context, memo, value, index);
+ });
+ return memo;
+ },
+
+ invoke: function(method) {
+ var args = $A(arguments).slice(1);
+ return this.map(function(value) {
+ return value[method].apply(value, args);
+ });
+ },
+
+ max: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result;
+ this.each(function(value, index) {
+ value = iterator.call(context, value, index);
+ if (result == null || value >= result)
+ result = value;
+ });
+ return result;
+ },
+
+ min: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result;
+ this.each(function(value, index) {
+ value = iterator.call(context, value, index);
+ if (result == null || value < result)
+ result = value;
+ });
+ return result;
+ },
+
+ partition: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var trues = [], falses = [];
+ this.each(function(value, index) {
+ (iterator.call(context, value, index) ?
+ trues : falses).push(value);
+ });
+ return [trues, falses];
+ },
+
+ pluck: function(property) {
+ var results = [];
+ this.each(function(value) {
+ results.push(value[property]);
+ });
+ return results;
+ },
+
+ reject: function(iterator, context) {
+ var results = [];
+ this.each(function(value, index) {
+ if (!iterator.call(context, value, index))
+ results.push(value);
+ });
+ return results;
+ },
+
+ sortBy: function(iterator, context) {
+ return this.map(function(value, index) {
+ return {
+ value: value,
+ criteria: iterator.call(context, value, index)
+ };
+ }).sort(function(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }).pluck('value');
+ },
+
+ toArray: function() {
+ return this.map();
+ },
+
+ zip: function() {
+ var iterator = Prototype.K, args = $A(arguments);
+ if (Object.isFunction(args.last()))
+ iterator = args.pop();
+
+ var collections = [this].concat(args).map($A);
+ return this.map(function(value, index) {
+ return iterator(collections.pluck(index));
+ });
+ },
+
+ size: function() {
+ return this.toArray().length;
+ },
+
+ inspect: function() {
+ return '#<Enumerable:' + this.toArray().inspect() + '>';
+ }
+};
+
+Object.extend(Enumerable, {
+ map: Enumerable.collect,
+ find: Enumerable.detect,
+ select: Enumerable.findAll,
+ filter: Enumerable.findAll,
+ member: Enumerable.include,
+ entries: Enumerable.toArray,
+ every: Enumerable.all,
+ some: Enumerable.any
+});
+function $A(iterable) {
+ if (!iterable) return [];
+ if (iterable.toArray) return iterable.toArray();
+ var length = iterable.length || 0, results = new Array(length);
+ while (length--) results[length] = iterable[length];
+ return results;
+}
+
+if (Prototype.Browser.WebKit) {
+ $A = function(iterable) {
+ if (!iterable) return [];
+ if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
+ iterable.toArray) return iterable.toArray();
+ var length = iterable.length || 0, results = new Array(length);
+ while (length--) results[length] = iterable[length];
+ return results;
+ };
+}
+
+Array.from = $A;
+
+Object.extend(Array.prototype, Enumerable);
+
+if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
+
+Object.extend(Array.prototype, {
+ _each: function(iterator) {
+ for (var i = 0, length = this.length; i < length; i++)
+ iterator(this[i]);
+ },
+
+ clear: function() {
+ this.length = 0;
+ return this;
+ },
+
+ first: function() {
+ return this[0];
+ },
+
+ last: function() {
+ return this[this.length - 1];
+ },
+
+ compact: function() {
+ return this.select(function(value) {
+ return value != null;
+ });
+ },
+
+ flatten: function() {
+ return this.inject([], function(array, value) {
+ return array.concat(Object.isArray(value) ?
+ value.flatten() : [value]);
+ });
+ },
+
+ without: function() {
+ var values = $A(arguments);
+ return this.select(function(value) {
+ return !values.include(value);
+ });
+ },
+
+ reverse: function(inline) {
+ return (inline !== false ? this : this.toArray())._reverse();
+ },
+
+ reduce: function() {
+ return this.length > 1 ? this : this[0];
+ },
+
+ uniq: function(sorted) {
+ return this.inject([], function(array, value, index) {
+ if (0 == index || (sorted ? array.last() != value : !array.include(value)))
+ array.push(value);
+ return array;
+ });
+ },
+
+ intersect: function(array) {
+ var length = array.length, i;
+ return this.uniq().findAll(function(item) {
+ i = length;
+ while (i--) if (item === array[i]) return true;
+ return false;
+ });
+ },
+
+ clone: function() {
+ return [].concat(this);
+ },
+
+ size: function() {
+ return this.length;
+ },
+
+ inspect: function() {
+ return '[' + this.map(Object.inspect).join(', ') + ']';
+ },
+
+ toJSON: function() {
+ var results = [];
+ this.each(function(object) {
+ var value = Object.toJSON(object);
+ if (!Object.isUndefined(value)) results.push(value);
+ });
+ return '[' + results.join(', ') + ']';
+ }
+});
+
+// use native browser JS 1.6 implementation if available
+if (Object.isFunction(Array.prototype.forEach))
+ Array.prototype._each = Array.prototype.forEach;
+
+if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
+ i || (i = 0);
+ var length = this.length;
+ if (i < 0) i = length + i;
+ for (; i < length; i++)
+ if (this[i] === item) return i;
+ return -1;
+};
+
+if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
+ i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
+ var n = this.slice(0, i).reverse().indexOf(item);
+ return (n < 0) ? n : i - n - 1;
+};
+
+Array.prototype.toArray = Array.prototype.clone;
+
+function $w(string) {
+ if (!Object.isString(string)) return [];
+ string = string.strip();
+ return string ? string.split(/\s+/) : [];
+}
+
+if (Prototype.Browser.Opera){
+ Array.prototype.concat = function() {
+ var array = [];
+ for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
+ for (var i = 0, length = arguments.length; i < length; i++) {
+ if (Object.isArray(arguments[i])) {
+ for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
+ array.push(arguments[i][j]);
+ } else {
+ array.push(arguments[i]);
+ }
+ }
+ return array;
+ };
+}
+Object.extend(Number.prototype, {
+ toColorPart: function() {
+ return this.toPaddedString(2, 16);
+ },
+
+ succ: function() {
+ return this + 1;
+ },
+
+ times: function(iterator, context) {
+ $R(0, this, true).each(iterator, context);
+ return this;
+ },
+
+ toPaddedString: function(length, radix) {
+ var string = this.toString(radix || 10);
+ return '0'.times(length - string.length) + string;
+ },
+
+ toJSON: function() {
+ return isFinite(this) ? this.toString() : 'null';
+ }
+});
+
+$w('abs round ceil floor').each(function(method){
+ Number.prototype[method] = Math[method].methodize();
+});
+function $H(object) {
+ return new Hash(object);
+};
+
+var Hash = Class.create(Enumerable, (function() {
+
+ function toQueryPair(key, value) {
+ if (Object.isUndefined(value)) return key;
+ return key + '=' + encodeURIComponent(String.interpret(value));
+ }
+
+ return {
+ initialize: function(object) {
+ this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
+ },
+
+ _each: function(iterator) {
+ for (var key in this._object) {
+ var value = this._object[key], pair = [key, value];
+ pair.key = key;
+ pair.value = value;
+ iterator(pair);
+ }
+ },
+
+ set: function(key, value) {
+ return this._object[key] = value;
+ },
+
+ get: function(key) {
+ // simulating poorly supported hasOwnProperty
+ if (this._object[key] !== Object.prototype[key])
+ return this._object[key];
+ },
+
+ unset: function(key) {
+ var value = this._object[key];
+ delete this._object[key];
+ return value;
+ },
+
+ toObject: function() {
+ return Object.clone(this._object);
+ },
+
+ keys: function() {
+ return this.pluck('key');
+ },
+
+ values: function() {
+ return this.pluck('value');
+ },
+
+ index: function(value) {
+ var match = this.detect(function(pair) {
+ return pair.value === value;
+ });
+ return match && match.key;
+ },
+
+ merge: function(object) {
+ return this.clone().update(object);
+ },
+
+ update: function(object) {
+ return new Hash(object).inject(this, function(result, pair) {
+ result.set(pair.key, pair.value);
+ return result;
+ });
+ },
+
+ toQueryString: function() {
+ return this.inject([], function(results, pair) {
+ var key = encodeURIComponent(pair.key), values = pair.value;
+
+ if (values && typeof values == 'object') {
+ if (Object.isArray(values))
+ return results.concat(values.map(toQueryPair.curry(key)));
+ } else results.push(toQueryPair(key, values));
+ return results;
+ }).join('&');
+ },
+
+ inspect: function() {
+ return '#<Hash:{' + this.map(function(pair) {
+ return pair.map(Object.inspect).join(': ');
+ }).join(', ') + '}>';
+ },
+
+ toJSON: function() {
+ return Object.toJSON(this.toObject());
+ },
+
+ clone: function() {
+ return new Hash(this);
+ }
+ }
+})());
+
+Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
+Hash.from = $H;
+var ObjectRange = Class.create(Enumerable, {
+ initialize: function(start, end, exclusive) {
+ this.start = start;
+ this.end = end;
+ this.exclusive = exclusive;
+ },
+
+ _each: function(iterator) {
+ var value = this.start;
+ while (this.include(value)) {
+ iterator(value);
+ value = value.succ();
+ }
+ },
+
+ include: function(value) {
+ if (value < this.start)
+ return false;
+ if (this.exclusive)
+ return value < this.end;
+ return value <= this.end;
+ }
+});
+
+var $R = function(start, end, exclusive) {
+ return new ObjectRange(start, end, exclusive);
+};
+
+var Ajax = {
+ getTransport: function() {
+ var transport = false;
+ Ajax.getTransport = Try.these(
+ function() {
+ /* fallback on activex xmlhttp to avoid IE7 local file-system read error */
+ if (Prototype.Browser.IE && window.location.href.indexOf('file://') == 0) throw 'skip';
+ transport = new XMLHttpRequest();
+ return function(){ return new XMLHttpRequest()}
+ },
+ function() {
+ transport = new ActiveXObject('Msxml2.XMLHTTP');
+ return function(){ return new ActiveXObject('Msxml2.XMLHTTP')}
+ },
+ function() {
+ transport = new ActiveXObject('Microsoft.XMLHTTP');
+ return function(){ return new ActiveXObject('Microsoft.XMLHTTP')}
+ }
+ ) || false;
+
+ return transport;
+ },
+
+ activeRequestCount: 0
+};
+
+Ajax.Responders = {
+ responders: [],
+
+ _each: function(iterator) {
+ this.responders._each(iterator);
+ },
+
+ register: function(responder) {
+ if (!this.include(responder))
+ this.responders.push(responder);
+ },
+
+ unregister: function(responder) {
+ this.responders = this.responders.without(responder);
+ },
+
+ dispatch: function(callback, request, transport, json) {
+ this.each(function(responder) {
+ if (Object.isFunction(responder[callback])) {
+ try {
+ responder[callback].apply(responder, [request, transport, json]);
+ } catch (e) { }
+ }
+ });
+ }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+ onCreate: function() { Ajax.activeRequestCount++ },
+ onComplete: function() { Ajax.activeRequestCount-- }
+});
+
+Ajax.Base = Class.create({
+ initialize: function(options) {
+ this.allowStatusZero = false;
+ this.options = {
+ method: 'post',
+ asynchronous: true,
+ contentType: 'application/x-www-form-urlencoded',
+ encoding: 'UTF-8',
+ parameters: '',
+ evalJSON: true,
+ evalJS: true
+ };
+ Object.extend(this.options, options || { });
+
+ this.options.method = this.options.method.toLowerCase();
+
+ if (Object.isString(this.options.parameters))
+ this.options.parameters = this.options.parameters.toQueryParams();
+ else if (Object.isHash(this.options.parameters))
+ this.options.parameters = this.options.parameters.toObject();
+ }
+});
+
+Ajax.Request = Class.create(Ajax.Base, {
+ _complete: false,
+ _allowStatusZero: false,
+
+ initialize: function($super, url, options) {
+ $super(options);
+ this.transport = Ajax.getTransport();
+ this.request(url);
+ },
+
+ request: (function() {
+
+ var absoluteExp = /^[a-z]{3,5}:/, fileExp = /^(file|ftp):/;
+ function isRelative(url) {
+ return !absoluteExp.test(url);
+ }
+
+ function isFileProtocol(url) {
+ return fileExp.test(url);
+ }
+
+ return function(url) {
+ var base;
+ if (Prototype.Browser.Opera && opera.version() < 9.5 &&
+ isRelative(url) && (base = $(document.documentElement).down('base')))
+ url = base.readAttribute('href') + url;
+
+ this.url = url;
+ this.method = this.options.method;
+ var params = Object.clone(this.options.parameters);
+ this._allowStatusZero = isFileProtocol(this.url) ||
+ (isRelative(url) && isFileProtocol(window.location.protocol));
+
+ if (!['get', 'post'].include(this.method)) {
+ // simulate other verbs over post
+ params['_method'] = this.method;
+ this.method = 'post';
+ }
+
+ this.parameters = params;
+
+ if (params = Object.toQueryString(params)) {
+ this.url += (this.url.include('?') ? '&' : '?') + params;
+ if (this.method == 'post' &&
+ /Konqueror|Safari|KHTML/.test(navigator.userAgent))
+ params += '&_=';
+ }
+
+ try {
+ var response = new Ajax.Response(this);
+ if (this.options.onCreate) this.options.onCreate(response);
+ Ajax.Responders.dispatch('onCreate', this, response);
+
+ this.transport.open(this.method.toUpperCase(), this.url,
+ this.options.asynchronous);
+
+ if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
+
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
+ this.setRequestHeaders();
+
+ this.body = this.method == 'post' ? (this.options.postBody || params) : null;
+ this.transport.send(this.body);
+
+ /* Force Firefox to handle ready state 4 for synchronous requests */
+ if (!this.options.asynchronous && this.transport.overrideMimeType)
+ this.onStateChange();
+ }
+ catch (e) {
+ this.dispatchException(e);
+ }
+ }
+ })(),
+
+ onStateChange: function() {
+ var readyState = this.transport.readyState;
+ if (readyState > 1 && !((readyState == 4) && this._complete))
+ this.respondToReadyState(this.transport.readyState);
+ },
+
+ setRequestHeaders: function() {
+ var headers = {
+ 'X-Requested-With': 'XMLHttpRequest',
+ 'X-Prototype-Version': Prototype.Version,
+ 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+ };
+
+ if (this.method == 'post') {
+ headers['Content-type'] = this.options.contentType +
+ (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+ /* Force "Connection: close" for older Mozilla browsers to work
+ * around a bug where XMLHttpRequest sends an incorrect
+ * Content-length header. See Mozilla Bugzilla #246651.
+ */
+ if (this.transport.overrideMimeType &&
+ (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
+ headers['Connection'] = 'close';
+ }
+
+ // user-defined headers
+ if (typeof this.options.requestHeaders == 'object') {
+ var extras = this.options.requestHeaders;
+
+ if (Object.isFunction(extras.push))
+ for (var i = 0, length = extras.length; i < length; i += 2)
+ headers[extras[i]] = extras[i+1];
+ else
+ $H(extras).each(function(pair) { headers[pair.key] = pair.value });
+ }
+
+ for (var name in headers)
+ this.transport.setRequestHeader(name, headers[name]);
+ },
+
+ success: function() {
+ var status = this.getStatus();
+ return (!status && this._allowStatusZero) || (status >= 200 && status < 300);
+ },
+
+ getStatus: function() {
+ try {
+ return this.transport.status || 0;
+ } catch (e) { return 0 }
+ },
+
+ respondToReadyState: function(readyState) {
+ var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
+
+ if (state == 'Complete') {
+ try {
+ this._complete = true;
+ (this.options['on' + response.status]
+ || this.options['on' + (this.success() ? 'Success' : 'Failure')]
+ || Prototype.emptyFunction)(response, response.headerJSON);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ var contentType = response.getHeader('Content-type');
+ if (this.options.evalJS == 'force'
+ || (this.options.evalJS && this.isSameOrigin() && contentType
+ && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
+ this.evalResponse();
+ }
+
+ try {
+ (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
+ Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ if (state == 'Complete') {
+ // avoid memory leak in MSIE: clean up
+ this.transport.onreadystatechange = Prototype.emptyFunction;
+ }
+ },
+
+ isSameOrigin: function() {
+ var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
+ return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
+ protocol: location.protocol,
+ domain: document.domain,
+ port: location.port ? ':' + location.port : ''
+ }));
+ },
+
+ getHeader: function(name) {
+ try {
+ return this.transport.getResponseHeader(name) || null;
+ } catch (e) { return null }
+ },
+
+ evalResponse: function() {
+ try {
+ return eval((this.transport.responseText || '').unfilterJSON());
+ } catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+ dispatchException: function(exception) {
+ (this.options.onException || Prototype.emptyFunction)(this, exception);
+ Ajax.Responders.dispatch('onException', this, exception);
+ }
+});
+
+Ajax.Request.Events =
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Response = Class.create({
+ initialize: function(request){
+ this.request = request;
+ var transport = this.transport = request.transport,
+ readyState = this.readyState = transport.readyState;
+
+ if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
+ this.status = this.getStatus();
+ this.statusText = this.getStatusText();
+ this.responseText = String.interpret(transport.responseText);
+ this.headerJSON = this._getHeaderJSON();
+ }
+
+ if (readyState == 4) {
+ var xml = transport.responseXML;
+ this.responseXML = Object.isUndefined(xml) ? null : xml;
+ this.responseJSON = this._getResponseJSON();
+ }
+ },
+
+ status: 0,
+ statusText: '',
+
+ getStatus: Ajax.Request.prototype.getStatus,
+
+ getStatusText: function() {
+ try {
+ return this.transport.statusText || '';
+ } catch (e) { return '' }
+ },
+
+ getHeader: Ajax.Request.prototype.getHeader,
+
+ getAllHeaders: function() {
+ try {
+ return this.getAllResponseHeaders();
+ } catch (e) { return null }
+ },
+
+ getResponseHeader: function(name) {
+ return this.transport.getResponseHeader(name);
+ },
+
+ getAllResponseHeaders: function() {
+ return this.transport.getAllResponseHeaders();
+ },
+
+ _getHeaderJSON: function() {
+ var json = this.getHeader('X-JSON');
+ if (!json) return null;
+ json = decodeURIComponent(escape(json));
+ try {
+ return json.evalJSON(this.request.options.sanitizeJSON ||
+ !this.request.isSameOrigin());
+ } catch (e) {
+ this.request.dispatchException(e);
+ }
+ },
+
+ _getResponseJSON: function() {
+ var options = this.request.options;
+ if (!options.evalJSON || (options.evalJSON != 'force' &&
+ !(this.getHeader('Content-type') || '').include('application/json')) ||
+ this.responseText.blank())
+ return null;
+ try {
+ return this.responseText.evalJSON(options.sanitizeJSON ||
+ !this.request.isSameOrigin());
+ } catch (e) {
+ this.request.dispatchException(e);
+ }
+ }
+});
+
+Ajax.Updater = Class.create(Ajax.Request, {
+ initialize: function($super, container, url, options) {
+ this.container = {
+ success: (container.success || container),
+ failure: (container.failure || (container.success ? null : container))
+ };
+
+ options = Object.clone(options);
+ var onComplete = options.onComplete;
+ options.onComplete = (function(response, json) {
+ this.updateContent(response.responseText);
+ if (Object.isFunction(onComplete)) onComplete(response, json);
+ }).bind(this);
+
+ $super(url, options);
+ },
+
+ updateContent: function(responseText) {
+ var receiver = this.container[this.success() ? 'success' : 'failure'],
+ options = this.options;
+
+ if (!options.evalScripts) responseText = responseText.stripScripts();
+
+ if (receiver = $(receiver)) {
+ if (options.insertion) {
+ if (Object.isString(options.insertion)) {
+ var insertion = { }; insertion[options.insertion] = responseText;
+ receiver.insert(insertion);
+ }
+ else options.insertion(receiver, responseText);
+ }
+ else receiver.update(responseText);
+ }
+ }
+});
+
+Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
+ initialize: function($super, container, url, options) {
+ $super(options);
+ this.onComplete = this.options.onComplete;
+
+ this.frequency = (this.options.frequency || 2);
+ this.decay = (this.options.decay || 1);
+
+ this.updater = { };
+ this.container = container;
+ this.url = url;
+
+ this.start();
+ },
+
+ start: function() {
+ this.options.onComplete = this.updateComplete.bind(this);
+ this.onTimerEvent();
+ },
+
+ stop: function() {
+ this.updater.options.onComplete = undefined;
+ clearTimeout(this.timer);
+ (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+ },
+
+ updateComplete: function(response) {
+ if (this.options.decay) {
+ this.decay = (response.responseText == this.lastText ?
+ this.decay * this.options.decay : 1);
+
+ this.lastText = response.responseText;
+ }
+ this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
+ },
+
+ onTimerEvent: function() {
+ this.updater = new Ajax.Updater(this.container, this.url, this.options);
+ }
+});
+function $(element) {
+ if (arguments.length > 1) {
+ for (var i = 0, elements = [], length = arguments.length; i < length; i++)
+ elements.push($(arguments[i]));
+ return elements;
+ }
+ if (Object.isString(element))
+ element = document.getElementById(element);
+ return Element.extend(element);
+}
+
+if (Prototype.BrowserFeatures.XPath) {
+ document._getElementsByXPath = function(expression, parentElement) {
+ var results = [];
+ var query = document.evaluate(expression, $(parentElement) || document,
+ null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ for (var i = 0, length = query.snapshotLength; i < length; i++)
+ results.push(Element.extend(query.snapshotItem(i)));
+ return results;
+ };
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Node) var Node = { };
+
+if (!Node.ELEMENT_NODE) {
+ // DOM level 2 ECMAScript Language Binding
+ Object.extend(Node, {
+ ELEMENT_NODE: 1,
+ ATTRIBUTE_NODE: 2,
+ TEXT_NODE: 3,
+ CDATA_SECTION_NODE: 4,
+ ENTITY_REFERENCE_NODE: 5,
+ ENTITY_NODE: 6,
+ PROCESSING_INSTRUCTION_NODE: 7,
+ COMMENT_NODE: 8,
+ DOCUMENT_NODE: 9,
+ DOCUMENT_TYPE_NODE: 10,
+ DOCUMENT_FRAGMENT_NODE: 11,
+ NOTATION_NODE: 12
+ });
+}
+
+(function() {
+ var element = this.Element;
+ this.Element = function(tagName, attributes) {
+ attributes = attributes || { };
+ tagName = tagName.toLowerCase();
+ var cache = Element.cache;
+ if (Prototype.Browser.IE && (attributes.name || attributes.type)) {
+ tagName = '<' + tagName +
+ (attributes.name ? ' name="' + attributes.name + '"' : '') +
+ (attributes.type ? ' type="' + attributes.type + '"' : '') + '>';
+ delete attributes.name; delete attributes.type;
+ return Element.writeAttribute(document.createElement(tagName), attributes);
+ }
+ if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
+ return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
+ };
+ Object.extend(this.Element, element || { });
+ if (element) this.Element.prototype = element.prototype;
+}).call(window);
+
+Element.cache = { };
+
+Element.Methods = {
+ visible: function(element) {
+ return $(element).style.display != 'none';
+ },
+
+ toggle: function(element) {
+ element = $(element);
+ Element[Element.visible(element) ? 'hide' : 'show'](element);
+ return element;
+ },
+
+ hide: function(element) {
+ element = $(element);
+ var originalDisplay = element.style.display;
+ if (originalDisplay && originalDisplay != 'none')
+ element._originalDisplay = originalDisplay;
+ element.style.display = 'none';
+ return element;
+ },
+
+ show: function(element) {
+ element = $(element);
+ if (element._originalDisplay) {
+ element.style.display = element._originalDisplay;
+ element._originalDisplay = null;
+ } else element.style.display = '';
+ return element;
+ },
+
+ remove: function(element) {
+ element = $(element);
+ element.parentNode.removeChild(element);
+ return element;
+ },
+
+ update: function(element, content) {
+ element = $(element);
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) return element.update().insert(content);
+ content = Object.toHTML(content);
+ element.innerHTML = content.stripScripts();
+ content.evalScripts.bind(content).defer();
+ return element;
+ },
+
+ replace: function(element, content) {
+ element = $(element);
+ if (content && content.toElement) content = content.toElement();
+ else if (!Object.isElement(content)) {
+ content = Object.toHTML(content);
+ var range = element.ownerDocument.createRange();
+ range.selectNode(element);
+ content.evalScripts.bind(content).defer();
+ content = range.createContextualFragment(content.stripScripts());
+ }
+ element.parentNode.replaceChild(content, element);
+ return element;
+ },
+
+ insert: function(element, insertions) {
+ element = $(element);
+
+ if (Object.isString(insertions) || Object.isNumber(insertions) ||
+ Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
+ insertions = {bottom:insertions};
+
+ var content, insert, tagName, childNodes;
+
+ for (var position in insertions) {
+ content = insertions[position];
+ position = position.toLowerCase();
+ insert = Element._insertionTranslations[position];
+
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) {
+ insert(element, content);
+ continue;
+ }
+
+ content = Object.toHTML(content);
+
+ tagName = ((position == 'before' || position == 'after')
+ ? element.parentNode : element).tagName.toUpperCase();
+
+ childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+
+ if (position == 'top' || position == 'after') childNodes.reverse();
+ childNodes.each(insert.curry(element));
+
+ content.evalScripts.bind(content).defer();
+ }
+
+ return element;
+ },
+
+ wrap: function(element, wrapper, attributes) {
+ element = $(element);
+ if (Object.isElement(wrapper))
+ $(wrapper).writeAttribute(attributes || { });
+ else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
+ else wrapper = new Element('div', wrapper);
+ if (element.parentNode)
+ element.parentNode.replaceChild(wrapper, element);
+ wrapper.appendChild(element);
+ return wrapper;
+ },
+
+ inspect: function(element) {
+ element = $(element);
+ var result = '<' + element.tagName.toLowerCase();
+ $H({'id': 'id', 'className': 'class'}).each(function(pair) {
+ var property = pair.first(), attribute = pair.last();
+ var value = (element[property] || '').toString();
+ if (value) result += ' ' + attribute + '=' + value.inspect(true);
+ });
+ return result + '>';
+ },
+
+ recursivelyCollect: function(element, property) {
+ element = $(element);
+ var elements = [];
+ while (element = element[property])
+ if (element.nodeType == 1)
+ elements.push(Element.extend(element));
+ return elements;
+ },
+
+ ancestors: function(element) {
+ return $(element).recursivelyCollect('parentNode');
+ },
+
+ descendants: function(element) {
+ return $(element).select("*");
+ },
+
+ firstDescendant: function(element) {
+ element = $(element).firstChild;
+ while (element && element.nodeType != 1) element = element.nextSibling;
+ return $(element);
+ },
+
+ immediateDescendants: function(element) {
+ if (!(element = $(element).firstChild)) return [];
+ while (element && element.nodeType != 1) element = element.nextSibling;
+ if (element) return [element].concat($(element).nextSiblings());
+ return [];
+ },
+
+ previousSiblings: function(element) {
+ return $(element).recursivelyCollect('previousSibling');
+ },
+
+ nextSiblings: function(element) {
+ return $(element).recursivelyCollect('nextSibling');
+ },
+
+ siblings: function(element) {
+ element = $(element);
+ return element.previousSiblings().reverse().concat(element.nextSiblings());
+ },
+
+ match: function(element, selector) {
+ if (Object.isString(selector))
+ selector = new Selector(selector);
+ return selector.match($(element));
+ },
+
+ up: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(element.parentNode);
+ var ancestors = element.ancestors();
+ return Object.isNumber(expression) ? ancestors[expression] :
+ Selector.findElement(ancestors, expression, index);
+ },
+
+ down: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return element.firstDescendant();
+ return Object.isNumber(expression) ? element.descendants()[expression] :
+ Element.select(element, expression)[index || 0];
+ },
+
+ previous: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
+ var previousSiblings = element.previousSiblings();
+ return Object.isNumber(expression) ? previousSiblings[expression] :
+ Selector.findElement(previousSiblings, expression, index);
+ },
+
+ next: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
+ var nextSiblings = element.nextSiblings();
+ return Object.isNumber(expression) ? nextSiblings[expression] :
+ Selector.findElement(nextSiblings, expression, index);
+ },
+
+ select: function() {
+ var args = $A(arguments), element = $(args.shift());
+ return Selector.findChildElements(element, args);
+ },
+
+ adjacent: function() {
+ var args = $A(arguments), element = $(args.shift());
+ return Selector.findChildElements(element.parentNode, args).without(element);
+ },
+
+ identify: function(element) {
+ element = $(element);
+ var id = element.readAttribute('id'), self = arguments.callee;
+ if (id) return id;
+ do { id = 'anonymous_element_' + self.counter++ } while ($(id));
+ element.writeAttribute('id', id);
+ return id;
+ },
+
+ readAttribute: function(element, name) {
+ element = $(element);
+ var t = Element._attributeTranslations.read;
+ if (t.names[name]) name = t.names[name];
+
+ if (Prototype.Browser.IE) {
+ // If we're reading from a form, avoid a conflict between an attribute
+ // and a child name.
+ if (element.tagName.toUpperCase() == 'FORM' &&
+ !/^((child|parent)Node|(next|previous)Sibling)$/.test(name) &&
+ element.children[name]){
+ element = $(element.cloneNode(false));
+ }
+ if (t.values[name]) return t.values[name](element, name);
+ if (name.include(':')) {
+ return (!element.attributes || !element.attributes[name]) ? null :
+ element.attributes[name].value;
+ }
+ } else if (t.values[name]) return t.values[name](element, name);
+
+ return element.getAttribute(name);
+ },
+
+ writeAttribute: function(element, name, value) {
+ element = $(element);
+ var attributes = { }, t = Element._attributeTranslations.write;
+
+ if (typeof name == 'object') attributes = name;
+ else attributes[name] = Object.isUndefined(value) ? true : value;
+
+ for (var attr in attributes) {
+ name = t.names[attr] || attr;
+ value = attributes[attr];
+ if (t.values[name]) name = t.values[name](element, value);
+ if (value === false || value === null)
+ element.removeAttribute(name);
+ else if (value === true)
+ element.setAttribute(name, name);
+ else element.setAttribute(name, value);
+ }
+ return element;
+ },
+
+ getHeight: function(element) {
+ return $(element).getDimensions().height;
+ },
+
+ getWidth: function(element) {
+ return $(element).getDimensions().width;
+ },
+
+ classNames: function(element) {
+ return new Element.ClassNames(element);
+ },
+
+ hasClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ var elementClassName = element.className;
+ return (elementClassName.length > 0 && (elementClassName == className ||
+ new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
+ },
+
+ addClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ if (!element.hasClassName(className))
+ element.className += (element.className ? ' ' : '') + className;
+ return element;
+ },
+
+ removeClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ element.className = element.className.replace(
+ new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
+ return element;
+ },
+
+ toggleClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ return element[element.hasClassName(className) ?
+ 'removeClassName' : 'addClassName'](className);
+ },
+
+ // removes whitespace-only text node children
+ cleanWhitespace: function(element) {
+ element = $(element);
+ var node = element.firstChild;
+ while (node) {
+ var nextNode = node.nextSibling;
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+ element.removeChild(node);
+ node = nextNode;
+ }
+ return element;
+ },
+
+ empty: function(element) {
+ return $(element).innerHTML.blank();
+ },
+
+ descendantOf: function(element, ancestor) {
+ element = $(element), ancestor = $(ancestor);
+
+ if (element.compareDocumentPosition)
+ return (element.compareDocumentPosition(ancestor) & 8) === 8;
+
+ if (ancestor.contains)
+ return ancestor.contains(element) && ancestor !== element;
+
+ while (element = element.parentNode)
+ if (element == ancestor) return true;
+
+ return false;
+ },
+
+ scrollTo: function(element) {
+ element = $(element);
+ var pos = element.cumulativeOffset();
+ window.scrollTo(pos[0], pos[1]);
+ return element;
+ },
+
+ getStyle: function(element, style) {
+ element = $(element);
+ style = style == 'float' ? 'cssFloat' : style.camelize();
+ var value = element.style[style];
+ if (!value || value == 'auto') {
+ var css = document.defaultView.getComputedStyle(element, null);
+ value = css ? css[style] : null;
+ }
+ if (style == 'opacity') return value ? parseFloat(value) : 1.0;
+ return value == 'auto' ? null : value;
+ },
+
+ getOpacity: function(element) {
+ return $(element).getStyle('opacity');
+ },
+
+ setStyle: function(element, styles) {
+ element = $(element);
+ var elementStyle = element.style, match;
+ if (Object.isString(styles)) {
+ element.style.cssText += ';' + styles;
+ return styles.include('opacity') ?
+ element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
+ }
+ for (var property in styles)
+ if (property == 'opacity') element.setOpacity(styles[property]);
+ else
+ elementStyle[(property == 'float' || property == 'cssFloat') ?
+ (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
+ property] = styles[property];
+
+ return element;
+ },
+
+ setOpacity: function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1 || value === '') ? '' :
+ (value < 0.00001) ? 0 : value;
+ return element;
+ },
+
+ getDimensions: function(element) {
+ element = $(element);
+ var display = element.getStyle('display'),
+ dimensions = { width: element.clientWidth, height: element.clientHeight };
+
+ // All *Width and *Height properties give 0 on elements with display: none,
+ // so enable the element temporarily
+ if (display === "none" || display === null) {
+ var els = element.style,
+ originalVisibility = els.visibility,
+ originalPosition = els.position,
+ originalDisplay = els.display;
+
+ els.visibility = 'hidden';
+ els.position = 'absolute';
+ els.display = 'block';
+
+ dimensions = { width: element.clientWidth, height: element.clientHeight };
+
+ els.display = originalDisplay;
+ els.position = originalPosition;
+ els.visibility = originalVisibility;
+ }
+
+ return dimensions;
+ },
+
+ makePositioned: function(element) {
+ element = $(element);
+ var pos = Element.getStyle(element, 'position');
+ if (pos == 'static' || !pos) {
+ element._madePositioned = true;
+ element.style.position = 'relative';
+ // Opera returns the offset relative to the positioning context, when an
+ // element is position relative but top and left have not been defined
+ if (window.opera) {
+ element.style.top = 0;
+ element.style.left = 0;
+ }
+ }
+ return element;
+ },
+
+ undoPositioned: function(element) {
+ element = $(element);
+ if (element._madePositioned) {
+ element._madePositioned = undefined;
+ element.style.position =
+ element.style.top =
+ element.style.left =
+ element.style.bottom =
+ element.style.right = '';
+ }
+ return element;
+ },
+
+ makeClipping: function(element) {
+ element = $(element);
+ if (element._overflow) return element;
+ element._overflow = Element.getStyle(element, 'overflow') || 'auto';
+ if (element._overflow !== 'hidden')
+ element.style.overflow = 'hidden';
+ return element;
+ },
+
+ undoClipping: function(element) {
+ element = $(element);
+ if (!element._overflow) return element;
+ element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
+ element._overflow = null;
+ return element;
+ },
+
+ cumulativeOffset: function(element) {
+ element = $(element);
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ } while (element);
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ positionedOffset: function(element) {
+ element = $(element);
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ if (element) {
+ if (element.tagName.toUpperCase() == 'BODY') break;
+ var p = Element.getStyle(element, 'position');
+ if (p !== 'static') break;
+ }
+ } while (element);
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ absolutize: function(element) {
+ element = $(element);
+ if (element.getStyle('position') == 'absolute') return element;
+ // Position.prepare(); // To be done manually by Scripty when it needs it.
+
+ var offsets = element.positionedOffset(),
+ dimensions = element.getDimensions(),
+ top = offsets[1],
+ left = offsets[0],
+ width = dimensions.width,
+ height = dimensions.height;
+
+ Object.extend(element, {
+ _originalLeft: left - parseFloat(element.style.left || 0),
+ _originalTop: top - parseFloat(element.style.top || 0),
+ _originalWidth: element.style.width,
+ _originalHeight: element.style.height
+ });
+
+ element.setStyle({
+ position: 'absolute',
+ top: top + 'px',
+ left: left + 'px',
+ width: width + 'px',
+ height: height + 'px'
+ });
+
+ return element;
+ },
+
+ relativize: function(element) {
+ element = $(element);
+ if (element.getStyle('position') == 'relative') return element;
+
+ if (!element._originalTop){
+ /* fix bizarre IE position issue with empty elements */
+ var isBuggy = element.outerHTML && element.innerHTML.blank();
+ if (isBuggy) element.innerHTML = '\x00';
+
+ Object.extend(element, {
+ _originalTop: element.offsetTop,
+ _originalLeft: element.offsetLeft,
+ _originalWidth: Element.getStyle(element, 'width'),
+ _originalHeight: Element.getStyle(element, 'height'),
+ _originalMarginTop: Element.getStyle(element, 'marginTop'),
+ _originalMarginLeft: Element.getStyle(element, 'marginLeft')
+ });
+
+ if (isBuggy) element.innerHTML = '';
+ }
+
+ Element.setStyle(element, {
+ position: 'relative',
+ width: element._originalWidth,
+ height: element._originalHeight,
+ marginTop: element._originalMarginTop,
+ marginLeft: element._originalMarginLeft
+ });
+
+ var offsets = element.positionedOffset(),
+ top = element._originalTop - offsets.top,
+ left = element._originalLeft - offsets.left;
+
+ var isAuto = /^(auto|)$/;
+ if (!isAuto.test(element.style.top)) top += element._originalTop;
+ if (!isAuto.test(element.style.left)) left += element._originalLeft;
+
+ Element.setStyle(element, {
+ top: top + 'px',
+ left: left + 'px'
+ });
+
+ return element;
+ },
+
+ getOffsetParent: function(element) {
+ element = $(element);
+ var op = element.offsetParent, docElement = document.documentElement;
+ if (op && op != docElement) return $(op);
+
+ while ((element = element.parentNode) && element !== docElement &&
+ element !== document) {
+ if (Element.getStyle(element, 'position') != 'static')
+ return $(element);
+ }
+
+ return $(document.body);
+ }
+};
+
+Object.extend(Element.Methods, (function() {
+ function getNumericStyle(element, style) {
+ return parseFloat(Element.getStyle(element, style)) || 0;
+ }
+
+ function getStyleDiff(element, source, style) {
+ return getNumericStyle(source, style) - getNumericStyle(element, style);
+ }
+
+ function cloneDimension(element, source, dimension) {
+ var d = Element.getDimensions(source), style = { };
+ style[dimension] = d[dimension] + 'px';
+
+ var styles = $w('margin padding');
+ var sides = (dimension === 'height') ? $w('top bottom') :
+ $w('left right');
+
+ var property;
+ for (var i = 0; i < 2; i++) {
+ for (var j = 0; j < 2; j++) {
+ property = styles[i] + sides[j].capitalize();
+ style[property] = (getNumericStyle(element, property) +
+ getStyleDiff(element, source, property)) + 'px';
+ }
+ }
+ Element.setStyle(element, style);
+ }
+
+ return {
+ cumulativeScrollOffset: function(element) {
+ element = $(element);
+ var valueT = 0, valueL = 0, endElement = document;
+ var B = Prototype.Browser;
+
+ // Safari and Opera need to stop at document.body or else they'll
+ // report inaccurate values.
+ if (B.WebKit || B.Opera && opera.version() < 9.5) {
+ if ([document, document.body, document.documentElement].include(element))
+ return Element._returnOffset(0, 0);
+
+ endElement = document.body;
+ }
+
+ if (Element.getStyle(element, 'position') !== 'fixed') {
+ while ((element = element.parentNode) && element !== endElement) {
+ if (Element.getStyle(element, 'position') === 'fixed') break;
+ valueT += element.scrollTop || 0;
+ valueL += element.scrollLeft || 0;
+ }
+ }
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ cumulativeOffset: function(element) {
+ element = $(element);
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += (element.offsetTop || 0);
+ valueL += (element.offsetLeft || 0);
+ } while ((element = Element.getOffsetParent(element)) != document.body);
+
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ positionedOffset: function(element) {
+ element = $(element);
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += (element.offsetTop || 0);
+ valueL += (element.offsetLeft || 0);
+ element = Element.getOffsetParent(element);
+ } while (element != document.body &&
+ Element.getStyle(element, 'position') == 'static');
+
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ viewportOffset: function(forElement) {
+ forElement = $(forElement);
+ var op, element = forElement, valueT = 0, valueL = 0;
+
+ do {
+ valueT += (element.offsetTop || 0);
+ valueL += (element.offsetLeft || 0);
+
+ // Safari fix
+ op = Element.getOffsetParent(element);
+ if (op == document.body && Element.getStyle(element,
+ 'position') == 'absolute') break;
+ } while ((element = op) != document.body);
+
+ var scrollOffset = Element.cumulativeScrollOffset(forElement);
+ valueT -= scrollOffset.top;
+ valueL -= scrollOffset.left;
+
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ clonePosition: function(element, source) {
+ element = $(element);
+ source = $(source);
+ var options = Object.extend({
+ setLeft: true,
+ setTop: true,
+ setWidth: true,
+ setHeight: true,
+ offsetTop: 0,
+ offsetLeft: 0
+ }, arguments[2] || { });
+
+ // find coordinate system to use
+ // delta [0,0] will do fine with position: fixed elements;
+ // position: absolute needs offsetParent deltas
+ var parent, delta = [0, 0];
+ if (Element.getStyle(element, 'position') == 'absolute') {
+ parent = Element.getOffsetParent(element);
+ delta = Element.viewportOffset(parent);
+ }
+
+ // correct by body offsets (fixes Safari)
+ if (parent == document.body) {
+ delta[0] -= document.body.offsetLeft;
+ delta[1] -= document.body.offsetTop;
+ }
+
+ // set dimensions
+ if (options.setWidth) cloneDimension(element, source, 'width');
+ if (options.setHeight) cloneDimension(element, source, 'height');
+
+ // find page position of source
+ var p = Element.viewportOffset(source),
+ borderOffset = ['borderLeftWidth', 'borderTopWidth'].map(
+ function(style) { return getStyleDiff(element, source, style); });
+
+ if (options.setLeft) {
+ var left = p[0] - delta[0] + borderOffset[0];
+ if (options.offsetLeft)
+ left += options.offsetLeft + getNumericStyle(element, 'paddingLeft');
+
+ element.style.left = left + 'px';
+ }
+ if (options.setTop) {
+ var top = p[1] - delta[1] + borderOffset[1];
+ if (options.offsetTop)
+ top += options.offsetTop + getNumericStyle(element, 'paddingTop');
+
+ element.style.top = top + 'px';
+ }
+ return element;
+ }
+ };
+})());
+
+Element.Methods.identify.counter = 1;
+
+Object.extend(Element.Methods, {
+ getElementsBySelector: Element.Methods.select,
+ childElements: Element.Methods.immediateDescendants
+});
+
+Element._attributeTranslations = {
+ write: {
+ names: {
+ className: 'class',
+ htmlFor: 'for'
+ },
+ values: { }
+ },
+
+ read: {
+ names: { },
+ values: {
+ _flag: function(element, attribute) {
+ return $(element).hasAttribute(attribute) ? attribute : null;
+ }
+ }
+ }
+};
+
+(function(v) {
+ Object.extend(v, {
+ disabled: v._flag,
+ checked: v._flag,
+ readonly: v._flag,
+ multiple: v._flag
+ });
+})(Element._attributeTranslations.read.values);
+
+if (Prototype.Browser.Opera) {
+ Element.Methods.getStyle = Element.Methods.getStyle.wrap(
+ function(proceed, element, style) {
+ switch (style) {
+ case 'left': case 'top': case 'right': case 'bottom':
+ if (proceed(element, 'position') === 'static') return null;
+ case 'height': case 'width':
+ // returns '0px' for hidden elements; we want it to return null
+ if (!Element.visible(element)) return null;
+
+ // returns the border-box dimensions rather than the content-box
+ // dimensions, so we subtract padding and borders from the value
+ var dim = parseInt(proceed(element, style), 10);
+
+ if (dim !== element['offset' + style.capitalize()])
+ return dim + 'px';
+
+ var properties;
+ if (style === 'height') {
+ properties = ['border-top-width', 'padding-top',
+ 'padding-bottom', 'border-bottom-width'];
+ }
+ else {
+ properties = ['border-left-width', 'padding-left',
+ 'padding-right', 'border-right-width'];
+ }
+ return properties.inject(dim, function(memo, property) {
+ var val = proceed(element, property);
+ return val === null ? memo : memo - parseInt(val, 10);
+ }) + 'px';
+ default: return proceed(element, style);
+ }
+ }
+ );
+
+ Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
+ function(proceed, element, attribute) {
+ if (attribute === 'title') return $(element).title;
+ return proceed(element, attribute);
+ }
+ );
+}
+
+else if (Prototype.Browser.IE) {
+ // IE doesn't report offsets correctly for static elements, so we change them
+ // to "relative" to get the values, then change them back.
+ Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
+ function(proceed, element) {
+ element = $(element);
+ // IE throws an error if element is not in document
+ try { element.offsetParent; }
+ catch(e) { return $(document.body); }
+
+ var position = element.getStyle('position');
+ if (position !== 'static') return proceed(element);
+ element.setStyle({ position: 'relative' });
+
+ var value = proceed(element);
+ element.setStyle({ position: position });
+ return value;
+ }
+ );
+
+ $w('positionedOffset viewportOffset').each(function(method) {
+ Element.Methods[method] = Element.Methods[method].wrap(
+ function(proceed, element) {
+ element = $(element);
+
+ var position = Element.getStyle(element, 'position');
+ if (position !== 'static') return proceed(element);
+
+ // Trigger hasLayout on the offset parent so that IE6 reports
+ // accurate offsetTop and offsetLeft values for position: fixed.
+ var offsetParent = Element.getOffsetParent(element),
+ style = { position: 'relative' };
+ if (Element.getOffsetParent(offsetParent, 'position') === 'fixed')
+ style.zoom = '1';
+
+ Element.setStyle(element, style);
+ var value = proceed(element);
+ Element.setStyle(element, { position: position});
+ return value;
+ }
+ );
+ });
+
+
+ Element.Methods.getStyle = function(element, style) {
+ element = $(element);
+ style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
+ var value = element.style[style];
+ if (!value && element.currentStyle) value = element.currentStyle[style];
+
+ if (style == 'opacity') {
+ if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
+ if (value[1]) return parseFloat(value[1]) / 100;
+ return 1.0;
+ }
+
+ if (value == 'auto') {
+ if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
+ return element['offset' + style.capitalize()] + 'px';
+ return null;
+ }
+ return value;
+ };
+
+ Element.Methods.setOpacity = function(element, value) {
+ function stripAlpha(filter){
+ return filter.replace(/alpha\([^\)]*\)/gi,'');
+ }
+ element = $(element);
+ var currentStyle = element.currentStyle;
+ if ((currentStyle && !currentStyle.hasLayout) ||
+ (!currentStyle && element.style.zoom == 'normal'))
+ element.style.zoom = 1;
+
+ var filter = element.getStyle('filter'), style = element.style;
+ if (value == 1 || value === '') {
+ (filter = stripAlpha(filter)) ?
+ style.filter = filter : style.removeAttribute('filter');
+ return element;
+ } else if (value < 0.00001) value = 0;
+ style.filter = stripAlpha(filter) +
+ 'alpha(opacity=' + (value * 100) + ')';
+ return element;
+ };
+
+ (function(t) {
+ t.has = { };
+ t.write.names = { };
+
+ $w('cellPadding cellSpacing colSpan rowSpan vAlign dateTime accessKey ' +
+ 'tabIndex encType maxLength readOnly longDesc frameBorder').each(function(attr) {
+ var lower = attr.toLowerCase();
+ t.has[lower] = attr;
+ t.read.names[lower] = attr;
+ t.write.names[lower] = attr;
+ });
+
+ [t.write.names, t.read.names].each(function(n) {
+ Object.extend(n, {
+ 'class': 'className',
+ 'for': 'htmlFor'
+ });
+ });
+ })(Element._attributeTranslations);
+
+ Object.extend(Element._attributeTranslations.read.values, {
+
+ _getAttr: function(element, attribute) {
+ return element.getAttribute(attribute, 2);
+ },
+
+ _getAttrNode: function(element, attribute) {
+ var node = element.getAttributeNode(attribute);
+ return node ? node.value : "";
+ },
+
+ _getEv: function(element, attribute) {
+ attribute = element.getAttribute(attribute);
+ return attribute ? attribute.toString().slice(23, -2) : null;
+ },
+
+ style: function(element) {
+ return element.style.cssText.toLowerCase();
+ },
+
+ title: function(element) {
+ return element.title;
+ }
+ });
+
+ Object.extend(Element._attributeTranslations.write.values, {
+ checked: function(element, value) {
+ element.checked = !!value;
+ },
+
+ encType: function(element, value) {
+ element.getAttributeNode('encType').value = value;
+ },
+
+ style: function(element, value) {
+ element.style.cssText = value ? value : '';
+ }
+ });
+
+ (function(v) {
+ delete v.readonly;
+ Object.extend(v, {
+ href: v._getAttr,
+ src: v._getAttr,
+ type: v._getAttr,
+ action: v._getAttrNode,
+ onload: v._getEv,
+ onunload: v._getEv,
+ onclick: v._getEv,
+ ondblclick: v._getEv,
+ onmousedown: v._getEv,
+ onmouseup: v._getEv,
+ onmouseover: v._getEv,
+ onmousemove: v._getEv,
+ onmouseout: v._getEv,
+ onfocus: v._getEv,
+ onblur: v._getEv,
+ onkeypress: v._getEv,
+ onkeydown: v._getEv,
+ onkeyup: v._getEv,
+ onsubmit: v._getEv,
+ onreset: v._getEv,
+ onselect: v._getEv,
+ onchange: v._getEv,
+ readOnly: v._flag.wrap(function(proceed, element, attribute) {
+ attribute = proceed(element, attribute);
+ return attribute? 'readonly' : null;
+ })
+ });
+ })(Element._attributeTranslations.read.values);
+}
+
+else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
+ Element.Methods.setOpacity = function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1) ? 0.999999 :
+ (value === '') ? '' : (value < 0.00001) ? 0 : value;
+ return element;
+ };
+}
+
+else if (Prototype.Browser.WebKit) {
+ Element.Methods.setOpacity = function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1 || value === '') ? '' :
+ (value < 0.00001) ? 0 : value;
+
+ if (value == 1)
+ if (element.tagName.toUpperCase() == 'IMG' && element.width) {
+ element.width++; element.width--;
+ } else try {
+ var n = document.createTextNode(' ');
+ element.appendChild(n);
+ element.removeChild(n);
+ } catch (e) { }
+
+ return element;
+ };
+
+ // Safari returns margins on body which is incorrect if the child is absolutely
+ // positioned. For performance reasons, redefine Element#cumulativeOffset for
+ // KHTML/WebKit only.
+ Element.Methods.cumulativeOffset = function(element) {
+ element = $(element);
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ if (element.offsetParent == document.body)
+ if (Element.getStyle(element, 'position') == 'absolute') break;
+
+ element = element.offsetParent;
+ } while (element);
+
+ return Element._returnOffset(valueL, valueT);
+ };
+}
+
+if (Prototype.Browser.IE || Prototype.Browser.Opera) {
+ // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
+ Element.Methods.update = function(element, content) {
+ element = $(element);
+
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) return element.update().insert(content);
+
+ content = Object.toHTML(content);
+ var tagName = element.tagName.toUpperCase();
+
+ if (tagName in Element._insertionTranslations.tags) {
+ $A(element.childNodes).each(function(node) { element.removeChild(node) });
+ Element._getContentFromAnonymousElement(tagName, content.stripScripts())
+ .each(function(node) { element.appendChild(node) });
+ }
+ else element.innerHTML = content.stripScripts();
+
+ content.evalScripts.bind(content).defer();
+ return element;
+ };
+}
+
+if (Prototype.Browser.IE) {
+ // Wrap Element#update to clean up event handlers on
+ // newly-removed elements. Prevents memory leaks in IE.
+ Element.Methods.update = Element.Methods.update.wrap(
+ function(proceed, element, contents) {
+ Element.select(element, '*').each(Event.stopObserving);
+ return proceed(element, contents);
+ }
+ );
+}
+
+if ('outerHTML' in document.createElement('div')) {
+ Element.Methods.replace = function(element, content) {
+ element = $(element);
+
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) {
+ element.parentNode.replaceChild(content, element);
+ return element;
+ }
+
+ content = Object.toHTML(content);
+ var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
+
+ // Avoid outerHTML in IE because it incorrectly removes the replaced
+ // elements' child nodes.
+ if (Element._insertionTranslations.tags[tagName] || Prototype.Browser.IE) {
+ var nextSibling = element.next();
+ var fragments = Element._getContentFromAnonymousElement(tagName,
+ content.stripScripts());
+ parent.removeChild(element);
+ if (nextSibling)
+ fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
+ else
+ fragments.each(function(node) { parent.appendChild(node) });
+ }
+ else element.outerHTML = content.stripScripts();
+
+ content.evalScripts.bind(content).defer();
+ return element;
+ };
+}
+
+Element._returnOffset = function(l, t) {
+ var result = [l, t];
+ result.left = l;
+ result.top = t;
+ return result;
+};
+
+Element._getContentFromAnonymousElement = function(tagName, html) {
+ var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
+ if (t) {
+ div.innerHTML = t[0] + html + t[1];
+ t[2].times(function() { div = div.firstChild });
+ } else div.innerHTML = html;
+ return $A(div.childNodes);
+};
+
+Element._insertionTranslations = {
+ before: function(element, node) {
+ element.parentNode.insertBefore(node, element);
+ },
+ top: function(element, node) {
+ element.insertBefore(node, element.firstChild);
+ },
+ bottom: function(element, node) {
+ element.appendChild(node);
+ },
+ after: function(element, node) {
+ element.parentNode.insertBefore(node, element.nextSibling);
+ },
+ tags: {
+ TABLE: ['<table>', '</table>', 1],
+ TBODY: ['<table><tbody>', '</tbody></table>', 2],
+ TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
+ TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
+ SELECT: ['<select>', '</select>', 1]
+ }
+};
+
+(function() {
+ Object.extend(this.tags, {
+ THEAD: this.tags.TBODY,
+ TFOOT: this.tags.TBODY,
+ TH: this.tags.TD
+ });
+}).call(Element._insertionTranslations);
+
+Element.Methods.Simulated = {
+ // No use of $ in this function in order to keep things fast.
+ // Used by the Selector class.
+ hasAttribute: function(element, attribute) {
+ attribute = Element._attributeTranslations.has[attribute] || attribute;
+ var node = element.getAttributeNode(attribute);
+ return !!(node && node.specified);
+ }
+};
+
+Element.Methods.ByTag = { };
+
+Object.extend(Element, Element.Methods);
+
+if (!Prototype.BrowserFeatures.ElementExtensions &&
+ document.createElement('div')['__proto__']) {
+ window.HTMLElement = { };
+ window.HTMLElement.prototype = document.createElement('div')['__proto__'];
+ Prototype.BrowserFeatures.ElementExtensions = true;
+}
+
+Element.extend = (function() {
+ if (Prototype.BrowserFeatures.SpecificElementExtensions)
+ return Prototype.K;
+
+ var Methods = { }, ByTag = Element.Methods.ByTag;
+
+ var extend = Object.extend(function(element) {
+ if (!element || element._extendedByPrototype ||
+ element.nodeType != 1 || element == window) return element;
+
+ // Filter out XML nodes in IE.
+ if (!(element.ownerDocument || element).body) return element;
+
+ var methods = Object.clone(Methods),
+ tagName = element.tagName.toUpperCase(), property, value;
+
+ // extend methods for specific tags
+ if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
+
+ for (property in methods) {
+ value = methods[property];
+ if (Object.isFunction(value) && !(property in element))
+ element[property] = value.methodize();
+ }
+
+ element._extendedByPrototype = Prototype.emptyFunction;
+ return element;
+
+ }, {
+ refresh: function() {
+ // extend methods for all tags (Safari doesn't need this)
+ if (!Prototype.BrowserFeatures.ElementExtensions) {
+ Object.extend(Methods, Element.Methods);
+ Object.extend(Methods, Element.Methods.Simulated);
+ }
+ }
+ });
+
+ extend.refresh();
+ return extend;
+})();
+
+
+// No use of $ in this function in order to keep things fast.
+// Used by the Selector class.
+Element.hasAttribute = function(element, attribute) {
+ if (element.hasAttribute) return element.hasAttribute(attribute);
+ return Element.Methods.Simulated.hasAttribute(element, attribute);
+};
+
+Element.addMethods = function(methods) {
+ var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
+
+ if (!methods) {
+ Object.extend(Form, Form.Methods);
+ Object.extend(Form.Element, Form.Element.Methods);
+ Object.extend(Element.Methods.ByTag, {
+ "BUTTON": Object.clone(Form.Element.Methods),
+ "FORM": Object.clone(Form.Methods),
+ "INPUT": Object.clone(Form.Element.Methods),
+ "SELECT": Object.clone(Form.Element.Methods),
+ "TEXTAREA": Object.clone(Form.Element.Methods)
+ });
+ }
+
+ if (arguments.length == 2) {
+ var tagName = methods;
+ methods = arguments[1];
+ }
+
+ if (!tagName) Object.extend(Element.Methods, methods || { });
+ else {
+ if (Object.isArray(tagName)) tagName.each(extend);
+ else extend(tagName);
+ }
+
+ function extend(tagName) {
+ tagName = tagName.toUpperCase();
+ if (!Element.Methods.ByTag[tagName])
+ Element.Methods.ByTag[tagName] = { };
+ Object.extend(Element.Methods.ByTag[tagName], methods);
+ }
+
+ function copy(methods, destination, onlyIfAbsent) {
+ onlyIfAbsent = onlyIfAbsent || false;
+ for (var property in methods) {
+ var value = methods[property];
+ if (!Object.isFunction(value)) continue;
+ if (!onlyIfAbsent || !(property in destination))
+ destination[property] = value.methodize();
+ }
+ }
+
+ function findDOMClass(tagName) {
+ var klass;
+ var trans = {
+ "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
+ "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
+ "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
+ "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
+ "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
+ "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
+ "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
+ "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
+ "FrameSet", "IFRAME": "IFrame"
+ };
+ if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
+ if (window[klass]) return window[klass];
+ klass = 'HTML' + tagName + 'Element';
+ if (window[klass]) return window[klass];
+ klass = 'HTML' + tagName.capitalize() + 'Element';
+ if (window[klass]) return window[klass];
+
+ window[klass] = { };
+ window[klass].prototype = document.createElement(tagName)['__proto__'];
+ return window[klass];
+ }
+
+ if (F.ElementExtensions) {
+ copy(Element.Methods, HTMLElement.prototype);
+ copy(Element.Methods.Simulated, HTMLElement.prototype, true);
+ }
+
+ if (F.SpecificElementExtensions) {
+ for (var tag in Element.Methods.ByTag) {
+ var klass = findDOMClass(tag);
+ if (Object.isUndefined(klass)) continue;
+ copy(T[tag], klass.prototype);
+ }
+ }
+
+ Object.extend(Element, Element.Methods);
+ delete Element.ByTag;
+
+ if (Element.extend.refresh) Element.extend.refresh();
+ Element.cache = { };
+};
+
+document.viewport = {
+ getDimensions: function() {
+ var dimensions = { }, B = Prototype.Browser;
+ $w('width height').each(function(d) {
+ var D = d.capitalize();
+ dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
+ (B.Opera && opera.version() < 9.5) ? document.body['client' + D] : document.documentElement['client' + D];
+ });
+ return dimensions;
+ },
+
+ getWidth: function() {
+ return this.getDimensions().width;
+ },
+
+ getHeight: function() {
+ return this.getDimensions().height;
+ },
+
+ getScrollOffsets: function() {
+ return Element._returnOffset(
+ window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
+ window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
+ }
+};
+/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
+ * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
+ * license. Please see http://www.yui-ext.com/ for more information. */
+
+var Selector = Class.create({
+ initialize: function(expression) {
+ this.expression = expression.strip();
+
+ if (this.shouldUseSelectorsAPI()) {
+ this.mode = 'selectorsAPI';
+ } else if (this.shouldUseXPath()) {
+ this.mode = 'xpath';
+ this.compileXPathMatcher();
+ } else {
+ this.mode = "normal";
+ this.compileMatcher();
+ }
+
+ },
+
+ shouldUseXPath: function() {
+ if (!Prototype.BrowserFeatures.XPath) return false;
+
+ var e = this.expression;
+
+ // Safari 3 chokes on :*-of-type and :empty
+ if (Prototype.Browser.WebKit &&
+ (e.include("-of-type") || e.include(":empty")))
+ return false;
+
+ // XPath can't do namespaced attributes, nor can it read
+ // the "checked" property from DOM nodes
+ if ((/(\[[\w-]*?:|:checked)/).test(e))
+ return false;
+
+ return true;
+ },
+
+ shouldUseSelectorsAPI: function() {
+ if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
+
+ if (!Selector._div) Selector._div = new Element('div');
+
+ // Make sure the browser treats the selector as valid. Test on an
+ // isolated element to minimize cost of this check.
+ try {
+ Selector._div.querySelector(this.expression);
+ } catch(e) {
+ return false;
+ }
+
+ return true;
+ },
+
+ compileMatcher: function() {
+ var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
+ c = Selector.criteria, le, p, m;
+
+ if (Selector._cache[e]) {
+ this.matcher = Selector._cache[e];
+ return;
+ }
+
+ this.matcher = ["this.matcher = function(root) {",
+ "var r = root, h = Selector.handlers, c = false, n;"];
+
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ p = ps[i];
+ if (m = e.match(p)) {
+ this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
+ new Template(c[i]).evaluate(m));
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+
+ this.matcher.push("return h.unique(n);\n}");
+ eval(this.matcher.join('\n'));
+ Selector._cache[this.expression] = this.matcher;
+ },
+
+ compileXPathMatcher: function() {
+ var e = this.expression, ps = Selector.patterns,
+ x = Selector.xpath, le, m;
+
+ if (Selector._cache[e]) {
+ this.xpath = Selector._cache[e]; return;
+ }
+
+ this.matcher = ['.//*'];
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ if (m = e.match(ps[i])) {
+ this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
+ new Template(x[i]).evaluate(m));
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+
+ this.xpath = this.matcher.join('');
+ Selector._cache[this.expression] = this.xpath;
+ },
+
+ findElements: function(root) {
+ root = root || document;
+ var e = this.expression, results;
+
+ switch (this.mode) {
+ case 'selectorsAPI':
+ // querySelectorAll queries document-wide, then filters to descendants
+ // of the context element. That's not what we want.
+ // Add an explicit context to the selector if necessary.
+ if (root !== document) {
+ var oldId = root.id, id = $(root).identify();
+ e = "#" + id + " " + e;
+ }
+
+ results = $A(root.querySelectorAll(e)).map(Element.extend);
+ root.id = oldId;
+
+ return results;
+ case 'xpath':
+ return document._getElementsByXPath(this.xpath, root);
+ default:
+ return this.matcher(root);
+ }
+ },
+
+ match: function(element) {
+ this.tokens = [];
+
+ var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
+ var le, p, m;
+
+ while (e && le !== e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ p = ps[i];
+ if (m = e.match(p)) {
+ // use the Selector.assertions methods unless the selector
+ // is too complex.
+ if (as[i]) {
+ this.tokens.push([i, Object.clone(m)]);
+ e = e.replace(m[0], '');
+ } else {
+ // reluctantly do a document-wide search
+ // and look for a match in the array
+ return this.findElements(document).include(element);
+ }
+ }
+ }
+ }
+
+ var match = true, name, matches;
+ for (var i = 0, token; token = this.tokens[i]; i++) {
+ name = token[0], matches = token[1];
+ if (!Selector.assertions[name](element, matches)) {
+ match = false; break;
+ }
+ }
+
+ return match;
+ },
+
+ toString: function() {
+ return this.expression;
+ },
+
+ inspect: function() {
+ return "#<Selector:" + this.expression.inspect() + ">";
+ }
+});
+
+Object.extend(Selector, {
+ _cache: { },
+
+ xpath: {
+ descendant: "//*",
+ child: "/*",
+ adjacent: "/following-sibling::*[1]",
+ laterSibling: '/following-sibling::*',
+ tagName: function(m) {
+ if (m[1] == '*') return '';
+ return "[local-name()='" + m[1].toLowerCase() +
+ "' or local-name()='" + m[1].toUpperCase() + "']";
+ },
+ className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
+ id: "[@id='#{1}']",
+ attrPresence: function(m) {
+ m[1] = m[1].toLowerCase();
+ return new Template("[@#{1}]").evaluate(m);
+ },
+ attr: function(m) {
+ m[1] = m[1].toLowerCase();
+ m[3] = m[5] || m[6];
+ return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
+ },
+ pseudo: function(m) {
+ var h = Selector.xpath.pseudos[m[1]];
+ if (!h) return '';
+ if (Object.isFunction(h)) return h(m);
+ return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
+ },
+ operators: {
+ '=': "[@#{1}='#{3}']",
+ '!=': "[@#{1}!='#{3}']",
+ '^=': "[starts-with(@#{1}, '#{3}')]",
+ '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
+ '*=': "[contains(@#{1}, '#{3}')]",
+ '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
+ '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
+ },
+ pseudos: {
+ 'first-child': '[not(preceding-sibling::*)]',
+ 'last-child': '[not(following-sibling::*)]',
+ 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
+ 'empty': "[count(*) = 0 and (count(text()) = 0)]",
+ 'checked': "[@checked]",
+ 'disabled': "[(@disabled) and (@type!='hidden')]",
+ 'enabled': "[not(@disabled) and (@type!='hidden')]",
+ 'not': function(m) {
+ var e = m[6], p = Selector.patterns,
+ x = Selector.xpath, le, v;
+
+ var exclusion = [];
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in p) {
+ if (m = e.match(p[i])) {
+ v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
+ exclusion.push("(" + v.substring(1, v.length - 1) + ")");
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+ return "[not(" + exclusion.join(" and ") + ")]";
+ },
+ 'nth-child': function(m) {
+ return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
+ },
+ 'nth-last-child': function(m) {
+ return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
+ },
+ 'nth-of-type': function(m) {
+ return Selector.xpath.pseudos.nth("position() ", m);
+ },
+ 'nth-last-of-type': function(m) {
+ return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
+ },
+ 'first-of-type': function(m) {
+ m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
+ },
+ 'last-of-type': function(m) {
+ m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
+ },
+ 'only-of-type': function(m) {
+ var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
+ },
+ nth: function(fragment, m) {
+ var mm, formula = m[6], predicate;
+ if (formula == 'even') formula = '2n+0';
+ if (formula == 'odd') formula = '2n+1';
+ if (mm = formula.match(/^(\d+)$/)) // digit only
+ return '[' + fragment + "= " + mm[1] + ']';
+ if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+ if (mm[1] == "-") mm[1] = -1;
+ var a = mm[1] ? Number(mm[1]) : 1;
+ var b = mm[2] ? Number(mm[2]) : 0;
+ predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
+ "((#{fragment} - #{b}) div #{a} >= 0)]";
+ return new Template(predicate).evaluate({
+ fragment: fragment, a: a, b: b });
+ }
+ }
+ }
+ },
+
+ criteria: {
+ tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
+ className: 'n = h.className(n, r, "#{1}", c); c = false;',
+ id: 'n = h.id(n, r, "#{1}", c); c = false;',
+ attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
+ attr: function(m) {
+ m[3] = (m[5] || m[6]);
+ return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
+ },
+ pseudo: function(m) {
+ if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
+ return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
+ },
+ descendant: 'c = "descendant";',
+ child: 'c = "child";',
+ adjacent: 'c = "adjacent";',
+ laterSibling: 'c = "laterSibling";'
+ },
+
+ patterns: {
+ // combinators must be listed first
+ // (and descendant needs to be last combinator)
+ laterSibling: /^\s*~\s*/,
+ child: /^\s*>\s*/,
+ adjacent: /^\s*\+\s*/,
+ descendant: /^\s/,
+
+ // selectors follow
+ tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
+ id: /^#([\w\-\*]+)(\b|$)/,
+ className: /^\.([\w\-\*]+)(\b|$)/,
+ pseudo:
+/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
+ attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
+ attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
+ },
+
+ // for Selector.match and Element#match
+ assertions: {
+ tagName: function(element, matches) {
+ return matches[1].toUpperCase() == element.tagName.toUpperCase();
+ },
+
+ className: function(element, matches) {
+ return Element.hasClassName(element, matches[1]);
+ },
+
+ id: function(element, matches) {
+ return element.id === matches[1];
+ },
+
+ attrPresence: function(element, matches) {
+ return Element.hasAttribute(element, matches[1]);
+ },
+
+ attr: function(element, matches) {
+ var nodeValue = Element.readAttribute(element, matches[1]);
+ return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
+ }
+ },
+
+ handlers: {
+ // UTILITY FUNCTIONS
+ // joins two collections
+ concat: function(a, b) {
+ for (var i = 0, node; node = b[i]; i++)
+ a.push(node);
+ return a;
+ },
+
+ // marks an array of nodes for counting
+ mark: function(nodes) {
+ var _true = Prototype.emptyFunction;
+ for (var i = 0, node; node = nodes[i]; i++)
+ node._countedByPrototype = _true;
+ return nodes;
+ },
+
+ unmark: function(nodes) {
+ for (var i = 0, node; node = nodes[i]; i++)
+ node._countedByPrototype = undefined;
+ return nodes;
+ },
+
+ // mark each child node with its position (for nth calls)
+ // "ofType" flag indicates whether we're indexing for nth-of-type
+ // rather than nth-child
+ index: function(parentNode, reverse, ofType) {
+ parentNode._countedByPrototype = Prototype.emptyFunction;
+ if (reverse) {
+ for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
+ var node = nodes[i];
+ if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+ }
+ } else {
+ for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
+ if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+ }
+ },
+
+ // filters out duplicates and extends all nodes
+ unique: function(nodes) {
+ if (nodes.length == 0) return nodes;
+ var results = [], n;
+ for (var i = 0, l = nodes.length; i < l; i++)
+ if (!(n = nodes[i])._countedByPrototype) {
+ n._countedByPrototype = Prototype.emptyFunction;
+ results.push(Element.extend(n));
+ }
+ return Selector.handlers.unmark(results);
+ },
+
+ // COMBINATOR FUNCTIONS
+ descendant: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ h.concat(results, node.getElementsByTagName('*'));
+ return results;
+ },
+
+ child: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ for (var j = 0, child; child = node.childNodes[j]; j++)
+ if (child.nodeType == 1 && child.tagName != '!') results.push(child);
+ }
+ return results;
+ },
+
+ adjacent: function(nodes) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ var next = this.nextElementSibling(node);
+ if (next) results.push(next);
+ }
+ return results;
+ },
+
+ laterSibling: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ h.concat(results, Element.nextSiblings(node));
+ return results;
+ },
+
+ nextElementSibling: function(node) {
+ while (node = node.nextSibling)
+ if (node.nodeType == 1) return node;
+ return null;
+ },
+
+ previousElementSibling: function(node) {
+ while (node = node.previousSibling)
+ if (node.nodeType == 1) return node;
+ return null;
+ },
+
+ // TOKEN FUNCTIONS
+ tagName: function(nodes, root, tagName, combinator) {
+ var uTagName = tagName.toUpperCase();
+ var results = [], h = Selector.handlers;
+ if (nodes) {
+ if (combinator) {
+ // fastlane for ordinary descendant combinators
+ if (combinator == "descendant") {
+ for (var i = 0, node; node = nodes[i]; i++)
+ h.concat(results, node.getElementsByTagName(tagName));
+ return results;
+ } else nodes = this[combinator](nodes);
+ if (tagName == "*") return nodes;
+ }
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node.tagName.toUpperCase() === uTagName) results.push(node);
+ return results;
+ } else return root.getElementsByTagName(tagName);
+ },
+
+ id: function(nodes, root, id, combinator) {
+ var targetNode = $(id), h = Selector.handlers;
+ if (!targetNode) {
+ // IE doesn't find elements by ID if they're not attached to the
+ // document.
+ if (Prototype.Browser.IE && (root.sourceIndex < 1 || root === document)) {
+ var nodes = root.getElementsByTagName('*');
+ for (var i = 0, node; node = nodes[i]; i++) {
+ if (node[id] = id) {
+ targetNode = node; break;
+ }
+ } if (!targetNode) return [];
+ } else return [];
+ }
+
+ if (!nodes && root === document) return [targetNode];
+ if (nodes) {
+ if (combinator) {
+ if (combinator == 'child') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (targetNode.parentNode == node) return [targetNode];
+ } else if (combinator == 'descendant') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Element.descendantOf(targetNode, node)) return [targetNode];
+ } else if (combinator == 'adjacent') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Selector.handlers.previousElementSibling(targetNode) == node)
+ return [targetNode];
+ } else nodes = h[combinator](nodes);
+ }
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node == targetNode) return [targetNode];
+ return [];
+ }
+ return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
+ },
+
+ className: function(nodes, root, className, combinator) {
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ return Selector.handlers.byClassName(nodes, root, className);
+ },
+
+ byClassName: function(nodes, root, className) {
+ if (!nodes) nodes = Selector.handlers.descendant([root]);
+ var needle = ' ' + className + ' ';
+ for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
+ nodeClassName = node.className;
+ if (nodeClassName.length == 0) continue;
+ if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
+ results.push(node);
+ }
+ return results;
+ },
+
+ attrPresence: function(nodes, root, attr, combinator) {
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ var results = [];
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Element.hasAttribute(node, attr)) results.push(node);
+ return results;
+ },
+
+ attr: function(nodes, root, attr, value, operator, combinator) {
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ var handler = Selector.operators[operator], results = [];
+ for (var i = 0, node; node = nodes[i]; i++) {
+ var nodeValue = Element.readAttribute(node, attr);
+ if (nodeValue === null) continue;
+ if (handler(nodeValue, value)) results.push(node);
+ }
+ return results;
+ },
+
+ pseudo: function(nodes, name, value, root, combinator) {
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ return Selector.pseudos[name](nodes, value, root);
+ }
+ },
+
+ pseudos: {
+ 'first-child': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ if (Selector.handlers.previousElementSibling(node)) continue;
+ results.push(node);
+ }
+ return results;
+ },
+ 'last-child': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ if (Selector.handlers.nextElementSibling(node)) continue;
+ results.push(node);
+ }
+ return results;
+ },
+ 'only-child': function(nodes, value, root) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
+ results.push(node);
+ return results;
+ },
+ 'nth-child': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root);
+ },
+ 'nth-last-child': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, true);
+ },
+ 'nth-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, false, true);
+ },
+ 'nth-last-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, true, true);
+ },
+ 'first-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, "1", root, false, true);
+ },
+ 'last-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, "1", root, true, true);
+ },
+ 'only-of-type': function(nodes, formula, root) {
+ var p = Selector.pseudos;
+ return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
+ },
+
+ // handles the an+b logic
+ getIndices: function(a, b, total) {
+ if (a == 0) return b > 0 ? [b] : [];
+ return $R(1, total).inject([], function(memo, i) {
+ if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
+ return memo;
+ });
+ },
+
+ // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
+ nth: function(nodes, formula, root, reverse, ofType) {
+ if (nodes.length == 0) return [];
+ if (formula == 'even') formula = '2n+0';
+ if (formula == 'odd') formula = '2n+1';
+ var h = Selector.handlers, results = [], indexed = [], m;
+ h.mark(nodes);
+ for (var i = 0, node; node = nodes[i]; i++) {
+ if (!node.parentNode._countedByPrototype) {
+ h.index(node.parentNode, reverse, ofType);
+ indexed.push(node.parentNode);
+ }
+ }
+ if (formula.match(/^\d+$/)) { // just a number
+ formula = Number(formula);
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node.nodeIndex == formula) results.push(node);
+ } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+ if (m[1] == "-") m[1] = -1;
+ var a = m[1] ? Number(m[1]) : 1;
+ var b = m[2] ? Number(m[2]) : 0;
+ var indices = Selector.pseudos.getIndices(a, b, nodes.length);
+ for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
+ for (var j = 0; j < l; j++)
+ if (node.nodeIndex == indices[j]) results.push(node);
+ }
+ }
+ h.unmark(nodes);
+ h.unmark(indexed);
+ return results;
+ },
+
+ 'empty': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ // IE treats comments as element nodes
+ if (node.tagName == '!' || node.firstChild) continue;
+ results.push(node);
+ }
+ return results;
+ },
+
+ 'not': function(nodes, selector, root) {
+ var h = Selector.handlers, selectorType, m;
+ var exclusions = new Selector(selector).findElements(root);
+ h.mark(exclusions);
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!node._countedByPrototype) results.push(node);
+ h.unmark(exclusions);
+ return results;
+ },
+
+ 'enabled': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!node.disabled && (!node.type || node.type !== 'hidden'))
+ results.push(node);
+ return results;
+ },
+
+ 'disabled': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (node.disabled) results.push(node);
+ return results;
+ },
+
+ 'checked': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (node.checked) results.push(node);
+ return results;
+ }
+ },
+
+ operators: {
+ '=': function(nv, v) { return nv == v; },
+ '!=': function(nv, v) { return nv != v; },
+ '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
+ '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
+ '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
+ '$=': function(nv, v) { return nv.endsWith(v); },
+ '*=': function(nv, v) { return nv.include(v); },
+ '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
+ '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
+ '-').include('-' + (v || "").toUpperCase() + '-'); }
+ },
+
+ split: function(expression) {
+ var expressions = [];
+ expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
+ expressions.push(m[1].strip());
+ });
+ return expressions;
+ },
+
+ matchElements: function(elements, expression) {
+ var matches = $$(expression), h = Selector.handlers;
+ h.mark(matches);
+ for (var i = 0, results = [], element; element = elements[i]; i++)
+ if (element._countedByPrototype) results.push(element);
+ h.unmark(matches);
+ return results;
+ },
+
+ findElement: function(elements, expression, index) {
+ if (Object.isNumber(expression)) {
+ index = expression; expression = false;
+ }
+ return Selector.matchElements(elements, expression || '*')[index || 0];
+ },
+
+ findChildElements: function(element, expressions) {
+ expressions = Selector.split(expressions.join(','));
+ var results = [], h = Selector.handlers;
+ for (var i = 0, l = expressions.length, selector; i < l; i++) {
+ selector = new Selector(expressions[i].strip());
+ h.concat(results, selector.findElements(element));
+ }
+ return (l > 1) ? h.unique(results) : results;
+ }
+});
+
+if (Prototype.Browser.IE) {
+ Object.extend(Selector.handlers, {
+ // IE returns comment nodes on getElementsByTagName("*").
+ // Filter them out.
+ concat: function(a, b) {
+ for (var i = 0, node; node = b[i]; i++)
+ if (node.tagName !== "!") a.push(node);
+ return a;
+ },
+
+ // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
+ unmark: function(nodes) {
+ for (var i = 0, node; node = nodes[i]; i++)
+ node.removeAttribute('_countedByPrototype');
+ return nodes;
+ }
+ });
+}
+
+function $$() {
+ return Selector.findChildElements(document, $A(arguments));
+}
+var Form = {
+ reset: function(form) {
+ $(form).reset();
+ return form;
+ },
+
+ serializeElements: function(elements, options) {
+ if (typeof options !== 'object') options = { hash: !!options };
+ else if (Object.isUndefined(options.hash)) options.hash = true;
+
+ var key, value, type, isImageType, isSubmitButton, submitSerialized;
+ var submit = options.submit;
+
+ var data = elements.inject({ }, function(result, element) {
+ element = $(element);
+ key = element.name;
+ value = element.getValue();
+ type = element.type;
+
+ isImageType = type === 'image';
+ isSubmitButton = (type === 'submit' || isImageType);
+
+ // Null values don't get serialized
+ if (value === null) return result;
+ // Disabled elements don't get serialized
+ if (element.disabled) return result;
+ // <input type="file|reset" /> doesn't get serialized
+ if (type === 'file' || type === 'reset') return result;
+ // Non-active submit buttons don't get serialized
+ if (isSubmitButton &&
+ (submit === false || submitSerialized ||
+ (submit && !(key === submit || element === submit))))
+ return result;
+
+ if (isSubmitButton) {
+ submitSerialized = true;
+ if (isImageType) {
+ var prefix = key ? key + '.' : '',
+ x = options.x || 0, y = options.y || 0;
+
+ result[prefix + 'x'] = x;
+ result[prefix + 'y'] = y;
+ return result;
+ }
+ }
+
+ else if (!key) return result;
+
+ if (key in result) {
+ // a key is already present; construct an array of values
+ if (!Object.isArray(result[key])) result[key] = [result[key]];
+ result[key].push(value);
+ } else result[key] = value;
+
+ return result;
+ });
+
+ return options.hash ? data : Object.toQueryString(data);
+ }
+};
+
+Form.Methods = {
+ serialize: function(form, options) {
+ return Form.serializeElements(Form.getElements(form), options);
+ },
+
+ getElements: function(form) {
+ return $A($(form).getElementsByTagName('*')).inject([],
+ function(elements, child) {
+ if (Form.Element.Serializers[child.tagName.toLowerCase()])
+ elements.push(Element.extend(child));
+ return elements;
+ }
+ );
+ },
+
+ getInputs: function(form, typeName, name) {
+ form = $(form);
+ var inputs = form.getElementsByTagName('input');
+
+ if (!typeName && !name) return $A(inputs).map(Element.extend);
+
+ for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+ var input = inputs[i];
+ if ((typeName && input.type != typeName) || (name && input.name != name))
+ continue;
+ matchingInputs.push(Element.extend(input));
+ }
+
+ return matchingInputs;
+ },
+
+ disable: function(form) {
+ form = $(form);
+ Form.getElements(form).invoke('disable');
+ return form;
+ },
+
+ enable: function(form) {
+ form = $(form);
+ Form.getElements(form).invoke('enable');
+ return form;
+ },
+
+ findFirstElement: function(form) {
+ var elements = $(form).getElements().findAll(function(element) {
+ return 'hidden' != element.type && !element.disabled;
+ });
+ var firstByIndex = elements.findAll(function(element) {
+ return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
+ }).sortBy(function(element) { return element.tabIndex }).first();
+
+ return firstByIndex ? firstByIndex : elements.find(function(element) {
+ return ['button', 'input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+ });
+ },
+
+ focusFirstElement: function(form) {
+ form = $(form);
+ form.findFirstElement().activate();
+ return form;
+ },
+
+ request: function(form, options) {
+ form = $(form), options = Object.clone(options || { });
+
+ var params = options.parameters, action = form.readAttribute('action') || '';
+ if (action.blank()) action = window.location.href;
+ options.parameters = form.serialize(true);
+
+ if (params) {
+ if (Object.isString(params)) params = params.toQueryParams();
+ Object.extend(options.parameters, params);
+ }
+
+ if (form.hasAttribute('method') && !options.method)
+ options.method = form.method;
+
+ return new Ajax.Request(action, options);
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element = {
+ focus: function(element) {
+ $(element).focus();
+ return element;
+ },
+
+ select: function(element) {
+ $(element).select();
+ return element;
+ }
+};
+
+Form.Element.Methods = {
+ serialize: function(element) {
+ element = $(element);
+ if (!element.disabled && element.name) {
+ var value = element.getValue();
+ if (value != undefined) {
+ var pair = { };
+ pair[element.name] = value;
+ return Object.toQueryString(pair);
+ }
+ }
+ return '';
+ },
+
+ getValue: function(element) {
+ if (!(element = $(element))) return null;
+ var method = element.tagName.toLowerCase(), s = Form.Element.Serializers;
+ return s[method]? s[method](element) : null;
+ },
+
+ setValue: function(element, value) {
+ if (!(element = $(element))) return null;
+ var method = element.tagName.toLowerCase(), s = Form.Element.Serializers;
+ if (s[method]) s[method](element, value);
+ return element;
+ },
+
+ clear: function(element) {
+ $(element).value = '';
+ return element;
+ },
+
+ present: function(element) {
+ return $(element).value != '';
+ },
+
+ activate: function(element) {
+ element = $(element);
+ try {
+ element.focus();
+ if (element.select && (element.tagName.toLowerCase() != 'input' ||
+ !['button', 'image', 'reset', 'submit'].include(element.type)))
+ element.select();
+ } catch (e) { }
+ return element;
+ },
+
+ disable: function(element) {
+ element = $(element);
+ element.disabled = true;
+ return element;
+ },
+
+ enable: function(element) {
+ element = $(element);
+ element.disabled = false;
+ return element;
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Field = Form.Element;
+var $F = Form.Element.Methods.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element.Serializers = {
+ input: function(element, value) {
+ switch (element.type.toLowerCase()) {
+ case 'checkbox':
+ case 'radio':
+ return Form.Element.Serializers.inputSelector(element, value);
+ default:
+ return Form.Element.Serializers.textarea(element, value);
+ }
+ },
+
+ inputSelector: function(element, value) {
+ if (Object.isUndefined(value)) return element.checked ? element.value : null;
+ else element.checked = !!value;
+ },
+
+ button: function(element, value){
+ if (Object.isUndefined(value)) return element.innerHTML;
+ else element.innerHTML = value;
+ },
+
+ textarea: function(element, value) {
+ if (Object.isUndefined(value)) return element.value;
+ else element.value = value;
+ },
+
+ select: function(element, index) {
+ if (Object.isUndefined(index))
+ return this[element.type == 'select-one' ?
+ 'selectOne' : 'selectMany'](element);
+ else {
+ var opt, value, single = !Object.isArray(index);
+ for (var i = 0, length = element.length; i < length; i++) {
+ opt = element.options[i];
+ value = this.optionValue(opt);
+ if (single) {
+ if (value == index) {
+ opt.selected = true;
+ return;
+ }
+ }
+ else opt.selected = index.include(value);
+ }
+ }
+ },
+
+ selectOne: function(element) {
+ var index = element.selectedIndex;
+ return index >= 0 ? this.optionValue(element.options[index]) : null;
+ },
+
+ selectMany: function(element) {
+ var values, length = element.length;
+ if (!length) return null;
+
+ for (var i = 0, values = []; i < length; i++) {
+ var opt = element.options[i];
+ if (opt.selected) values.push(this.optionValue(opt));
+ }
+ return values;
+ },
+
+ optionValue: function(opt) {
+ // extend element because hasAttribute may not be native
+ return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
+ initialize: function($super, element, frequency, callback) {
+ $super(callback, frequency);
+ this.element = $(element);
+ this.lastValue = this.getValue();
+ },
+
+ execute: function() {
+ var value = this.getValue();
+ if (Object.isString(this.lastValue) && Object.isString(value) ?
+ this.lastValue != value : String(this.lastValue) != String(value)) {
+ this.callback(this.element, value);
+ this.lastValue = value;
+ }
+ }
+});
+
+Form.Element.Observer = Class.create(Abstract.TimedObserver, {
+ getValue: function() {
+ return Form.Element.getValue(this.element);
+ }
+});
+
+Form.Observer = Class.create(Abstract.TimedObserver, {
+ getValue: function() {
+ return Form.serialize(this.element);
+ }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = Class.create({
+ initialize: function(element, callback) {
+ this.element = $(element);
+ this.callback = callback;
+
+ this.lastValue = this.getValue();
+ if (this.element.tagName.toLowerCase() == 'form')
+ this.registerFormCallbacks();
+ else
+ this.registerCallback(this.element);
+ },
+
+ onElementEvent: function() {
+ var value = this.getValue();
+ if (this.lastValue != value) {
+ this.callback(this.element, value);
+ this.lastValue = value;
+ }
+ },
+
+ registerFormCallbacks: function() {
+ Form.getElements(this.element).each(this.registerCallback, this);
+ },
+
+ registerCallback: function(element) {
+ if (element.type) {
+ switch (element.type.toLowerCase()) {
+ case 'checkbox':
+ case 'radio':
+ Event.observe(element, 'click', this.onElementEvent.bind(this));
+ break;
+ default:
+ Event.observe(element, 'change', this.onElementEvent.bind(this));
+ break;
+ }
+ }
+ }
+});
+
+Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
+ getValue: function() {
+ return Form.Element.getValue(this.element);
+ }
+});
+
+Form.EventObserver = Class.create(Abstract.EventObserver, {
+ getValue: function() {
+ return Form.serialize(this.element);
+ }
+});
+if (!window.Event) var Event = { };
+
+Object.extend(Event, {
+ KEY_BACKSPACE: 8,
+ KEY_TAB: 9,
+ KEY_RETURN: 13,
+ KEY_ESC: 27,
+ KEY_LEFT: 37,
+ KEY_UP: 38,
+ KEY_RIGHT: 39,
+ KEY_DOWN: 40,
+ KEY_DELETE: 46,
+ KEY_HOME: 36,
+ KEY_END: 35,
+ KEY_PAGEUP: 33,
+ KEY_PAGEDOWN: 34,
+ KEY_INSERT: 45,
+
+ cache: { },
+
+ relatedTarget: function(event) {
+ var element;
+ switch(event.type) {
+ case 'mouseover': element = event.fromElement; break;
+ case 'mouseout': element = event.toElement; break;
+ default: return null;
+ }
+ return Element.extend(element);
+ }
+});
+
+Event.Methods = (function() {
+ var isButton;
+
+ if (Prototype.Browser.IE) {
+ var buttonMap = { 0: 1, 1: 4, 2: 2 };
+ isButton = function(event, code) {
+ return event.button == buttonMap[code];
+ };
+
+ } else if (Prototype.Browser.WebKit) {
+ isButton = function(event, code) {
+ switch (code) {
+ case 0: return event.which == 1 && !event.metaKey;
+ case 1: return event.which == 1 && event.metaKey;
+ default: return false;
+ }
+ };
+
+ } else {
+ isButton = function(event, code) {
+ return event.which ? (event.which === code + 1) : (event.button === code);
+ };
+ }
+
+ return {
+ isLeftClick: function(event) { return isButton(event, 0) },
+ isMiddleClick: function(event) { return isButton(event, 1) },
+ isRightClick: function(event) { return isButton(event, 2) },
+
+ element: function(event) {
+ event = Event.extend(event);
+ var node = event.target, currentTarget = event.currentTarget, type = event.type;
+
+ if (currentTarget && currentTarget.tagName) {
+ // Firefox screws up the "click" event when moving between radio buttons
+ // via arrow keys. It also screws up the "load" and "error" events on images,
+ // reporting the document as the target instead of the original image.
+ if (['load', 'error'].include(type) ||
+ (currentTarget.tagName.toUpperCase() === "INPUT" && currentTarget.type === "radio" && type === "click"))
+ node = currentTarget;
+ }
+
+ return Element.extend(node && node.nodeType == Node.TEXT_NODE ?
+ node.parentNode : node);
+ },
+
+ findElement: function(event, expression) {
+ var element = Event.element(event);
+ if (!expression) return element;
+ var elements = [element].concat(element.ancestors());
+ return Selector.findElement(elements, expression, 0);
+ },
+
+ pointer: function(event) {
+ var docElement = document.documentElement,
+ body = document.body || { scrollLeft: 0, scrollTop: 0 };
+ return {
+ x: event.pageX || (event.clientX +
+ (docElement.scrollLeft || body.scrollLeft) -
+ (docElement.clientLeft || 0)),
+ y: event.pageY || (event.clientY +
+ (docElement.scrollTop || body.scrollTop) -
+ (docElement.clientTop || 0))
+ };
+ },
+
+ pointerX: function(event) { return Event.pointer(event).x },
+ pointerY: function(event) { return Event.pointer(event).y },
+
+ stop: function(event) {
+ Event.extend(event);
+ event.preventDefault();
+ event.stopPropagation();
+ event.stopped = true;
+ }
+ };
+})();
+
+Event.extend = (function() {
+ var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
+ m[name] = Event.Methods[name].methodize();
+ return m;
+ });
+
+ if (Prototype.Browser.IE) {
+ Object.extend(methods, {
+ stopPropagation: function() { this.cancelBubble = true },
+ preventDefault: function() { this.returnValue = false },
+ inspect: function() { return "[object Event]" }
+ });
+
+ return function(event) {
+ if (!event) return false;
+ if (event._extendedByPrototype) return event;
+
+ var pointer = Event.pointer(event);
+ Object.extend(event, {
+ _extendedByPrototype: Prototype.emptyFunction,
+ target: Element.extend(event.srcElement),
+ relatedTarget: Event.relatedTarget(event),
+ pageX: pointer.x,
+ pageY: pointer.y
+ });
+ return Object.extend(event, methods);
+ };
+
+ } else {
+ Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
+ Object.extend(Event.prototype, methods);
+ return Prototype.K;
+ }
+})();
+
+Object.extend(Event, (function() {
+ var cache = Event.cache;
+
+ function getEventID(element) {
+ // Event ID is stored as the 0th index in a one-item array so that it
+ // won't get copied to a new node when cloneNode is called.
+ if (element === window) return 1;
+ if (element._prototypeEventID) return element._prototypeEventID[0];
+ return element._prototypeEventID = [arguments.callee.id++];
+ }
+ getEventID.id = 2;
+
+ function getDOMEventName(eventName) {
+ if (eventName && eventName.include(':')) return "dataavailable";
+ return eventName;
+ }
+
+ function getCacheForID(id) {
+ return cache[id] = cache[id] || { };
+ }
+
+ function addEventDispatcher(element, eventName, dispatchWrapper) {
+ var id = getEventID(element), wrappers = getWrappersForEventName(id, eventName);
+ if (wrappers.dispatcher) return;
+
+ wrappers.dispatcher = function(event) {
+ var w = getWrappersForEventName(id, eventName);
+ for(var i = 0, l = w.length; i < l; i++) w[i](event); // execute wrappers
+ };
+
+ if (dispatchWrapper) wrappers.dispatcher = wrappers.dispatcher.wrap(dispatchWrapper);
+ element.attachEvent("on" + getDOMEventName(eventName), wrappers.dispatcher);
+ }
+
+ function getWrappersForEventName(id, eventName) {
+ var c = getCacheForID(id);
+ return c[eventName] = c[eventName] || [];
+ }
+
+ function createWrapper(element, eventName, handler) {
+ var id = getEventID(element), c = getCacheForID(id);
+
+ // Attach the element itself onto its cache entry so we can retrieve it for
+ // cleanup on page unload.
+ if (!c.element) c.element = element;
+
+ var w = getWrappersForEventName(id, eventName);
+ if (w.pluck("handler").include(handler)) return false;
+
+ var wrapper = function(event) {
+ if (!Event || !Event.extend ||
+ (event.eventName && event.eventName != eventName))
+ return false;
+
+ handler.call(element, Event.extend(event));
+ };
+
+ wrapper.handler = handler;
+ w.push(wrapper);
+ return wrapper;
+ }
+
+ function findWrapper(id, eventName, handler) {
+ var w = getWrappersForEventName(id, eventName);
+ return w.find(function(wrapper) { return wrapper.handler == handler });
+ }
+
+ function destroyWrapper(id, eventName, handler) {
+ var c = getCacheForID(id);
+ if (!c[eventName]) return false;
+ var d = c[eventName].dispatcher;
+ c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
+ c[eventName].dispatcher = d;
+ }
+
+ // Loop through all elements and remove all handlers on page unload. IE
+ // needs this in order to prevent memory leaks.
+ function purgeListeners() {
+ var element, entry;
+ for (var i in Event.cache) {
+ entry = Event.cache[i];
+ Event.stopObserving(entry.element);
+ entry.element = null;
+ }
+ }
+
+ function onStop() {
+ document.detachEvent("onstop", onStop);
+ purgeListeners();
+ }
+
+ function onBeforeUnload() {
+ if (document.readyState === "interactive") {
+ document.attachEvent("onstop", onStop);
+ (function() { document.detachEvent("onstop", onStop); }).defer();
+ }
+ }
+
+ if (window.attachEvent && !window.addEventListener) {
+ // Internet Explorer needs to remove event handlers on page unload
+ // in order to avoid memory leaks.
+ window.attachEvent("onunload", purgeListeners);
+
+ // IE also doesn't fire the unload event if the page is navigated away
+ // from before it's done loading. Workaround adapted from
+ // http://blog.moxiecode.com/2008/04/08/unload-event-never-fires-in-ie/.
+ window.attachEvent("onbeforeunload", onBeforeUnload);
+
+ // Ensure window onload is fired after "dom:loaded"
+ addEventDispatcher(window, 'load', function(proceed, event) {
+ if (document.loaded) {
+ proceed(event);
+ } else {
+ arguments.callee.defer(proceed, event);
+ }
+ });
+
+ // Ensure window onresize is fired only once per resize
+ addEventDispatcher(window, 'resize', function(proceed, event) {
+ var callee = arguments.callee, dimensions = document.viewport.getDimensions();
+ if (dimensions.width != callee.prevWidth || dimensions.height != callee.prevHeight) {
+ callee.prevWidth = dimensions.width;
+ callee.prevHeight = dimensions.height;
+ proceed(event);
+ }
+ });
+ }
+
+ // Safari has a dummy event handler on page unload so that it won't
+ // use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
+ // object when page is returned to via the back button using its bfcache.
+ else if (Prototype.Browser.WebKit) {
+ window.addEventListener("unload", Prototype.emptyFunction, false);
+ }
+
+ return {
+ observe: function(element, eventName, handler) {
+ element = $(element);
+ var name = getDOMEventName(eventName);
+
+ var wrapper = createWrapper(element, eventName, handler);
+ if (!wrapper) return element;
+
+ if (element.addEventListener) {
+ element.addEventListener(name, wrapper, false);
+ } else {
+ addEventDispatcher(element, eventName);
+ }
+
+ return element;
+ },
+
+ stopObserving: function(element, eventName, handler) {
+ element = $(element);
+ eventName = Object.isString(eventName) ? eventName : null;
+ var id = getEventID(element), c = cache[id];
+
+ if (!c) {
+ return element;
+ }
+ else if (!handler && eventName) {
+ getWrappersForEventName(id, eventName).each(function(wrapper) {
+ Event.stopObserving(element, eventName, wrapper.handler);
+ });
+ return element;
+ }
+ else if (!eventName) {
+ Object.keys(c).without("element").each(function(eventName) {
+ Event.stopObserving(element, eventName);
+ });
+ return element;
+ }
+
+ var wrapper = findWrapper(id, eventName, handler);
+ if (!wrapper) return element;
+
+ var name = getDOMEventName(eventName);
+ if (element.removeEventListener) {
+ element.removeEventListener(name, wrapper, false);
+ destroyWrapper(id, eventName, handler);
+ } else {
+ destroyWrapper(id, eventName, handler);
+ var wrappers = getWrappersForEventName(id, eventName);
+ if (!wrappers.length) {
+ element.detachEvent("on" + name, wrappers.dispatcher);
+ wrappers.dispatcher = null;
+ }
+ }
+
+ return element;
+ },
+
+ fire: function(element, eventName, memo) {
+ element = $(element);
+ if (element == document && document.createEvent && !element.dispatchEvent)
+ element = document.documentElement;
+
+ var event;
+ if (document.createEvent) {
+ event = document.createEvent("HTMLEvents");
+ event.initEvent("dataavailable", true, true);
+ } else {
+ event = document.createEventObject();
+ event.eventType = "ondataavailable";
+ }
+
+ event.eventName = eventName;
+ event.memo = memo || { };
+
+ if (document.createEvent) {
+ element.dispatchEvent(event);
+ } else {
+ element.fireEvent(event.eventType, event);
+ }
+
+ return Event.extend(event);
+ }
+ };
+})());
+
+Object.extend(Event, Event.Methods);
+
+Element.addMethods({
+ fire: Event.fire,
+ observe: Event.observe,
+ stopObserving: Event.stopObserving
+});
+
+Object.extend(document, {
+ fire: Element.Methods.fire.methodize(),
+ observe: Element.Methods.observe.methodize(),
+ stopObserving: Element.Methods.stopObserving.methodize(),
+ loaded: false
+});
+
+(function() {
+ /* Support for the DOMContentLoaded event is based on work by Dan Webb,
+ Matthias Miller, Dean Edwards, John Resig and Diego Perini. */
+
+ var timer;
+
+ function fireContentLoadedEvent() {
+ if (document.loaded) return;
+ if (timer) window.clearInterval(timer);
+ document.loaded = true;
+ document.fire("dom:loaded");
+ }
+
+ if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", fireContentLoadedEvent, false);
+ } else {
+ document.attachEvent("onreadystatechange", function() {
+ if (document.readyState == "complete") {
+ document.detachEvent("onreadystatechange", arguments.callee);
+ fireContentLoadedEvent();
+ }
+ });
+
+ if (window == top) {
+ timer = setInterval(function() {
+ try {
+ document.documentElement.doScroll("left");
+ } catch(e) { return }
+ fireContentLoadedEvent();
+ }, 10);
+ }
+ }
+
+
+ // Safari <3.1 doesn't support DOMContentLoaded
+ if (Prototype.Browser.WebKit && (navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1] < 525)) {
+ timer = setInterval(function() {
+ if (/loaded|complete/.test(document.readyState))
+ fireContentLoadedEvent();
+ }, 10);
+ }
+
+ // Worst case fallback...
+ Event.observe(window, "load", fireContentLoadedEvent);
+})();
+/*------------------------------- DEPRECATED -------------------------------*/
+
+Hash.toQueryString = Object.toQueryString;
+
+var Toggle = { display: Element.toggle };
+
+Element.Methods.childOf = Element.Methods.descendantOf;
+
+var Insertion = {
+ Before: function(element, content) {
+ return Element.insert(element, {before:content});
+ },
+
+ Top: function(element, content) {
+ return Element.insert(element, {top:content});
+ },
+
+ Bottom: function(element, content) {
+ return Element.insert(element, {bottom:content});
+ },
+
+ After: function(element, content) {
+ return Element.insert(element, {after:content});
+ }
+};
+
+var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
+
+// This should be moved to script.aculo.us; notice the deprecated methods
+// further below, that map to the newer Element methods.
+var Position = {
+ // set to true if needed, warning: firefox performance problems
+ // NOT neeeded for page scrolling, only if draggable contained in
+ // scrollable elements
+ includeScrollOffsets: false,
+
+ // must be called before calling withinIncludingScrolloffset, every time the
+ // page is scrolled
+ prepare: function() {
+ this.deltaX = window.pageXOffset
+ || document.documentElement.scrollLeft
+ || document.body.scrollLeft
+ || 0;
+ this.deltaY = window.pageYOffset
+ || document.documentElement.scrollTop
+ || document.body.scrollTop
+ || 0;
+ },
+
+ // caches x/y coordinate pair to use with overlap
+ within: function(element, x, y) {
+ if (this.includeScrollOffsets)
+ return this.withinIncludingScrolloffsets(element, x, y);
+
+ var dimensions = Element.getDimensions(element);
+ this.xcomp = x;
+ this.ycomp = y;
+ this.offset = Element.cumulativeOffset(element);
+
+ return (y >= this.offset[1] &&
+ y < this.offset[1] + dimensions.height &&
+ x >= this.offset[0] &&
+ x < this.offset[0] + dimensions.width);
+ },
+
+ withinIncludingScrolloffsets: function(element, x, y) {
+ var offsetcache = Element.cumulativeScrollOffset(element),
+ dimensions = Element.getDimensions(element);
+
+ this.xcomp = x + offsetcache[0] - this.deltaX;
+ this.ycomp = y + offsetcache[1] - this.deltaY;
+ this.offset = Element.cumulativeOffset(element);
+
+ return (this.ycomp >= this.offset[1] &&
+ this.ycomp < this.offset[1] + dimensions.height &&
+ this.xcomp >= this.offset[0] &&
+ this.xcomp < this.offset[0] + dimensions.width);
+ },
+
+ // within must be called directly before
+ overlap: function(mode, element) {
+ var dimensions = Element.getDimensions(element);
+ if (!mode) return 0;
+ if (mode == 'vertical')
+ return ((this.offset[1] + dimensions.height) - this.ycomp) /
+ dimensions.height;
+ if (mode == 'horizontal')
+ return ((this.offset[0] + dimensions.width) - this.xcomp) /
+ dimensions.width;
+ },
+
+ // Deprecation layer -- use newer Element methods now (1.5.2).
+
+ cumulativeOffset: Element.Methods.cumulativeOffset,
+
+ positionedOffset: Element.Methods.positionedOffset,
+
+ absolutize: function(element) {
+ Position.prepare();
+ return Element.absolutize(element);
+ },
+
+ relativize: function(element) {
+ Position.prepare();
+ return Element.relativize(element);
+ },
+
+ realOffset: Element.Methods.cumulativeScrollOffset,
+
+ offsetParent: Element.Methods.getOffsetParent,
+
+ page: Element.Methods.viewportOffset,
+
+ clone: function(source, target, options) {
+ options = options || { };
+ return Element.clonePosition(target, source, options);
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
+ function iter(name) {
+ return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
+ }
+
+ instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
+ function(element, className) {
+ className = className.toString().strip();
+ var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
+ return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
+ } : function(element, className) {
+ className = className.toString().strip();
+ var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
+ if (!classNames && !className) return elements;
+
+ var nodes = $(element).getElementsByTagName('*');
+ className = ' ' + className + ' ';
+
+ for (var i = 0, child, cn; child = nodes[i]; i++) {
+ if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
+ (classNames && classNames.all(function(name) {
+ return !name.toString().blank() && cn.include(' ' + name + ' ');
+ }))))
+ elements.push(Element.extend(child));
+ }
+ return elements;
+ };
+
+ return function(className, parentElement) {
+ return $(parentElement || document.body).getElementsByClassName(className);
+ };
+}(Element.Methods);
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+ initialize: function(element) {
+ this.element = $(element);
+ },
+
+ _each: function(iterator) {
+ this.element.className.split(/\s+/).select(function(name) {
+ return name.length > 0;
+ })._each(iterator);
+ },
+
+ set: function(className) {
+ this.element.className = className;
+ },
+
+ add: function(classNameToAdd) {
+ if (this.include(classNameToAdd)) return;
+ this.set($A(this).concat(classNameToAdd).join(' '));
+ },
+
+ remove: function(classNameToRemove) {
+ if (!this.include(classNameToRemove)) return;
+ this.set($A(this).without(classNameToRemove).join(' '));
+ },
+
+ toString: function() {
+ return $A(this).join(' ');
+ }
+};
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+
+/*--------------------------------------------------------------------------*/
+
+Element.addMethods(); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/dist/prototype_update_helper.js b/dom/tests/mochitest/ajax/prototype/dist/prototype_update_helper.js
new file mode 100644
index 0000000000..0f4b949381
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/dist/prototype_update_helper.js
@@ -0,0 +1,417 @@
+/* Update Helper (c) 2008 Tobie Langel
+ *
+ * Requires Prototype >= 1.6.0
+ *
+ * Update Helper is distributable under the same terms as Prototype
+ * (MIT-style license). For details, see the Prototype web site:
+ * http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var UpdateHelper = Class.create({
+ logLevel: 0,
+ MessageTemplate: new Template('Update Helper: #{message}\n#{stack}'),
+ Regexp: new RegExp("@" + window.location.protocol + ".*?\\d+\\n", "g"),
+
+ initialize: function(deprecatedMethods) {
+ var notify = function(message, type) {
+ this.notify(message, type);
+ }.bind(this); // Late binding to simplify testing.
+
+ deprecatedMethods.each(function(d) {
+ var condition = d.condition,
+ type = d.type || 'info',
+ message = d.message,
+ namespace = d.namespace,
+ method = d.methodName;
+
+ namespace[method] = (namespace[method] || function() {}).wrap(function(proceed) {
+ var arr = $A(arguments);
+ var args = arr.splice(1, arr.length);
+ if (!condition || condition.apply(this, args)) notify(message, type);
+ return proceed.apply(proceed, args);
+ });
+ });
+ Element.addMethods();
+ },
+
+ notify: function(message, type) {
+ switch(type) {
+ case 'info':
+ if (this.logLevel > UpdateHelper.Info) return false;
+ case 'warn':
+ if (this.logLevel > UpdateHelper.Warn) return false;
+ default:
+ if (this.logLevel > UpdateHelper.Error) return false;
+ }
+ this.log(this.MessageTemplate.evaluate({
+ message: message,
+ stack: this.getStack()
+ }), type);
+ return true;
+ },
+
+ getStack: function() {
+ try {
+ throw new Error("stack");
+ } catch(e) {
+ return (e.stack || '').match(this.Regexp).reject(function(path) {
+ return /(prototype|unittest|update_helper)\.js/.test(path);
+ }).join("\n");
+ }
+ },
+
+ log: function(message, type) {
+ if (type == 'error') console.error(message);
+ else if (type == 'warn') console.warn(message);
+ else console.log(message);
+ }
+});
+
+Object.extend(UpdateHelper, {
+ Info: 0,
+ Warn: 1,
+ Error: 2
+});
+
+/* UpdateHelper for Prototype 1.6.0.2 (c) 2008 Tobie Langel
+ *
+ * UpdateHelper for Prototype is freely distributable under the same
+ * terms as Prototype (MIT-style license).
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ * Include this file right below prototype.js. All messages
+ * will be logged to the console.
+ *
+ * Note: You can tune the level of warning by redefining
+ * prototypeUpdateHelper.logLevel with one of the appropriate constansts
+ * (UpdateHelper.Info, UpdateHelper.Warn or UpdateHelper.Error), e.g.:
+ *
+ * prototypeUpdateHelper.logLevel = UpdateHelper.Warn;
+ *
+ * This, for example, will prevent deprecation messages from being logged.
+ *
+ * THIS SCRIPT WORKS IN FIREFOX ONLY
+ *--------------------------------------------------------------------------*/
+
+var prototypeUpdateHelper = new UpdateHelper([
+ {
+ methodName: 'display',
+ namespace: Toggle,
+ message: 'Toggle.display has been deprecated, please use Element.toggle instead.'
+ },
+
+ {
+ methodName: 'show',
+ namespace: Element.Methods,
+ message: 'Passing an arbitrary number of elements to Element.show is no longer supported.\n' +
+ 'Use [id_1, id_2, ...].each(Element.show) or $(id_1, id_2, ...).invoke("show") instead.',
+ type: 'error',
+ condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
+ },
+
+ {
+ methodName: 'hide',
+ namespace: Element.Methods,
+ message: 'Passing an arbitrary number of elements to Element.hide is no longer supported.\n' +
+ 'Use [id_1, id_2, ...].each(Element.hide) or $(id_1, id_2, ...).invoke("hide") instead.',
+ type: 'error',
+ condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
+ },
+
+ {
+ methodName: 'toggle',
+ namespace: Element.Methods,
+ message: 'Passing an arbitrary number of elements to Element.toggle is no longer supported.\n' +
+ 'Use [id_1, id_2, ...].each(Element.toggle) or $(id_1, id_2, ...).invoke("toggle") instead.',
+ type: 'error',
+ condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
+ },
+
+ {
+ methodName: 'clear',
+ namespace: Form.Element.Methods,
+ message: 'Passing an arbitrary number of elements to Field.clear is no longer supported.\n' +
+ 'Use [id_1, id_2, ...].each(Form.Element.clear) or $(id_1, id_2, ...).invoke("clear") instead.',
+ type: 'error',
+ condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
+ },
+
+ {
+ methodName: 'present',
+ namespace: Form.Element.Methods,
+ message: 'Passing an arbitrary number of elements to Field.present is no longer supported.\n' +
+ 'Use [id_1, id_2, ...].each(Form.Element.present) or $(id_1, id_2, ...).invoke("present") instead.',
+ type: 'error',
+ condition: function() { return arguments.length > 1 && !Object.isNumber(arguments[1]) }
+ },
+
+ {
+ methodName: 'childOf',
+ namespace: Element.Methods,
+ message: 'Element#childOf has been deprecated, please use Element#descendantOf instead.'
+ },
+
+ {
+ methodName: 'Before',
+ namespace: Insertion,
+ message: 'Insertion.Before has been deprecated, please use Element#insert instead.'
+ },
+
+ {
+ methodName: 'Top',
+ namespace: Insertion,
+ message: 'Insertion.Top has been deprecated, please use Element#insert instead.'
+ },
+
+ {
+ methodName: 'Bottom',
+ namespace: Insertion,
+ message: 'Insertion.Bottom has been deprecated, please use Element#insert instead.'
+ },
+
+ {
+ methodName: 'After',
+ namespace: Insertion,
+ message: 'Insertion.After has been deprecated, please use Element#insert instead.'
+ },
+
+ {
+ methodName: 'prepare',
+ namespace: Position,
+ message: 'Position.prepare has been deprecated.'
+ },
+
+ {
+ methodName: 'within',
+ namespace: Position,
+ message: 'Position.within has been deprecated.'
+ },
+
+ {
+ methodName: 'withinIncludingScrolloffsets',
+ namespace: Position,
+ message: 'Position.withinIncludingScrolloffsets has been deprecated.'
+ },
+
+ {
+ methodName: 'overlap',
+ namespace: Position,
+ message: 'Position.overlap has been deprecated.'
+ },
+
+ {
+ methodName: 'cumulativeOffset',
+ namespace: Position,
+ message: 'Position.cumulativeOffset has been deprecated, please use Element#cumulativeOffset instead.'
+ },
+
+ {
+ methodName: 'positionedOffset',
+ namespace: Position,
+ message: 'Position.positionedOffset has been deprecated, please use Element#positionedOffset instead.'
+ },
+
+ {
+ methodName: 'absolutize',
+ namespace: Position,
+ message: 'Position.absolutize has been deprecated, please use Element#absolutize instead.'
+ },
+
+ {
+ methodName: 'relativize',
+ namespace: Position,
+ message: 'Position.relativize has been deprecated, please use Element#relativize instead.'
+ },
+
+ {
+ methodName: 'realOffset',
+ namespace: Position,
+ message: 'Position.realOffset has been deprecated, please use Element#cumulativeScrollOffset instead.'
+ },
+
+ {
+ methodName: 'offsetParent',
+ namespace: Position,
+ message: 'Position.offsetParent has been deprecated, please use Element#getOffsetParent instead.'
+ },
+
+ {
+ methodName: 'page',
+ namespace: Position,
+ message: 'Position.page has been deprecated, please use Element#viewportOffset instead.'
+ },
+
+ {
+ methodName: 'clone',
+ namespace: Position,
+ message: 'Position.clone has been deprecated, please use Element#clonePosition instead.'
+ },
+
+ {
+ methodName: 'initialize',
+ namespace: Element.ClassNames.prototype,
+ message: 'Element.ClassNames has been deprecated.'
+ },
+
+ {
+ methodName: 'classNames',
+ namespace: Element.Methods,
+ message: 'Element#classNames has been deprecated.\n' +
+ 'If you need to access CSS class names as an array, try: $w(element.classname).'
+ },
+
+ {
+ methodName: 'setStyle',
+ namespace: Element.Methods,
+ message: 'Use of uncamelized style-property names is no longer supported.\n' +
+ 'Use either camelized style-property names or a regular CSS string instead (see online documentation).',
+ type: 'error',
+ condition: function(element, style) {
+ return !Object.isString(style) && Object.keys(style).join('').include('-');
+ }
+ },
+
+ {
+ methodName: 'getElementsByClassName',
+ namespace: document,
+ message: 'document.getElementsByClassName has been deprecated, please use $$ instead.'
+ },
+
+ {
+ methodName: 'getElementsByClassName',
+ namespace: Element.Methods,
+ message: 'Element#getElementsByClassName has been deprecated, please use Element#select instead.'
+ },
+
+ {
+ methodName: 'immediateDescendants',
+ namespace: Element.Methods,
+ message: 'Element#immediateDescendants has been deprecated, please use Element#childElements instead.'
+ },
+
+ {
+ methodName: 'getElementsBySelector',
+ namespace: Element.Methods,
+ message: 'Element#getElementsBySelector has been deprecated, please use Element#select instead.'
+ },
+
+ {
+ methodName: 'toQueryString',
+ namespace: Hash,
+ message: 'Hash.toQueryString has been deprecated.\n' +
+ 'Use the instance method Hash#toQueryString or Object.toQueryString instead.'
+ },
+
+ {
+ methodName: 'toJSON',
+ namespace: Hash,
+ message: 'Hash.toJSON has been removed.\n' +
+ 'Use the instance method Hash#toJSON or Object.toJSON instead.',
+ type: 'error'
+ },
+
+ {
+ methodName: 'remove',
+ namespace: Hash.prototype,
+ message: 'Hash#remove is no longer supported, use Hash#unset instead.\n' +
+ 'Please note that Hash#unset only accepts one argument.',
+ type: 'error'
+ },
+
+ {
+ methodName: 'merge',
+ namespace: Hash.prototype,
+ message: 'Hash#merge is no longer destructive and now operates on a clone of the Hash instance.\n' +
+ 'If you need a destructive merge, use Hash#update instead.',
+ type: 'warn'
+ },
+
+ {
+ methodName: 'unloadCache',
+ namespace: Event,
+ message: 'Event.unloadCache has been deprecated.',
+ type: 'error'
+ },
+
+ {
+ methodName: 'create',
+ namespace: Class,
+ message: 'The class API has been fully revised and now allows for mixins and inheritance.\n' +
+ 'You can find more about it here: http://prototypejs.org/learn/class-inheritance',
+ condition: function() { return !arguments.length }
+ }
+]);
+
+// Special casing for Hash.
+
+(function() {
+ var __properties = Object.keys(Hash.prototype).concat(['_object', '__properties']);
+
+ var messages = {
+ setting: new Template("Directly setting a property on an instance of Hash is no longer supported.\n" +
+ "Please use Hash#set('#{property}', #{value}) instead."),
+ getting: new Template("Directly accessing a property of an instance of Hash is no longer supported.\n" +
+ "Please use Hash#get('#{property}') instead.")
+ };
+
+ function notify(property, value) {
+ var message = messages[arguments.length == 1 ? 'getting' : 'setting'].evaluate({
+ property: property,
+ value: Object.inspect(value)
+ });
+ prototypeUpdateHelper.notify(message, 'error');
+ }
+
+ function defineSetters(obj, prop) {
+ if (obj.__properties.include(prop)) return;
+ obj.__properties.push(prop);
+ obj.__defineGetter__(prop, function() {
+ checkProperties(this);
+ notify(prop);
+ });
+ obj.__defineSetter__(prop, function(value) {
+ checkProperties(this);
+ notify(prop, value);
+ });
+ }
+
+ function checkProperties(hash) {
+ var current = Object.keys(hash);
+ if (current.length == hash.__properties.length)
+ return;
+ current.each(function(prop) {
+ if (hash.__properties.include(prop)) return;
+ notify(prop, hash[prop]);
+ defineSetters(hash, prop);
+ });
+ }
+
+ Hash.prototype.set = Hash.prototype.set.wrap(function(proceed, property, value) {
+ defineSetters(this, property);
+ return proceed(property, value);
+ });
+
+ $w('merge update').each(function(name) {
+ Hash.prototype[name] = Hash.prototype[name].wrap(function(proceed, object) {
+ for (var prop in object) defineSetters(this, prop);
+ return proceed(object);
+ });
+ });
+
+ $H(Hash.prototype).each(function(method) {
+ var key = method.key;
+ if (!Object.isFunction(method.value) || key == 'initialize') return;
+ Hash.prototype[key] = Hash.prototype[key].wrap(function(proceed) {
+ checkProperties(this);
+ var arr = $A(arguments);
+ return proceed.apply(proceed, arr.splice(1, arr.length));
+ });
+ });
+
+ Hash.prototype.initialize = Hash.prototype.initialize.wrap(function(proceed, object) {
+ this.__properties = __properties.clone();
+ for (var prop in object) defineSetters(this, prop);
+ proceed(object);
+ });
+})();
diff --git a/dom/tests/mochitest/ajax/prototype/manifest.json b/dom/tests/mochitest/ajax/prototype/manifest.json
new file mode 100644
index 0000000000..1beb8a7079
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/manifest.json
@@ -0,0 +1 @@
+{testcases:["test/unit/tmp/ajax_test.html","test/unit/tmp/array_test.html","test/unit/tmp/base_test.html","test/unit/tmp/dom_test.html","test/unit/tmp/element_mixins_test.html","test/unit/tmp/enumerable_test.html","test/unit/tmp/event_test.html","test/unit/tmp/form_test.html","test/unit/tmp/hash_test.html","test/unit/tmp/number_test.html","test/unit/tmp/position_test.html","test/unit/tmp/range_test.html","test/unit/tmp/selector_test.html","test/unit/tmp/string_test.html", "test/unit/tmp/unit_test.html"]} \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/mochitest.ini b/dom/tests/mochitest/ajax/prototype/mochitest.ini
new file mode 100644
index 0000000000..6af573fad6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/mochitest.ini
@@ -0,0 +1,67 @@
+[DEFAULT]
+support-files =
+ manifest.json
+ dist/prototype.js
+ test/browser.html
+ test/console.html
+ test/test.css
+ test/functional/event.html
+ test/lib/unittest.js
+ test/unit/ajax_test.js
+ test/unit/array_test.js
+ test/unit/base_test.js
+ test/unit/dom_test.js
+ test/unit/element_mixins_test.js
+ test/unit/enumerable_test.js
+ test/unit/event_test.js
+ test/unit/form_test.js
+ test/unit/hash_test.js
+ test/unit/number_test.js
+ test/unit/position_test.js
+ test/unit/range_test.js
+ test/unit/selector_test.js
+ test/unit/string_test.js
+ test/unit/unittest_test.js
+ test/unit/fixtures/ajax.html
+ test/unit/fixtures/ajax.js
+ test/unit/fixtures/array.html
+ test/unit/fixtures/base.html
+ test/unit/fixtures/base.js
+ test/unit/fixtures/content.html
+ test/unit/fixtures/data.json
+ test/unit/fixtures/dom.css
+ test/unit/fixtures/dom.html
+ test/unit/fixtures/dom.js
+ test/unit/fixtures/element_mixins.html
+ test/unit/fixtures/element_mixins.js
+ test/unit/fixtures/empty.html
+ test/unit/fixtures/empty.js
+ test/unit/fixtures/enumerable.html
+ test/unit/fixtures/enumerable.js
+ test/unit/fixtures/event.html
+ test/unit/fixtures/form.html
+ test/unit/fixtures/hash.js
+ test/unit/fixtures/hello.js
+ test/unit/fixtures/logo.gif
+ test/unit/fixtures/position.html
+ test/unit/fixtures/selector.html
+ test/unit/fixtures/string.js
+ test/unit/fixtures/unittest.html
+ test/unit/tmp/ajax_test.html
+ test/unit/tmp/array_test.html
+ test/unit/tmp/base_test.html
+ test/unit/tmp/dom_test.html
+ test/unit/tmp/element_mixins_test.html
+ test/unit/tmp/enumerable_test.html
+ test/unit/tmp/event_test.html
+ test/unit/tmp/form_test.html
+ test/unit/tmp/hash_test.html
+ test/unit/tmp/number_test.html
+ test/unit/tmp/position_test.html
+ test/unit/tmp/range_test.html
+ test/unit/tmp/selector_test.html
+ test/unit/tmp/string_test.html
+ test/unit/tmp/unit_test.html
+
+[test_Prototype.html]
+skip-if = toolkit == 'android'
diff --git a/dom/tests/mochitest/ajax/prototype/test/browser.html b/dom/tests/mochitest/ajax/prototype/test/browser.html
new file mode 100644
index 0000000000..ec699f9d45
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/browser.html
@@ -0,0 +1,229 @@
+<!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=utf-8" />
+ <title>Prototype object browser</title>
+ <style type="text/css" media="screen">
+ body {
+ font-family: Lucida Grande, Verdana, sans-serif;
+ font-size: 13px;
+ }
+
+ .inspector {
+ margin: 1%;
+ float: left;
+ width: 31%;
+ border: 1px solid #ccc;
+ background-color: white;
+ }
+
+ .inspector h2 {
+ font-size: 13px;
+ margin: 0;
+ text-align: center;
+ padding: 5px;
+ background-color: #e6e6e6;
+ border-bottom: 1px solid #999;
+ }
+
+ .inspector ul {
+ height: 200px;
+ overflow: auto;
+ margin: 0;
+ padding-left: 0;
+ }
+
+ .inspector li {
+ cursor: pointer;
+ list-style-type: none;
+ padding: 2px 5px 2px 30px;
+ color: #333;
+ }
+
+ .inspector li.selected {
+ background-color: #888;
+ color: #fff;
+ }
+
+ .inspector.active li.selected {
+ background-color: #1a76fd;
+ color: #fff;
+ }
+
+ #path, #value {
+ width: 97%;
+ margin: 1%;
+ }
+
+ #path {
+ margin-bottom: 0;
+ border: 1px solid #ccc;
+ border-bottom: 1px solid #999;
+ background-color: #e6e6e6;
+ }
+
+ #value {
+ margin-top: 0;
+ border: 1px solid #ccc;
+ border-top: none;
+ overflow: auto;
+ }
+
+ #path_content, #value_content {
+ display: block;
+ padding: 15px 30px 15px 30px;
+ }
+
+ </style>
+ <script type="text/javascript" src="../dist/prototype.js"></script>
+ <script type="text/javascript">
+ var Browser = Class.create();
+ Browser.prototype = {
+ initialize: function(element, name, value, options) {
+ this.element = $(element);
+ this.name = name;
+ this.value = value;
+ this.history = [];
+ Object.extend(this, options || {});
+ this.reset();
+ },
+
+ reset: function() {
+ this.go(this.name, this.value);
+ },
+
+ refresh: function() {
+ var children = $A(this.element.childNodes),
+ history = this.history.toArray(),
+ elements = history.slice(-3).pluck('element');
+
+ children.each(function(element) {
+ if (element && !elements.include(element))
+ this.element.removeChild(element);
+ }.bind(this));
+
+ children = $A(this.element.childNodes);
+
+ elements.each(function(element, index) {
+ Element.removeClassName(element, 'active');
+ var child = children[index];
+ if (!child)
+ this.element.appendChild(element);
+ else if (!element.parentNode)
+ this.element.insertBefore(element, child);
+ }.bind(this));
+
+ this.setTitle();
+ this.setValue();
+ },
+
+ setTitle: function() {
+ if (this.titleElement)
+ this.titleElement.innerHTML =
+ this.history.pluck('name').invoke('escapeHTML').join('.');
+ },
+
+ setValue: function() {
+ if (this.valueElement)
+ this.valueElement.innerHTML =
+ this.currentValue().escapeHTML() + '&nbsp;';
+ },
+
+ currentValue: function() {
+ try {
+ return Object.inspect(this.current());
+ } catch (e) {
+ return '(Internal Function)';
+ }
+ },
+
+ current: function() {
+ return this.history.last().value;
+ },
+
+ go: function(name, value) {
+ var from = this.history.last();
+ this.history.push(new Inspector(this, name, value));
+ this.refresh();
+ if (from)
+ Element.addClassName(from.element, 'active');
+ }
+ }
+
+ var Inspector = Class.create();
+ Inspector.prototype = {
+ initialize: function(browser, name, value) {
+ this.browser = browser;
+ this.name = name;
+ this.value = value;
+ this.id = 'inspector_' + new Date().getTime();
+ this.history = this.browser.history.toArray();
+ this.history.push(this);
+ this.createElement();
+ this.populate();
+ },
+
+ properties: function() {
+ var properties = [];
+ for (var property in this.value)
+ properties.push(property);
+ properties.sort();
+ return properties;
+ },
+
+ createElement: function() {
+ var element = document.createElement('div');
+ element.className = 'inspector';
+ element.id = this.id;
+ this.element = element;
+
+ var title = document.createElement('h2');
+ title.innerHTML = this.name.toString().escapeHTML();
+ this.titleElement = title;
+
+ var list = document.createElement('ul');
+ this.listElement = list;
+
+ element.appendChild(title);
+ element.appendChild(list);
+ },
+
+ populate: function() {
+ this.properties().each(function(property) {
+ var li = document.createElement('li');
+ li.innerHTML = property.toString().escapeHTML();
+ li.onclick = this.select.bind(this, li);
+ li._property = property;
+ this.listElement.appendChild(li);
+ }.bind(this));
+ },
+
+ select: function(element) {
+ this.unselect();
+ Element.addClassName(element, 'selected');
+ this.selectedProperty = element;
+ this.browser.history = this.history.toArray();
+ this.browser.go(element._property, this.value[element._property]);
+ },
+
+ unselect: function() {
+ if (this.selectedProperty)
+ Element.removeClassName(this.selectedProperty, 'selected');
+ this.selectedProperty = null;
+ }
+ }
+ </script>
+ </head>
+ <body>
+ <div id="browser_wrapper">
+ <div id="browser"></div>
+ <div style="clear: left"></div>
+ </div>
+ <h1 id="path"><span id="path_content"></span></h1>
+ <pre id="value"><div id="value_content"></div></pre>
+ <script type="text/javascript">
+ new Browser('browser', 'window', window, {titleElement: $('path_content'), valueElement: $('value_content')})
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/console.html b/dom/tests/mochitest/ajax/prototype/test/console.html
new file mode 100644
index 0000000000..2b586ee426
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/console.html
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+ <head>
+ <title>Prototype Console</title>
+ <script src="../dist/prototype.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ Prototype.Console = Class.create();
+ Prototype.Console.prototype = {
+ initialize: function(element, form, input) {
+ this.element = $(element);
+ this.form = $(form);
+ this.input = $(input);
+ this.context = window.eval.bind(window);
+ this.registerCallbacks();
+ document.title = 'Prototype Console ' + Prototype.Version;
+ Field.activate(this.input);
+ },
+
+ registerCallbacks: function() {
+ Event.observe(this.form, 'submit', function(event) {
+ this.eval($F(this.input));
+ this.input.value = '';
+ Field.activate(this.input);
+ Event.stop(event);
+ }.bind(this));
+ },
+
+ log: function(type, message) {
+ new Insertion.Bottom(this.element,
+ '<tr class="' + type + '"><td>' +
+ message.escapeHTML() + '</td></tr>');
+ Element.scrollTo(this.form);
+ },
+
+ eval: function(expression) {
+ if (expression.match(/^\s*$/)) return;
+ try {
+ this.log('input', expression);
+ window.$_ = this.context.call(window, expression);
+ this.log('output', Object.inspect($_));
+ } catch (e) {
+ this.log('error', e.toString());
+ }
+ },
+
+ clear: function() {
+ this.element.innerHTML = '';
+ }
+ }
+ </script>
+ <style type="text/css">
+ body {
+ margin: 0;
+ padding: 0;
+ }
+
+ .console {
+ width: 100%;
+ border-collapse: collapse;
+ margin-bottom: 50px;
+ }
+
+ .console td {
+ padding: 5px;
+ font-family: monospace;
+ font-size: 14px;
+ }
+
+ .console tr.input td {
+ background-color: #eee;
+ font-weight: bold;
+ }
+
+ .console tr.error td,
+ .console tr.output td {
+ color: #333;
+ border-bottom: 1px solid #ccc;
+ }
+
+ .console tr.error td {
+ color: #f00;
+ }
+
+ #input-form {
+ width: 100%;
+ background-color: #f0f5b8;
+ border-top: 1px solid #333;
+ padding: 10px;
+ position: fixed;
+ height: 25px;
+ bottom: 0;
+ margin: 0;
+ }
+ </style>
+ </head>
+ <body>
+ <table class="console">
+ <tbody id="console">
+ </tbody>
+ </table>
+ <form id="input-form">
+ <input type="text" size="60" id="input" />
+ <input type="submit" value="Evaluate" />
+ </form>
+ <script type="text/javascript">
+ window.console = new Prototype.Console('console', 'input-form', 'input');
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/ajax/prototype/test/functional/event.html b/dom/tests/mochitest/ajax/prototype/test/functional/event.html
new file mode 100644
index 0000000000..526e711f9a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/functional/event.html
@@ -0,0 +1,243 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype functional test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../dist/prototype.js" type="text/javascript"></script>
+
+ <style type="text/css" media="screen">
+ /* <![CDATA[ */
+ body { margin:1em 2em; padding:0; font-size:0.8em }
+ hr { width:31.2em; margin:1em 0; text-align:left }
+ p { width:30em; margin:0.5em 0; padding:0.3em 0.6em; color:#222; background:#eee; border:1px solid silver; }
+ .subtest { margin-top:-0.5em }
+ .passed { color:green; border-color:olive }
+ .failed { color:firebrick; border-color:firebrick }
+ .button { padding:0.2em 0.4em; background:#ccc; border:1px solid #aaa }
+ #log { position:absolute; left:35em; top:5em; width:20em; font-size:13px !important }
+ h2 { font:normal 1.1em Verdana,Arial,sans-serif; font-style:italic; color:gray; margin-top:-1.2em }
+ h2 *, h2 a:visited { color:#444 }
+ h2 a:hover { color:blue }
+ a:visited { color:blue }
+ a:hover { color:red }
+ /* ]]> */
+ </style>
+
+ <script type="text/javascript">
+ Element.addMethods({
+ passed: function(el, message) {
+ el = $(el);
+ el.className = 'passed';
+ (el.down('span') || el).update(message || 'Test passed!');
+ },
+
+ failed: function(el, message) {
+ el = $(el);
+ el.className = 'failed';
+ (el.down('span') || el).update(message || 'Test failed');
+ }
+ });
+
+ function log(obj) {
+ var line, all = [];
+ for (prop in obj) {
+ if (typeof obj[prop] == 'function' || /^[A-Z]|[XY]$/.test(prop)) continue;
+ line = prop + ": " + Object.inspect(obj[prop]);
+ all.push(line.escapeHTML());
+ }
+ $('log').update(all.join('<br />'));
+ }
+ </script>
+</head>
+<body>
+ <h1>Prototype functional tests for the Event module</h1>
+
+ <div id="log">log empty</div>
+
+ <p id="basic">A basic event test - <strong>click here</strong></p>
+ <p id="basic_remove" class="subtest"><strong>click</strong> to stop observing the first test</p>
+
+ <p id="inline_test" onclick="Event.stop(event); $(this).passed();"><strong>click</strong> to ensure generic Event methods work on inline handlers</p>
+
+ <script type="text/javascript">
+ var basic_callback = function(e){
+ $('basic').passed();
+ if ($('basic_remove')) $('basic_remove').show()
+ else $('basic').failed()
+ log(e);
+ }
+ $('basic').observe('click', basic_callback)
+ $('basic_remove').observe('click', function(e){
+ el = $('basic')
+ el.passed('This test should now be inactive (try clicking)')
+ el.stopObserving('click')
+ $('basic_remove').remove()
+ log(e);
+ }).hide()
+ </script>
+
+ <p id="basic2"><strong>Scope</strong> test - scope of the handler should be this element</p>
+
+ <script type="text/javascript">
+ $('basic2').observe('click', function(e) {
+ if (this === window) $('basic2').failed('Window scope! (needs scope correction)');
+ else this.passed();
+ log(e);
+ });
+ </script>
+
+ <p id="basic3"><strong>Event object</strong> test - should be present as a first argument</p>
+
+ <script type="text/javascript">
+ $('basic3').observe('click', function(evt) {
+ el = $('basic3');
+ if (typeof evt != 'object') this.failed('Expected event object for first argument');
+ else this.passed('Good first argument');
+ log(evt);
+ });
+ </script>
+
+ <p><a href="#wrong" id="hijack">Hijack link test</a> (preventDefault)</p>
+
+ <script type="text/javascript">
+ $('hijack').observe('click', function(e){
+ el = $(this.parentNode);
+ log(e); // this makes it fail?!?
+ e.preventDefault();
+
+ setTimeout(function() {
+ if (window.location.hash == '#wrong') el.failed('Hijack failed (<a href="' +
+ window.location.toString().replace(/#.+$/, '') + '">remove the fragment</a>)')
+ else el.passed();
+ }, 50)
+ })
+ </script>
+
+ <hr />
+
+
+ <p>Mouse click:
+ <span class="button" id="left">left</span> <span class="button" id="middle">middle</span> <span class="button" id="right">right</span></p>
+
+ <script type="text/javascript">
+ $w('left middle right').each(function(button) {
+ Event.observe(button, 'mousedown', function(e) {
+ if (Event['is' + this.id.capitalize() + 'Click'](e)) this.passed('Squeak!')
+ else this.failed('OH NO!');
+ log(e);
+ });
+ });
+ </script>
+
+ <p id="context">Context menu event (tries to prevent default)</p>
+
+ <script type="text/javascript">
+ $('context').observe('contextmenu', function(e){
+ this.passed();
+ Event.stop(e);
+ log(e);
+ })
+ </script>
+
+ <p id="target">Event.element() test</p>
+
+ <script type="text/javascript">
+ $('target').observe('click', function(e) {
+ if (e.element() == this && e.target == this) this.passed();
+ else this.failed();
+ log(e);
+ });
+ </script>
+
+ <p id="currentTarget"><span>Event.currentTarget test</span></p>
+
+ <script type="text/javascript">
+ $('currentTarget').observe('click', function(e){
+ if (e.currentTarget !== this) this.failed();
+ else this.passed();
+ log(e);
+ })
+ </script>
+
+ <p id="findElement"><span>Event.findElement() test</span></p>
+
+ <script type="text/javascript">
+ $('findElement').observe('click', function(e){
+ if (e.findElement('p') == this && e.findElement('body') == document.body &&
+ e.findElement('foo') == null) this.passed();
+ else this.failed();
+ log(e);
+ })
+ </script>
+
+ <div id="container"><p id="stop"><strong>Stop propagation</strong> test (bubbling)</p></div>
+
+ <script type="text/javascript">
+ $('stop').observe('click', function(e){
+ e.stop();
+ this.passed();
+ log(e);
+ })
+ $('container').observe('click', function(e){
+ $('stop').failed();
+ log(e);
+ })
+ </script>
+
+ <div>
+ <p id="keyup_log"><strong>Keyup</strong> test - focus on the textarea and type</p>
+ <textarea id="keyup" class="subtest"></textarea>
+ </div>
+
+ <script type="text/javascript">
+ $('keyup').observe('keyup', function(e){
+ el = $('keyup_log');
+ el.passed('Key captured: the length is ' + $('keyup').value.length);
+ log(e);
+ })
+ </script>
+
+ <p id="bind"><code>bindAsEventListener()</code> test</p>
+
+ <script type="text/javascript">
+ $('bind').observe('click', function(e, str, arr){
+ el = $('bind')
+ try {
+ if (arguments.length != 3) throw arguments.length + ' arguments: ' + $A(arguments).inspect()
+ if (str != 'foo') throw 'wrong string: ' + str
+ if (arr.constructor != Array) throw '3rd parameter is not an array'
+ el.passed();
+ }
+ catch (err) { el.failed(err.toString()) }
+ log(e);
+ }.bindAsEventListener(document.body, 'foo', [1,2,3]))
+ </script>
+
+ <p id="obj_inspect"><code>Object.inspect(event)</code> test</p>
+
+ <script type="text/javascript">
+ $('obj_inspect').observe('click', function(e){
+ el = $('obj_inspect')
+ try { el.passed(Object.inspect(e)) }
+ catch (err) { el.failed('Failed! Error thrown') }
+ log(e);
+ })
+ </script>
+
+ <p id="addunload">Add unload events</p>
+
+ <script type="text/javascript">
+ $('addunload').observe('click', function(e){
+ if (this._done) return
+
+ window.onunload = function(){ alert('inline unload fired!') }
+ Event.observe(window, 'unload', function(){ alert('observed unload fired!') })
+
+ this.update('Registered two unload events, one inline ("onunload") and one regular - try to refresh, both should fire')
+ this._done = true
+ log(e);
+ })
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/prototype/test/lib/unittest.js b/dom/tests/mochitest/ajax/prototype/test/lib/unittest.js
new file mode 100644
index 0000000000..4f92d13dc0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/lib/unittest.js
@@ -0,0 +1,602 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005 Jon Tirsen (http://www.tirsen.com)
+// (c) 2005 Michael Schuerig (http://www.schuerig.de/michael/)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+// experimental, Firefox-only
+Event.simulateMouse = function(element, eventName) {
+ var options = Object.extend({
+ pointerX: 0,
+ pointerY: 0,
+ buttons: 0
+ }, arguments[2] || {});
+ var oEvent = document.createEvent("MouseEvents");
+ oEvent.initMouseEvent(eventName, true, true, document.defaultView,
+ options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
+ false, false, false, false, 0, $(element));
+
+ if (this.mark) Element.remove(this.mark);
+
+ var style = 'position: absolute; width: 5px; height: 5px;' +
+ 'top: #{pointerY}px; left: #{pointerX}px;'.interpolate(options) +
+ 'border-top: 1px solid red; border-left: 1px solid red;'
+
+ this.mark = new Element('div', { style: style });
+ this.mark.appendChild(document.createTextNode(" "));
+ document.body.appendChild(this.mark);
+
+ if (this.step)
+ alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
+
+ $(element).dispatchEvent(oEvent);
+};
+
+// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2.
+// You need to downgrade to 1.0.4 for now to get this working
+// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much
+Event.simulateKey = function(element, eventName) {
+ var options = Object.extend({
+ ctrlKey: false,
+ altKey: false,
+ shiftKey: false,
+ metaKey: false,
+ keyCode: 0,
+ charCode: 0
+ }, arguments[2] || {});
+
+ var oEvent = document.createEvent("KeyboardEvent");
+ oEvent.initKeyEvent(eventName, true, true, window,
+ options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
+ options.keyCode, options.charCode );
+ $(element).dispatchEvent(oEvent);
+};
+
+Event.simulateKeys = function(element, command) {
+ for (var i=0; i<command.length; i++) {
+ Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)});
+ }
+};
+
+var Test = {
+ Unit: {
+ inspect: Object.inspect // security exception workaround
+ }
+};
+
+Test.Unit.Logger = Class.create({
+ initialize: function(element) {
+ this.element = $(element);
+ if (this.element) this._createLogTable();
+ this.tbody = $(this.element.getElementsByTagName('tbody')[0]);
+ },
+
+ start: function(testName) {
+ this.testName = testName;
+ if (!this.element) return;
+ this.tbody.insert('<tr><td>' + testName + '</td><td></td><td></td></tr>');
+ },
+
+ setStatus: function(status) {
+ this.getLastLogLine().addClassName(status);
+ $(this.getLastLogLine().getElementsByTagName('td')[1]).update(status);
+ },
+
+ finish: function(status, summary) {
+ if (!this.element) return;
+ this.setStatus(status);
+ this.message(summary);
+ },
+
+ message: function(message) {
+ if (!this.element) return;
+ this.getMessageCell().update(this._toHTML(message));
+ },
+
+ summary: function(summary) {
+ if (!this.element) return;
+ var div = $(this.element.getElementsByTagName('div')[0]);
+ div.update(this._toHTML(summary));
+ },
+
+ getLastLogLine: function() {
+ //return this.element.descendants('tr').last();
+ var trs = this.element.getElementsByTagName('tr');
+ return $(trs[trs.length - 1]);
+ },
+
+ getMessageCell: function() {
+ return this.getLastLogLine().down('td', 2);
+ var tds = this.getLastLogLine().getElementsByTagName('td');
+ return $(tds[2]);
+ },
+
+ _createLogTable: function() {
+ var html = '<div class="logsummary">running...</div>' +
+ '<table class="logtable">' +
+ '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
+ '<tbody class="loglines"></tbody>' +
+ '</table>';
+ this.element.update(html);
+
+ },
+
+ appendActionButtons: function(actions) {
+ actions = $H(actions);
+ if (!actions.any()) return;
+ var div = new Element("div", {className: 'action_buttons'});
+ actions.inject(div, function(container, action) {
+ var button = new Element("input").setValue(action.key).observe("click", action.value);
+ button.type = "button";
+ return container.insert(button);
+ });
+ this.getMessageCell().insert(div);
+ },
+
+ _toHTML: function(txt) {
+ return txt.escapeHTML().replace(/\n/g,"<br />");
+ }
+});
+
+Test.Unit.Runner = Class.create({
+ initialize: function(testcases) {
+ var options = this.options = Object.extend({
+ testLog: 'testlog'
+ }, arguments[1] || {});
+
+ options.resultsURL = this.queryParams.resultsURL;
+
+ this.tests = this.getTests(testcases);
+ this.currentTest = 0;
+
+ Event.observe(window, "load", function() {
+ this.logger = new Test.Unit.Logger($(options.testLog));
+ this.runTests.bind(this).delay(0.1);
+ }.bind(this));
+ },
+
+ queryParams: window.location.search.parseQuery(),
+
+ getTests: function(testcases) {
+ var tests, options = this.options;
+ if (this.queryParams.tests) tests = this.queryParams.tests.split(',');
+ else if (options.tests) tests = options.tests;
+ else if (options.test) tests = [option.test];
+ else tests = Object.keys(testcases).grep(/^test/);
+
+ return tests.map(function(test) {
+ if (testcases[test])
+ return new Test.Unit.Testcase(test, testcases[test], testcases.setup, testcases.teardown);
+ }).compact();
+ },
+
+ getResult: function() {
+ var results = {
+ tests: this.tests.length,
+ assertions: 0,
+ failures: 0,
+ errors: 0
+ };
+
+ return this.tests.inject(results, function(results, test) {
+ results.assertions += test.assertions;
+ results.failures += test.failures;
+ results.errors += test.errors;
+ return results;
+ });
+ },
+
+ postResults: function() {
+ if (this.options.resultsURL) {
+ new Ajax.Request(this.options.resultsURL,
+ { method: 'get', parameters: this.getResult(), asynchronous: false });
+ }
+ },
+
+ runTests: function() {
+ var test = this.tests[this.currentTest], actions;
+
+ if (!test) return this.finish();
+ if (test.timerID > 0) test.timerID = -1;
+ if (!test.isWaiting) this.logger.start(test.name);
+ test.run();
+ if (test.isWaiting) {
+ if (test.timeToWait) {
+ this.logger.message("Waiting for " + test.timeToWait + "ms");
+ test.timerID = setTimeout(this.runTests.bind(this), test.timeToWait);
+ } else {
+ this.logger.message("Waiting for finish");
+ }
+ test.runner = this;
+ return;
+ }
+
+ this.logger.finish(test.status(), test.summary());
+ if (actions = test.actions) this.logger.appendActionButtons(actions);
+ this.currentTest++;
+ // tail recursive, hopefully the browser will skip the stackframe
+ this.runTests();
+ },
+
+ finish: function() {
+ this.postResults();
+ this.logger.summary(this.summary());
+ },
+
+ summary: function() {
+ return '#{tests} tests, #{assertions} assertions, #{failures} failures, #{errors} errors'
+ .interpolate(this.getResult());
+ }
+});
+
+Test.Unit.MessageTemplate = Class.create({
+ initialize: function(string) {
+ var parts = [];
+ (string || '').scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/, function(part) {
+ parts.push(part[0]);
+ });
+ this.parts = parts;
+ },
+
+ evaluate: function(params) {
+ return this.parts.map(function(part) {
+ return part == '?' ? Test.Unit.inspect(params.shift()) : part.replace(/\\\?/, '?');
+ }).join('');
+ }
+});
+
+Test.Unit.Assertions = {
+ buildMessage: function(message, template) {
+ var args = $A(arguments).slice(2);
+ return (message ? message + '\n' : '') + new Test.Unit.MessageTemplate(template).evaluate(args);
+ },
+
+ flunk: function(message) {
+ this.assertBlock(message || 'Flunked', function() { return false });
+ },
+
+ assertBlock: function(message, block) {
+ try {
+ block.call(this) ? this.pass() : this.fail(message);
+ } catch(e) { this.error(e) }
+ },
+
+ assert: function(expression, message) {
+ message = this.buildMessage(message || 'assert', 'got <?>', expression);
+ this.assertBlock(message, function() { return expression });
+ },
+
+ assertEqual: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertEqual', 'expected <?>, actual: <?>', expected, actual);
+ this.assertBlock(message, function() { return expected == actual });
+ },
+
+ assertNotEqual: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertNotEqual', 'expected <?>, actual: <?>', expected, actual);
+ this.assertBlock(message, function() { return expected != actual });
+ },
+
+ assertEnumEqual: function(expected, actual, message) {
+ expected = $A(expected);
+ actual = $A(actual);
+ message = this.buildMessage(message || 'assertEnumEqual', 'expected <?>, actual: <?>', expected, actual);
+ this.assertBlock(message, function() {
+ return expected.length == actual.length && expected.zip(actual).all(function(pair) { return pair[0] == pair[1] });
+ });
+ },
+
+ assertEnumNotEqual: function(expected, actual, message) {
+ expected = $A(expected);
+ actual = $A(actual);
+ message = this.buildMessage(message || 'assertEnumNotEqual', '<?> was the same as <?>', expected, actual);
+ this.assertBlock(message, function() {
+ return expected.length != actual.length || expected.zip(actual).any(function(pair) { return pair[0] != pair[1] });
+ });
+ },
+
+ assertHashEqual: function(expected, actual, message) {
+ expected = $H(expected);
+ actual = $H(actual);
+ var expected_array = expected.toArray().sort(), actual_array = actual.toArray().sort();
+ message = this.buildMessage(message || 'assertHashEqual', 'expected <?>, actual: <?>', expected, actual);
+ // from now we recursively zip & compare nested arrays
+ var block = function() {
+ return expected_array.length == actual_array.length &&
+ expected_array.zip(actual_array).all(function(pair) {
+ return pair.all(Object.isArray) ?
+ pair[0].zip(pair[1]).all(arguments.callee) : pair[0] == pair[1];
+ });
+ };
+ this.assertBlock(message, block);
+ },
+
+ assertHashNotEqual: function(expected, actual, message) {
+ expected = $H(expected);
+ actual = $H(actual);
+ var expected_array = expected.toArray().sort(), actual_array = actual.toArray().sort();
+ message = this.buildMessage(message || 'assertHashNotEqual', '<?> was the same as <?>', expected, actual);
+ // from now we recursively zip & compare nested arrays
+ var block = function() {
+ return !(expected_array.length == actual_array.length &&
+ expected_array.zip(actual_array).all(function(pair) {
+ return pair.all(Object.isArray) ?
+ pair[0].zip(pair[1]).all(arguments.callee) : pair[0] == pair[1];
+ }));
+ };
+ this.assertBlock(message, block);
+ },
+
+ assertIdentical: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertIdentical', 'expected <?>, actual: <?>', expected, actual);
+ this.assertBlock(message, function() { return expected === actual });
+ },
+
+ assertNotIdentical: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertNotIdentical', 'expected <?>, actual: <?>', expected, actual);
+ this.assertBlock(message, function() { return expected !== actual });
+ },
+
+ assertNull: function(obj, message) {
+ message = this.buildMessage(message || 'assertNull', 'got <?>', obj);
+ this.assertBlock(message, function() { return obj === null });
+ },
+
+ assertNotNull: function(obj, message) {
+ message = this.buildMessage(message || 'assertNotNull', 'got <?>', obj);
+ this.assertBlock(message, function() { return obj !== null });
+ },
+
+ assertUndefined: function(obj, message) {
+ message = this.buildMessage(message || 'assertUndefined', 'got <?>', obj);
+ this.assertBlock(message, function() { return typeof obj == "undefined" });
+ },
+
+ assertNotUndefined: function(obj, message) {
+ message = this.buildMessage(message || 'assertNotUndefined', 'got <?>', obj);
+ this.assertBlock(message, function() { return typeof obj != "undefined" });
+ },
+
+ assertNullOrUndefined: function(obj, message) {
+ message = this.buildMessage(message || 'assertNullOrUndefined', 'got <?>', obj);
+ this.assertBlock(message, function() { return obj == null });
+ },
+
+ assertNotNullOrUndefined: function(obj, message) {
+ message = this.buildMessage(message || 'assertNotNullOrUndefined', 'got <?>', obj);
+ this.assertBlock(message, function() { return obj != null });
+ },
+
+ assertMatch: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertMatch', 'regex <?> did not match <?>', expected, actual);
+ this.assertBlock(message, function() { return new RegExp(expected).exec(actual) });
+ },
+
+ assertNoMatch: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertNoMatch', 'regex <?> matched <?>', expected, actual);
+ this.assertBlock(message, function() { return !(new RegExp(expected).exec(actual)) });
+ },
+
+ assertHidden: function(element, message) {
+ message = this.buildMessage(message || 'assertHidden', '? isn\'t hidden.', element);
+ this.assertBlock(message, function() { return element.style.display == 'none' });
+ },
+
+ assertInstanceOf: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertInstanceOf', '<?> was not an instance of the expected type', actual);
+ this.assertBlock(message, function() { return actual instanceof expected });
+ },
+
+ assertNotInstanceOf: function(expected, actual, message) {
+ message = this.buildMessage(message || 'assertNotInstanceOf', '<?> was an instance of the expected type', actual);
+ this.assertBlock(message, function() { return !(actual instanceof expected) });
+ },
+
+ assertRespondsTo: function(method, obj, message) {
+ message = this.buildMessage(message || 'assertRespondsTo', 'object doesn\'t respond to <?>', method);
+ this.assertBlock(message, function() { return (method in obj && typeof obj[method] == 'function') });
+ },
+
+ assertRaise: function(exceptionName, method, message) {
+ message = this.buildMessage(message || 'assertRaise', '<?> exception expected but none was raised', exceptionName);
+ var block = function() {
+ try {
+ method();
+ return false;
+ } catch(e) {
+ if (e.name == exceptionName) return true;
+ else throw e;
+ }
+ };
+ this.assertBlock(message, block);
+ },
+
+ assertNothingRaised: function(method, message) {
+ try {
+ method();
+ this.assert(true, "Expected nothing to be thrown");
+ } catch(e) {
+ message = this.buildMessage(message || 'assertNothingRaised', '<?> was thrown when nothing was expected.', e);
+ this.flunk(message);
+ }
+ },
+
+ _isVisible: function(element) {
+ element = $(element);
+ if (!element.parentNode) return true;
+ this.assertNotNull(element);
+ if (element.style && Element.getStyle(element, 'display') == 'none')
+ return false;
+
+ return arguments.callee.call(this, element.parentNode);
+ },
+
+ assertVisible: function(element, message) {
+ message = this.buildMessage(message, '? was not visible.', element);
+ this.assertBlock(message, function() { return this._isVisible(element) });
+ },
+
+ assertNotVisible: function(element, message) {
+ message = this.buildMessage(message, '? was not hidden and didn\'t have a hidden parent either.', element);
+ this.assertBlock(message, function() { return !this._isVisible(element) });
+ },
+
+ assertElementsMatch: function() {
+ var pass = true, expressions = $A(arguments), elements = $A(expressions.shift());
+ if (elements.length != expressions.length) {
+ message = this.buildMessage('assertElementsMatch', 'size mismatch: ? elements, ? expressions (?).', elements.length, expressions.length, expressions);
+ this.flunk(message);
+ pass = false;
+ }
+ elements.zip(expressions).all(function(pair, index) {
+ var element = $(pair.first()), expression = pair.last();
+ if (element.match(expression)) return true;
+ message = this.buildMessage('assertElementsMatch', 'In index <?>: expected <?> but got ?', index, expression, element);
+ this.flunk(message);
+ pass = false;
+ }.bind(this))
+
+ if (pass) this.assert(true, "Expected all elements to match.");
+ },
+
+ assertElementMatches: function(element, expression, message) {
+ this.assertElementsMatch([element], expression);
+ }
+};
+
+Test.Unit.Testcase = Class.create(Test.Unit.Assertions, {
+ initialize: function(name, test, setup, teardown) {
+ this.name = name;
+ this.test = test || Prototype.emptyFunction;
+ this.setup = setup || Prototype.emptyFunction;
+ this.teardown = teardown || Prototype.emptyFunction;
+ this.messages = [];
+ this.actions = {};
+ },
+
+ isWaiting: false,
+ timeToWait: null,
+ timerID: -1,
+ runner: null,
+ assertions: 0,
+ failures: 0,
+ errors: 0,
+ isRunningFromRake: window.location.port == 4711,
+
+ wait: function(time, nextPart) {
+ this.isWaiting = true;
+ this.test = nextPart;
+ this.timeToWait = time;
+ },
+
+ waitForFinish: function() {
+ this.isWaiting = true;
+ },
+
+ finish: function() {
+ if (this.timerID > 0) {
+ clearTimeout(this.timerID);
+ this.timerID = -1;
+ this.timeToWait = null;
+ }
+ this.test = function(){};
+ // continue test
+ if (this.runner)
+ this.runner.runTests();
+ },
+
+ run: function(rethrow) {
+ try {
+ try {
+ if (!this.isWaiting) this.setup();
+ this.isWaiting = false;
+ this.test();
+ } finally {
+ if (!this.isWaiting) {
+ this.teardown();
+ }
+ }
+ }
+ catch(e) {
+ if (rethrow) throw e;
+ this.error(e, this);
+ }
+ },
+
+ summary: function() {
+ var msg = '#{assertions} assertions, #{failures} failures, #{errors} errors\n';
+ return msg.interpolate(this) + this.messages.join("\n");
+ },
+
+ pass: function() {
+ this.assertions++;
+ },
+
+ fail: function(message) {
+ this.failures++;
+ var line = "";
+ try {
+ throw new Error("stack");
+ } catch(e){
+ match = /.*\/(.*_test\.js):(\d+)/.exec(e.stack || '') || ['','',''];
+ file = match[1];
+ line = match[2];
+ }
+ this.messages.push("Failure: " + message + (line ? " " + file + ": Line #" + line : ""));
+ },
+
+ info: function(message) {
+ this.messages.push("Info: " + message);
+ },
+
+ error: function(error, test) {
+ this.errors++;
+ this.actions['retry with throw'] = function() { test.run(true) };
+ this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) + ")");
+ },
+
+ status: function() {
+ if (this.failures > 0) return 'failed';
+ if (this.errors > 0) return 'error';
+ return 'passed';
+ },
+
+ benchmark: function(operation, iterations) {
+ var startAt = new Date();
+ (iterations || 1).times(operation);
+ var timeTaken = ((new Date())-startAt);
+ this.info((arguments[2] || 'Operation') + ' finished ' +
+ iterations + ' iterations in ' + (timeTaken/1000)+'s' );
+ return timeTaken;
+ }
+});
+
+if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
+ var finish = Test.Unit.Logger.prototype.finish;
+ Test.Unit.Logger.prototype.finish = function(status,summary){
+ parent.SimpleTest.ok( status == "passed", `${this.testName}: ${summary}` );
+ return finish.apply( this, arguments );
+ };
+
+ // Intentionally overwrite (to stop the Ajax request)
+ Test.Unit.Runner.prototype.postResults = parent.runAJAXTest;
+})();
+
+
diff --git a/dom/tests/mochitest/ajax/prototype/test/test.css b/dom/tests/mochitest/ajax/prototype/test/test.css
new file mode 100644
index 0000000000..6fe8f51c9b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/test.css
@@ -0,0 +1,50 @@
+body, div, p, h1, h2, h3, ul, ol, span, a, table, td, form, img, li {
+ font-family: sans-serif;
+}
+
+body {
+ font-size:0.8em;
+}
+
+#log {
+ padding-bottom: 1em;
+ border-bottom: 2px solid #000;
+ margin-bottom: 2em;
+}
+
+.logsummary {
+ margin-top: 1em;
+ margin-bottom: 1em;
+ padding: 1ex;
+ border: 1px solid #000;
+ font-weight: bold;
+}
+
+.logtable {
+ width:100%;
+ border-collapse: collapse;
+ border: 1px dotted #666;
+}
+
+.logtable td, .logtable th {
+ text-align: left;
+ padding: 3px 8px;
+ border: 1px dotted #666;
+}
+
+.logtable .passed {
+ background-color: #cfc;
+}
+
+.logtable .failed, .logtable .error {
+ background-color: #fcc;
+}
+
+.logtable td div.action_buttons {
+ display: inline;
+}
+
+.logtable td div.action_buttons input {
+ margin: 0 5px;
+ font-size: 10px;
+} \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/ajax_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/ajax_test.js
new file mode 100644
index 0000000000..9ceb985186
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/ajax_test.js
@@ -0,0 +1,286 @@
+var extendDefault = function(options) {
+ return Object.extend({
+ asynchronous: false,
+ method: 'get',
+ onException: function(request, e) { throw e }
+ }, options);
+};
+
+new Test.Unit.Runner({
+ setup: function() {
+ $('content').update('');
+ $('content2').update('');
+ },
+
+ teardown: function() {
+ // hack to cleanup responders
+ Ajax.Responders.responders = [Ajax.Responders.responders[0]];
+ },
+
+ testSynchronousRequest: function() {
+ this.assertEqual("", $("content").innerHTML);
+
+ this.assertEqual(0, Ajax.activeRequestCount);
+ new Ajax.Request("../fixtures/hello.js", extendDefault({
+ asynchronous: false,
+ method: 'GET',
+ evalJS: 'force'
+ }));
+ this.assertEqual(0, Ajax.activeRequestCount);
+
+ var h2 = $("content").firstChild;
+ this.assertEqual("Hello world!", h2.innerHTML);
+ },
+
+ testUpdaterOptions: function() {
+ var options = {
+ method: 'get',
+ asynchronous: false,
+ evalJS: 'force',
+ onComplete: Prototype.emptyFunction
+ }
+ var request = new Ajax.Updater("content", "../fixtures/hello.js", options);
+ request.options.onComplete = function() {};
+ this.assertIdentical(Prototype.emptyFunction, options.onComplete);
+ },
+
+ testEvalResponseShouldBeCalledBeforeOnComplete: function() {
+ if (this.isRunningFromRake) {
+ this.assertEqual("", $("content").innerHTML);
+
+ this.assertEqual(0, Ajax.activeRequestCount);
+ new Ajax.Request("../fixtures/hello.js", extendDefault({
+ onComplete: function(response) { this.assertNotEqual("", $("content").innerHTML) }.bind(this)
+ }));
+ this.assertEqual(0, Ajax.activeRequestCount);
+
+ var h2 = $("content").firstChild;
+ this.assertEqual("Hello world!", h2.innerHTML);
+ } else {
+ this.info(message);
+ }
+ },
+
+ testContentTypeSetForSimulatedVerbs: function() {
+ if (this.isRunningFromRake) {
+ new Ajax.Request('/inspect', extendDefault({
+ method: 'put',
+ contentType: 'application/bogus',
+ onComplete: function(response) {
+ this.assertEqual('application/bogus; charset=UTF-8', response.responseJSON.headers['content-type']);
+ }.bind(this)
+ }));
+ } else {
+ this.info(message);
+ }
+ },
+
+ testOnCreateCallback: function() {
+ new Ajax.Request("../fixtures/content.html", extendDefault({
+ onCreate: function(transport) { this.assertEqual(0, transport.readyState) }.bind(this),
+ onComplete: function(transport) { this.assertNotEqual(0, transport.readyState) }.bind(this)
+ }));
+ },
+
+ testEvalJS: function() {
+ if (this.isRunningFromRake) {
+
+ $('content').update();
+ new Ajax.Request("/response", extendDefault({
+ parameters: Fixtures.js,
+ onComplete: function(transport) {
+ var h2 = $("content").firstChild;
+ this.assertEqual("Hello world!", h2.innerHTML);
+ }.bind(this)
+ }));
+
+ $('content').update();
+ new Ajax.Request("/response", extendDefault({
+ evalJS: false,
+ parameters: Fixtures.js,
+ onComplete: function(transport) {
+ this.assertEqual("", $("content").innerHTML);
+ }.bind(this)
+ }));
+ } else {
+ this.info(message);
+ }
+
+ $('content').update();
+ new Ajax.Request("../fixtures/hello.js", extendDefault({
+ evalJS: 'force',
+ onComplete: function(transport) {
+ var h2 = $("content").firstChild;
+ this.assertEqual("Hello world!", h2.innerHTML);
+ }.bind(this)
+ }));
+ },
+
+ testCallbacks: function() {
+ var options = extendDefault({
+ onCreate: function(transport) { this.assertInstanceOf(Ajax.Response, transport) }.bind(this)
+ });
+
+ Ajax.Request.Events.each(function(state){
+ options['on' + state] = options.onCreate;
+ });
+
+ new Ajax.Request("../fixtures/content.html", options);
+ },
+
+ testResponseText: function() {
+ new Ajax.Request("../fixtures/empty.html", extendDefault({
+ onComplete: function(transport) { this.assertEqual('', transport.responseText) }.bind(this)
+ }));
+
+ new Ajax.Request("../fixtures/content.html", extendDefault({
+ onComplete: function(transport) { this.assertEqual(sentence, transport.responseText.toLowerCase()) }.bind(this)
+ }));
+ },
+
+ testResponseXML: function() {
+ if (this.isRunningFromRake) {
+ new Ajax.Request("/response", extendDefault({
+ parameters: Fixtures.xml,
+ onComplete: function(transport) {
+ this.assertEqual('foo', transport.responseXML.getElementsByTagName('name')[0].getAttribute('attr'))
+ }.bind(this)
+ }));
+ } else {
+ this.info(message);
+ }
+ },
+
+ testResponseJSON: function() {
+ if (this.isRunningFromRake) {
+ new Ajax.Request("/response", extendDefault({
+ parameters: Fixtures.json,
+ onComplete: function(transport) { this.assertEqual(123, transport.responseJSON.test) }.bind(this)
+ }));
+
+ new Ajax.Request("/response", extendDefault({
+ parameters: {
+ 'Content-Length': 0,
+ 'Content-Type': 'application/json'
+ },
+ onComplete: function(transport) { this.assertNull(transport.responseJSON) }.bind(this)
+ }));
+
+ new Ajax.Request("/response", extendDefault({
+ evalJSON: false,
+ parameters: Fixtures.json,
+ onComplete: function(transport) { this.assertNull(transport.responseJSON) }.bind(this)
+ }));
+
+ new Ajax.Request("/response", extendDefault({
+ parameters: Fixtures.jsonWithoutContentType,
+ onComplete: function(transport) { this.assertNull(transport.responseJSON) }.bind(this)
+ }));
+
+ new Ajax.Request("/response", extendDefault({
+ sanitizeJSON: true,
+ parameters: Fixtures.invalidJson,
+ onException: function(request, error) {
+ this.assert(error.message.include('Badly formed JSON string'));
+ this.assertInstanceOf(Ajax.Request, request);
+ }.bind(this)
+ }));
+ } else {
+ this.info(message);
+ }
+
+ new Ajax.Request("../fixtures/data.json", extendDefault({
+ evalJSON: 'force',
+ onComplete: function(transport) { this.assertEqual(123, transport.responseJSON.test) }.bind(this)
+ }));
+ },
+
+ testHeaderJSON: function() {
+ if (this.isRunningFromRake) {
+ new Ajax.Request("/response", extendDefault({
+ parameters: Fixtures.headerJson,
+ onComplete: function(transport, json) {
+ this.assertEqual('hello #éà', transport.headerJSON.test);
+ this.assertEqual('hello #éà', json.test);
+ }.bind(this)
+ }));
+
+ new Ajax.Request("/response", extendDefault({
+ onComplete: function(transport, json) {
+ this.assertNull(transport.headerJSON)
+ this.assertNull(json)
+ }.bind(this)
+ }));
+ } else {
+ this.info(message);
+ }
+ },
+
+ testGetHeader: function() {
+ if (this.isRunningFromRake) {
+ new Ajax.Request("/response", extendDefault({
+ parameters: { 'X-TEST': 'some value' },
+ onComplete: function(transport) {
+ this.assertEqual('some value', transport.getHeader('X-Test'));
+ this.assertNull(transport.getHeader('X-Inexistant'));
+ }.bind(this)
+ }));
+ } else {
+ this.info(message);
+ }
+ },
+
+ testParametersCanBeHash: function() {
+ if (this.isRunningFromRake) {
+ new Ajax.Request("/response", extendDefault({
+ parameters: $H({ "one": "two", "three": "four" }),
+ onComplete: function(transport) {
+ this.assertEqual("two", transport.getHeader("one"));
+ this.assertEqual("four", transport.getHeader("three"));
+ this.assertNull(transport.getHeader("toObject"));
+ }.bind(this)
+ }));
+ } else {
+ this.info(message);
+ }
+ },
+
+ testIsSameOriginMethod: function() {
+ var isSameOrigin = Ajax.Request.prototype.isSameOrigin;
+ this.assert(isSameOrigin.call({ url: '/foo/bar.html' }), '/foo/bar.html');
+ this.assert(isSameOrigin.call({ url: window.location.toString() }), window.location);
+ this.assert(!isSameOrigin.call({ url: 'http://example.com' }), 'http://example.com');
+
+ if (this.isRunningFromRake) {
+ Ajax.Request.prototype.isSameOrigin = function() {
+ return false
+ };
+
+ $("content").update('same origin policy');
+ new Ajax.Request("/response", extendDefault({
+ parameters: Fixtures.js,
+ onComplete: function(transport) {
+ this.assertEqual("same origin policy", $("content").innerHTML);
+ }.bind(this)
+ }));
+
+ new Ajax.Request("/response", extendDefault({
+ parameters: Fixtures.invalidJson,
+ onException: function(request, error) {
+ this.assert(error.message.include('Badly formed JSON string'));
+ }.bind(this)
+ }));
+
+ new Ajax.Request("/response", extendDefault({
+ parameters: { 'X-JSON': '{});window.attacked = true;({}' },
+ onException: function(request, error) {
+ this.assert(error.message.include('Badly formed JSON string'));
+ }.bind(this)
+ }));
+
+ Ajax.Request.prototype.isSameOrigin = isSameOrigin;
+ } else {
+ this.info(message);
+ }
+ }
+});
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/array_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/array_test.js
new file mode 100644
index 0000000000..c3f9d41147
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/array_test.js
@@ -0,0 +1,190 @@
+var globalArgsTest = 'nothing to see here';
+
+new Test.Unit.Runner({
+ test$A: function(){
+ this.assertEnumEqual([], $A({}));
+ },
+
+ testToArrayOnArguments: function(){
+ function toArrayOnArguments(){
+ globalArgsTest = $A(arguments);
+ }
+ toArrayOnArguments();
+ this.assertEnumEqual([], globalArgsTest);
+ toArrayOnArguments('foo');
+ this.assertEnumEqual(['foo'], globalArgsTest);
+ toArrayOnArguments('foo','bar');
+ this.assertEnumEqual(['foo','bar'], globalArgsTest);
+ },
+
+ testToArrayOnNodeList: function(){
+ // direct HTML
+ this.assertEqual(3, $A($('test_node').childNodes).length);
+
+ // DOM
+ var element = document.createElement('div');
+ element.appendChild(document.createTextNode('22'));
+ (2).times(function(){ element.appendChild(document.createElement('span')) });
+ this.assertEqual(3, $A(element.childNodes).length);
+
+ // HTML String
+ element = document.createElement('div');
+ $(element).update('22<span></span><span></span');
+ this.assertEqual(3, $A(element.childNodes).length);
+ },
+
+ testClear: function(){
+ this.assertEnumEqual([], [].clear());
+ this.assertEnumEqual([], [1].clear());
+ this.assertEnumEqual([], [1,2].clear());
+ },
+
+ testClone: function(){
+ this.assertEnumEqual([], [].clone());
+ this.assertEnumEqual([1], [1].clone());
+ this.assertEnumEqual([1,2], [1,2].clone());
+ this.assertEnumEqual([0,1,2], [0,1,2].clone());
+ var a = [0,1,2];
+ var b = a;
+ this.assertIdentical(a, b);
+ b = a.clone();
+ this.assertNotIdentical(a, b);
+ },
+
+ testFirst: function(){
+ this.assertUndefined([].first());
+ this.assertEqual(1, [1].first());
+ this.assertEqual(1, [1,2].first());
+ },
+
+ testLast: function(){
+ this.assertUndefined([].last());
+ this.assertEqual(1, [1].last());
+ this.assertEqual(2, [1,2].last());
+ },
+
+ testCompact: function(){
+ this.assertEnumEqual([], [].compact());
+ this.assertEnumEqual([1,2,3], [1,2,3].compact());
+ this.assertEnumEqual([0,1,2,3], [0,null,1,2,undefined,3].compact());
+ this.assertEnumEqual([1,2,3], [null,1,2,3,null].compact());
+ },
+
+ testFlatten: function(){
+ this.assertEnumEqual([], [].flatten());
+ this.assertEnumEqual([1,2,3], [1,2,3].flatten());
+ this.assertEnumEqual([1,2,3], [1,[[[2,3]]]].flatten());
+ this.assertEnumEqual([1,2,3], [[1],[2],[3]].flatten());
+ this.assertEnumEqual([1,2,3], [[[[[[[1]]]]]],2,3].flatten());
+ },
+
+ testIndexOf: function(){
+ this.assertEqual(-1, [].indexOf(1));
+ this.assertEqual(-1, [0].indexOf(1));
+ this.assertEqual(0, [1].indexOf(1));
+ this.assertEqual(1, [0,1,2].indexOf(1));
+ this.assertEqual(0, [1,2,1].indexOf(1));
+ this.assertEqual(2, [1,2,1].indexOf(1, -1));
+ this.assertEqual(1, [undefined,null].indexOf(null));
+ },
+
+ testLastIndexOf: function(){
+ this.assertEqual(-1,[].lastIndexOf(1));
+ this.assertEqual(-1, [0].lastIndexOf(1));
+ this.assertEqual(0, [1].lastIndexOf(1));
+ this.assertEqual(2, [0,2,4,6].lastIndexOf(4));
+ this.assertEqual(3, [4,4,2,4,6].lastIndexOf(4));
+ this.assertEqual(3, [0,2,4,6].lastIndexOf(6,3));
+ this.assertEqual(-1, [0,2,4,6].lastIndexOf(6,2));
+ this.assertEqual(0, [6,2,4,6].lastIndexOf(6,2));
+
+ var fixture = [1,2,3,4,3];
+ this.assertEqual(4, fixture.lastIndexOf(3));
+ this.assertEnumEqual([1,2,3,4,3],fixture);
+
+ //tests from http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:lastIndexOf
+ var array = [2, 5, 9, 2];
+ this.assertEqual(3,array.lastIndexOf(2));
+ this.assertEqual(-1,array.lastIndexOf(7));
+ this.assertEqual(3,array.lastIndexOf(2,3));
+ this.assertEqual(0,array.lastIndexOf(2,2));
+ this.assertEqual(0,array.lastIndexOf(2,-2));
+ this.assertEqual(3,array.lastIndexOf(2,-1));
+ },
+
+ testInspect: function(){
+ this.assertEqual('[]',[].inspect());
+ this.assertEqual('[1]',[1].inspect());
+ this.assertEqual('[\'a\']',['a'].inspect());
+ this.assertEqual('[\'a\', 1]',['a',1].inspect());
+ },
+
+ testIntersect: function(){
+ this.assertEnumEqual([1,3], [1,1,3,5].intersect([1,2,3]));
+ this.assertEnumEqual([1], [1,1].intersect([1,1]));
+ this.assertEnumEqual([0], [0,2].intersect([1,0]));
+ this.assertEnumEqual([], [1,1,3,5].intersect([4]));
+ this.assertEnumEqual([], [1].intersect(['1']));
+
+ this.assertEnumEqual(
+ ['B','C','D'],
+ $R('A','Z').toArray().intersect($R('B','D').toArray())
+ );
+ },
+
+ testToJSON: function(){
+ this.assertEqual('[]', [].toJSON());
+ this.assertEqual('[\"a\"]', ['a'].toJSON());
+ this.assertEqual('[\"a\", 1]', ['a', 1].toJSON());
+ this.assertEqual('[\"a\", {\"b\": null}]', ['a', {'b': null}].toJSON());
+ },
+
+ testReduce: function(){
+ this.assertUndefined([].reduce());
+ this.assertNull([null].reduce());
+ this.assertEqual(1, [1].reduce());
+ this.assertEnumEqual([1,2,3], [1,2,3].reduce());
+ this.assertEnumEqual([1,null,3], [1,null,3].reduce());
+ },
+
+ testReverse: function(){
+ this.assertEnumEqual([], [].reverse());
+ this.assertEnumEqual([1], [1].reverse());
+ this.assertEnumEqual([2,1], [1,2].reverse());
+ this.assertEnumEqual([3,2,1], [1,2,3].reverse());
+ },
+
+ testSize: function(){
+ this.assertEqual(4, [0, 1, 2, 3].size());
+ this.assertEqual(0, [].size());
+ },
+
+ testUniq: function(){
+ this.assertEnumEqual([1], [1, 1, 1].uniq());
+ this.assertEnumEqual([1], [1].uniq());
+ this.assertEnumEqual([], [].uniq());
+ this.assertEnumEqual([0, 1, 2, 3], [0, 1, 2, 2, 3, 0, 2].uniq());
+ this.assertEnumEqual([0, 1, 2, 3], [0, 0, 1, 1, 2, 3, 3, 3].uniq(true));
+ },
+
+ testWithout: function(){
+ this.assertEnumEqual([], [].without(0));
+ this.assertEnumEqual([], [0].without(0));
+ this.assertEnumEqual([1], [0,1].without(0));
+ this.assertEnumEqual([1,2], [0,1,2].without(0));
+ },
+
+ test$w: function(){
+ this.assertEnumEqual(['a', 'b', 'c', 'd'], $w('a b c d'));
+ this.assertEnumEqual([], $w(' '));
+ this.assertEnumEqual([], $w(''));
+ this.assertEnumEqual([], $w(null));
+ this.assertEnumEqual([], $w(undefined));
+ this.assertEnumEqual([], $w());
+ this.assertEnumEqual([], $w(10));
+ this.assertEnumEqual(['a'], $w('a'));
+ this.assertEnumEqual(['a'], $w('a '));
+ this.assertEnumEqual(['a'], $w(' a'));
+ this.assertEnumEqual(['a', 'b', 'c', 'd'], $w(' a b\nc\t\nd\n'));
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/base_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/base_test.js
new file mode 100644
index 0000000000..f2843128a0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/base_test.js
@@ -0,0 +1,511 @@
+new Test.Unit.Runner({
+ testFunctionArgumentNames: function() {
+ this.assertEnumEqual([], (function() {}).argumentNames());
+ this.assertEnumEqual(["one"], (function(one) {}).argumentNames());
+ this.assertEnumEqual(["one", "two", "three"], (function(one, two, three) {}).argumentNames());
+ this.assertEnumEqual(["one", "two", "three"], (function( one , two
+ , three ) {}).argumentNames());
+ this.assertEqual("$super", (function($super) {}).argumentNames().first());
+
+ function named1() {};
+ this.assertEnumEqual([], named1.argumentNames());
+ function named2(one) {};
+ this.assertEnumEqual(["one"], named2.argumentNames());
+ function named3(one, two, three) {};
+ this.assertEnumEqual(["one", "two", "three"], named3.argumentNames());
+ },
+
+ testFunctionBind: function() {
+ function methodWithoutArguments() { return this.hi };
+ function methodWithArguments() { return this.hi + ',' + $A(arguments).join(',') };
+ var func = Prototype.emptyFunction;
+
+ this.assertIdentical(func, func.bind());
+ this.assertIdentical(func, func.bind(undefined));
+ this.assertNotIdentical(func, func.bind(null));
+
+ this.assertEqual('without', methodWithoutArguments.bind({ hi: 'without' })());
+ this.assertEqual('with,arg1,arg2', methodWithArguments.bind({ hi: 'with' })('arg1','arg2'));
+ this.assertEqual('withBindArgs,arg1,arg2',
+ methodWithArguments.bind({ hi: 'withBindArgs' }, 'arg1', 'arg2')());
+ this.assertEqual('withBindArgsAndArgs,arg1,arg2,arg3,arg4',
+ methodWithArguments.bind({ hi: 'withBindArgsAndArgs' }, 'arg1', 'arg2')('arg3', 'arg4'));
+ },
+
+ testFunctionCurry: function() {
+ var split = function(delimiter, string) { return string.split(delimiter); };
+ var splitOnColons = split.curry(":");
+ this.assertNotIdentical(split, splitOnColons);
+ this.assertEnumEqual(split(":", "0:1:2:3:4:5"), splitOnColons("0:1:2:3:4:5"));
+ this.assertIdentical(split, split.curry());
+ },
+
+ testFunctionDelay: function() {
+ window.delayed = undefined;
+ var delayedFunction = function() { window.delayed = true; };
+ var delayedFunctionWithArgs = function() { window.delayedWithArgs = $A(arguments).join(' '); };
+ delayedFunction.delay(0.8);
+ delayedFunctionWithArgs.delay(0.8, 'hello', 'world');
+ this.assertUndefined(window.delayed);
+ this.wait(1000, function() {
+ this.assert(window.delayed);
+ this.assertEqual('hello world', window.delayedWithArgs);
+ });
+ },
+
+ testFunctionWrap: function() {
+ function sayHello(){
+ return 'hello world';
+ };
+
+ this.assertEqual('HELLO WORLD', sayHello.wrap(function(proceed) {
+ return proceed().toUpperCase();
+ })());
+
+ var temp = String.prototype.capitalize;
+ String.prototype.capitalize = String.prototype.capitalize.wrap(function(proceed, eachWord) {
+ if (eachWord && this.include(' ')) return this.split(' ').map(function(str){
+ return str.capitalize();
+ }).join(' ');
+ return proceed();
+ });
+ this.assertEqual('Hello world', 'hello world'.capitalize());
+ this.assertEqual('Hello World', 'hello world'.capitalize(true));
+ this.assertEqual('Hello', 'hello'.capitalize());
+ String.prototype.capitalize = temp;
+ },
+
+ testFunctionDefer: function() {
+ window.deferred = undefined;
+ var deferredFunction = function() { window.deferred = true; };
+ deferredFunction.defer();
+ this.assertUndefined(window.deferred);
+ this.wait(50, function() {
+ this.assert(window.deferred);
+
+ window.deferredValue = 0;
+ var deferredFunction2 = function(arg) { window.deferredValue = arg; };
+ deferredFunction2.defer('test');
+ this.wait(50, function() {
+ this.assertEqual('test', window.deferredValue);
+ });
+ });
+ },
+
+ testFunctionMethodize: function() {
+ var Foo = { bar: function(baz) { return baz } };
+ var baz = { quux: Foo.bar.methodize() };
+
+ this.assertEqual(Foo.bar.methodize(), baz.quux);
+ this.assertEqual(baz, Foo.bar(baz));
+ this.assertEqual(baz, baz.quux());
+ },
+
+ testObjectExtend: function() {
+ var object = {foo: 'foo', bar: [1, 2, 3]};
+ this.assertIdentical(object, Object.extend(object));
+ this.assertHashEqual({foo: 'foo', bar: [1, 2, 3]}, object);
+ this.assertIdentical(object, Object.extend(object, {bla: 123}));
+ this.assertHashEqual({foo: 'foo', bar: [1, 2, 3], bla: 123}, object);
+ this.assertHashEqual({foo: 'foo', bar: [1, 2, 3], bla: null},
+ Object.extend(object, {bla: null}));
+ },
+
+ testObjectToQueryString: function() {
+ this.assertEqual('a=A&b=B&c=C&d=D%23', Object.toQueryString({a: 'A', b: 'B', c: 'C', d: 'D#'}));
+ },
+
+ testObjectClone: function() {
+ var object = {foo: 'foo', bar: [1, 2, 3]};
+ this.assertNotIdentical(object, Object.clone(object));
+ this.assertHashEqual(object, Object.clone(object));
+ this.assertHashEqual({}, Object.clone());
+ var clone = Object.clone(object);
+ delete clone.bar;
+ this.assertHashEqual({foo: 'foo'}, clone,
+ "Optimizing Object.clone perf using prototyping doesn't allow properties to be deleted.");
+ },
+
+ testObjectInspect: function() {
+ this.assertEqual('undefined', Object.inspect());
+ this.assertEqual('undefined', Object.inspect(undefined));
+ this.assertEqual('null', Object.inspect(null));
+ this.assertEqual("'foo\\\\b\\\'ar'", Object.inspect('foo\\b\'ar'));
+ this.assertEqual('[]', Object.inspect([]));
+ this.assertNothingRaised(function() { Object.inspect(window.Node) });
+ },
+
+ testObjectToJSON: function() {
+ this.assertUndefined(Object.toJSON(undefined));
+ this.assertUndefined(Object.toJSON(Prototype.K));
+ this.assertEqual('\"\"', Object.toJSON(''));
+ this.assertEqual('[]', Object.toJSON([]));
+ this.assertEqual('[\"a\"]', Object.toJSON(['a']));
+ this.assertEqual('[\"a\", 1]', Object.toJSON(['a', 1]));
+ this.assertEqual('[\"a\", {\"b\": null}]', Object.toJSON(['a', {'b': null}]));
+ this.assertEqual('{\"a\": \"hello!\"}', Object.toJSON({a: 'hello!'}));
+ this.assertEqual('{}', Object.toJSON({}));
+ this.assertEqual('{}', Object.toJSON({a: undefined, b: undefined, c: Prototype.K}));
+ this.assertEqual('{\"b\": [false, true], \"c\": {\"a\": \"hello!\"}}',
+ Object.toJSON({'b': [undefined, false, true, undefined], c: {a: 'hello!'}}));
+ this.assertEqual('{\"b\": [false, true], \"c\": {\"a\": \"hello!\"}}',
+ Object.toJSON($H({'b': [undefined, false, true, undefined], c: {a: 'hello!'}})));
+ this.assertEqual('true', Object.toJSON(true));
+ this.assertEqual('false', Object.toJSON(false));
+ this.assertEqual('null', Object.toJSON(null));
+ var sam = new Person('sam');
+ this.assertEqual('-sam', Object.toJSON(sam));
+ this.assertEqual('-sam', sam.toJSON());
+ var element = $('test');
+ this.assertUndefined(Object.toJSON(element));
+ element.toJSON = function(){return 'I\'m a div with id test'};
+ this.assertEqual('I\'m a div with id test', Object.toJSON(element));
+ },
+
+ testObjectToHTML: function() {
+ this.assertIdentical('', Object.toHTML());
+ this.assertIdentical('', Object.toHTML(''));
+ this.assertIdentical('', Object.toHTML(null));
+ this.assertIdentical('0', Object.toHTML(0));
+ this.assertIdentical('123', Object.toHTML(123));
+ this.assertEqual('hello world', Object.toHTML('hello world'));
+ this.assertEqual('hello world', Object.toHTML({toHTML: function() { return 'hello world' }}));
+ },
+
+ testObjectIsArray: function() {
+ this.assert(Object.isArray([]));
+ this.assert(Object.isArray([0]));
+ this.assert(Object.isArray([0, 1]));
+ this.assert(!Object.isArray({}));
+ this.assert(!Object.isArray($('list').childNodes));
+ this.assert(!Object.isArray());
+ this.assert(!Object.isArray(''));
+ this.assert(!Object.isArray('foo'));
+ this.assert(!Object.isArray(0));
+ this.assert(!Object.isArray(1));
+ this.assert(!Object.isArray(null));
+ this.assert(!Object.isArray(true));
+ this.assert(!Object.isArray(false));
+ this.assert(!Object.isArray(undefined));
+ },
+
+ testObjectIsHash: function() {
+ this.assert(Object.isHash($H()));
+ this.assert(Object.isHash(new Hash()));
+ this.assert(!Object.isHash({}));
+ this.assert(!Object.isHash(null));
+ this.assert(!Object.isHash());
+ this.assert(!Object.isHash(''));
+ this.assert(!Object.isHash(2));
+ this.assert(!Object.isHash(false));
+ this.assert(!Object.isHash(true));
+ this.assert(!Object.isHash([]));
+ },
+
+ testObjectIsElement: function() {
+ this.assert(Object.isElement(document.createElement('div')));
+ this.assert(Object.isElement(new Element('div')));
+ this.assert(Object.isElement($('testlog')));
+ this.assert(!Object.isElement(document.createTextNode('bla')));
+
+ // falsy variables should not mess up return value type
+ this.assertIdentical(false, Object.isElement(0));
+ this.assertIdentical(false, Object.isElement(''));
+ this.assertIdentical(false, Object.isElement(NaN));
+ this.assertIdentical(false, Object.isElement(null));
+ this.assertIdentical(false, Object.isElement(undefined));
+ },
+
+ testObjectIsFunction: function() {
+ this.assert(Object.isFunction(function() { }));
+ this.assert(Object.isFunction(Class.create()));
+ this.assert(!Object.isFunction("a string"));
+ this.assert(!Object.isFunction($("testlog")));
+ this.assert(!Object.isFunction([]));
+ this.assert(!Object.isFunction({}));
+ this.assert(!Object.isFunction(0));
+ this.assert(!Object.isFunction(false));
+ this.assert(!Object.isFunction(undefined));
+ this.assert(!Object.isFunction(/foo/));
+ this.assert(!Object.isFunction(document.getElementsByTagName('div')));
+ },
+
+ testObjectIsString: function() {
+ this.assert(!Object.isString(function() { }));
+ this.assert(Object.isString("a string"));
+ this.assert(!Object.isString(0));
+ this.assert(!Object.isString([]));
+ this.assert(!Object.isString({}));
+ this.assert(!Object.isString(false));
+ this.assert(!Object.isString(undefined));
+ },
+
+ testObjectIsNumber: function() {
+ this.assert(Object.isNumber(0));
+ this.assert(Object.isNumber(1.0));
+ this.assert(!Object.isNumber(function() { }));
+ this.assert(!Object.isNumber("a string"));
+ this.assert(!Object.isNumber([]));
+ this.assert(!Object.isNumber({}));
+ this.assert(!Object.isNumber(false));
+ this.assert(!Object.isNumber(undefined));
+ },
+
+ testObjectIsUndefined: function() {
+ this.assert(Object.isUndefined(undefined));
+ this.assert(!Object.isUndefined(null));
+ this.assert(!Object.isUndefined(false));
+ this.assert(!Object.isUndefined(0));
+ this.assert(!Object.isUndefined(""));
+ this.assert(!Object.isUndefined(function() { }));
+ this.assert(!Object.isUndefined([]));
+ this.assert(!Object.isUndefined({}));
+ },
+
+ // sanity check
+ testDoesntExtendObjectPrototype: function() {
+ // for-in is supported with objects
+ var iterations = 0, obj = { a: 1, b: 2, c: 3 };
+ for (property in obj) iterations++;
+ this.assertEqual(3, iterations);
+
+ // for-in is not supported with arrays
+ iterations = 0;
+ var arr = [1,2,3];
+ for (property in arr) iterations++;
+ this.assert(iterations > 3);
+ },
+
+
+ testBindAsEventListener: function() {
+ for ( var i = 0; i < 10; ++i ) {
+ var div = document.createElement('div');
+ div.setAttribute('id','test-'+i);
+ document.body.appendChild(div);
+ var tobj = new TestObj();
+ var eventTest = { test: true };
+ var call = tobj.assertingEventHandler.bindAsEventListener(tobj,
+ this.assertEqual.bind(this, eventTest),
+ this.assertEqual.bind(this, arg1),
+ this.assertEqual.bind(this, arg2),
+ this.assertEqual.bind(this, arg3), arg1, arg2, arg3 );
+ call(eventTest);
+ }
+ },
+
+ testDateToJSON: function() {
+ this.assertEqual('\"1970-01-01T00:00:00Z\"', new Date(Date.UTC(1970, 0, 1)).toJSON());
+ },
+
+ testRegExpEscape: function() {
+ this.assertEqual('word', RegExp.escape('word'));
+ this.assertEqual('\\/slashes\\/', RegExp.escape('/slashes/'));
+ this.assertEqual('\\\\backslashes\\\\', RegExp.escape('\\backslashes\\'));
+ this.assertEqual('\\\\border of word', RegExp.escape('\\border of word'));
+
+ this.assertEqual('\\(\\?\\:non-capturing\\)', RegExp.escape('(?:non-capturing)'));
+ this.assertEqual('non-capturing', new RegExp(RegExp.escape('(?:') + '([^)]+)').exec('(?:non-capturing)')[1]);
+
+ this.assertEqual('\\(\\?\\=positive-lookahead\\)', RegExp.escape('(?=positive-lookahead)'));
+ this.assertEqual('positive-lookahead', new RegExp(RegExp.escape('(?=') + '([^)]+)').exec('(?=positive-lookahead)')[1]);
+
+ this.assertEqual('\\(\\?<\\=positive-lookbehind\\)', RegExp.escape('(?<=positive-lookbehind)'));
+ this.assertEqual('positive-lookbehind', new RegExp(RegExp.escape('(?<=') + '([^)]+)').exec('(?<=positive-lookbehind)')[1]);
+
+ this.assertEqual('\\(\\?\\!negative-lookahead\\)', RegExp.escape('(?!negative-lookahead)'));
+ this.assertEqual('negative-lookahead', new RegExp(RegExp.escape('(?!') + '([^)]+)').exec('(?!negative-lookahead)')[1]);
+
+ this.assertEqual('\\(\\?<\\!negative-lookbehind\\)', RegExp.escape('(?<!negative-lookbehind)'));
+ this.assertEqual('negative-lookbehind', new RegExp(RegExp.escape('(?<!') + '([^)]+)').exec('(?<!negative-lookbehind)')[1]);
+
+ this.assertEqual('\\[\\\\w\\]\\+', RegExp.escape('[\\w]+'));
+ this.assertEqual('character class', new RegExp(RegExp.escape('[') + '([^\\]]+)').exec('[character class]')[1]);
+
+ this.assertEqual('<div>', new RegExp(RegExp.escape('<div>')).exec('<td><div></td>')[0]);
+
+ this.assertEqual('false', RegExp.escape(false));
+ this.assertEqual('undefined', RegExp.escape());
+ this.assertEqual('null', RegExp.escape(null));
+ this.assertEqual('42', RegExp.escape(42));
+
+ this.assertEqual('\\\\n\\\\r\\\\t', RegExp.escape('\\n\\r\\t'));
+ this.assertEqual('\n\r\t', RegExp.escape('\n\r\t'));
+ this.assertEqual('\\{5,2\\}', RegExp.escape('{5,2}'));
+
+ this.assertEqual(
+ '\\/\\(\\[\\.\\*\\+\\?\\^\\=\\!\\:\\$\\{\\}\\(\\)\\|\\[\\\\\\]\\\\\\\/\\\\\\\\\\]\\)\\/g',
+ RegExp.escape('/([.*+?^=!:${}()|[\\]\\/\\\\])/g')
+ );
+ },
+
+ testBrowserDetection: function() {
+ var results = $H(Prototype.Browser).map(function(engine){
+ return engine;
+ }).partition(function(engine){
+ return engine[1] === true
+ });
+ var trues = results[0], falses = results[1];
+
+ this.info('User agent string is: ' + navigator.userAgent);
+
+ this.assert(trues.size() == 0 || trues.size() == 1,
+ 'There should be only one or no browser detected.');
+
+ // we should have definite trues or falses here
+ trues.each(function(result) {
+ this.assert(result[1] === true);
+ }, this);
+ falses.each(function(result) {
+ this.assert(result[1] === false);
+ }, this);
+
+ if (navigator.userAgent.indexOf('AppleWebKit/') > -1) {
+ this.info('Running on WebKit');
+ this.assert(Prototype.Browser.WebKit);
+ }
+
+ if (!!window.opera) {
+ this.info('Running on Opera');
+ this.assert(Prototype.Browser.Opera);
+ }
+
+ if (!!(window.attachEvent && !window.opera)) {
+ this.info('Running on IE');
+ this.assert(Prototype.Browser.IE);
+ }
+
+ if (navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1) {
+ this.info('Running on Gecko');
+ this.assert(Prototype.Browser.Gecko);
+ }
+ },
+
+ testClassCreate: function() {
+ this.assert(Object.isFunction(Animal), 'Animal is not a constructor');
+ this.assertEnumEqual([Cat, Mouse, Dog, Ox], Animal.subclasses);
+ Animal.subclasses.each(function(subclass) {
+ this.assertEqual(Animal, subclass.superclass);
+ }, this);
+
+ var Bird = Class.create(Animal);
+ this.assertEqual(Bird, Animal.subclasses.last());
+ // for..in loop (for some reason) doesn't iterate over the constructor property in top-level classes
+ this.assertEnumEqual(Object.keys(new Animal).sort(), Object.keys(new Bird).without('constructor').sort());
+ },
+
+ testClassInstantiation: function() {
+ var pet = new Animal("Nibbles");
+ this.assertEqual("Nibbles", pet.name, "property not initialized");
+ this.assertEqual('Nibbles: Hi!', pet.say('Hi!'));
+ this.assertEqual(Animal, pet.constructor, "bad constructor reference");
+ this.assertUndefined(pet.superclass);
+
+ var Empty = Class.create();
+ this.assert('object', typeof new Empty);
+ },
+
+ testInheritance: function() {
+ var tom = new Cat('Tom');
+ this.assertEqual(Cat, tom.constructor, "bad constructor reference");
+ this.assertEqual(Animal, tom.constructor.superclass, 'bad superclass reference');
+ this.assertEqual('Tom', tom.name);
+ this.assertEqual('Tom: meow', tom.say('meow'));
+ this.assertEqual('Tom: Yuk! I only eat mice.', tom.eat(new Animal));
+ },
+
+ testSuperclassMethodCall: function() {
+ var tom = new Cat('Tom');
+ this.assertEqual('Tom: Yum!', tom.eat(new Mouse));
+
+ // augment the constructor and test
+ var Dodo = Class.create(Animal, {
+ initialize: function($super, name) {
+ $super(name);
+ this.extinct = true;
+ },
+
+ say: function($super, message) {
+ return $super(message) + " honk honk";
+ }
+ });
+
+ var gonzo = new Dodo('Gonzo');
+ this.assertEqual('Gonzo', gonzo.name);
+ this.assert(gonzo.extinct, 'Dodo birds should be extinct');
+ this.assertEqual("Gonzo: hello honk honk", gonzo.say("hello"));
+ },
+
+ testClassAddMethods: function() {
+ var tom = new Cat('Tom');
+ var jerry = new Mouse('Jerry');
+
+ Animal.addMethods({
+ sleep: function() {
+ return this.say('ZZZ');
+ }
+ });
+
+ Mouse.addMethods({
+ sleep: function($super) {
+ return $super() + " ... no, can't sleep! Gotta steal cheese!";
+ },
+ escape: function(cat) {
+ return this.say('(from a mousehole) Take that, ' + cat.name + '!');
+ }
+ });
+
+ this.assertEqual('Tom: ZZZ', tom.sleep(), "added instance method not available to subclass");
+ this.assertEqual("Jerry: ZZZ ... no, can't sleep! Gotta steal cheese!", jerry.sleep());
+ this.assertEqual("Jerry: (from a mousehole) Take that, Tom!", jerry.escape(tom));
+ // insure that a method has not propagated *up* the prototype chain:
+ this.assertUndefined(tom.escape);
+ this.assertUndefined(new Animal().escape);
+
+ Animal.addMethods({
+ sleep: function() {
+ return this.say('zZzZ');
+ }
+ });
+
+ this.assertEqual("Jerry: zZzZ ... no, can't sleep! Gotta steal cheese!", jerry.sleep());
+ },
+
+ testBaseClassWithMixin: function() {
+ var grass = new Plant('grass', 3);
+ this.assertRespondsTo('getValue', grass);
+ this.assertEqual('#<Plant: grass>', grass.inspect());
+ },
+
+ testSubclassWithMixin: function() {
+ var snoopy = new Dog('Snoopy', 12, 'male');
+ this.assertRespondsTo('reproduce', snoopy);
+ },
+
+ testSubclassWithMixins: function() {
+ var cow = new Ox('cow', 400, 'female');
+ this.assertEqual('#<Ox: cow>', cow.inspect());
+ this.assertRespondsTo('reproduce', cow);
+ this.assertRespondsTo('getValue', cow);
+ },
+
+ testClassWithToStringAndValueOfMethods: function() {
+ var Foo = Class.create({
+ toString: function() { return "toString" },
+ valueOf: function() { return "valueOf" }
+ });
+
+ var Parent = Class.create({
+ m1: function(){ return 'm1' },
+ m2: function(){ return 'm2' }
+ });
+ var Child = Class.create(Parent, {
+ m1: function($super) { return 'm1 child' },
+ m2: function($super) { return 'm2 child' }
+ });
+
+ this.assert(new Child().m1.toString().indexOf('m1 child') > -1);
+
+ this.assertEqual("toString", new Foo().toString());
+ this.assertEqual("valueOf", new Foo().valueOf());
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/dom_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/dom_test.js
new file mode 100644
index 0000000000..ebb3b383ec
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/dom_test.js
@@ -0,0 +1,1404 @@
+var getInnerHTML = function(id) {
+ return $(id).innerHTML.toString().toLowerCase().gsub(/[\r\n\t]/, '');
+};
+var createParagraph = function(text) {
+ var p = document.createElement('p');
+ p.appendChild(document.createTextNode(text));
+ return p;
+}
+
+new Test.Unit.Runner({
+ setup: function() {
+ if (documentViewportProperties) return;
+ // Based on properties check from http://www.quirksmode.org/viewport/compatibility.html
+ documentViewportProperties = {
+ properties : [
+ 'self.pageXOffset', 'self.pageYOffset',
+ 'self.screenX', 'self.screenY',
+ 'self.innerHeight', 'self.innerWidth',
+ 'self.outerHeight', 'self.outerWidth',
+ 'self.screen.height', 'self.screen.width',
+ 'self.screen.availHeight', 'self.screen.availWidth',
+ 'self.screen.availTop', 'self.screen.availLeft',
+ 'self.screen.Top', 'self.screen.Left',
+ 'self.screenTop', 'self.screenLeft',
+ 'document.body.clientHeight', 'document.body.clientWidth',
+ 'document.body.scrollHeight', 'document.body.scrollWidth',
+ 'document.body.scrollLeft', 'document.body.scrollTop',
+ 'document.body.offsetHeight', 'document.body.offsetWidth',
+ 'document.body.offsetTop', 'document.body.offsetLeft'
+ ].inject([], function(properties, prop) {
+ if (!self.screen && prop.include('self.screen')) return;
+ if (!document.body && prop.include('document.body')) return;
+ properties.push(prop);
+ if (prop.include('.body') && document.documentElement)
+ properties.push(prop.sub('.body', '.documentElement'));
+ return properties;
+ }),
+
+ inspect : function() {
+ var props = [];
+ this.properties.each(function(prop) {
+ if (eval(prop)) props[prop] = eval(prop);
+ }, this);
+ return props;
+ }
+ };
+ },
+
+ testDollarFunction: function() {
+ this.assertUndefined($());
+
+ this.assertNull(document.getElementById('noWayThisIDExists'));
+ this.assertNull($('noWayThisIDExists'));
+
+ this.assertIdentical(document.getElementById('testdiv'), $('testdiv'));
+ this.assertEnumEqual([ $('testdiv'), $('container') ], $('testdiv', 'container'));
+ this.assertEnumEqual([ $('testdiv'), undefined, $('container') ],
+ $('testdiv', 'noWayThisIDExists', 'container'));
+ var elt = $('testdiv');
+ this.assertIdentical(elt, $(elt));
+ this.assertRespondsTo('hide', elt);
+ this.assertRespondsTo('childOf', elt);
+ },
+
+ testGetElementsByClassName: function() {
+ if (document.getElementsByClassName.toString().include('[native code]')) {
+ this.info("browser uses native getElementsByClassName; skipping tests");
+ return;
+ }
+
+
+ var div = $('class_names'), list = $('class_names_ul');
+
+ this.assertElementsMatch(document.getElementsByClassName('A'), 'p.A', 'ul#class_names_ul.A', 'li.A.C');
+
+ if (Prototype.Browser.IE)
+ this.assertUndefined(document.getElementById('unextended').show);
+
+ this.assertElementsMatch(div.getElementsByClassName('B'), 'ul#class_names_ul.A.B', 'div.B.C.D');
+ this.assertElementsMatch(div.getElementsByClassName('D C B'), 'div.B.C.D');
+ this.assertElementsMatch(div.getElementsByClassName(' D\nC\tB '), 'div.B.C.D');
+ this.assertElementsMatch(div.getElementsByClassName($w('D C B')));
+ this.assertElementsMatch(list.getElementsByClassName('A'), 'li.A.C');
+ this.assertElementsMatch(list.getElementsByClassName(' A '), 'li.A.C');
+ this.assertElementsMatch(list.getElementsByClassName('C A'), 'li.A.C');
+ this.assertElementsMatch(list.getElementsByClassName("C\nA "), 'li.A.C');
+ this.assertElementsMatch(list.getElementsByClassName('B'));
+ this.assertElementsMatch(list.getElementsByClassName('1'), 'li.1');
+ this.assertElementsMatch(list.getElementsByClassName([1]), 'li.1');
+ this.assertElementsMatch(list.getElementsByClassName(['1 junk']));
+ this.assertElementsMatch(list.getElementsByClassName(''));
+ this.assertElementsMatch(list.getElementsByClassName(' '));
+ this.assertElementsMatch(list.getElementsByClassName(['']));
+ this.assertElementsMatch(list.getElementsByClassName([' ', '']));
+ this.assertElementsMatch(list.getElementsByClassName({}));
+
+ // those lookups shouldn't have extended all nodes in document
+ if (Prototype.Browser.IE) this.assertUndefined(document.getElementById('unextended')['show']);
+ },
+
+ testElementInsertWithHTML: function() {
+ Element.insert('insertions-main', {before:'<p><em>before</em> text</p><p>more testing</p>'});
+ this.assert(getInnerHTML('insertions-container').startsWith('<p><em>before</em> text</p><p>more testing</p>'));
+ Element.insert('insertions-main', {after:'<p><em>after</em> text</p><p>more testing</p>'});
+ this.assert(getInnerHTML('insertions-container').endsWith('<p><em>after</em> text</p><p>more testing</p>'));
+ Element.insert('insertions-main', {top:'<p><em>top</em> text.</p><p>more testing</p>'});
+ this.assert(getInnerHTML('insertions-main').startsWith('<p><em>top</em> text.</p><p>more testing</p>'));
+ Element.insert('insertions-main', {bottom:'<p><em>bottom</em> text.</p><p>more testing</p>'});
+ this.assert(getInnerHTML('insertions-main').endsWith('<p><em>bottom</em> text.</p><p>more testing</p>'));
+ },
+
+ testElementInsertWithDOMNode: function() {
+ Element.insert('insertions-node-main', {before: createParagraph('node before')});
+ this.assert(getInnerHTML('insertions-node-container').startsWith('<p>node before</p>'));
+ Element.insert('insertions-node-main', {after: createParagraph('node after')});
+ this.assert(getInnerHTML('insertions-node-container').endsWith('<p>node after</p>'));
+ Element.insert('insertions-node-main', {top:createParagraph('node top')});
+ this.assert(getInnerHTML('insertions-node-main').startsWith('<p>node top</p>'));
+ Element.insert('insertions-node-main', {bottom:createParagraph('node bottom')});
+ this.assert(getInnerHTML('insertions-node-main').endsWith('<p>node bottom</p>'));
+ this.assertEqual($('insertions-node-main'), $('insertions-node-main').insert(document.createElement('p')));
+ },
+
+ testElementInsertWithToElementMethod: function() {
+ Element.insert('insertions-node-main', {toElement: createParagraph.curry('toElement') });
+ this.assert(getInnerHTML('insertions-node-main').endsWith('<p>toelement</p>'));
+ Element.insert('insertions-node-main', {bottom: {toElement: createParagraph.curry('bottom toElement') }});
+ this.assert(getInnerHTML('insertions-node-main').endsWith('<p>bottom toelement</p>'));
+ },
+
+ testElementInsertWithToHTMLMethod: function() {
+ Element.insert('insertions-node-main', {toHTML: function() { return '<p>toHTML</p>'} });
+ this.assert(getInnerHTML('insertions-node-main').endsWith('<p>tohtml</p>'));
+ Element.insert('insertions-node-main', {bottom: {toHTML: function() { return '<p>bottom toHTML</p>'} }});
+ this.assert(getInnerHTML('insertions-node-main').endsWith('<p>bottom tohtml</p>'));
+ },
+
+ testElementInsertWithNonString: function() {
+ Element.insert('insertions-main', {bottom:3});
+ this.assert(getInnerHTML('insertions-main').endsWith('3'));
+ },
+
+ testElementInsertInTables: function() {
+ Element.insert('second_row', {after:'<tr id="third_row"><td>Third Row</td></tr>'});
+ this.assert($('second_row').descendantOf('table'));
+
+ $('a_cell').insert({top:'hello world'});
+ this.assert($('a_cell').innerHTML.startsWith('hello world'));
+ $('a_cell').insert({after:'<td>hi planet</td>'});
+ this.assertEqual('hi planet', $('a_cell').next().innerHTML);
+ $('table_for_insertions').insert('<tr><td>a cell!</td></tr>');
+ this.assert($('table_for_insertions').innerHTML.gsub('\r\n', '').toLowerCase().include('<tr><td>a cell!</td></tr>'));
+ $('row_1').insert({after:'<tr></tr><tr></tr><tr><td>last</td></tr>'});
+ this.assertEqual('last', $A($('table_for_row_insertions').getElementsByTagName('tr')).last().lastChild.innerHTML);
+ },
+
+ testElementInsertInSelect: function() {
+ var selectTop = $('select_for_insert_top'), selectBottom = $('select_for_insert_bottom');
+ selectBottom.insert('<option value="33">option 33</option><option selected="selected">option 45</option>');
+ this.assertEqual('option 45', selectBottom.getValue());
+ selectTop.insert({top:'<option value="A">option A</option><option value="B" selected="selected">option B</option>'});
+ this.assertEqual(4, selectTop.options.length);
+ },
+
+ testElementMethodInsert: function() {
+ $('element-insertions-main').insert({before:'some text before'});
+ this.assert(getInnerHTML('element-insertions-container').startsWith('some text before'));
+ $('element-insertions-main').insert({after:'some text after'});
+ this.assert(getInnerHTML('element-insertions-container').endsWith('some text after'));
+ $('element-insertions-main').insert({top:'some text top'});
+ this.assert(getInnerHTML('element-insertions-main').startsWith('some text top'));
+ $('element-insertions-main').insert({bottom:'some text bottom'});
+ this.assert(getInnerHTML('element-insertions-main').endsWith('some text bottom'));
+
+ $('element-insertions-main').insert('some more text at the bottom');
+ this.assert(getInnerHTML('element-insertions-main').endsWith('some more text at the bottom'));
+
+ $('element-insertions-main').insert({TOP:'some text uppercase top'});
+ this.assert(getInnerHTML('element-insertions-main').startsWith('some text uppercase top'));
+
+ $('element-insertions-multiple-main').insert({
+ top:'1', bottom:2, before: new Element('p').update('3'), after:'4'
+ });
+ this.assert(getInnerHTML('element-insertions-multiple-main').startsWith('1'));
+ this.assert(getInnerHTML('element-insertions-multiple-main').endsWith('2'));
+ this.assert(getInnerHTML('element-insertions-multiple-container').startsWith('<p>3</p>'));
+ this.assert(getInnerHTML('element-insertions-multiple-container').endsWith('4'));
+
+ $('element-insertions-main').update('test');
+ $('element-insertions-main').insert(null);
+ $('element-insertions-main').insert({bottom:null});
+ this.assertEqual('test', getInnerHTML('element-insertions-main'));
+ $('element-insertions-main').insert(1337);
+ this.assertEqual('test1337', getInnerHTML('element-insertions-main'));
+ },
+
+ testNewElementInsert: function() {
+ var container = new Element('div');
+ element = new Element('div');
+ container.insert(element);
+
+ element.insert({ before: '<p>a paragraph</p>' });
+ this.assertEqual('<p>a paragraph</p><div></div>', getInnerHTML(container));
+ element.insert({ after: 'some text' });
+ this.assertEqual('<p>a paragraph</p><div></div>some text', getInnerHTML(container));
+
+ element.insert({ top: '<p>a paragraph</p>' });
+ this.assertEqual('<p>a paragraph</p>', getInnerHTML(element));
+ element.insert('some text');
+ this.assertEqual('<p>a paragraph</p>some text', getInnerHTML(element));
+ },
+
+ testInsertionBackwardsCompatibility: function() {
+ new Insertion.Before('element-insertions-main', 'some backward-compatibility testing before');
+ this.assert(getInnerHTML('element-insertions-container').include('some backward-compatibility testing before'));
+ new Insertion.After('element-insertions-main', 'some backward-compatibility testing after');
+ this.assert(getInnerHTML('element-insertions-container').include('some backward-compatibility testing after'));
+ new Insertion.Top('element-insertions-main', 'some backward-compatibility testing top');
+ this.assert(getInnerHTML('element-insertions-main').startsWith('some backward-compatibility testing top'));
+ new Insertion.Bottom('element-insertions-main', 'some backward-compatibility testing bottom');
+ this.assert(getInnerHTML('element-insertions-main').endsWith('some backward-compatibility testing bottom'));
+ },
+
+ testElementWrap: function() {
+ var element = $('wrap'), parent = document.createElement('div');
+ element.wrap();
+ this.assert(getInnerHTML('wrap-container').startsWith('<div><p'));
+ element.wrap('div');
+ this.assert(getInnerHTML('wrap-container').startsWith('<div><div><p'));
+
+ element.wrap(parent);
+ this.assert(Object.isFunction(parent.setStyle));
+ this.assert(getInnerHTML('wrap-container').startsWith('<div><div><div><p'));
+
+ element.wrap('div', {className: 'wrapper'});
+ this.assert(element.up().hasClassName('wrapper'));
+ element.wrap({className: 'other-wrapper'});
+ this.assert(element.up().hasClassName('other-wrapper'));
+ element.wrap(new Element('div'), {className: 'yet-other-wrapper'});
+ this.assert(element.up().hasClassName('yet-other-wrapper'));
+
+ var orphan = new Element('p'), div = new Element('div');
+ orphan.wrap(div);
+ this.assertEqual(orphan.parentNode, div);
+ },
+
+ testElementWrapReturnsWrapper: function() {
+ var element = new Element("div");
+ var wrapper = element.wrap("div");
+ this.assertNotEqual(element, wrapper);
+ this.assertEqual(element.up(), wrapper);
+ },
+
+ testElementVisible: function(){
+ this.assertNotEqual('none', $('test-visible').style.display);
+ this.assertEqual('none', $('test-hidden').style.display);
+ },
+
+ testElementToggle: function(){
+ $('test-toggle-visible').toggle();
+ this.assert(!$('test-toggle-visible').visible());
+ $('test-toggle-visible').toggle();
+ this.assert($('test-toggle-visible').visible());
+ $('test-toggle-hidden').toggle();
+ this.assert($('test-toggle-hidden').visible());
+ $('test-toggle-hidden').toggle();
+ this.assert(!$('test-toggle-hidden').visible());
+ },
+
+ testElementShow: function(){
+ $('test-show-visible').show();
+ this.assert($('test-show-visible').visible());
+ $('test-show-hidden').show();
+ this.assert($('test-show-hidden').visible());
+ },
+
+ testElementHide: function(){
+ $('test-hide-visible').hide();
+ this.assert(!$('test-hide-visible').visible());
+ $('test-hide-hidden').hide();
+ this.assert(!$('test-hide-hidden').visible());
+ },
+
+ testElementRemove: function(){
+ $('removable').remove();
+ this.assert($('removable-container').empty());
+ },
+
+ testElementUpdate: function() {
+ $('testdiv').update('hello from div!');
+ this.assertEqual('hello from div!', $('testdiv').innerHTML);
+
+ Element.update('testdiv', 'another hello from div!');
+ this.assertEqual('another hello from div!', $('testdiv').innerHTML);
+
+ Element.update('testdiv', 123);
+ this.assertEqual('123', $('testdiv').innerHTML);
+
+ Element.update('testdiv');
+ this.assertEqual('', $('testdiv').innerHTML);
+
+ Element.update('testdiv', '&nbsp;');
+ this.assert(!$('testdiv').innerHTML.empty());
+ },
+
+ testElementUpdateWithScript: function() {
+ $('testdiv').update('hello from div!<script>\ntestVar="hello!";\n</'+'script>');
+ this.assertEqual('hello from div!',$('testdiv').innerHTML);
+ this.wait(100,function(){
+ this.assertEqual('hello!',testVar);
+
+ Element.update('testdiv','another hello from div!\n<script>testVar="another hello!"</'+'script>\nhere it goes');
+
+ // note: IE normalizes whitespace (like line breaks) to single spaces, thus the match test
+ this.assertMatch(/^another hello from div!\s+here it goes$/,$('testdiv').innerHTML);
+ this.wait(100,function(){
+ this.assertEqual('another hello!',testVar);
+
+ Element.update('testdiv','a\n<script>testVar="a"\ntestVar="b"</'+'script>');
+ this.wait(100,function(){
+ this.assertEqual('b', testVar);
+
+ Element.update('testdiv',
+ 'x<script>testVar2="a"</'+'script>\nblah\n'+
+ 'x<script>testVar2="b"</'+'script>');
+ this.wait(100,function(){
+ this.assertEqual('b', testVar2);
+ });
+ });
+ });
+ });
+ },
+
+ testElementUpdateInTableRow: function() {
+ $('second_row').update('<td id="i_am_a_td">test</td>');
+ this.assertEqual('test',$('i_am_a_td').innerHTML);
+
+ Element.update('second_row','<td id="i_am_a_td">another <span>test</span></td>');
+ this.assertEqual('another <span>test</span>',$('i_am_a_td').innerHTML.toLowerCase());
+ },
+
+ testElementUpdateInTableCell: function() {
+ Element.update('a_cell','another <span>test</span>');
+ this.assertEqual('another <span>test</span>',$('a_cell').innerHTML.toLowerCase());
+ },
+
+ testElementUpdateInTable: function() {
+ Element.update('table','<tr><td>boo!</td></tr>');
+ this.assertMatch(/^<tr>\s*<td>boo!<\/td><\/tr>$/,$('table').innerHTML.toLowerCase());
+ },
+
+ testElementUpdateInSelect: function() {
+ var select = $('select_for_update');
+ select.update('<option value="3">option 3</option><option selected="selected">option 4</option>');
+ this.assertEqual('option 4', select.getValue());
+ },
+
+ testElementUpdateWithDOMNode: function() {
+ $('testdiv').update(new Element('div').insert('bla'));
+ this.assertEqual('<div>bla</div>', getInnerHTML('testdiv'));
+ },
+
+ testElementUpdateWithToElementMethod: function() {
+ $('testdiv').update({toElement: createParagraph.curry('foo')});
+ this.assertEqual('<p>foo</p>', getInnerHTML('testdiv'));
+ },
+
+ testElementUpdateWithToHTMLMethod: function() {
+ $('testdiv').update({toHTML: function() { return 'hello world' }});
+ this.assertEqual('hello world', getInnerHTML('testdiv'));
+ },
+
+ testElementReplace: function() {
+ $('testdiv-replace-1').replace('hello from div!');
+ this.assertEqual('hello from div!', $('testdiv-replace-container-1').innerHTML);
+
+ $('testdiv-replace-2').replace(123);
+ this.assertEqual('123', $('testdiv-replace-container-2').innerHTML);
+
+ $('testdiv-replace-3').replace();
+ this.assertEqual('', $('testdiv-replace-container-3').innerHTML);
+
+ $('testrow-replace').replace('<tr><td>hello</td></tr>');
+ this.assert(getInnerHTML('testrow-replace-container').include('<tr><td>hello</td></tr>'));
+
+ $('testoption-replace').replace('<option>hello</option>');
+ this.assert($('testoption-replace-container').innerHTML.include('hello'));
+
+ Element.replace('testinput-replace', '<p>hello world</p>');
+ this.assertEqual('<p>hello world</p>', getInnerHTML('testform-replace'));
+
+ Element.replace('testform-replace', '<form></form>');
+ this.assertEqual('<p>some text</p><form></form><p>some text</p>', getInnerHTML('testform-replace-container'));
+ },
+
+ testElementReplaceWithScript: function() {
+ $('testdiv-replace-4').replace('hello from div!<script>testVarReplace="hello!"</'+'script>');
+ this.assertEqual('hello from div!', $('testdiv-replace-container-4').innerHTML);
+ this.wait(100,function(){
+ this.assertEqual('hello!',testVarReplace);
+
+ $('testdiv-replace-5').replace('another hello from div!\n<script>testVarReplace="another hello!"</'+'script>\nhere it goes');
+
+ // note: IE normalizes whitespace (like line breaks) to single spaces, thus the match test
+ this.assertMatch(/^another hello from div!\s+here it goes$/,$('testdiv-replace-container-5').innerHTML);
+ this.wait(100,function(){
+ this.assertEqual('another hello!',testVarReplace);
+ });
+ });
+ },
+
+ testElementReplaceWithDOMNode: function() {
+ $('testdiv-replace-element').replace(createParagraph('hello'));
+ this.assertEqual('<p>hello</p>', getInnerHTML('testdiv-replace-container-element'));
+ },
+
+ testElementReplaceWithToElementMethod: function() {
+ $('testdiv-replace-toelement').replace({toElement: createParagraph.curry('hello')});
+ this.assertEqual('<p>hello</p>', getInnerHTML('testdiv-replace-container-toelement'));
+ },
+
+ testElementReplaceWithToHTMLMethod: function() {
+ $('testdiv-replace-tohtml').replace({toHTML: function() { return 'hello' }});
+ this.assertEqual('hello', getInnerHTML('testdiv-replace-container-tohtml'));
+ },
+
+ testElementSelectorMethod: function() {
+ ['getElementsBySelector','select'].each(function(method) {
+ var testSelector = $('container')[method]('p.test');
+ this.assertEqual(testSelector.length, 4);
+ this.assertEqual(testSelector[0], $('intended'));
+ this.assertEqual(testSelector[0], $$('#container p.test')[0]);
+ }, this);
+ },
+
+ testElementAdjacent: function() {
+ var elements = $('intended').adjacent('p');
+ this.assertEqual(elements.length, 3);
+ elements.each(function(element){
+ this.assert(element != $('intended'));
+ }, this);
+ },
+
+ testElementIdentify: function() {
+ var parent = $('identification');
+ this.assertEqual(parent.down().identify(), 'predefined_id');
+ this.assert(parent.down(1).identify().startsWith('anonymous_element_'));
+ this.assert(parent.down(2).identify().startsWith('anonymous_element_'));
+ this.assert(parent.down(3).identify().startsWith('anonymous_element_'));
+
+ this.assert(parent.down(3).id !== parent.down(2).id);
+ },
+
+ testElementClassNameMethod: function() {
+ var testClassNames = $('container').getElementsByClassName('test');
+ var testSelector = $('container').getElementsBySelector('p.test');
+ this.assertEqual(testClassNames[0], $('intended'));
+ this.assertEqual(testClassNames.length, 4);
+ this.assertEqual(testSelector[3], testClassNames[3]);
+ this.assertEqual(testClassNames.length, testSelector.length);
+ },
+
+ testElementAncestors: function() {
+ var ancestors = $('navigation_test_f').ancestors();
+ this.assertElementsMatch(ancestors, 'ul', 'li', 'ul#navigation_test',
+ 'div#nav_tests_isolator', 'body', 'html');
+ this.assertElementsMatch(ancestors.last().ancestors());
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof $(dummy.childNodes[0]).ancestors()[0]['setStyle'] == 'function');
+ },
+
+ testElementDescendants: function() {
+ this.assertElementsMatch($('navigation_test').descendants(),
+ 'li', 'em', 'li', 'em.dim', 'li', 'em', 'ul', 'li',
+ 'em.dim', 'li#navigation_test_f', 'em', 'li', 'em');
+ this.assertElementsMatch($('navigation_test_f').descendants(), 'em');
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof dummy.descendants()[0].setStyle == 'function');
+ },
+
+ testElementFirstDescendant: function() {
+ this.assertElementMatches($('navigation_test').firstDescendant(), 'li.first');
+ this.assertNull($('navigation_test_next_sibling').firstDescendant());
+ },
+
+ testElementChildElements: function() {
+ this.assertElementsMatch($('navigation_test').childElements(),
+ 'li.first', 'li', 'li#navigation_test_c', 'li.last');
+ this.assertNotEqual(0, $('navigation_test_next_sibling').childNodes.length);
+ this.assertEnumEqual([], $('navigation_test_next_sibling').childElements());
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof dummy.childElements()[0].setStyle == 'function');
+ },
+
+ testElementImmediateDescendants: function() {
+ this.assertIdentical(Element.Methods.childElements, Element.Methods.immediateDescendants);
+ },
+
+ testElementPreviousSiblings: function() {
+ this.assertElementsMatch($('navigation_test').previousSiblings(),
+ 'span#nav_test_prev_sibling', 'p.test', 'div', 'div#nav_test_first_sibling');
+ this.assertElementsMatch($('navigation_test_f').previousSiblings(), 'li');
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof $(dummy.childNodes[1]).previousSiblings()[0].setStyle == 'function');
+ },
+
+ testElementNextSiblings: function() {
+ this.assertElementsMatch($('navigation_test').nextSiblings(),
+ 'div#navigation_test_next_sibling', 'p');
+ this.assertElementsMatch($('navigation_test_f').nextSiblings());
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof $(dummy.childNodes[0]).nextSiblings()[0].setStyle == 'function');
+ },
+
+ testElementSiblings: function() {
+ this.assertElementsMatch($('navigation_test').siblings(),
+ 'div#nav_test_first_sibling', 'div', 'p.test',
+ 'span#nav_test_prev_sibling', 'div#navigation_test_next_sibling', 'p');
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof $(dummy.childNodes[0]).siblings()[0].setStyle == 'function');
+ },
+
+ testElementUp: function() {
+ var element = $('navigation_test_f');
+ this.assertElementMatches(element.up(), 'ul');
+ this.assertElementMatches(element.up(0), 'ul');
+ this.assertElementMatches(element.up(1), 'li');
+ this.assertElementMatches(element.up(2), 'ul#navigation_test');
+ this.assertElementsMatch(element.up('li').siblings(), 'li.first', 'li', 'li.last');
+ this.assertElementMatches(element.up('ul', 1), 'ul#navigation_test');
+ this.assertEqual(undefined, element.up('garbage'));
+ this.assertEqual(undefined, element.up(6));
+ this.assertElementMatches(element.up('.non-existant, ul'), 'ul');
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof $(dummy.childNodes[0]).up().setStyle == 'function');
+ },
+
+ testElementDown: function() {
+ var element = $('navigation_test');
+ this.assertElementMatches(element.down(), 'li.first');
+ this.assertElementMatches(element.down(0), 'li.first');
+ this.assertElementMatches(element.down(1), 'em');
+ this.assertElementMatches(element.down('li', 5), 'li.last');
+ this.assertElementMatches(element.down('ul').down('li', 1), 'li#navigation_test_f');
+ this.assertElementMatches(element.down('.non-existant, .first'), 'li.first');
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof dummy.down().setStyle == 'function');
+
+ var input = $$('input')[0];
+ this.assertNothingRaised(function(){ input.down('span') });
+ this.assertUndefined(input.down('span'));
+ },
+
+ testElementPrevious: function() {
+ var element = $('navigation_test').down('li.last');
+ this.assertElementMatches(element.previous(), 'li#navigation_test_c');
+ this.assertElementMatches(element.previous(1), 'li');
+ this.assertElementMatches(element.previous('.first'), 'li.first');
+ this.assertEqual(undefined, element.previous(3));
+ this.assertEqual(undefined, $('navigation_test').down().previous());
+ this.assertElementMatches(element.previous('.non-existant, .first'), 'li.first');
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof $(dummy.childNodes[1]).previous().setStyle == 'function');
+ },
+
+ testElementNext: function() {
+ var element = $('navigation_test').down('li.first');
+ this.assertElementMatches(element.next(), 'li');
+ this.assertElementMatches(element.next(1), 'li#navigation_test_c');
+ this.assertElementMatches(element.next(2), 'li.last');
+ this.assertElementMatches(element.next('.last'), 'li.last');
+ this.assertEqual(undefined, element.next(3));
+ this.assertEqual(undefined, element.next(2).next());
+ this.assertElementMatches(element.next('.non-existant, .last'), 'li.last');
+
+ var dummy = $(document.createElement('DIV'));
+ dummy.innerHTML = '<div></div>'.times(3);
+ this.assert(typeof $(dummy.childNodes[0]).next().setStyle == 'function');
+ },
+
+ testElementInspect: function() {
+ this.assertEqual('<ul id="navigation_test">', $('navigation_test').inspect());
+ this.assertEqual('<li class="first">', $('navigation_test').down().inspect());
+ this.assertEqual('<em>', $('navigation_test').down(1).inspect());
+ },
+
+ testElementMakeClipping: function() {
+ var chained = Element.extend(document.createElement('DIV'));
+ this.assertEqual(chained, chained.makeClipping());
+ this.assertEqual(chained, chained.makeClipping());
+ this.assertEqual(chained, chained.makeClipping().makeClipping());
+
+ this.assertEqual(chained, chained.undoClipping());
+ this.assertEqual(chained, chained.undoClipping());
+ this.assertEqual(chained, chained.undoClipping().makeClipping());
+
+ ['hidden','visible','scroll'].each( function(overflowValue) {
+ var element = $('element_with_'+overflowValue+'_overflow');
+
+ this.assertEqual(overflowValue, element.getStyle('overflow'));
+ element.makeClipping();
+ this.assertEqual('hidden', element.getStyle('overflow'));
+ element.undoClipping();
+ this.assertEqual(overflowValue, element.getStyle('overflow'));
+ }, this);
+ },
+
+ testElementExtend: function() {
+ var element = $('element_extend_test');
+ this.assertRespondsTo('show', element);
+
+ var XHTML_TAGS = $w(
+ 'a abbr acronym address applet area '+
+ 'b bdo big blockquote br button caption '+
+ 'cite code col colgroup dd del dfn div dl dt '+
+ 'em fieldset form h1 h2 h3 h4 h5 h6 hr '+
+ 'i iframe img input ins kbd label legend li '+
+ 'map object ol optgroup option p param pre q samp '+
+ 'script select small span strong style sub sup '+
+ 'table tbody td textarea tfoot th thead tr tt ul var');
+
+ XHTML_TAGS.each(function(tag) {
+ var element = document.createElement(tag);
+ this.assertEqual(element, Element.extend(element));
+ this.assertRespondsTo('show', element);
+ }, this);
+
+ [null,'','a','aa'].each(function(content) {
+ var textnode = document.createTextNode(content);
+ this.assertEqual(textnode, Element.extend(textnode));
+ this.assert(typeof textnode['show'] == 'undefined');
+ }, this);
+ },
+
+ testElementExtendReextendsDiscardedNodes: function() {
+ this.assertRespondsTo('show', $('discard_1'));
+ $('element_reextend_test').innerHTML += '<div id="discard_2"></div>';
+ this.assertRespondsTo('show', $('discard_1'));
+ },
+
+ testElementCleanWhitespace: function() {
+ Element.cleanWhitespace("test_whitespace");
+ this.assertEqual(3, $("test_whitespace").childNodes.length);
+
+ this.assertEqual(1, $("test_whitespace").firstChild.nodeType);
+ this.assertEqual('SPAN', $("test_whitespace").firstChild.tagName);
+
+ this.assertEqual(1, $("test_whitespace").firstChild.nextSibling.nodeType);
+ this.assertEqual('DIV', $("test_whitespace").firstChild.nextSibling.tagName);
+
+ this.assertEqual(1, $("test_whitespace").firstChild.nextSibling.nextSibling.nodeType);
+ this.assertEqual('SPAN', $("test_whitespace").firstChild.nextSibling.nextSibling.tagName);
+
+ var element = document.createElement('DIV');
+ element.appendChild(document.createTextNode(''));
+ element.appendChild(document.createTextNode(''));
+ this.assertEqual(2, element.childNodes.length);
+ Element.cleanWhitespace(element);
+ this.assertEqual(0, element.childNodes.length);
+ },
+
+ testElementEmpty: function() {
+ this.assert($('test-empty').empty());
+ this.assert($('test-empty-but-contains-whitespace').empty());
+ this.assert(!$('test-full').empty());
+ },
+
+ testDescendantOf: function() {
+ this.assert($('child').descendantOf('ancestor'));
+ this.assert($('child').descendantOf($('ancestor')));
+
+ this.assert(!$('ancestor').descendantOf($('child')));
+
+ this.assert($('great-grand-child').descendantOf('ancestor'), 'great-grand-child < ancestor');
+ this.assert($('grand-child').descendantOf('ancestor'), 'grand-child < ancestor');
+ this.assert($('great-grand-child').descendantOf('grand-child'), 'great-grand-child < grand-child');
+ this.assert($('grand-child').descendantOf('child'), 'grand-child < child');
+ this.assert($('great-grand-child').descendantOf('child'), 'great-grand-child < child');
+
+ this.assert($('sibling').descendantOf('ancestor'), 'sibling < ancestor');
+ this.assert($('grand-sibling').descendantOf('sibling'), 'grand-sibling < sibling');
+ this.assert($('grand-sibling').descendantOf('ancestor'), 'grand-sibling < ancestor');
+
+ this.assert($('grand-sibling').descendantOf(document.body), 'grand-sibling < body');
+
+ this.assert(!$('great-grand-child').descendantOf('great-grand-child'), 'great-grand-child < great-grand-child');
+ this.assert(!$('great-grand-child').descendantOf('sibling'), 'great-grand-child < sibling');
+ this.assert(!$('sibling').descendantOf('child'), 'sibling < child');
+ this.assert(!$('great-grand-child').descendantOf('not-in-the-family'), 'great-grand-child < not-in-the-family');
+ this.assert(!$('child').descendantOf('not-in-the-family'), 'child < not-in-the-family');
+
+ this.assert(!$(document.body).descendantOf('great-grand-child'));
+
+ // dynamically-created elements
+ $('ancestor').insert(new Element('div', { id: 'weird-uncle' }));
+ this.assert($('weird-uncle').descendantOf('ancestor'));
+
+ $(document.body).insert(new Element('div', { id: 'impostor' }));
+ this.assert(!$('impostor').descendantOf('ancestor'));
+
+ // test descendantOf document
+ this.assert($(document.body).descendantOf(document));
+ this.assert($(document.documentElement).descendantOf(document));
+ },
+
+ testChildOf: function() {
+ this.assert($('child').childOf('ancestor'));
+ this.assert($('child').childOf($('ancestor')));
+ this.assert($('great-grand-child').childOf('ancestor'));
+ this.assert(!$('great-grand-child').childOf('not-in-the-family'));
+ this.assertIdentical(Element.Methods.childOf, Element.Methods.descendantOf);
+ },
+
+ testElementSetStyle: function() {
+ Element.setStyle('style_test_3',{ 'left': '2px' });
+ this.assertEqual('2px', $('style_test_3').style.left);
+
+ Element.setStyle('style_test_3',{ marginTop: '1px' });
+ this.assertEqual('1px', $('style_test_3').style.marginTop);
+
+ $('style_test_3').setStyle({ marginTop: '2px', left: '-1px' });
+ this.assertEqual('-1px', $('style_test_3').style.left);
+ this.assertEqual('2px', $('style_test_3').style.marginTop);
+
+ this.assertEqual('none', $('style_test_3').getStyle('float'));
+ $('style_test_3').setStyle({ 'float': 'left' });
+ this.assertEqual('left', $('style_test_3').getStyle('float'));
+
+ $('style_test_3').setStyle({ cssFloat: 'none' });
+ this.assertEqual('none', $('style_test_3').getStyle('float'));
+
+ this.assertEqual(1, $('style_test_3').getStyle('opacity'));
+
+ $('style_test_3').setStyle({ opacity: 0.5 });
+ this.assertEqual(0.5, $('style_test_3').getStyle('opacity'));
+
+ $('style_test_3').setStyle({ opacity: '' });
+ this.assertEqual(1, $('style_test_3').getStyle('opacity'));
+
+ $('style_test_3').setStyle({ opacity: 0 });
+ this.assertEqual(0, $('style_test_3').getStyle('opacity'));
+
+ $('test_csstext_1').setStyle('font-size: 15px');
+ this.assertEqual('15px', $('test_csstext_1').getStyle('font-size'));
+
+ $('test_csstext_2').setStyle({height: '40px'});
+ $('test_csstext_2').setStyle('font-size: 15px');
+ this.assertEqual('15px', $('test_csstext_2').getStyle('font-size'));
+ this.assertEqual('40px', $('test_csstext_2').getStyle('height'));
+
+ $('test_csstext_3').setStyle('font-size: 15px');
+ this.assertEqual('15px', $('test_csstext_3').getStyle('font-size'));
+ this.assertEqual('1px', $('test_csstext_3').getStyle('border-top-width'));
+
+ $('test_csstext_4').setStyle('font-size: 15px');
+ this.assertEqual('15px', $('test_csstext_4').getStyle('font-size'));
+
+ $('test_csstext_4').setStyle('float: right; font-size: 10px');
+ this.assertEqual('right', $('test_csstext_4').getStyle('float'));
+ this.assertEqual('10px', $('test_csstext_4').getStyle('font-size'));
+
+ $('test_csstext_5').setStyle('float: left; opacity: .5; font-size: 10px');
+ this.assertEqual(parseFloat('0.5'), parseFloat($('test_csstext_5').getStyle('opacity')));
+ },
+
+ testElementSetStyleCamelized: function() {
+ this.assertNotEqual('30px', $('style_test_3').style.marginTop);
+ $('style_test_3').setStyle({ marginTop: '30px'}, true);
+ this.assertEqual('30px', $('style_test_3').style.marginTop);
+ },
+
+ testElementSetOpacity: function() {
+ [0,0.1,0.5,0.999].each(function(opacity){
+ $('style_test_3').setOpacity(opacity);
+
+ // b/c of rounding issues on IE special case
+ var realOpacity = $('style_test_3').getStyle('opacity');
+
+ // opera rounds off to two significant digits, so we check for a
+ // ballpark figure
+ this.assert((Number(realOpacity) - opacity) <= 0.002, 'setting opacity to ' + opacity);
+ }, this);
+
+ this.assertEqual(0,
+ $('style_test_3').setOpacity(0.0000001).getStyle('opacity'));
+
+ // for Firefox, we don't set to 1, because of flickering
+ this.assert(
+ $('style_test_3').setOpacity(0.9999999).getStyle('opacity') > 0.999
+ );
+ if (Prototype.Browser.IE) {
+ this.assert($('style_test_4').setOpacity(0.5).currentStyle.hasLayout);
+ this.assert(2, $('style_test_5').setOpacity(0.5).getStyle('zoom'));
+ this.assert(0.5, new Element('div').setOpacity(0.5).getOpacity());
+ this.assert(2, new Element('div').setOpacity(0.5).setStyle('zoom: 2;').getStyle('zoom'));
+ this.assert(2, new Element('div').setStyle('zoom: 2;').setOpacity(0.5).getStyle('zoom'));
+ }
+ },
+
+ testElementGetStyle: function() {
+ this.assertEqual("none",
+ $('style_test_1').getStyle('display'));
+
+ // not displayed, so "null" ("auto" is tranlated to "null")
+ this.assertNull(Element.getStyle('style_test_1', 'width'), 'elements that are hidden should return null on getStyle("width")');
+
+ $('style_test_1').show();
+
+ // from id rule
+ this.assertEqual("pointer",
+ Element.getStyle('style_test_1','cursor'));
+
+ this.assertEqual("block",
+ Element.getStyle('style_test_2','display'));
+
+ // we should always get something for width (if displayed)
+ // firefox and safari automatically send the correct value,
+ // IE is special-cased to do the same
+ this.assertEqual($('style_test_2').offsetWidth+'px', Element.getStyle('style_test_2','width'));
+
+ this.assertEqual("static",Element.getStyle('style_test_1','position'));
+ // from style
+ this.assertEqual("11px",
+ Element.getStyle('style_test_2','font-size'));
+ // from class
+ this.assertEqual("1px",
+ Element.getStyle('style_test_2','margin-left'));
+
+ ['not_floating_none','not_floating_style','not_floating_inline'].each(function(element) {
+ this.assertEqual('none', $(element).getStyle('float'));
+ this.assertEqual('none', $(element).getStyle('cssFloat'));
+ }, this);
+
+ ['floating_style','floating_inline'].each(function(element) {
+ this.assertEqual('left', $(element).getStyle('float'));
+ this.assertEqual('left', $(element).getStyle('cssFloat'));
+ }, this);
+
+ this.assertEqual(0.5, $('op1').getStyle('opacity'));
+ this.assertEqual(0.5, $('op2').getStyle('opacity'));
+ this.assertEqual(1.0, $('op3').getStyle('opacity'));
+
+ $('op1').setStyle({opacity: '0.3'});
+ $('op2').setStyle({opacity: '0.3'});
+ $('op3').setStyle({opacity: '0.3'});
+
+ this.assertEqual(0.3, $('op1').getStyle('opacity'));
+ this.assertEqual(0.3, $('op2').getStyle('opacity'));
+ this.assertEqual(0.3, $('op3').getStyle('opacity'));
+
+ $('op3').setStyle({opacity: 0});
+ this.assertEqual(0, $('op3').getStyle('opacity'));
+
+ if (navigator.appVersion.match(/MSIE/)) {
+ this.assertEqual('alpha(opacity=30)', $('op1').getStyle('filter'));
+ this.assertEqual('progid:DXImageTransform.Microsoft.Blur(strength=10)alpha(opacity=30)', $('op2').getStyle('filter'));
+ $('op2').setStyle({opacity:''});
+ this.assertEqual('progid:DXImageTransform.Microsoft.Blur(strength=10)', $('op2').getStyle('filter'));
+ this.assertEqual('alpha(opacity=0)', $('op3').getStyle('filter'));
+ this.assertEqual(0.3, $('op4-ie').getStyle('opacity'));
+ }
+ // verify that value is still found when using camelized
+ // strings (function previously used getPropertyValue()
+ // which expected non-camelized strings)
+ this.assertEqual("12px", $('style_test_1').getStyle('fontSize'));
+
+ // getStyle on width/height should return values according to
+ // the CSS box-model, which doesn't include
+ // margin, padding, or borders
+ // TODO: This test fails on IE because there seems to be no way
+ // to calculate this properly (clientWidth/Height returns 0)
+ if (!navigator.appVersion.match(/MSIE/)) {
+ this.assertEqual("14px", $('style_test_dimensions').getStyle('width'));
+ this.assertEqual("17px", $('style_test_dimensions').getStyle('height'));
+ }
+
+ // height/width could always be calculated if it's set to "auto" (Firefox)
+ this.assertNotNull($('auto_dimensions').getStyle('height'));
+ this.assertNotNull($('auto_dimensions').getStyle('width'));
+ },
+
+ testElementGetOpacity: function() {
+ this.assertEqual(0.45, $('op1').setOpacity(0.45).getOpacity());
+ },
+
+ testElementReadAttribute: function() {
+ var attribFormIssues = $('attributes_with_issues_form');
+ this.assertEqual('blah-class', attribFormIssues.readAttribute('class'));
+ this.assertEqual('post', attribFormIssues.readAttribute('method'));
+ this.assertEqual('string', typeof(attribFormIssues.readAttribute('action')));
+ this.assertEqual('string', typeof(attribFormIssues.readAttribute('id')));
+
+ $(document.body).insert('<div id="ie_href_test_div"></div>');
+ $('ie_href_test_div').insert('<p>blah blah</p><a id="ie_href_test" href="test.html">blah</a>');
+ this.assertEqual('test.html', $('ie_href_test').readAttribute('href'));
+
+ this.assertEqual('test.html' , $('attributes_with_issues_1').readAttribute('href'));
+ this.assertEqual('L' , $('attributes_with_issues_1').readAttribute('accesskey'));
+ this.assertEqual('50' , $('attributes_with_issues_1').readAttribute('tabindex'));
+ this.assertEqual('a link' , $('attributes_with_issues_1').readAttribute('title'));
+
+ $('cloned_element_attributes_issue').readAttribute('foo')
+ var clone = $('cloned_element_attributes_issue').cloneNode(true);
+ clone.writeAttribute('foo', 'cloned');
+ this.assertEqual('cloned', clone.readAttribute('foo'));
+ this.assertEqual('original', $('cloned_element_attributes_issue').readAttribute('foo'));
+
+ ['href', 'accesskey', 'accesskey', 'title'].each(function(attr) {
+ this.assertEqual('' , $('attributes_with_issues_2').readAttribute(attr));
+ }, this);
+
+ ['checked','disabled','readonly','multiple'].each(function(attr) {
+ this.assertEqual(attr, $('attributes_with_issues_'+attr).readAttribute(attr));
+ }, this);
+
+ this.assertEqual("alert('hello world');", $('attributes_with_issues_1').readAttribute('onclick'));
+ this.assertNull($('attributes_with_issues_1').readAttribute('onmouseover'));
+
+ this.assertEqual('date', $('attributes_with_issues_type').readAttribute('type'));
+ this.assertEqual('text', $('attributes_with_issues_readonly').readAttribute('type'));
+
+ var elements = $('custom_attributes').immediateDescendants();
+ this.assertEnumEqual(['1', '2'], elements.invoke('readAttribute', 'foo'));
+ this.assertEnumEqual(['2', null], elements.invoke('readAttribute', 'bar'));
+
+ var table = $('write_attribute_table');
+ this.assertEqual('4', table.readAttribute('cellspacing'));
+ this.assertEqual('6', table.readAttribute('cellpadding'));
+
+ // test for consistent flag value across browsers
+ ["true", true, " ", 'rEadOnLy'].each(function(value) {
+ $('attributes_with_issues_readonly').writeAttribute('readonly', value);
+ this.assertEqual('readonly', $('attributes_with_issues_readonly').readAttribute('readonly'));
+ }, this);
+ },
+
+ testElementWriteAttribute: function() {
+ var element = Element.extend(document.body.appendChild(document.createElement('p')));
+ this.assertRespondsTo('writeAttribute', element);
+ this.assertEqual(element, element.writeAttribute('id', 'write_attribute_test'));
+ this.assertEqual('write_attribute_test', element.id);
+ this.assertEqual('http://prototypejs.org/', $('write_attribute_link').
+ writeAttribute({href: 'http://prototypejs.org/', title: 'Home of Prototype'}).href);
+ this.assertEqual('Home of Prototype', $('write_attribute_link').title);
+
+ var element2 = Element.extend(document.createElement('p'));
+ element2.writeAttribute('id', 'write_attribute_without_hash');
+ this.assertEqual('write_attribute_without_hash', element2.id);
+ element2.writeAttribute('animal', 'cat');
+ this.assertEqual('cat', element2.readAttribute('animal'));
+ },
+
+ testElementWriteAttributeWithBooleans: function() {
+ var input = $('write_attribute_input'),
+ select = $('write_attribute_select'),
+ checkbox = $('write_attribute_checkbox'),
+ checkedCheckbox = $('write_attribute_checked_checkbox');
+ this.assert( input. writeAttribute('readonly'). hasAttribute('readonly'));
+ this.assert(!input. writeAttribute('readonly', false). hasAttribute('readonly'));
+ this.assert( input. writeAttribute('readonly', true). hasAttribute('readonly'));
+ this.assert(!input. writeAttribute('readonly', null). hasAttribute('readonly'));
+ this.assert( input. writeAttribute('readonly', 'readonly').hasAttribute('readonly'));
+ this.assert( select. writeAttribute('multiple'). hasAttribute('multiple'));
+ this.assert( input. writeAttribute('disabled'). hasAttribute('disabled'));
+ this.assert( checkbox. writeAttribute('checked'). checked);
+ this.assert(!checkedCheckbox.writeAttribute('checked', false). checked);
+ },
+
+ testElementWriteAttributeWithIssues: function() {
+ var input = $('write_attribute_input').writeAttribute({maxlength: 90, minlength:80, tabindex: 10}),
+ td = $('write_attribute_td').writeAttribute({valign: 'bottom', colspan: 2, rowspan: 2});
+ this.assertEqual(80, input.readAttribute('minlength'));
+ this.assertEqual(90, input.readAttribute('maxlength'));
+ this.assertEqual(10, input.readAttribute('tabindex'));
+ this.assertEqual(2, td.readAttribute('colspan'));
+ this.assertEqual(2, td.readAttribute('rowspan'));
+ this.assertEqual('bottom', td.readAttribute('valign'));
+
+ var p = $('write_attribute_para'), label = $('write_attribute_label');
+ this.assertEqual('some-class', p. writeAttribute({'class': 'some-class'}). readAttribute('class'));
+ this.assertEqual('some-className', p. writeAttribute({className: 'some-className'}).readAttribute('class'));
+ this.assertEqual('some-id', label.writeAttribute({'for': 'some-id'}). readAttribute('for'));
+ this.assertEqual('some-other-id', label.writeAttribute({htmlFor: 'some-other-id'}). readAttribute('for'));
+
+ this.assert(p.writeAttribute({style: 'width: 5px;'}).readAttribute('style').toLowerCase().include('width'));
+
+ var table = $('write_attribute_table');
+ table.writeAttribute('cellspacing', '2')
+ table.writeAttribute('cellpadding', '3')
+ this.assertEqual('2', table.readAttribute('cellspacing'));
+ this.assertEqual('3', table.readAttribute('cellpadding'));
+
+ var iframe = new Element('iframe', { frameborder: 0 });
+ this.assertIdentical(0, parseInt(iframe.readAttribute('frameborder')));
+ },
+
+ testElementWriteAttributeWithCustom: function() {
+ var p = $('write_attribute_para').writeAttribute({name: 'martin', location: 'stockholm', age: 26});
+ this.assertEqual('martin', p.readAttribute('name'));
+ this.assertEqual('stockholm', p.readAttribute('location'));
+ this.assertEqual('26', p.readAttribute('age'));
+ },
+
+ testElementHasAttribute: function() {
+ var label = $('write_attribute_label');
+ this.assertIdentical(true, label.hasAttribute('for'));
+ this.assertIdentical(false, label.hasAttribute('htmlFor'));
+ this.assertIdentical(false, label.hasAttribute('className'));
+ this.assertIdentical(false, label.hasAttribute('rainbows'));
+
+ var input = $('write_attribute_input');
+ this.assertNotIdentical(null, input.hasAttribute('readonly'));
+ this.assertNotIdentical(null, input.hasAttribute('readOnly'));
+ },
+
+ testNewElement: function() {
+ this.assert(new Element('h1'));
+
+ var XHTML_TAGS = $w(
+ 'a abbr acronym address area '+
+ 'b bdo big blockquote br button caption '+
+ 'cite code col colgroup dd del dfn div dl dt '+
+ 'em fieldset form h1 h2 h3 h4 h5 h6 hr '+
+ 'i iframe img input ins kbd label legend li '+
+ 'map object ol optgroup option p param pre q samp '+
+ 'script select small span strong style sub sup '+
+ 'table tbody td textarea tfoot th thead tr tt ul var');
+
+ XHTML_TAGS.each(function(tag, index) {
+ var id = tag + '_' + index, element = document.body.appendChild(new Element(tag, {id: id}));
+ this.assertEqual(tag, element.tagName.toLowerCase());
+ this.assertEqual(element, document.body.lastChild);
+ this.assertEqual(id, element.id);
+ }, this);
+
+
+ this.assertRespondsTo('update', new Element('div'));
+ Element.addMethods({
+ cheeseCake: function(){
+ return 'Cheese cake';
+ }
+ });
+
+ this.assertRespondsTo('cheeseCake', new Element('div'));
+
+ /* window.ElementOld = function(tagName, attributes) {
+ if (Prototype.Browser.IE && attributes && attributes.name) {
+ tagName = '<' + tagName + ' name="' + attributes.name + '">';
+ delete attributes.name;
+ }
+ return Element.extend(document.createElement(tagName)).writeAttribute(attributes || {});
+ };
+
+ this.benchmark(function(){
+ XHTML_TAGS.each(function(tagName) { new Element(tagName) });
+ }, 5);
+
+ this.benchmark(function(){
+ XHTML_TAGS.each(function(tagName) { new ElementOld(tagName) });
+ }, 5); */
+
+ this.assertEqual('foobar', new Element('a', {custom: 'foobar'}).readAttribute('custom'));
+ var input = document.body.appendChild(new Element('input',
+ {id: 'my_input_field_id', name: 'my_input_field'}));
+ this.assertEqual(input, document.body.lastChild);
+ this.assertEqual('my_input_field', $(document.body.lastChild).name);
+ if (Prototype.Browser.IE)
+ this.assertMatch(/name=["']?my_input_field["']?/, $('my_input_field').outerHTML);
+
+ if (originalElement && Prototype.BrowserFeatures.ElementExtensions) {
+ Element.prototype.fooBar = Prototype.emptyFunction
+ this.assertRespondsTo('fooBar', new Element('div'));
+ }
+
+ //test IE setting "type" property of newly created button element
+ var button = new Element('button', {id:'button_type_test',type: 'reset'});
+ var form = $('attributes_with_issues_form');
+ var input = $('attributes_with_issues_regular');
+
+ form.insert(button);
+ input.value = 1;
+ button.click();
+
+ this.assertEqual('0', input.value);
+ button.remove();
+ },
+
+ testElementGetHeight: function() {
+ this.assertIdentical(100, $('dimensions-visible').getHeight());
+ this.assertIdentical(100, $('dimensions-display-none').getHeight());
+ },
+
+ testElementGetWidth: function() {
+ this.assertIdentical(200, $('dimensions-visible').getWidth());
+ this.assertIdentical(200, $('dimensions-display-none').getWidth());
+ },
+
+ testElementGetDimensions: function() {
+ this.assertIdentical(100, $('dimensions-visible').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-visible').getDimensions().width);
+ this.assertIdentical(100, $('dimensions-display-none').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-display-none').getDimensions().width);
+
+ this.assertIdentical(100, $('dimensions-visible-pos-rel').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-visible-pos-rel').getDimensions().width);
+ this.assertIdentical(100, $('dimensions-display-none-pos-rel').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-display-none-pos-rel').getDimensions().width);
+
+ this.assertIdentical(100, $('dimensions-visible-pos-abs').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-visible-pos-abs').getDimensions().width);
+ this.assertIdentical(100, $('dimensions-display-none-pos-abs').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-display-none-pos-abs').getDimensions().width);
+
+ // known failing issue
+ // this.assert($('dimensions-nestee').getDimensions().width <= 500, 'check for proper dimensions of hidden child elements');
+
+ $('dimensions-td').hide();
+ this.assertIdentical(100, $('dimensions-td').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-td').getDimensions().width);
+ $('dimensions-td').show();
+
+ $('dimensions-tr').hide();
+ this.assertIdentical(100, $('dimensions-tr').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-tr').getDimensions().width);
+ $('dimensions-tr').show();
+
+ $('dimensions-table').hide();
+ this.assertIdentical(100, $('dimensions-table').getDimensions().height);
+ this.assertIdentical(200, $('dimensions-table').getDimensions().width);
+
+ },
+
+ testDOMAttributesHavePrecedenceOverExtendedElementMethods: function() {
+ this.assertNothingRaised(function() { $('dom_attribute_precedence').down('form') });
+ this.assertEqual($('dom_attribute_precedence').down('input'), $('dom_attribute_precedence').down('form').update);
+ },
+
+ testClassNames: function() {
+ this.assertEnumEqual([], $('class_names').classNames());
+ this.assertEnumEqual(['A'], $('class_names').down().classNames());
+ this.assertEnumEqual(['A', 'B'], $('class_names_ul').classNames());
+ },
+
+ testHasClassName: function() {
+ this.assertIdentical(false, $('class_names').hasClassName('does_not_exist'));
+ this.assertIdentical(true, $('class_names').down().hasClassName('A'));
+ this.assertIdentical(false, $('class_names').down().hasClassName('does_not_exist'));
+ this.assertIdentical(true, $('class_names_ul').hasClassName('A'));
+ this.assertIdentical(true, $('class_names_ul').hasClassName('B'));
+ this.assertIdentical(false, $('class_names_ul').hasClassName('does_not_exist'));
+ },
+
+ testAddClassName: function() {
+ $('class_names').addClassName('added_className');
+ this.assertEnumEqual(['added_className'], $('class_names').classNames());
+
+ $('class_names').addClassName('added_className'); // verify that className cannot be added twice.
+ this.assertEnumEqual(['added_className'], $('class_names').classNames());
+
+ $('class_names').addClassName('another_added_className');
+ this.assertEnumEqual(['added_className', 'another_added_className'], $('class_names').classNames());
+ },
+
+ testRemoveClassName: function() {
+ $('class_names').removeClassName('added_className');
+ this.assertEnumEqual(['another_added_className'], $('class_names').classNames());
+
+ $('class_names').removeClassName('added_className'); // verify that removing a non existent className is safe.
+ this.assertEnumEqual(['another_added_className'], $('class_names').classNames());
+
+ $('class_names').removeClassName('another_added_className');
+ this.assertEnumEqual([], $('class_names').classNames());
+ },
+
+ testToggleClassName: function() {
+ $('class_names').toggleClassName('toggled_className');
+ this.assertEnumEqual(['toggled_className'], $('class_names').classNames());
+
+ $('class_names').toggleClassName('toggled_className');
+ this.assertEnumEqual([], $('class_names').classNames());
+
+ $('class_names_ul').toggleClassName('toggled_className');
+ this.assertEnumEqual(['A', 'B', 'toggled_className'], $('class_names_ul').classNames());
+
+ $('class_names_ul').toggleClassName('toggled_className');
+ this.assertEnumEqual(['A', 'B'], $('class_names_ul').classNames());
+ },
+
+ testElementScrollTo: function() {
+ var elem = $('scroll_test_2');
+ Element.scrollTo('scroll_test_2');
+ this.assertEqual(Position.page(elem)[1], 0);
+ window.scrollTo(0, 0);
+
+ elem.scrollTo();
+ this.assertEqual(Position.page(elem)[1], 0);
+ window.scrollTo(0, 0);
+ },
+
+ testCustomElementMethods: function() {
+ var elem = $('navigation_test_f');
+ this.assertRespondsTo('hashBrowns', elem);
+ this.assertEqual('hash browns', elem.hashBrowns());
+
+ this.assertRespondsTo('hashBrowns', Element);
+ this.assertEqual('hash browns', Element.hashBrowns(elem));
+ },
+
+ testSpecificCustomElementMethods: function() {
+ var elem = $('navigation_test_f');
+
+ this.assert(Element.Methods.ByTag[elem.tagName]);
+ this.assertRespondsTo('pancakes', elem);
+ this.assertEqual("pancakes", elem.pancakes());
+
+ var elem2 = $('test-visible');
+
+ this.assert(Element.Methods.ByTag[elem2.tagName]);
+ this.assertUndefined(elem2.pancakes);
+ this.assertRespondsTo('waffles', elem2);
+ this.assertEqual("waffles", elem2.waffles());
+
+ this.assertRespondsTo('orangeJuice', elem);
+ this.assertRespondsTo('orangeJuice', elem2);
+ this.assertEqual("orange juice", elem.orangeJuice());
+ this.assertEqual("orange juice", elem2.orangeJuice());
+
+ this.assert(typeof Element.orangeJuice == 'undefined');
+ this.assert(typeof Element.pancakes == 'undefined');
+ this.assert(typeof Element.waffles == 'undefined');
+
+ },
+
+ testScriptFragment: function() {
+ var element = document.createElement('div');
+ // tests an issue with Safari 2.0 crashing when the ScriptFragment
+ // regular expression is using a pipe-based approach for
+ // matching any character
+ ['\r','\n',' '].each(function(character){
+ $(element).update("<script>"+character.times(10000)+"</scr"+"ipt>");
+ this.assertEqual('', element.innerHTML);
+ }, this);
+ $(element).update("<script>var blah='"+'\\'.times(10000)+"'</scr"+"ipt>");
+ this.assertEqual('', element.innerHTML);
+ },
+
+ testPositionedOffset: function() {
+ this.assertEnumEqual([10,10],
+ $('body_absolute').positionedOffset());
+ this.assertEnumEqual([10,10],
+ $('absolute_absolute').positionedOffset());
+ this.assertEnumEqual([10,10],
+ $('absolute_relative').positionedOffset());
+ this.assertEnumEqual([0,10],
+ $('absolute_relative_undefined').positionedOffset());
+ this.assertEnumEqual([10,10],
+ $('absolute_fixed_absolute').positionedOffset());
+
+ var afu = $('absolute_fixed_undefined');
+ this.assertEnumEqual([afu.offsetLeft, afu.offsetTop],
+ afu.positionedOffset());
+
+ var element = new Element('div'), offset = element.positionedOffset();
+ this.assertEnumEqual([0,0], offset);
+ this.assertIdentical(0, offset.top);
+ this.assertIdentical(0, offset.left);
+ },
+
+ testCumulativeOffset: function() {
+ var element = new Element('div'), offset = element.cumulativeOffset();
+ this.assertEnumEqual([0,0], offset);
+ this.assertIdentical(0, offset.top);
+ this.assertIdentical(0, offset.left);
+ },
+
+ testViewportOffset: function() {
+ this.assertEnumEqual([10,10],
+ $('body_absolute').viewportOffset());
+ this.assertEnumEqual([20,20],
+ $('absolute_absolute').viewportOffset());
+ this.assertEnumEqual([20,20],
+ $('absolute_relative').viewportOffset());
+ this.assertEnumEqual([20,30],
+ $('absolute_relative_undefined').viewportOffset());
+ var element = new Element('div'), offset = element.viewportOffset();
+ this.assertEnumEqual([0,0], offset);
+ this.assertIdentical(0, offset.top);
+ this.assertIdentical(0, offset.left);
+ },
+
+ testOffsetParent: function() {
+ this.assertEqual('body_absolute', $('absolute_absolute').getOffsetParent().id);
+ this.assertEqual('body_absolute', $('absolute_relative').getOffsetParent().id);
+ this.assertEqual('absolute_relative', $('inline').getOffsetParent().id);
+ this.assertEqual('absolute_relative', $('absolute_relative_undefined').getOffsetParent().id);
+
+ this.assertEqual(document.body, new Element('div').getOffsetParent());
+ },
+
+ testAbsolutize: function() {
+ $('notInlineAbsoluted', 'inlineAbsoluted').each(function(elt) {
+ if ('_originalLeft' in elt) delete elt._originalLeft;
+ elt.absolutize();
+ this.assertUndefined(elt._originalLeft, 'absolutize() did not detect absolute positioning');
+ }, this);
+ // invoking on "absolute" positioned element should return element
+ var element = $('absolute_fixed_undefined').setStyle({position: 'absolute'});
+ this.assertEqual(element, element.absolutize());
+
+ // test relatively positioned element with no height specified for IE7
+ var element = $('absolute_relative'), dimensions = element.getDimensions();
+ element.absolutize();
+ this.assertIdentical(dimensions.width, element.getDimensions().width);
+ this.assertIdentical(dimensions.height, element.getDimensions().height);
+ },
+
+ testRelativize: function() {
+ // invoking on "relative" positioned element should return element
+ var element = $('absolute_fixed_undefined').setStyle({position: 'relative'});
+ this.assertEqual(element, element.relativize());
+
+ var assertPositionEqual = function(modifier, element) {
+ element = $(element);
+ var offsets = element.cumulativeOffset();
+ Element[modifier](element);
+ this.assertEnumEqual(offsets, element.cumulativeOffset());
+ }.bind(this);
+
+ var testRelativize = assertPositionEqual.curry('relativize');
+ testRelativize('notInlineAbsoluted');
+ testRelativize('inlineAbsoluted');
+ testRelativize('absolute_absolute');
+ },
+
+ testElementToViewportDimensionsDoesNotAffectDocumentProperties: function() {
+ // No properties on the document should be affected when resizing
+ // an absolute positioned(0,0) element to viewport dimensions
+ var vd = document.viewport.getDimensions();
+
+ var before = documentViewportProperties.inspect();
+ $('elementToViewportDimensions').setStyle({ height: vd.height + 'px', width: vd.width + 'px' }).show();
+ var after = documentViewportProperties.inspect();
+ $('elementToViewportDimensions').hide();
+
+ documentViewportProperties.properties.each(function(prop) {
+ this.assertEqual(before[prop], after[prop], prop + ' was affected');
+ }, this);
+ },
+
+ testNodeConstants: function() {
+ this.assert(window.Node, 'window.Node is unavailable');
+
+ var constants = $H({
+ ELEMENT_NODE: 1,
+ ATTRIBUTE_NODE: 2,
+ TEXT_NODE: 3,
+ CDATA_SECTION_NODE: 4,
+ ENTITY_REFERENCE_NODE: 5,
+ ENTITY_NODE: 6,
+ PROCESSING_INSTRUCTION_NODE: 7,
+ COMMENT_NODE: 8,
+ DOCUMENT_NODE: 9,
+ DOCUMENT_TYPE_NODE: 10,
+ DOCUMENT_FRAGMENT_NODE: 11,
+ NOTATION_NODE: 12
+ });
+
+ constants.each(function(pair) {
+ this.assertEqual(Node[pair.key], pair.value);
+ }, this);
+ }
+});
+
+function preservingBrowserDimensions(callback) {
+ var original = document.viewport.getDimensions();
+ window.resizeTo(640, 480);
+ var resized = document.viewport.getDimensions();
+ original.width += 640 - resized.width, original.height += 480 - resized.height;
+
+ try {
+ window.resizeTo(original.width, original.height);
+ callback();
+ } finally {
+ window.resizeTo(original.width, original.height);
+ }
+}
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/element_mixins_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/element_mixins_test.js
new file mode 100644
index 0000000000..239179375c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/element_mixins_test.js
@@ -0,0 +1,32 @@
+new Test.Unit.Runner({
+ testInput: function() {
+ this.assert($("input").present != null);
+ this.assert(typeof $("input").present == 'function');
+ this.assert($("input").select != null);
+ this.assertRespondsTo('present', Form.Element);
+ this.assertRespondsTo('present', Form.Element.Methods);
+ this.assertRespondsTo('coffee', $('input'));
+ this.assertIdentical(Prototype.K, Form.Element.coffee);
+ this.assertIdentical(Prototype.K, Form.Element.Methods.coffee);
+ },
+
+ testForm: function() {
+ this.assert($("form").reset != null);
+ this.assert($("form").getInputs().length == 2);
+ },
+
+ testEvent: function() {
+ this.assert($("form").observe != null)
+ // Can't really test this one with TestUnit...
+ $('form').observe("submit", function(e) {
+ alert("yeah!");
+ Event.stop(e);
+ });
+ },
+
+ testCollections: function() {
+ this.assert($$("input").all(function(input) {
+ return (input.focus != null);
+ }));
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/enumerable_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/enumerable_test.js
new file mode 100644
index 0000000000..fdc7c019d0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/enumerable_test.js
@@ -0,0 +1,263 @@
+function prime(value) {
+ for (var i = 2; i < value; i++)
+ if (value % i == 0) return false;
+ return true;
+}
+
+new Test.Unit.Runner({
+ testEachBreak: function() {
+ var result = 0;
+ Fixtures.Basic.each(function(value) {
+ if ((result = value) == 2) throw $break;
+ });
+
+ this.assertEqual(2, result);
+ },
+
+ testEachReturnActsAsContinue: function() {
+ var results = [];
+ Fixtures.Basic.each(function(value) {
+ if (value == 2) return;
+ results.push(value);
+ });
+
+ this.assertEqual('1, 3', results.join(', '));
+ },
+
+ testEachChaining: function() {
+ this.assertEqual(Fixtures.Primes, Fixtures.Primes.each(Prototype.emptyFunction));
+ this.assertEqual(3, Fixtures.Basic.each(Prototype.emptyFunction).length);
+ },
+
+ testEnumContext: function() {
+ var results = [];
+ Fixtures.Basic.each(function(value) {
+ results.push(value * this.i);
+ }, { i: 2 });
+
+ this.assertEqual('2 4 6', results.join(' '));
+
+ this.assert(Fixtures.Basic.all(function(value){
+ return value >= this.min && value <= this.max;
+ }, { min: 1, max: 3 }));
+ this.assert(!Fixtures.Basic.all(function(value){
+ return value >= this.min && value <= this.max;
+ }));
+ this.assert(Fixtures.Basic.any(function(value){
+ return value == this.target_value;
+ }, { target_value: 2 }));
+ },
+
+ testAny: function() {
+ this.assert(!([].any()));
+
+ this.assert([true, true, true].any());
+ this.assert([true, false, false].any());
+ this.assert(![false, false, false].any());
+
+ this.assert(Fixtures.Basic.any(function(value) {
+ return value > 2;
+ }));
+ this.assert(!Fixtures.Basic.any(function(value) {
+ return value > 5;
+ }));
+ },
+
+ testAll: function() {
+ this.assert([].all());
+
+ this.assert([true, true, true].all());
+ this.assert(![true, false, false].all());
+ this.assert(![false, false, false].all());
+
+ this.assert(Fixtures.Basic.all(function(value) {
+ return value > 0;
+ }));
+ this.assert(!Fixtures.Basic.all(function(value) {
+ return value > 1;
+ }));
+ },
+
+ testCollect: function() {
+ this.assertEqual(Fixtures.Nicknames.join(', '),
+ Fixtures.People.collect(function(person) {
+ return person.nickname;
+ }).join(", "));
+
+ this.assertEqual(26, Fixtures.Primes.map().length);
+ },
+
+ testDetect: function() {
+ this.assertEqual('Marcel Molina Jr.',
+ Fixtures.People.detect(function(person) {
+ return person.nickname.match(/no/);
+ }).name);
+ },
+
+ testEachSlice: function() {
+ this.assertEnumEqual([], [].eachSlice(2));
+ this.assertEqual(1, [1].eachSlice(1).length);
+ this.assertEnumEqual([1], [1].eachSlice(1)[0]);
+ this.assertEqual(2, Fixtures.Basic.eachSlice(2).length);
+ this.assertEnumEqual(
+ [3, 2, 1, 11, 7, 5, 19, 17, 13, 31, 29, 23, 43, 41, 37, 59, 53, 47, 71, 67, 61, 83, 79, 73, 97, 89],
+ Fixtures.Primes.eachSlice( 3, function(slice){ return slice.reverse() }).flatten()
+ );
+ this.assertEnumEqual(Fixtures.Basic, Fixtures.Basic.eachSlice(-10));
+ this.assertEnumEqual(Fixtures.Basic, Fixtures.Basic.eachSlice(0));
+ this.assertNotIdentical(Fixtures.Basic, Fixtures.Basic.eachSlice(0));
+ },
+
+ testEachWithIndex: function() {
+ var nicknames = [], indexes = [];
+ Fixtures.People.each(function(person, index) {
+ nicknames.push(person.nickname);
+ indexes.push(index);
+ });
+
+ this.assertEqual(Fixtures.Nicknames.join(', '),
+ nicknames.join(', '));
+ this.assertEqual('0, 1, 2, 3', indexes.join(', '));
+ },
+
+ testFindAll: function() {
+ this.assertEqual(Fixtures.Primes.join(', '),
+ Fixtures.Z.findAll(prime).join(', '));
+ },
+
+ testGrep: function() {
+ this.assertEqual('noradio, htonl',
+ Fixtures.Nicknames.grep(/o/).join(", "));
+
+ this.assertEqual('NORADIO, HTONL',
+ Fixtures.Nicknames.grep(/o/, function(nickname) {
+ return nickname.toUpperCase();
+ }).join(", "))
+
+ this.assertEnumEqual($('grepHeader', 'grepCell'),
+ $('grepTable', 'grepTBody', 'grepRow', 'grepHeader', 'grepCell').grep(new Selector('.cell')));
+ },
+
+ testInclude: function() {
+ this.assert(Fixtures.Nicknames.include('sam-'));
+ this.assert(Fixtures.Nicknames.include('noradio'));
+ this.assert(!Fixtures.Nicknames.include('gmosx'));
+ this.assert(Fixtures.Basic.include(2));
+ this.assert(Fixtures.Basic.include('2'));
+ this.assert(!Fixtures.Basic.include('4'));
+ },
+
+ testInGroupsOf: function() {
+ this.assertEnumEqual([], [].inGroupsOf(3));
+
+ var arr = [1, 2, 3, 4, 5, 6].inGroupsOf(3);
+ this.assertEqual(2, arr.length);
+ this.assertEnumEqual([1, 2, 3], arr[0]);
+ this.assertEnumEqual([4, 5, 6], arr[1]);
+
+ arr = [1, 2, 3, 4, 5, 6].inGroupsOf(4);
+ this.assertEqual(2, arr.length);
+ this.assertEnumEqual([1, 2, 3, 4], arr[0]);
+ this.assertEnumEqual([5, 6, null, null], arr[1]);
+
+ var basic = Fixtures.Basic
+
+ arr = basic.inGroupsOf(4,'x');
+ this.assertEqual(1, arr.length);
+ this.assertEnumEqual([1, 2, 3, 'x'], arr[0]);
+
+ this.assertEnumEqual([1,2,3,'a'], basic.inGroupsOf(2, 'a').flatten());
+
+ arr = basic.inGroupsOf(5, '');
+ this.assertEqual(1, arr.length);
+ this.assertEnumEqual([1, 2, 3, '', ''], arr[0]);
+
+ this.assertEnumEqual([1,2,3,0], basic.inGroupsOf(2, 0).flatten());
+ this.assertEnumEqual([1,2,3,false], basic.inGroupsOf(2, false).flatten());
+ },
+
+ testInject: function() {
+ this.assertEqual(1061,
+ Fixtures.Primes.inject(0, function(sum, value) {
+ return sum + value;
+ }));
+ },
+
+ testInvoke: function() {
+ var result = [[2, 1, 3], [6, 5, 4]].invoke('sort');
+ this.assertEqual(2, result.length);
+ this.assertEqual('1, 2, 3', result[0].join(', '));
+ this.assertEqual('4, 5, 6', result[1].join(', '));
+
+ result = result.invoke('invoke', 'toString', 2);
+ this.assertEqual('1, 10, 11', result[0].join(', '));
+ this.assertEqual('100, 101, 110', result[1].join(', '));
+ },
+
+ testMax: function() {
+ this.assertEqual(100, Fixtures.Z.max());
+ this.assertEqual(97, Fixtures.Primes.max());
+ this.assertEqual(2, [ -9, -8, -7, -6, -4, -3, -2, 0, -1, 2 ].max());
+ this.assertEqual('sam-', Fixtures.Nicknames.max()); // ?s > ?U
+ },
+
+ testMin: function() {
+ this.assertEqual(1, Fixtures.Z.min());
+ this.assertEqual(0, [ 1, 2, 3, 4, 5, 6, 7, 8, 0, 9 ].min());
+ this.assertEqual('Ulysses', Fixtures.Nicknames.min()); // ?U < ?h
+ },
+
+ testPartition: function() {
+ var result = Fixtures.People.partition(function(person) {
+ return person.name.length < 15;
+ }).invoke('pluck', 'nickname');
+
+ this.assertEqual(2, result.length);
+ this.assertEqual('sam-, htonl', result[0].join(', '));
+ this.assertEqual('noradio, Ulysses', result[1].join(', '));
+ },
+
+ testPluck: function() {
+ this.assertEqual(Fixtures.Nicknames.join(', '),
+ Fixtures.People.pluck('nickname').join(', '));
+ },
+
+ testReject: function() {
+ this.assertEqual(0,
+ Fixtures.Nicknames.reject(Prototype.K).length);
+
+ this.assertEqual('sam-, noradio, htonl',
+ Fixtures.Nicknames.reject(function(nickname) {
+ return nickname != nickname.toLowerCase();
+ }).join(', '));
+ },
+
+ testSortBy: function() {
+ this.assertEqual('htonl, noradio, sam-, Ulysses',
+ Fixtures.People.sortBy(function(value) {
+ return value.nickname.toLowerCase();
+ }).pluck('nickname').join(', '));
+ },
+
+ testToArray: function() {
+ var result = Fixtures.People.toArray();
+ this.assert(result != Fixtures.People); // they're different objects...
+ this.assertEqual(Fixtures.Nicknames.join(', '),
+ result.pluck('nickname').join(', ')); // but the values are the same
+ },
+
+ testZip: function() {
+ var result = [1, 2, 3].zip([4, 5, 6], [7, 8, 9]);
+ this.assertEqual('[[1, 4, 7], [2, 5, 8], [3, 6, 9]]', result.inspect());
+
+ result = [1, 2, 3].zip([4, 5, 6], [7, 8, 9], function(array) { return array.reverse() });
+ this.assertEqual('[[7, 4, 1], [8, 5, 2], [9, 6, 3]]', result.inspect());
+ },
+
+ testSize: function() {
+ this.assertEqual(4, Fixtures.People.size());
+ this.assertEqual(4, Fixtures.Nicknames.size());
+ this.assertEqual(26, Fixtures.Primes.size());
+ this.assertEqual(0, [].size());
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/event_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/event_test.js
new file mode 100644
index 0000000000..ae10a77a7f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/event_test.js
@@ -0,0 +1,286 @@
+var documentLoaded = document.loaded;
+
+new Test.Unit.Runner({
+
+ // test firing an event and observing it on the element it's fired from
+ testCustomEventFiring: function() {
+ var span = $("span"), fired = false, observer = function(event) {
+ this.assertEqual(span, event.element());
+ this.assertEqual(1, event.memo.index);
+ fired = true;
+ }.bind(this);
+
+ span.observe("test:somethingHappened", observer);
+ span.fire("test:somethingHappened", { index: 1 });
+ this.assert(fired);
+
+ fired = false;
+ span.fire("test:somethingElseHappened");
+ this.assert(!fired);
+
+ span.stopObserving("test:somethingHappened", observer);
+ span.fire("test:somethingHappened");
+ this.assert(!fired);
+ },
+
+ // test firing an event and observing it on a containing element
+ testCustomEventBubbling: function() {
+ var span = $("span"), outer = $("outer"), fired = false, observer = function(event) {
+ this.assertEqual(span, event.element());
+ fired = true;
+ }.bind(this);
+
+ outer.observe("test:somethingHappened", observer);
+ span.fire("test:somethingHappened");
+ this.assert(fired);
+
+ fired = false;
+ span.fire("test:somethingElseHappened");
+ this.assert(!fired);
+
+ outer.stopObserving("test:somethingHappened", observer);
+ span.fire("test:somethingHappened");
+ this.assert(!fired);
+ },
+
+ testCustomEventCanceling: function() {
+ var span = $("span"), outer = $("outer"), inner = $("inner");
+ var fired = false, stopped = false;
+
+ function outerObserver(event) {
+ fired = span == event.element();
+ }
+
+ function innerObserver(event) {
+ event.stop();
+ stopped = true;
+ }
+
+ inner.observe("test:somethingHappened", innerObserver);
+ outer.observe("test:somethingHappened", outerObserver);
+ span.fire("test:somethingHappened");
+ this.assert(stopped);
+ this.assert(!fired);
+
+ fired = stopped = false;
+ inner.stopObserving("test:somethingHappened", innerObserver);
+ span.fire("test:somethingHappened");
+ this.assert(!stopped);
+ this.assert(fired);
+
+ outer.stopObserving("test:somethingHappened", outerObserver);
+ },
+
+ testEventObjectIsExtended: function() {
+ var span = $("span"), event, observedEvent, observer = function(e) { observedEvent = e };
+ span.observe("test:somethingHappened", observer);
+ event = span.fire("test:somethingHappened");
+ this.assertEqual(event, observedEvent);
+ this.assertEqual(Event.Methods.stop.methodize(), event.stop);
+ span.stopObserving("test:somethingHappened", observer);
+
+ event = span.fire("test:somethingHappenedButNoOneIsListening");
+ this.assertEqual(Event.Methods.stop.methodize(), event.stop);
+ },
+
+ testEventObserversAreBoundToTheObservedElement: function() {
+ var span = $("span"), target, observer = function() { target = this };
+
+ span.observe("test:somethingHappened", observer);
+ span.fire("test:somethingHappened");
+ span.stopObserving("test:somethingHappened", observer);
+ this.assertEqual(span, target);
+ target = null;
+
+ var outer = $("outer");
+ outer.observe("test:somethingHappened", observer);
+ span.fire("test:somethingHappened");
+ outer.stopObserving("test:somethingHappened", observer);
+ this.assertEqual(outer, target);
+ },
+
+ testMultipleCustomEventObserversWithTheSameHandler: function() {
+ var span = $("span"), count = 0, observer = function() { count++ };
+
+ span.observe("test:somethingHappened", observer);
+ span.observe("test:somethingElseHappened", observer);
+ span.fire("test:somethingHappened");
+ this.assertEqual(1, count);
+ span.fire("test:somethingElseHappened");
+ this.assertEqual(2, count);
+ span.stopObserving("test:somethingHappened", observer);
+ span.stopObserving("test:somethingElseHappened", observer);
+ },
+
+ testStopObservingWithoutArguments: function() {
+ var span = $("span"), count = 0, observer = function() { count++ };
+
+ span.observe("test:somethingHappened", observer);
+ span.observe("test:somethingElseHappened", observer);
+ span.stopObserving();
+ span.fire("test:somethingHappened");
+ this.assertEqual(0, count);
+ span.fire("test:somethingElseHappened");
+ this.assertEqual(0, count);
+
+ this.assertEqual(window, Event.stopObserving(window));
+
+ // test element with no observers
+ this.assertNothingRaised(function() { $(document.body).stopObserving() });
+ },
+
+ testStopObservingWithoutHandlerArgument: function() {
+ var span = $("span"), count = 0, observer = function() { count++ };
+
+ span.observe("test:somethingHappened", observer);
+ span.observe("test:somethingElseHappened", observer);
+ span.stopObserving("test:somethingHappened");
+ span.fire("test:somethingHappened");
+ this.assertEqual(0, count);
+ span.fire("test:somethingElseHappened");
+ this.assertEqual(1, count);
+ span.stopObserving("test:somethingElseHappened");
+ span.fire("test:somethingElseHappened");
+ this.assertEqual(1, count);
+
+ // test element with no observers
+ this.assertNothingRaised(function() { $(document.body).stopObserving("test:somethingHappened") });
+ },
+
+ testStopObservingRemovesHandlerFromCache: function() {
+ var span = $("span"), observer = function() { }, eventID;
+
+ span.observe("test:somethingHappened", observer);
+ eventID = span._prototypeEventID;
+
+ this.assert(Event.cache[eventID]);
+ this.assert(Object.isArray(Event.cache[eventID]["test:somethingHappened"]));
+ this.assertEqual(1, Event.cache[eventID]["test:somethingHappened"].length);
+
+ span.stopObserving("test:somethingHappened", observer);
+ this.assert(Event.cache[eventID]);
+ this.assert(Object.isArray(Event.cache[eventID]["test:somethingHappened"]));
+ this.assertEqual(0, Event.cache[eventID]["test:somethingHappened"].length);
+ },
+
+ testObserveAndStopObservingAreChainable: function() {
+ var span = $("span"), observer = function() { };
+
+ this.assertEqual(span, span.observe("test:somethingHappened", observer));
+ this.assertEqual(span, span.stopObserving("test:somethingHappened", observer));
+
+ span.observe("test:somethingHappened", observer);
+ this.assertEqual(span, span.stopObserving("test:somethingHappened"));
+
+ span.observe("test:somethingHappened", observer);
+ this.assertEqual(span, span.stopObserving());
+ this.assertEqual(span, span.stopObserving()); // assert it again, after there are no observers
+
+ span.observe("test:somethingHappened", observer);
+ this.assertEqual(span, span.observe("test:somethingHappened", observer)); // try to reuse the same observer
+ span.stopObserving();
+ },
+
+ testObserveInsideHandlers: function() {
+ var fired = false, observer = function(event) {
+ fired = true;
+ };
+
+ document.observe("test:somethingHappened", function() {
+ document.observe("test:somethingHappened", observer);
+ });
+
+ document.fire("test:somethingHappened");
+ this.assert(!fired);
+
+ document.fire("test:somethingHappened");
+ this.assert(fired);
+ document.stopObserving("test:somethingHappened");
+ },
+
+ testStopObservingInsideHandlers: function() {
+ var fired = false, observer = function(event) {
+ fired = true;
+ };
+
+ document.observe("test:somethingHappened", observer);
+ document.observe("test:somethingHappened", function() {
+ document.stopObserving("test:somethingHappened", observer);
+ });
+
+ document.fire("test:somethingHappened");
+ this.assert(fired);
+
+ fired = false;
+ document.fire("test:somethingHappened");
+ document.stopObserving("test:somethingHappened");
+ this.assert(!fired);
+ },
+
+ testDocumentLoaded: function() {
+ this.assert(!documentLoaded);
+ this.assert(document.loaded);
+ },
+
+ testDocumentContentLoadedEventFiresBeforeWindowLoad: function() {
+ this.assert(eventResults.contentLoaded, "contentLoaded");
+ this.assert(eventResults.contentLoaded.endOfDocument, "contentLoaded.endOfDocument");
+ this.assert(!eventResults.contentLoaded.windowLoad, "!contentLoaded.windowLoad");
+ this.assert(eventResults.windowLoad, "windowLoad");
+ this.assert(eventResults.windowLoad.endOfDocument, "windowLoad.endOfDocument");
+ this.assert(eventResults.windowLoad.contentLoaded, "windowLoad.contentLoaded");
+ },
+
+ testEventStopped: function() {
+ var span = $("span"), event;
+
+ span.observe("test:somethingHappened", function() { });
+ event = span.fire("test:somethingHappened");
+ this.assert(!event.stopped, "event.stopped should be false with an empty observer");
+ span.stopObserving("test:somethingHappened");
+
+ span.observe("test:somethingHappened", function(e) { e.stop() });
+ event = span.fire("test:somethingHappened");
+ this.assert(event.stopped, "event.stopped should be true for an observer that calls stop");
+ span.stopObserving("test:somethingHappened");
+ },
+
+ testEventFindElement: function() {
+ var span = $("span"), event;
+ event = span.fire("test:somethingHappened");
+ this.assertElementMatches(event.findElement(), 'span#span');
+ this.assertElementMatches(event.findElement('span'), 'span#span');
+ this.assertElementMatches(event.findElement('p'), 'p#inner');
+ this.assertEqual(null, event.findElement('div.does_not_exist'));
+ this.assertElementMatches(event.findElement('.does_not_exist, span'), 'span#span');
+ },
+
+ testEventIDDuplication: function() {
+ $('container').down().observe("test:somethingHappened", Prototype.emptyFunction);
+ $('container').innerHTML += $('container').innerHTML;
+ this.assertUndefined($('container').down(1)._prototypeEventID);
+ },
+
+ testHandlerCallsPreserveOrder: function() {
+ var span = $("span"), order = [ ];
+ span.observe("test:somethingHappened", function(e) { order.push('first') });
+ span.observe("test:somethingHappened", function(e) { order.push('second') });
+ span.fire("test:somethingHappened");
+ this.assertEnumEqual(['first', 'second'], order);
+ span.stopObserving("test:somethingHappened");
+ }
+});
+
+document.observe("dom:loaded", function(event) {
+ eventResults.contentLoaded = {
+ endOfDocument: eventResults.endOfDocument,
+ windowLoad: eventResults.windowLoad
+ };
+});
+
+Event.observe(window, "load", function(event) {
+ eventResults.windowLoad = {
+ endOfDocument: eventResults.endOfDocument,
+ contentLoaded: eventResults.contentLoaded
+ };
+});
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.html
new file mode 100644
index 0000000000..4af5e267ac
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.html
@@ -0,0 +1,2 @@
+<div id="content"></div>
+<div id="content2" style="color:red"></div>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.js
new file mode 100644
index 0000000000..8487943f73
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.js
@@ -0,0 +1,42 @@
+var Fixtures = {
+ js: {
+ responseBody: '$("content").update("<H2>Hello world!</H2>");',
+ 'Content-Type': ' text/javascript '
+ },
+
+ html: {
+ responseBody: "Pack my box with <em>five dozen</em> liquor jugs! " +
+ "Oh, how <strong>quickly</strong> daft jumping zebras vex..."
+ },
+
+ xml: {
+ responseBody: '<?xml version="1.0" encoding="UTF-8" ?><name attr="foo">bar</name>',
+ 'Content-Type': 'application/xml'
+ },
+
+ json: {
+ responseBody: '{\n\r"test": 123}',
+ 'Content-Type': 'application/json'
+ },
+
+ jsonWithoutContentType: {
+ responseBody: '{"test": 123}'
+ },
+
+ invalidJson: {
+ responseBody: '{});window.attacked = true;({}',
+ 'Content-Type': 'application/json'
+ },
+
+ headerJson: {
+ 'X-JSON': '{"test": "hello #éà"}'
+ }
+};
+
+var responderCounter = 0;
+
+// lowercase comparison because of MSIE which presents HTML tags in uppercase
+var sentence = ("Pack my box with <em>five dozen</em> liquor jugs! " +
+"Oh, how <strong>quickly</strong> daft jumping zebras vex...").toLowerCase();
+
+var message = 'You must be running your tests from rake to test this feature.'; \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/array.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/array.html
new file mode 100644
index 0000000000..8f091878c8
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/array.html
@@ -0,0 +1 @@
+<div id="test_node">22<span id="span_1"></span><span id="span_2"></span></div>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.html
new file mode 100644
index 0000000000..5a08fbd554
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.html
@@ -0,0 +1,6 @@
+<div id="test"></div>
+<ul id="list">
+ <li></li>
+ <li></li>
+ <li></li>
+</ul> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.js
new file mode 100644
index 0000000000..8e9e00bd54
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.js
@@ -0,0 +1,106 @@
+var Person = function(name){
+ this.name = name;
+};
+
+Person.prototype.toJSON = function() {
+ return '-' + this.name;
+};
+
+var arg1 = 1;
+var arg2 = 2;
+var arg3 = 3;
+function TestObj() { };
+TestObj.prototype.assertingEventHandler =
+ function(event, assertEvent, assert1, assert2, assert3, a1, a2, a3) {
+ assertEvent(event);
+ assert1(a1);
+ assert2(a2);
+ assert3(a3);
+ };
+
+var globalBindTest = null;
+
+
+// base class
+var Animal = Class.create({
+ initialize: function(name) {
+ this.name = name;
+ },
+ name: "",
+ eat: function() {
+ return this.say("Yum!");
+ },
+ say: function(message) {
+ return this.name + ": " + message;
+ }
+});
+
+// subclass that augments a method
+var Cat = Class.create(Animal, {
+ eat: function($super, food) {
+ if (food instanceof Mouse) return $super();
+ else return this.say("Yuk! I only eat mice.");
+ }
+});
+
+// empty subclass
+var Mouse = Class.create(Animal, {});
+
+//mixins
+var Sellable = {
+ getValue: function(pricePerKilo) {
+ return this.weight * pricePerKilo;
+ },
+
+ inspect: function() {
+ return '#<Sellable: #{weight}kg>'.interpolate(this);
+ }
+};
+
+var Reproduceable = {
+ reproduce: function(partner) {
+ if (partner.constructor != this.constructor || partner.sex == this.sex)
+ return null;
+ var weight = this.weight / 10, sex = Math.random(1).round() ? 'male' : 'female';
+ return new this.constructor('baby', weight, sex);
+ }
+};
+
+// base class with mixin
+var Plant = Class.create(Sellable, {
+ initialize: function(name, weight) {
+ this.name = name;
+ this.weight = weight;
+ },
+
+ inspect: function() {
+ return '#<Plant: #{name}>'.interpolate(this);
+ }
+});
+
+// subclass with mixin
+var Dog = Class.create(Animal, Reproduceable, {
+ initialize: function($super, name, weight, sex) {
+ this.weight = weight;
+ this.sex = sex;
+ $super(name);
+ }
+});
+
+// subclass with mixins
+var Ox = Class.create(Animal, Sellable, Reproduceable, {
+ initialize: function($super, name, weight, sex) {
+ this.weight = weight;
+ this.sex = sex;
+ $super(name);
+ },
+
+ eat: function(food) {
+ if (food instanceof Plant)
+ this.weight += food.weight;
+ },
+
+ inspect: function() {
+ return '#<Ox: #{name}>'.interpolate(this);
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/content.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/content.html
new file mode 100644
index 0000000000..ee3701d3c3
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/content.html
@@ -0,0 +1 @@
+Pack my box with <em>five dozen</em> liquor jugs! Oh, how <strong>quickly</strong> daft jumping zebras vex... \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/data.json b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/data.json
new file mode 100644
index 0000000000..85391eb939
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/data.json
@@ -0,0 +1 @@
+{test: 123} \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.css b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.css
new file mode 100644
index 0000000000..453a569c26
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.css
@@ -0,0 +1,85 @@
+#style_test_1 { cursor: pointer; font-size:12px;}
+div.style-test { margin-left: 1px }
+
+#style_test_dimensions_container {
+ position: absolute;
+ top: 0;
+ left: 500px;
+ width: 20px;
+ height: 30px;
+ margin: 10px;
+ padding: 10px;
+ border: 3px solid red;
+}
+
+#not_floating_style { float: none }
+#floating_style { float: left }
+#op2 { opacity:0.5;filter:alpha(opacity=50)progid:DXImageTransform.Microsoft.Blur(strength=10);}
+
+#scroll_test_1 {
+ margin: 10px;
+ padding: 10px;
+ position: relative;
+}
+
+#scroll_test_2 {
+ position: absolute;
+ left: 10px;
+ top: 10px;
+}
+
+#dimensions-visible,
+#dimensions-display-none,
+#dimensions-visible-pos-rel,
+#dimensions-display-none-pos-rel,
+#dimensions-visible-pos-abs,
+#dimensions-display-none-pos-abs {
+ font-size: 10px;
+ height: 10em;
+ width: 20em;
+}
+
+#dimensions-visible-pos-abs,
+#dimensions-display-none-pos-abs {
+ position: absolute;
+ top: 15px;
+ left: 15px;
+}
+
+#dimensions-visible-pos-rel,
+#dimensions-display-none-pos-rel {
+ position: relative;
+ top: 15px;
+ left: 15px;
+}
+
+#dimensions-display-none, #dimensions-display-none-pos-rel, #dimensions-display-none-pos-abs {
+ display: none;
+}
+
+#dimensions-table, #dimensions-tbody, #dimensions-tr, #dimensions-td {
+ font-size: 10px;
+ margin: 0;
+ padding: 0;
+ border: 0;
+ border-spacing: 0;
+ height: 10em;
+ width: 20em;
+}
+
+
+#notInlineAbsoluted { position: absolute; }
+
+#elementToViewportDimensions {
+ position: absolute;
+ top: 0;
+ left: 0;
+ height: 10px;
+ width: 10px;
+ background: #000;
+}
+
+/* for scroll test on really big screens */
+body {
+ height: 40000px;
+} \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.html
new file mode 100644
index 0000000000..1273098e6d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.html
@@ -0,0 +1,285 @@
+<div id="scroll_test_1">
+ <p id="scroll_test_2">Scroll test</p>
+</div>
+
+<div id="test-visible">visible</div>
+<div id="test-hidden" style="display:none;">hidden</div>
+<div id="test-toggle-visible">visible</div>
+<div id="test-toggle-hidden" style="display:none;">hidden</div>
+<div id="test-hide-visible">visible</div>
+<div id="test-hide-hidden" style="display:none;">hidden</div>
+<div id="test-show-visible">visible</div>
+<div id="test-show-hidden" style="display:none;">hidden</div>
+<div id="removable-container"><div id="removable"></div></div>
+
+<div>
+ <table>
+ <tbody id="table">
+ <tr>
+ <td>Data</td>
+ </tr>
+ <tr>
+ <td id="a_cell">First Row</td>
+ </tr>
+ <tr id="second_row">
+ <td>Second Row</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<div id="table-container-to-replace">
+ <table>
+ <tbody id="table-to-replace">
+ <tr>
+ <td>Data</td>
+ </tr>
+ <tr>
+ <td id="a_cell-to-replace">First Row</td>
+ </tr>
+ <tr id="second_row-to-replace">
+ <td>Second Row</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<p class="test">Test paragraph outside of container</p>
+
+<div id="container">
+ <p class="test" id="intended">Test paragraph 1 inside of container</p>
+ <p class="test">Test paragraph 2 inside of container</p>
+ <p class="test">Test paragraph 3 inside of container</p>
+ <p class="test">Test paragraph 4 inside of container</p>
+</div>
+
+<div id="testdiv">to be updated</div>
+<div id="testdiv-replace-container-1"><div id="testdiv-replace-1"></div></div>
+<div id="testdiv-replace-container-2"><div id="testdiv-replace-2"></div></div>
+<div id="testdiv-replace-container-3"><div id="testdiv-replace-3"></div></div>
+<div id="testdiv-replace-container-4"><div id="testdiv-replace-4"></div></div>
+<div id="testdiv-replace-container-5"><div id="testdiv-replace-5"></div></div>
+<div id="testdiv-replace-container-element"><div id="testdiv-replace-element"></div></div>
+<div id="testdiv-replace-container-toelement"><div id="testdiv-replace-toelement"></div></div>
+<div id="testdiv-replace-container-tohtml"><div id="testdiv-replace-tohtml"></div></div>
+<div id="testtable-replace-container"><table id="testtable-replace"></table></div>
+<table id="testrow-replace-container"><tr id="testrow-replace"></tr></table>
+<select id="testoption-replace-container"><option id="testoption-replace"></option><option>stays</option></select>
+<div id="testform-replace-container"><p>some text</p><form id="testform-replace"><input id="testinput-replace" type="text" /></form><p>some text</p></div>
+
+<div id="element_with_visible_overflow" style="overflow:visible">V</div>
+<div id="element_with_hidden_overflow" style="overflow:hidden">H</div>
+<div id="element_with_scroll_overflow" style="overflow:scroll">S</div>
+
+<div id="element_extend_test"> </div>
+
+<div id="element_reextend_test"><div id="discard_1"></div></div>
+
+<div id="test_whitespace"> <span> </span>
+
+
+<div><div></div> </div><span> </span>
+</div>
+
+
+<div id="nav_tests_isolator">
+ <div id="nav_test_first_sibling"></div>
+ <div></div>
+ <p id="nav_test_p" class="test"></p>
+ <span id="nav_test_prev_sibling"></span>
+
+ <ul id="navigation_test" style="display: none">
+ <!-- comment node to screw things up -->
+ <li class="first"><em>A</em></li>
+ <li><em class="dim">B</em></li>
+ <li id="navigation_test_c">
+ <em>C</em>
+ <ul>
+ <li><em class="dim">E</em></li>
+ <li id="navigation_test_f"><em>F</em></li>
+ </ul>
+ </li>
+ <li class="last"><em>D</em></li>
+ </ul>
+
+ <div id="navigation_test_next_sibling">
+ <!-- -->
+ </div>
+
+ <p></p>
+</div>
+
+<div id="class_names">
+ <p class="A"></p>
+ <ul class="A B" id="class_names_ul">
+ <li class="C"></li>
+ <li class="A C"></li>
+ <li class="1"></li>
+ </ul>
+ <div class="B C D"></div>
+ <div id="unextended"></div>
+</div>
+
+<div id="style_test_1" style="display:none;"></div>
+<div id="style_test_2" class="style-test" style="font-size:11px;"></div>
+
+<div id="style_test_3">blah</div>
+<span id="style_test_4">blah</span>
+<span id="style_test_5">blah</span>
+
+<div id="style_test_dimensions_container">
+ <div id="style_test_dimensions" style="background:#ddd;padding:1px;margin:1px;border:1px solid #00f"><div style="height:5px;background:#eee;width:5px;padding:2px;margin:2px;border:2px solid #0f0"> </div>
+ </div>
+</div>
+
+<div id="test_csstext_1">test_csstext_1</div>
+<div id="test_csstext_2">test_csstext_2</div>
+<div id="test_csstext_3" style="border: 1px solid red">test_csstext_3</div>
+<div id="test_csstext_4" style="font-size: 20px">test_csstext_4</div>
+<div id="test_csstext_5">test_csstext_5</div>
+
+<div id="custom_attributes">
+ <div foo="1" bar="2"></div>
+ <div foo="2"></div>
+</div>
+
+<div id="cloned_element_attributes_issue" foo="original"></div>
+<a id="attributes_with_issues_1" href="test.html" accesskey="L" tabindex="50" title="a link" onclick="alert('hello world');"></a>
+<a id="attributes_with_issues_2" href="" accesskey="" tabindex="" title=""></a>
+<a id="attributes_with_issues_3"></a>
+<form id="attributes_with_issues_form" method="post" action="blah" class="blah-class">
+ <input type="hidden" id="id" />
+ <input type="hidden" name="id" />
+ <input type="checkbox" id="action" />
+ <input type="checkbox" name="action" />
+ <input type="text" id="method" />
+ <input type="hidden" name="class" />
+ <input type="checkbox" id="attributes_with_issues_checked" name="a" checked="checked"/>
+ <input type="checkbox" id="attributes_with_issues_disabled" name="b" checked="checked" disabled="disabled"/>
+ <input type="text" id="attributes_with_issues_readonly" name="c" readonly="readonly" value="blech"/>
+ <input type="text" id="attributes_with_issues_regular" name="d" value="0"/>
+ <input type="date" id="attributes_with_issues_type" value="blech" />
+ <select id="attributes_with_issues_multiple" name="e" multiple="multiple">
+ <option>blech</option>
+ <option>blah</option>
+ </select>
+</form>
+
+<!-- writeAttributes -->
+<p id="write_attribute_para"></p>
+<a id="write_attribute_link" href="test.html"></a>
+<form action="/dev/null" id="write_attribute_form" method="get" accept-charset="utf-8">
+ <label id="write_attribute_label"></label>
+ <input type="checkbox" name="write_attribute_checkbox" value="" id="write_attribute_checkbox">
+ <input type="checkbox" checked="checked" name="write_attribute_checked_checkbox" value="" id="write_attribute_checked_checkbox">
+ <input type="text" name="write_attribute_input" value="" id="write_attribute_input">
+ <select id="write_attribute_select">
+ <option>Cat</option>
+ <option>Dog</option>
+ </select>
+</form>
+
+<table id="write_attribute_table" cellpadding="6" cellspacing="4">
+ <tr><td id="write_attribute_td">A</td><td>B</td></tr>
+ <tr><td>C</td></tr>
+ <tr><td>D</td><td>E</td><td>F</td></tr>
+</table>
+
+<div id="dom_attribute_precedence">
+ <form action="blech" method="post">
+ <input type="submit" id="update" />
+ </form>
+</div>
+
+<div id="not_floating_none">NFN</div>
+<div id="not_floating_inline" style="float:none">NFI</div>
+<div id="not_floating_style">NFS</div>
+
+<div id="floating_inline" style="float:left">FI</div>
+<div id="floating_style">FS</div>
+<!-- Test Element opacity functions -->
+<img id="op1" alt="op2" src="fixtures/logo.gif" style="opacity:0.5;filter:alpha(opacity=50)" />
+<img id="op2" alt="op2" src="fixtures/logo.gif"/>
+<img id="op3" alt="op3" src="fixtures/logo.gif"/>
+<img id="op4-ie" alt="op3" src="fixtures/logo.gif" style="filter:alpha(opacity=30)" />
+<div id="dimensions-visible"></div>
+<div id="dimensions-display-none"></div>
+<div id="dimensions-visible-pos-rel"></div>
+<div id="dimensions-display-none-pos-rel"></div>
+<div id="dimensions-visible-pos-abs"></div>
+<div id="dimensions-display-none-pos-abs"></div>
+<table border="0" cellspacing="0" cellpadding="0" id="dimensions-table">
+ <tbody id="dimensions-tbody">
+ <tr id="dimensions-tr">
+ <td id="dimensions-td">Data</td>
+ </tr>
+ </tbody>
+</table>
+
+<div id="dimensions-nester" style="width: 500px;">
+ <div id="dimensions-nestee" style="display: none">This is a nested DIV. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
+</div>
+
+
+<p id="test-empty"></p>
+<p id="test-empty-but-contains-whitespace">
+
+
+</p>
+<p id="test-full">content</p>
+<div id="ancestor">
+ <div id="child">
+ <div id="grand-child">
+ <div id="great-grand-child"></div>
+ </div></div><!-- intentional formatting; don't change this line -->
+ <div id="sibling"><div id="grand-sibling"></div></div>
+</div>
+<div id="not-in-the-family"></div>
+
+<div id="insertions-container"><div id="insertions-main"><p>some content.</p></div></div>
+<div id="insertions-node-container"><div id="insertions-node-main"><p>some content.</p></div></div>
+<div id="element-insertions-container"><div id="element-insertions-main"><p>some content.</p></div></div>
+<div id="element-insertions-multiple-container"><div id="element-insertions-multiple-main"><p>some content.</p></div></div>
+<table id="table_for_insertions"></table>
+<table id="table_for_row_insertions"><tr id="row_1"></tr></table>
+<form method="post" action="blah">
+ <select id="select_for_update" name="select_for_update">
+ <option>option 1</option>
+ <option>option 2</option>
+ </select>
+ <select id="select_for_insert_bottom" name="select_for_insert_bottom">
+ <option>option 1</option>
+ <option>option 2</option>
+ </select>
+ <select id="select_for_insert_top" name="select_for_insert_top">
+ <option>option 1</option>
+ <option>option 2</option>
+ </select>
+</form>
+<div id="wrap-container"><p id="wrap"></p></div>
+
+<!-- Positioning methods bench -->
+<div id="body_absolute" style="position: absolute; top: 10px; left: 10px">
+ <div id="absolute_absolute" style="position: absolute; top: 10px; left:10px"> </div>
+ <div id="absolute_relative" style="position: relative; top: 10px; left:10px">
+ <div style="height:10px;font-size:2px">test<span id="inline">test</span></div>
+ <div id="absolute_relative_undefined">XYZ</div>
+ </div>
+ <div id="absolute_fixed" style="position: fixed; top: 10px; left: 10px">
+ <span id="absolute_fixed_absolute" style="position: absolute; top: 10px; left: 10px">foo</span>
+ <span id="absolute_fixed_undefined" style="display:block">bar</span>
+ </div></div>
+<div id="notInlineAbsoluted"></div>
+<div id="inlineAbsoluted" style="position: absolute"></div>
+
+<div id="unextended"></div>
+<div id="identification">
+ <div id="predefined_id"></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div id="anonymous_element_3"></div>
+</div>
+
+<div id='elementToViewportDimensions' style='display: none'></div>
+<div id="auto_dimensions" style="height:auto"></div> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.js
new file mode 100644
index 0000000000..18f62f354c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.js
@@ -0,0 +1,17 @@
+var testVar = 'to be updated', testVar2 = '', documentViewportProperties;
+
+Element.addMethods({
+ hashBrowns: function(element) { return 'hash browns'; }
+});
+
+Element.addMethods("LI", {
+ pancakes: function(element) { return "pancakes"; }
+});
+
+Element.addMethods("DIV", {
+ waffles: function(element) { return "waffles"; }
+});
+
+Element.addMethods($w("li div"), {
+ orangeJuice: function(element) { return "orange juice"; }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.html
new file mode 100644
index 0000000000..583d0e5f30
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.html
@@ -0,0 +1,4 @@
+<form id="form">
+ <input type="text" id="input" value="4" />
+ <input type="submit" />
+</form> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.js
new file mode 100644
index 0000000000..22b1c3fd14
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.js
@@ -0,0 +1,2 @@
+Form.Element.Methods.coffee = Prototype.K;
+Element.addMethods(); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.html
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.html
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.js
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.js
@@ -0,0 +1 @@
+
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.html
new file mode 100644
index 0000000000..5e7e8f3b3c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.html
@@ -0,0 +1,8 @@
+<table id="grepTable">
+<tbody id="grepTBody">
+ <tr id="grepRow">
+ <th id="grepHeader" class="cell"></th>
+ <td id="grepCell" class="cell"></td>
+ </tr>
+</tbody>
+</table>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.js
new file mode 100644
index 0000000000..5fae7662dd
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.js
@@ -0,0 +1,23 @@
+var Fixtures = {
+ People: [
+ {name: 'Sam Stephenson', nickname: 'sam-'},
+ {name: 'Marcel Molina Jr.', nickname: 'noradio'},
+ {name: 'Scott Barron', nickname: 'htonl'},
+ {name: 'Nicholas Seckar', nickname: 'Ulysses'}
+ ],
+
+ Nicknames: $w('sam- noradio htonl Ulysses'),
+
+ Basic: [1, 2, 3],
+
+ Primes: [
+ 1, 2, 3, 5, 7, 11, 13, 17, 19, 23,
+ 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
+ 71, 73, 79, 83, 89, 97
+ ],
+
+ Z: []
+};
+
+for (var i = 1; i <= 100; i++)
+ Fixtures.Z.push(i);
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/event.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/event.html
new file mode 100644
index 0000000000..baa88a7d10
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/event.html
@@ -0,0 +1,4 @@
+<div id="outer" style="display: none">
+ <p id="inner">One two three <span id="span">four</span></p>
+</div>
+<div id="container"><div></div></div>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/form.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/form.html
new file mode 100644
index 0000000000..dc7f171bf2
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/form.html
@@ -0,0 +1,112 @@
+<form id="form" method="get" action="fixtures/empty.js">
+ <input type="text" name="val1" id="input_enabled" value="4" />
+ <div>This is not a form element</div>
+ <input type="text" name="val2" id="input_disabled" disabled="disabled" value="5" />
+ <input type="submit" name="first_submit" value="Commit it!" />
+ <input type="submit" name="second_submit" value="Delete it!" />
+ <input type="text" name="action" value="blah" />
+</form>
+
+<form id="bigform" method="get" action="fixtures/empty.js">
+ <div id="inputs">
+ <input type="text" name="dummy" id="dummy_disabled" disabled="disabled"/>
+ <input type="submit" name="commit" id="submit" />
+ <input type="button" name="clicky" value="click me" />
+ <input type="reset" name="revert" />
+ <input type="text" name="greeting" id="focus_text" value="Hello" />
+ </div>
+
+ <div id="buttons">
+ <button type="button" id="button_type_button" name="button">Click Me</button>
+ </div>div>
+
+ <!-- some edge cases in serialization -->
+ <div id="value_checks">
+ <input name="twin" type="text" value="" />
+ <input name="twin" type="text" value="siamese" />
+ <!-- Rails checkbox hack with hidden input: -->
+ <input name="checky" type="checkbox" id="checkbox_hack" value="1" />
+ <input name="checky" type="hidden" value="0" />
+ </div>
+
+ <!-- all variations of SELECT controls -->
+ <div id="selects_wrapper">
+ <select name="vu">
+ <option value="1" selected="selected">One</option>
+ <option value="2">Two</option>
+ <option value="3">Three</option>
+ </select>
+ <select id="multiSel1" name="vm[]" multiple="multiple">
+ <option id="multiSel1_opt1" value="1" selected="selected">One</option>
+ <option id="multiSel1_opt2" value="2">Two</option>
+ <option id="multiSel1_opt3" value="3" selected="selected">Three</option>
+ </select>
+ <select name="nvu">
+ <option selected="selected">One</option>
+ <option value="2">Two</option>
+ <option value="3">Three</option>
+ </select>
+
+ <fieldset id="selects_fieldset">
+ <select name="nvm[]" multiple="multiple">
+ <option selected="selected">One</option>
+ <option>Two</option>
+ <option selected="selected">Three</option>
+ </select>
+ <select name="evu">
+ <option value="" selected="selected">One</option>
+ <option value="2">Two</option>
+ <option value="3">Three</option>
+ </select>
+ <select name="evm[]" multiple="multiple">
+ <option value="" selected="selected">One</option>
+ <option>Two</option>
+ <option selected="selected">Three</option>
+ </select>
+ </fieldset>
+ </div>
+
+ <div id="various">
+ <select name="tf_selectOne"><option selected="selected"></option><option>1</option></select>
+ <textarea name="tf_textarea"></textarea>
+ <input type="checkbox" name="tf_checkbox" value="on" />
+ <select name="tf_selectMany" multiple="multiple"></select>
+ <input type="text" name="tf_text" />
+ <div>This is not a form element</div>
+ <input type="radio" name="tf_radio" value="on" />
+ <input type="hidden" name="tf_hidden" />
+ <input type="password" name="tf_password" />
+ </div>
+</form>
+
+<form id="form_focus_hidden" style="display: none">
+ <input type="text" />
+</form>
+
+<form id="form_with_file_input">
+ <input type="file" name="file_name" value="foo" />
+</form>
+
+<!-- tabindexed forms -->
+<div id="tabindex">
+ <form id="ffe">
+ <p><input type="text" disabled="disabled" id="ffe_disabled" /></p>
+ <input type="hidden" id="ffe_hidden" />
+ <input type="checkbox" id="ffe_checkbox" />
+ </form>
+
+ <form id="ffe_ti">
+ <p><input type="text" disabled="disabled" id="ffe_ti_disabled" /></p>
+ <input type="hidden" id="ffe_ti_hidden" />
+ <input type="checkbox" id="ffe_ti_checkbox" />
+ <input type="submit" id="ffe_ti_submit" tabindex="1" />
+ </form>
+
+ <form id="ffe_ti2">
+ <p><input type="text" disabled="disabled" id="ffe_ti2_disabled" /></p>
+ <input type="hidden" id="ffe_ti2_hidden" />
+ <input type="checkbox" id="ffe_ti2_checkbox" tabindex="0" />
+ <input type="submit" id="ffe_ti2_submit" tabindex="1" />
+ </form>
+
+</div>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hash.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hash.js
new file mode 100644
index 0000000000..be5ccfa7d9
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hash.js
@@ -0,0 +1,25 @@
+var Fixtures = {
+ one: { a: 'A#' },
+
+ many: {
+ a: 'A',
+ b: 'B',
+ c: 'C',
+ d: 'D#'
+ },
+
+ functions: {
+ quad: function(n) { return n*n },
+ plus: function(n) { return n+n }
+ },
+
+ multiple: { color: $w('r g b') },
+ multiple_nil: { color: ['r', null, 'g', undefined, 0] },
+ multiple_all_nil: { color: [null, undefined] },
+ multiple_empty: { color: [] },
+ multiple_special: { 'stuff[]': $w('$ a ;') },
+
+ value_undefined: { a:"b", c:undefined },
+ value_null: { a:"b", c:null },
+ value_zero: { a:"b", c:0 }
+};
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hello.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hello.js
new file mode 100644
index 0000000000..63d81117bf
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hello.js
@@ -0,0 +1 @@
+$("content").update("<H2>Hello world!</H2>");
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/logo.gif b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/logo.gif
new file mode 100644
index 0000000000..71574abd76
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/logo.gif
Binary files differ
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/position.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/position.html
new file mode 100644
index 0000000000..5fd7bdf4b6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/position.html
@@ -0,0 +1,9 @@
+<div id="ensure_scrollbars" style="width:10000px; height:10000px; position:absolute" > </div>
+
+<div id="body_absolute" style="position: absolute; top: 10px; left: 10px">
+ <div id="absolute_absolute" style="position: absolute; top: 10px; left:10px"> </div>
+ <div id="absolute_relative" style="position: relative; top: 10px; left:10px">
+ <div style="height:10px;font-size:2px">test<span id="inline">test</span></div>
+ <div id="absolute_relative_undefined"> </div>
+ </div>
+</div>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/selector.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/selector.html
new file mode 100644
index 0000000000..d745c8fd55
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/selector.html
@@ -0,0 +1,69 @@
+<div id="fixtures" style="display: none">
+ <h1 class="title">Some title <span>here</span></h1>
+ <p id="p" class="first summary">
+ <strong id="strong">This</strong> is a short blurb
+ <a id="link_1" class="first internal" rel="external nofollow" href="#">with a <em id="em2">link</em></a> or
+ <a id="link_2" class="internal highlight" href="#"><em id="em">two</em></a>.
+ Or <cite id="with_title" title="hello world!">a citation</cite>.
+ </p>
+ <ul id="list">
+ <li id="item_1" class="first"><a id="link_3" href="#" class="external"><span id="span">Another link</span></a></li>
+ <li id="item_2">Some text</li>
+ <li id="item_3" xml:lang="es-us" class="">Otra cosa</li>
+ </ul>
+
+ <!-- this form has a field with the name 'id',
+ therefore its ID property won't be 'troubleForm': -->
+ <form id="troubleForm">
+ <input type="hidden" name="id" id="hidden" />
+ <input type="text" name="disabled_text_field" id="disabled_text_field" disabled="disabled" />
+ <input type="text" name="enabled_text_field" id="enabled_text_field" />
+ <input type="checkbox" name="checkboxes" id="checked_box" checked="checked" value="Checked" />
+ <input type="checkbox" name="checkboxes" id="unchecked_box" value="Unchecked"/>
+ <input type="radio" name="radiobuttons" id="checked_radio" checked="checked" value="Checked" />
+ <input type="radio" name="radiobuttons" id="unchecked_radio" value="Unchecked" />
+ </form>
+
+ <form id="troubleForm2">
+ <input type="checkbox" name="brackets[5][]" id="chk_1" checked="checked" value="1" />
+ <input type="checkbox" name="brackets[5][]" id="chk_2" value="2" />
+ </form>
+
+ <div id="level1">
+ <span id="level2_1">
+ <span id="level3_1"></span>
+ <!-- This comment should be ignored by the adjacent selector -->
+ <span id="level3_2"></span>
+ </span>
+ <span id="level2_2">
+ <em id="level_only_child">
+ </em>
+ </span>
+ <div id="level2_3"></div>
+ </div> <!-- #level1 -->
+
+ <div id="dupContainer">
+ <span id="dupL1" class="span_foo span_bar">
+ <span id="dupL2">
+ <span id="dupL3">
+ <span id="dupL4">
+ <span id="dupL5"></span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </div> <!-- #dupContainer -->
+
+ <div id="grandfather"> grandfather
+ <div id="father" class="brothers men"> father
+ <div id="son"> son </div>
+ </div>
+ <div id="uncle" class="brothers men"> uncle </div>
+ </div>
+
+ <form id="commaParent" title="commas,are,good">
+ <input type="hidden" id="commaChild" name="foo" value="#commaOne,#commaTwo" />
+ <input type="hidden" id="commaTwo" name="foo2" value="oops" />
+ </form>
+ <div id="counted_container"><div class="is_counted"></div></div>
+</div>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/string.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/string.js
new file mode 100644
index 0000000000..e4483a5b61
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/string.js
@@ -0,0 +1,8 @@
+var attackTarget;
+var evalScriptsCounter = 0,
+ largeTextEscaped = '&lt;span&gt;test&lt;/span&gt;',
+ largeTextUnescaped = '<span>test</span>';
+(2048).times(function(){
+ largeTextEscaped += ' ABC';
+ largeTextUnescaped += ' ABC';
+});
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/unittest.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/unittest.html
new file mode 100644
index 0000000000..15d303aa3d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/unittest.html
@@ -0,0 +1,18 @@
+<div id="testlog_2"> </div>
+
+<!-- Test elements follow -->
+<div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div>
+
+<div id="test_2"> <span> </span>
+
+
+
+<div><div></div> </div><span> </span>
+</div>
+
+<ul id="tlist"><li id="tlist_1">x1</li><li id="tlist_2">x2</li></ul>
+<ul id="tlist2"><li class="a" id="tlist2_1">x1</li><li id="tlist2_2">x2</li></ul>
+
+<div id="testmoveby" style="background-color:#333;width:100px;">XXXX</div>
+
+<div id="testcss1">testcss1<span id="testcss1_span" style="display:none;">blah</span></div><div id="testcss2">testcss1</div>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/form_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/form_test.js
new file mode 100644
index 0000000000..4cda87d81b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/form_test.js
@@ -0,0 +1,384 @@
+// sweet sweet additional assertions
+Object.extend(Test.Unit.Testcase.prototype, {
+ assertEnabled: function() {
+ for (var i = 0, element; element = arguments[i]; i++) {
+ this.assert(!$(element).disabled, Test.Unit.inspect(element) + ' was disabled');
+ }
+ },
+ assertDisabled: function() {
+ for (var i = 0, element; element = arguments[i]; i++) {
+ this.assert($(element).disabled, Test.Unit.inspect(element) + ' was enabled');
+ }
+ }
+});
+
+new Test.Unit.Runner({
+
+ // Make sure to set defaults in the test forms, as some browsers override this
+ // with previously entered values on page reload
+ setup: function(){
+ $$('form').each(function(f){ f.reset() });
+ // hidden value does not reset (for some reason)
+ $('bigform')['tf_hidden'].value = '';
+ },
+
+ testDollarF: function(){
+ this.assertEqual("4", $F("input_enabled"));
+ },
+
+ testFormElementEventObserver: function(){
+ var callbackCounter = 0;
+ var observer = new Form.Element.EventObserver('input_enabled', function(){
+ callbackCounter++;
+ });
+
+ this.assertEqual(0, callbackCounter);
+ $('input_enabled').value = 'boo!';
+ observer.onElementEvent(); // can't test the event directly, simulating
+ this.assertEqual(1, callbackCounter);
+ },
+
+ testFormElementObserver: function(){
+ var timedCounter = 0;
+ // First part: regular field
+ var observer = new Form.Element.Observer('input_enabled', 0.5, function() {
+ ++timedCounter;
+ });
+
+ // Test it's unchanged yet
+ this.assertEqual(0, timedCounter);
+ // Test it doesn't change on first check
+ this.wait(550, function() {
+ this.assertEqual(0, timedCounter);
+ // Change, test it doesn't immediately change
+ $('input_enabled').value = 'yowza!';
+ this.assertEqual(0, timedCounter);
+ // Test it changes on next check, but not again on the next
+ this.wait(550, function() {
+ this.assertEqual(1, timedCounter);
+ this.wait(550, function() {
+ this.assertEqual(1, timedCounter);
+ observer.stop();
+ });
+ });
+ });
+
+ // Second part: multiple-select
+ [1, 2, 3].each(function(index) {
+ $('multiSel1_opt' + index).selected = (1 == index);
+ });
+ timedCounter = 0;
+ observer = new Form.Element.Observer('multiSel1', 0.5, function() {
+ ++timedCounter;
+ });
+
+ // Test it's unchanged yet
+ this.assertEqual(0, timedCounter);
+ // Test it doesn't change on first check
+ this.wait(550, function() {
+ this.assertEqual(0, timedCounter);
+ // Change, test it doesn't immediately change
+ // NOTE: it is important that the 3rd be re-selected, for the
+ // serialize form to obtain the expected value :-)
+ $('multiSel1_opt3').selected = true;
+ this.assertEqual(0, timedCounter);
+ // Test it changes on next check, but not again on the next
+ this.wait(550, function() {
+ this.assertEqual(1, timedCounter);
+ this.wait(550, function() {
+ this.assertEqual(1, timedCounter);
+ observer.stop();
+ });
+ });
+ });
+ },
+
+ testFormObserver: function(){
+ var timedCounter = 0;
+ // should work the same way was Form.Element.Observer
+ var observer = new Form.Observer('form', 0.5, function(form, value) {
+ ++timedCounter;
+ });
+
+ // Test it's unchanged yet
+ this.assertEqual(0, timedCounter);
+ // Test it doesn't change on first check
+ this.wait(550, function() {
+ this.assertEqual(0, timedCounter);
+ // Change, test it doesn't immediately change
+ $('input_enabled').value = 'yowza!';
+ this.assertEqual(0, timedCounter);
+ // Test it changes on next check, but not again on the next
+ this.wait(550, function() {
+ this.assertEqual(1, timedCounter);
+ this.wait(550, function() {
+ this.assertEqual(1, timedCounter);
+ observer.stop();
+ });
+ });
+ });
+ },
+
+ testFormEnabling: function(){
+ var form = $('bigform')
+ var input1 = $('dummy_disabled');
+ var input2 = $('focus_text');
+
+ this.assertDisabled(input1);
+ this.assertEnabled(input2);
+
+ form.disable();
+ this.assertDisabled(input1, input2);
+ form.enable();
+ this.assertEnabled(input1, input2);
+ input1.disable();
+ this.assertDisabled(input1);
+
+ // non-form elements:
+ var fieldset = $('selects_fieldset');
+ var fields = fieldset.immediateDescendants();
+ fields.each(function(select) { this.assertEnabled(select) }, this);
+
+ Form.disable(fieldset)
+ fields.each(function(select) { this.assertDisabled(select) }, this);
+
+ Form.enable(fieldset)
+ fields.each(function(select) { this.assertEnabled(select) }, this);
+ },
+
+ testFormElementEnabling: function(){
+ var field = $('input_disabled');
+ field.enable();
+ this.assertEnabled(field);
+ field.disable();
+ this.assertDisabled(field);
+
+ var field = $('input_enabled');
+ this.assertEnabled(field);
+ field.disable();
+ this.assertDisabled(field);
+ field.enable();
+ this.assertEnabled(field);
+ },
+
+ // due to the lack of a DOM hasFocus() API method,
+ // we're simulating things here a little bit
+ testFormActivating: function(){
+ // Firefox, IE, and Safari 2+
+ function getSelection(element){
+ try {
+ if (typeof element.selectionStart == 'number') {
+ return element.value.substring(element.selectionStart, element.selectionEnd);
+ } else if (document.selection && document.selection.createRange) {
+ return document.selection.createRange().text;
+ }
+ }
+ catch(e){ return null }
+ }
+
+ // Form.focusFirstElement shouldn't focus disabled elements
+ var element = Form.findFirstElement('bigform');
+ this.assertEqual('submit', element.id);
+
+ // Test IE doesn't select text on buttons
+ Form.focusFirstElement('bigform');
+ if (document.selection) this.assertEqual('', getSelection(element));
+
+ // Form.Element.activate shouldn't select text on buttons
+ element = $('focus_text');
+ this.assertEqual('', getSelection(element));
+
+ // Form.Element.activate should select text on text input elements
+ element.activate();
+ this.assertEqual('Hello', getSelection(element));
+
+ // Form.Element.activate shouldn't raise an exception when the form or field is hidden
+ this.assertNothingRaised(function() {
+ $('form_focus_hidden').focusFirstElement();
+ });
+ },
+
+ testFormGetElements: function() {
+ var elements = Form.getElements('various'),
+ names = $w('tf_selectOne tf_textarea tf_checkbox tf_selectMany tf_text tf_radio tf_hidden tf_password');
+ this.assertEnumEqual(names, elements.pluck('name'))
+ },
+
+ testFormGetInputs: function() {
+ var form = $('form');
+ [form.getInputs(), Form.getInputs(form)].each(function(inputs){
+ this.assertEqual(inputs.length, 5);
+ this.assert(inputs instanceof Array);
+ this.assert(inputs.all(function(input) { return (input.tagName == "INPUT"); }));
+ }, this);
+ },
+
+ testFormFindFirstElement: function() {
+ this.assertEqual($('ffe_checkbox'), $('ffe').findFirstElement());
+ this.assertEqual($('ffe_ti_submit'), $('ffe_ti').findFirstElement());
+ this.assertEqual($('ffe_ti2_checkbox'), $('ffe_ti2').findFirstElement());
+ },
+
+ testFormSerialize: function() {
+ // form is initially empty
+ var form = $('bigform');
+ var expected = { tf_selectOne:'', tf_textarea:'', tf_text:'', tf_hidden:'', tf_password:'' };
+ this.assertHashEqual(expected, Form.serialize('various', true));
+
+ // set up some stuff
+ form['tf_selectOne'].selectedIndex = 1;
+ form['tf_textarea'].value = "boo hoo!";
+ form['tf_text'].value = "123öäü";
+ form['tf_hidden'].value = "moo%hoo&test";
+ form['tf_password'].value = 'sekrit code';
+ form['tf_checkbox'].checked = true;
+ form['tf_radio'].checked = true;
+ var expected = { tf_selectOne:1, tf_textarea:"boo hoo!", tf_text:"123öäü",
+ tf_hidden:"moo%hoo&test", tf_password:'sekrit code', tf_checkbox:'on', tf_radio:'on' }
+
+ // return params
+ this.assertHashEqual(expected, Form.serialize('various', true));
+ // return string
+ this.assertEnumEqual(Object.toQueryString(expected).split('&').sort(),
+ Form.serialize('various').split('&').sort());
+ this.assertEqual('string', typeof $('form').serialize({ hash:false }));
+
+ // Checks that disabled element is not included in serialized form.
+ $('input_enabled').enable();
+ this.assertHashEqual({ val1:4, action:'blah', first_submit:'Commit it!' },
+ $('form').serialize(true));
+
+ // should not eat empty values for duplicate names
+ $('checkbox_hack').checked = false;
+ var data = Form.serialize('value_checks', true);
+ this.assertEnumEqual(['', 'siamese'], data['twin']);
+ this.assertEqual('0', data['checky']);
+
+ $('checkbox_hack').checked = true;
+ this.assertEnumEqual($w('1 0'), Form.serialize('value_checks', true)['checky']);
+
+ // all kinds of SELECT controls
+ var params = Form.serialize('selects_fieldset', true);
+ var expected = { 'nvm[]':['One', 'Three'], evu:'', 'evm[]':['', 'Three'] };
+ this.assertHashEqual(expected, params);
+ params = Form.serialize('selects_wrapper', true);
+ this.assertHashEqual(Object.extend(expected, { vu:1, 'vm[]':[1, 3], nvu:'One' }), params);
+
+ // explicit submit button
+ this.assertHashEqual({ val1:4, action:'blah', second_submit:'Delete it!' },
+ $('form').serialize({ submit: 'second_submit' }));
+ this.assertHashEqual({ val1:4, action:'blah' },
+ $('form').serialize({ submit: false }));
+ this.assertHashEqual({ val1:4, action:'blah' },
+ $('form').serialize({ submit: 'inexistent' }));
+
+ // file input should not be serialized
+ this.assertEqual('', $('form_with_file_input').serialize());
+ },
+
+ testFormMethodsOnExtendedElements: function() {
+ var form = $('form');
+ this.assertEqual(Form.serialize('form'), form.serialize());
+ this.assertEqual(Form.Element.serialize('input_enabled'), $('input_enabled').serialize());
+ this.assertNotEqual(form.serialize, $('input_enabled').serialize);
+
+ Element.addMethods('INPUT', { anInputMethod: function(input) { return 'input' } });
+ Element.addMethods('SELECT', { aSelectMethod: function(select) { return 'select' } });
+
+ form = $('bigform');
+ var input = form['tf_text'], select = form['tf_selectOne'];
+ input._extendedByPrototype = select._extendedByPrototype = false;
+
+ this.assert($(input).anInputMethod);
+ this.assert(!input.aSelectMethod);
+ this.assertEqual('input', input.anInputMethod());
+
+ this.assert($(select).aSelectMethod);
+ this.assert(!select.anInputMethod);
+ this.assertEqual('select', select.aSelectMethod());
+ },
+
+ testFormRequest: function() {
+ request = $("form").request();
+ this.assert($("form").hasAttribute("method"));
+ this.assert(request.url.include("fixtures/empty.js?val1=4"));
+ this.assertEqual("get", request.method);
+
+ request = $("form").request({ method: "put", parameters: {val2: "hello"} });
+ var url = request.url;
+
+ this.assert(url.startsWith("fixtures/empty.js"));
+ this.assert(url.endsWith("_method=put") || url.endsWith("_method=put&_="));
+ this.assertEqual(4, request.options.parameters['val1']);
+ this.assertEqual('hello', request.options.parameters['val2']);
+ this.assertEqual("post", request.method);
+ this.assertEqual("put", request.parameters['_method']);
+
+ // with empty action attribute
+ request = $("ffe").request({ method: 'post' });
+ this.assert(request.url.include("unit/tmp/form_test.html"),
+ 'wrong default action for form element with empty action attribute');
+ },
+
+ testFormElementMethodsChaining: function(){
+ var methods = $w('clear activate disable enable'),
+ formElements = $('form').getElements();
+ methods.each(function(method){
+ formElements.each(function(element){
+ var returned = element[method]();
+ this.assertIdentical(element, returned);
+ }, this);
+ }, this);
+ },
+
+ testGetValue: function() {
+ this.assertEqual('Click Me', Form.Element.getValue('button_type_button')); // Button element
+ this.assertEqual(null, Form.Element.getValue('someBorkedId')); // Unknown
+ this.assertEqual(null, Form.Element.getValue('form')); // Unsupported
+ this.assertEqual(null, Form.Element.getValue('form')); // Unsupported
+ },
+
+ testSetValue: function(){
+ // unkown element
+ this.assertEqual(null, Form.Element.setValue('someBorkedId', 'blah')); // Unknown
+
+ // test button element
+ var button = $('button_type_button');
+ button.setValue('I Changed');
+ this.assertEqual('I Changed', button.getValue());
+
+ // text input
+ var input = $('input_enabled'), oldValue = input.getValue();
+ this.assertEqual(input, input.setValue('foo'), 'setValue chaining is broken');
+ this.assertEqual('foo', input.getValue(), 'value improperly set');
+ input.setValue(oldValue);
+ this.assertEqual(oldValue, input.getValue(), 'value improperly restored to original');
+
+ // checkbox
+ input = $('checkbox_hack');
+ input.setValue(false);
+ this.assertEqual(null, input.getValue(), 'checkbox should be unchecked');
+ input.setValue(true);
+ this.assertEqual("1", input.getValue(), 'checkbox should be checked');
+
+ // selectbox
+ input = $('bigform')['vu'];
+ input.setValue('3');
+ this.assertEqual('3', input.getValue(), 'single select option improperly set');
+ input.setValue('1');
+ this.assertEqual('1', input.getValue());
+
+ // multiple select
+ input = $('bigform')['vm[]'];
+ input.setValue(['2', '3']);
+ this.assertEnumEqual(['2', '3'], input.getValue(),
+ 'multiple select options improperly set');
+ input.setValue(['1', '3']);
+ this.assertEnumEqual(['1', '3'], input.getValue());
+
+ // test chainability
+ var input = $('input_enabled');
+ this.assert(Object.isElement(button.setValue('New Value')));
+ this.assert(Object.isElement(input.setValue('New Value')));
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/hash_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/hash_test.js
new file mode 100644
index 0000000000..cc3d083135
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/hash_test.js
@@ -0,0 +1,178 @@
+new Test.Unit.Runner({
+ testSet: function() {
+ var h = $H({a: 'A'})
+
+ this.assertEqual('B', h.set('b', 'B'));
+ this.assertHashEqual({a: 'A', b: 'B'}, h);
+
+ this.assertUndefined(h.set('c'));
+ this.assertHashEqual({a: 'A', b: 'B', c: undefined}, h);
+ },
+
+ testGet: function() {
+ var h = $H({a: 'A'});
+ this.assertEqual('A', h.get('a'));
+ this.assertUndefined(h.a);
+ this.assertUndefined($H({}).get('a'));
+
+ this.assertUndefined($H({}).get('toString'));
+ this.assertUndefined($H({}).get('constructor'));
+ },
+
+ testUnset: function() {
+ var hash = $H(Fixtures.many);
+ this.assertEqual('B', hash.unset('b'));
+ this.assertHashEqual({a:'A', c: 'C', d:'D#'}, hash);
+ this.assertUndefined(hash.unset('z'));
+ this.assertHashEqual({a:'A', c: 'C', d:'D#'}, hash);
+ // not equivalent to Hash#remove
+ this.assertEqual('A', hash.unset('a', 'c'));
+ this.assertHashEqual({c: 'C', d:'D#'}, hash);
+ },
+
+ testToObject: function() {
+ var hash = $H(Fixtures.many), object = hash.toObject();
+ this.assertInstanceOf(Object, object);
+ this.assertHashEqual(Fixtures.many, object);
+ this.assertNotIdentical(Fixtures.many, object);
+ hash.set('foo', 'bar');
+ this.assertHashNotEqual(object, hash.toObject());
+ },
+
+ testConstruct: function() {
+ var object = Object.clone(Fixtures.one);
+ var h = new Hash(object), h2 = $H(object);
+ this.assertInstanceOf(Hash, h);
+ this.assertInstanceOf(Hash, h2);
+
+ this.assertHashEqual({}, new Hash());
+ this.assertHashEqual(object, h);
+ this.assertHashEqual(object, h2);
+
+ h.set('foo', 'bar');
+ this.assertHashNotEqual(object, h);
+
+ var clone = $H(h);
+ this.assertInstanceOf(Hash, clone);
+ this.assertHashEqual(h, clone);
+ h.set('foo', 'foo');
+ this.assertHashNotEqual(h, clone);
+ this.assertIdentical($H, Hash.from);
+ },
+
+ testKeys: function() {
+ this.assertEnumEqual([], $H({}).keys());
+ this.assertEnumEqual(['a'], $H(Fixtures.one).keys());
+ this.assertEnumEqual($w('a b c d'), $H(Fixtures.many).keys().sort());
+ this.assertEnumEqual($w('plus quad'), $H(Fixtures.functions).keys().sort());
+ },
+
+ testValues: function() {
+ this.assertEnumEqual([], $H({}).values());
+ this.assertEnumEqual(['A#'], $H(Fixtures.one).values());
+ this.assertEnumEqual($w('A B C D#'), $H(Fixtures.many).values().sort());
+ this.assertEnumEqual($w('function function'),
+ $H(Fixtures.functions).values().map(function(i){ return typeof i }));
+ this.assertEqual(9, $H(Fixtures.functions).get('quad')(3));
+ this.assertEqual(6, $H(Fixtures.functions).get('plus')(3));
+ },
+
+ testIndex: function() {
+ this.assertUndefined($H().index('foo'));
+
+ this.assert('a', $H(Fixtures.one).index('A#'));
+ this.assert('a', $H(Fixtures.many).index('A'));
+ this.assertUndefined($H(Fixtures.many).index('Z'))
+
+ var hash = $H({a:1,b:'2',c:1});
+ this.assert(['a','c'].include(hash.index(1)));
+ this.assertUndefined(hash.index('1'));
+ },
+
+ testMerge: function() {
+ var h = $H(Fixtures.many);
+ this.assertNotIdentical(h, h.merge());
+ this.assertNotIdentical(h, h.merge({}));
+ this.assertInstanceOf(Hash, h.merge());
+ this.assertInstanceOf(Hash, h.merge({}));
+ this.assertHashEqual(h, h.merge());
+ this.assertHashEqual(h, h.merge({}));
+ this.assertHashEqual(h, h.merge($H()));
+ this.assertHashEqual({a:'A', b:'B', c:'C', d:'D#', aaa:'AAA' }, h.merge({aaa: 'AAA'}));
+ this.assertHashEqual({a:'A#', b:'B', c:'C', d:'D#' }, h.merge(Fixtures.one));
+ },
+
+ testUpdate: function() {
+ var h = $H(Fixtures.many);
+ this.assertIdentical(h, h.update());
+ this.assertIdentical(h, h.update({}));
+ this.assertHashEqual(h, h.update());
+ this.assertHashEqual(h, h.update({}));
+ this.assertHashEqual(h, h.update($H()));
+ this.assertHashEqual({a:'A', b:'B', c:'C', d:'D#', aaa:'AAA' }, h.update({aaa: 'AAA'}));
+ this.assertHashEqual({a:'A#', b:'B', c:'C', d:'D#', aaa:'AAA' }, h.update(Fixtures.one));
+ },
+
+ testToQueryString: function() {
+ this.assertEqual('', $H({}).toQueryString());
+ this.assertEqual('a%23=A', $H({'a#': 'A'}).toQueryString());
+ this.assertEqual('a=A%23', $H(Fixtures.one).toQueryString());
+ this.assertEqual('a=A&b=B&c=C&d=D%23', $H(Fixtures.many).toQueryString());
+ this.assertEqual("a=b&c", $H(Fixtures.value_undefined).toQueryString());
+ this.assertEqual("a=b&c", $H("a=b&c".toQueryParams()).toQueryString());
+ this.assertEqual("a=b&c=", $H(Fixtures.value_null).toQueryString());
+ this.assertEqual("a=b&c=0", $H(Fixtures.value_zero).toQueryString());
+ this.assertEqual("color=r&color=g&color=b", $H(Fixtures.multiple).toQueryString());
+ this.assertEqual("color=r&color=&color=g&color&color=0", $H(Fixtures.multiple_nil).toQueryString());
+ this.assertEqual("color=&color", $H(Fixtures.multiple_all_nil).toQueryString());
+ this.assertEqual("", $H(Fixtures.multiple_empty).toQueryString());
+ this.assertEqual("", $H({foo: {}, bar: {}}).toQueryString());
+ this.assertEqual("stuff%5B%5D=%24&stuff%5B%5D=a&stuff%5B%5D=%3B", $H(Fixtures.multiple_special).toQueryString());
+ this.assertHashEqual(Fixtures.multiple_special, $H(Fixtures.multiple_special).toQueryString().toQueryParams());
+ this.assertIdentical(Object.toQueryString, Hash.toQueryString);
+ },
+
+ testInspect: function() {
+ this.assertEqual('#<Hash:{}>', $H({}).inspect());
+ this.assertEqual("#<Hash:{'a': 'A#'}>", $H(Fixtures.one).inspect());
+ this.assertEqual("#<Hash:{'a': 'A', 'b': 'B', 'c': 'C', 'd': 'D#'}>", $H(Fixtures.many).inspect());
+ },
+
+ testClone: function() {
+ var h = $H(Fixtures.many);
+ this.assertHashEqual(h, h.clone());
+ this.assertInstanceOf(Hash, h.clone());
+ this.assertNotIdentical(h, h.clone());
+ },
+
+ testToJSON: function() {
+ this.assertEqual('{\"b\": [false, true], \"c\": {\"a\": \"hello!\"}}',
+ $H({'b': [undefined, false, true, undefined], c: {a: 'hello!'}}).toJSON());
+ },
+
+ testAbilityToContainAnyKey: function() {
+ var h = $H({ _each: 'E', map: 'M', keys: 'K', pluck: 'P', unset: 'U' });
+ this.assertEnumEqual($w('_each keys map pluck unset'), h.keys().sort());
+ this.assertEqual('U', h.unset('unset'));
+ this.assertHashEqual({ _each: 'E', map: 'M', keys: 'K', pluck: 'P' }, h);
+ },
+
+ testHashToTemplateReplacements: function() {
+ var template = new Template("#{a} #{b}"), hash = $H({ a: "hello", b: "world" });
+ this.assertEqual("hello world", template.evaluate(hash.toObject()));
+ this.assertEqual("hello world", template.evaluate(hash));
+ this.assertEqual("hello", "#{a}".interpolate(hash));
+ },
+
+ testPreventIterationOverShadowedProperties: function() {
+ // redundant now that object is systematically cloned.
+ var FooMaker = function(value) {
+ this.key = value;
+ };
+ FooMaker.prototype.key = 'foo';
+ var foo = new FooMaker('bar');
+ this.assertEqual("key=bar", new Hash(foo).toQueryString());
+ this.assertEqual("key=bar", new Hash(new Hash(foo)).toQueryString());
+ }
+
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/number_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/number_test.js
new file mode 100644
index 0000000000..4e09529b2c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/number_test.js
@@ -0,0 +1,44 @@
+new Test.Unit.Runner({
+
+ testNumberMathMethods: function() {
+ this.assertEqual(1, (0.9).round());
+ this.assertEqual(-2, (-1.9).floor());
+ this.assertEqual(-1, (-1.9).ceil());
+
+ $w('abs floor round ceil').each(function(method) {
+ this.assertEqual(Math[method](Math.PI), Math.PI[method]());
+ }, this);
+ },
+
+ testNumberToColorPart: function() {
+ this.assertEqual('00', (0).toColorPart());
+ this.assertEqual('0a', (10).toColorPart());
+ this.assertEqual('ff', (255).toColorPart());
+ },
+
+ testNumberToPaddedString: function() {
+ this.assertEqual('00', (0).toPaddedString(2, 16));
+ this.assertEqual('0a', (10).toPaddedString(2, 16));
+ this.assertEqual('ff', (255).toPaddedString(2, 16));
+ this.assertEqual('000', (0).toPaddedString(3));
+ this.assertEqual('010', (10).toPaddedString(3));
+ this.assertEqual('100', (100).toPaddedString(3));
+ this.assertEqual('1000', (1000).toPaddedString(3));
+ },
+
+ testNumberToJSON: function() {
+ this.assertEqual('null', Number.NaN.toJSON());
+ this.assertEqual('0', (0).toJSON());
+ this.assertEqual('-293', (-293).toJSON());
+ },
+
+ testNumberTimes: function() {
+ var results = [];
+ (5).times(function(i) { results.push(i) });
+ this.assertEnumEqual($R(0, 4), results);
+
+ results = [];
+ (5).times(function(i) { results.push(i * this.i) }, { i: 2 });
+ this.assertEnumEqual([0, 2, 4, 6, 8], results);
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/position_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/position_test.js
new file mode 100644
index 0000000000..5cea791b1f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/position_test.js
@@ -0,0 +1,44 @@
+var testVar = 'to be updated';
+
+new Test.Unit.Runner({
+
+ setup: function() {
+ scrollTo(0,0);
+ Position.prepare();
+ Position.includeScrollOffsets = false;
+ },
+
+ teardown: function() {
+ scrollTo(0,0);
+ Position.prepare();
+ Position.includeScrollOffsets = false;
+ },
+
+ testPrepare: function() {
+ Position.prepare();
+ this.assertEqual(0, Position.deltaX);
+ this.assertEqual(0, Position.deltaY);
+ scrollTo(20,30);
+ Position.prepare();
+ this.assertEqual(20, Position.deltaX);
+ this.assertEqual(30, Position.deltaY);
+ },
+
+ testWithin: function() {
+ [true, false].each(function(withScrollOffsets) {
+ Position.includeScrollOffsets = withScrollOffsets;
+ this.assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
+ this.assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
+ this.assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
+ this.assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
+ }, this);
+
+ scrollTo(20,30);
+ Position.prepare();
+ Position.includeScrollOffsets = true;
+ this.assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
+ this.assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
+ this.assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
+ this.assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/range_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/range_test.js
new file mode 100644
index 0000000000..bcf5acb0b5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/range_test.js
@@ -0,0 +1,58 @@
+new Test.Unit.Runner({
+
+ testInclude: function() {
+ this.assert(!$R(0, 0, true).include(0));
+ this.assert($R(0, 0, false).include(0));
+
+ this.assert($R(0, 5, true).include(0));
+ this.assert($R(0, 5, true).include(4));
+ this.assert(!$R(0, 5, true).include(5));
+
+ this.assert($R(0, 5, false).include(0));
+ this.assert($R(0, 5, false).include(5));
+ this.assert(!$R(0, 5, false).include(6));
+ },
+
+ testEach: function() {
+ var results = [];
+ $R(0, 0, true).each(function(value) {
+ results.push(value);
+ });
+
+ this.assertEnumEqual([], results);
+
+ results = [];
+ $R(0, 3, false).each(function(value) {
+ results.push(value);
+ });
+
+ this.assertEnumEqual([0, 1, 2, 3], results);
+ },
+
+ testAny: function() {
+ this.assert(!$R(1, 1, true).any());
+ this.assert($R(0, 3, false).any(function(value) {
+ return value == 3;
+ }));
+ },
+
+ testAll: function() {
+ this.assert($R(1, 1, true).all());
+ this.assert($R(0, 3, false).all(function(value) {
+ return value <= 3;
+ }));
+ },
+
+ testToArray: function() {
+ this.assertEnumEqual([], $R(0, 0, true).toArray());
+ this.assertEnumEqual([0], $R(0, 0, false).toArray());
+ this.assertEnumEqual([0], $R(0, 1, true).toArray());
+ this.assertEnumEqual([0, 1], $R(0, 1, false).toArray());
+ this.assertEnumEqual([-3, -2, -1, 0, 1, 2], $R(-3, 3, true).toArray());
+ this.assertEnumEqual([-3, -2, -1, 0, 1, 2, 3], $R(-3, 3, false).toArray());
+ },
+
+ testDefaultsToNotExclusive: function() {
+ this.assertEnumEqual($R(-3,3), $R(-3,3,false));
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/selector_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/selector_test.js
new file mode 100644
index 0000000000..72506fc17d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/selector_test.js
@@ -0,0 +1,377 @@
+var $RunBenchmarks = false;
+
+new Test.Unit.Runner({
+
+ testSelectorWithTagName: function() {
+ this.assertEnumEqual($A(document.getElementsByTagName('li')), $$('li'));
+ this.assertEnumEqual([$('strong')], $$('strong'));
+ this.assertEnumEqual([], $$('nonexistent'));
+
+ var allNodes = $A(document.getElementsByTagName('*')).select( function(node) {
+ return node.tagName !== '!';
+ });
+ this.assertEnumEqual(allNodes, $$('*'));
+ },
+
+ testSelectorWithId: function() {
+ this.assertEnumEqual([$('fixtures')], $$('#fixtures'));
+ this.assertEnumEqual([], $$('#nonexistent'));
+ this.assertEnumEqual([$('troubleForm')], $$('#troubleForm'));
+ },
+
+ testSelectorWithClassName: function() {
+ this.assertEnumEqual($('p', 'link_1', 'item_1'), $$('.first'));
+ this.assertEnumEqual([], $$('.second'));
+ },
+
+ testSelectorWithTagNameAndId: function() {
+ this.assertEnumEqual([$('strong')], $$('strong#strong'));
+ this.assertEnumEqual([], $$('p#strong'));
+ },
+
+ testSelectorWithTagNameAndClassName: function() {
+ this.assertEnumEqual($('link_1', 'link_2'), $$('a.internal'));
+ this.assertEnumEqual([$('link_2')], $$('a.internal.highlight'));
+ this.assertEnumEqual([$('link_2')], $$('a.highlight.internal'));
+ this.assertEnumEqual([], $$('a.highlight.internal.nonexistent'));
+ },
+
+ testSelectorWithIdAndClassName: function() {
+ this.assertEnumEqual([$('link_2')], $$('#link_2.internal'));
+ this.assertEnumEqual([$('link_2')], $$('.internal#link_2'));
+ this.assertEnumEqual([$('link_2')], $$('#link_2.internal.highlight'));
+ this.assertEnumEqual([], $$('#link_2.internal.nonexistent'));
+ },
+
+ testSelectorWithTagNameAndIdAndClassName: function() {
+ this.assertEnumEqual([$('link_2')], $$('a#link_2.internal'));
+ this.assertEnumEqual([$('link_2')], $$('a.internal#link_2'));
+ this.assertEnumEqual([$('item_1')], $$('li#item_1.first'));
+ this.assertEnumEqual([], $$('li#item_1.nonexistent'));
+ this.assertEnumEqual([], $$('li#item_1.first.nonexistent'));
+ },
+
+ test$$MatchesAncestryWithTokensSeparatedByWhitespace: function() {
+ this.assertEnumEqual($('em2', 'em', 'span'), $$('#fixtures a *'));
+ this.assertEnumEqual([$('p')], $$('div#fixtures p'));
+ },
+
+ test$$CombinesResultsWhenMultipleExpressionsArePassed: function() {
+ this.assertEnumEqual($('link_1', 'link_2', 'item_1', 'item_2', 'item_3'), $$('#p a', ' ul#list li '));
+ },
+
+ testSelectorWithTagNameAndAttributeExistence: function() {
+ this.assertEnumEqual($$('#fixtures h1'), $$('h1[class]'), 'h1[class]');
+ this.assertEnumEqual($$('#fixtures h1'), $$('h1[CLASS]'), 'h1[CLASS]');
+ this.assertEnumEqual([$('item_3')], $$('li#item_3[class]'), 'li#item_3[class]');
+ },
+
+ testSelectorWithTagNameAndSpecificAttributeValue: function() {
+ this.assertEnumEqual($('link_1', 'link_2', 'link_3'), $$('a[href="#"]'));
+ this.assertEnumEqual($('link_1', 'link_2', 'link_3'), $$('a[href=#]'));
+ },
+
+ testSelectorWithTagNameAndWhitespaceTokenizedAttributeValue: function() {
+ this.assertEnumEqual($('link_1', 'link_2'), $$('a[class~="internal"]'), "a[class~=\"internal\"]");
+ this.assertEnumEqual($('link_1', 'link_2'), $$('a[class~=internal]'), "a[class~=internal]");
+ },
+
+ testSelectorWithAttributeAndNoTagName: function() {
+ this.assertEnumEqual($(document.body).select('a[href]'), $(document.body).select('[href]'));
+ this.assertEnumEqual($$('a[class~="internal"]'), $$('[class~=internal]'));
+ this.assertEnumEqual($$('*[id]'), $$('[id]'));
+ this.assertEnumEqual($('checked_radio', 'unchecked_radio'), $$('[type=radio]'));
+ this.assertEnumEqual($$('*[type=checkbox]'), $$('[type=checkbox]'));
+ this.assertEnumEqual($('with_title', 'commaParent'), $$('[title]'));
+ this.assertEnumEqual($$('#troubleForm *[type=radio]'), $$('#troubleForm [type=radio]'));
+ this.assertEnumEqual($$('#troubleForm *[type]'), $$('#troubleForm [type]'));
+ },
+
+ testSelectorWithUniversalAndHyphenTokenizedAttributeValue: function() {
+ this.assertEnumEqual([$('item_3')], $$('*[xml:lang|="es"]'));
+ this.assertEnumEqual([$('item_3')], $$('*[xml:lang|="ES"]'));
+ },
+
+ testSelectorWithTagNameAndNegatedAttributeValue: function() {
+ this.assertEnumEqual([], $$('a[href!="#"]'));
+ },
+
+ testSelectorWithBracketAttributeValue: function() {
+ this.assertEnumEqual($('chk_1', 'chk_2'), $$('#troubleForm2 input[name="brackets[5][]"]'));
+ this.assertEnumEqual([$('chk_1')], $$('#troubleForm2 input[name="brackets[5][]"]:checked'));
+ this.assertEnumEqual([$('chk_2')], $$('#troubleForm2 input[name="brackets[5][]"][value=2]'));
+ this.assertEnumEqual([], $$('#troubleForm2 input[name=brackets[5][]]'));
+ },
+
+ test$$WithNestedAttributeSelectors: function() {
+ this.assertEnumEqual([$('strong')], $$('div[style] p[id] strong'), 'div[style] p[id] strong');
+ },
+
+ testSelectorWithMultipleConditions: function() {
+ this.assertEnumEqual([$('link_3')], $$('a[class~=external][href="#"]'),
+ 'a[class~=external][href="#"]');
+ this.assertEnumEqual([], $$('a[class~=external][href!="#"]'),
+ 'a[class~=external][href!="#"]');
+ },
+
+ testSelectorMatchElements: function() {
+ this.assertElementsMatch(Selector.matchElements($('list').descendants(), 'li'), '#item_1', '#item_2', '#item_3');
+ this.assertElementsMatch(Selector.matchElements($('fixtures').descendants(), 'a.internal'), '#link_1', '#link_2');
+ this.assertEnumEqual([], Selector.matchElements($('fixtures').descendants(), 'p.last'));
+ this.assertElementsMatch(Selector.matchElements($('fixtures').descendants(), '.inexistant, a.internal'), '#link_1', '#link_2');
+ },
+
+ testSelectorFindElement: function() {
+ this.assertElementMatches(Selector.findElement($('list').descendants(), 'li'), 'li#item_1.first');
+ this.assertElementMatches(Selector.findElement($('list').descendants(), 'li', 1), 'li#item_2');
+ this.assertElementMatches(Selector.findElement($('list').descendants(), 'li#item_3'), 'li');
+ this.assertEqual(undefined, Selector.findElement($('list').descendants(), 'em'));
+ },
+
+ testElementMatch: function() {
+ var span = $('dupL1');
+
+ // tests that should pass
+ this.assert(span.match('span'));
+ this.assert(span.match('span#dupL1'));
+ this.assert(span.match('div > span'), 'child combinator');
+ this.assert(span.match('#dupContainer span'), 'descendant combinator');
+ this.assert(span.match('#dupL1'), 'ID only');
+ this.assert(span.match('span.span_foo'), 'class name 1');
+ this.assert(span.match('span.span_bar'), 'class name 2');
+ this.assert(span.match('span:first-child'), 'first-child pseudoclass');
+
+ this.assert(!span.match('span.span_wtf'), 'bogus class name');
+ this.assert(!span.match('#dupL2'), 'different ID');
+ this.assert(!span.match('div'), 'different tag name');
+ this.assert(!span.match('span span'), 'different ancestry');
+ this.assert(!span.match('span > span'), 'different parent');
+ this.assert(!span.match('span:nth-child(5)'), 'different pseudoclass');
+
+ this.assert(!$('link_2').match('a[rel^=external]'));
+ this.assert($('link_1').match('a[rel^=external]'));
+ this.assert($('link_1').match('a[rel^="external"]'));
+ this.assert($('link_1').match("a[rel^='external']"));
+
+ this.assert(span.match({ match: function(element) { return true }}), 'custom selector');
+ this.assert(!span.match({ match: function(element) { return false }}), 'custom selector');
+ },
+
+ testSelectorWithSpaceInAttributeValue: function() {
+ this.assertEnumEqual([$('with_title')], $$('cite[title="hello world!"]'));
+ },
+
+ // AND NOW COME THOSE NEW TESTS AFTER ANDREW'S REWRITE!
+
+ testSelectorWithNamespacedAttributes: function() {
+ if (Prototype.BrowserFeatures.XPath) {
+ this.assertUndefined(new Selector('html[xml:lang]').xpath);
+ this.assertUndefined(new Selector('body p[xml:lang]').xpath);
+ } else
+ this.info("Could not test XPath bypass: no XPath to begin with!");
+
+ this.assertElementsMatch($$('[xml:lang]'), 'html', '#item_3');
+ this.assertElementsMatch($$('*[xml:lang]'), 'html', '#item_3');
+ },
+
+ testSelectorWithChild: function() {
+ this.assertEnumEqual($('link_1', 'link_2'), $$('p.first > a'));
+ this.assertEnumEqual($('father', 'uncle'), $$('div#grandfather > div'));
+ this.assertEnumEqual($('level2_1', 'level2_2'), $$('#level1>span'));
+ this.assertEnumEqual($('level2_1', 'level2_2'), $$('#level1 > span'));
+ this.assertEnumEqual($('level3_1', 'level3_2'), $$('#level2_1 > *'));
+ this.assertEnumEqual([], $$('div > #nonexistent'));
+ $RunBenchmarks && this.wait(500, function() {
+ this.benchmark(function() { $$('#level1 > span') }, 1000);
+ });
+ },
+
+ testSelectorWithAdjacence: function() {
+ this.assertEnumEqual([$('uncle')], $$('div.brothers + div.brothers'));
+ this.assertEnumEqual([$('uncle')], $$('div.brothers + div'));
+ this.assertEqual($('level2_2'), $$('#level2_1+span').reduce());
+ this.assertEqual($('level2_2'), $$('#level2_1 + span').reduce());
+ this.assertEqual($('level2_2'), $$('#level2_1 + *').reduce());
+ this.assertEnumEqual([], $$('#level2_2 + span'));
+ this.assertEqual($('level3_2'), $$('#level3_1 + span').reduce());
+ this.assertEqual($('level3_2'), $$('#level3_1 + *').reduce());
+ this.assertEnumEqual([], $$('#level3_2 + *'));
+ this.assertEnumEqual([], $$('#level3_1 + em'));
+ $RunBenchmarks && this.wait(500, function() {
+ this.benchmark(function() { $$('#level3_1 + span') }, 1000);
+ });
+ },
+
+ testSelectorWithLaterSibling: function() {
+ this.assertEnumEqual([$('list')], $$('h1 ~ ul'));
+ this.assertEqual($('level2_2'), $$('#level2_1 ~ span').reduce());
+ this.assertEnumEqual($('level2_2', 'level2_3'), $$('#level2_1 ~ *').reduce());
+ this.assertEnumEqual([], $$('#level2_2 ~ span'));
+ this.assertEnumEqual([], $$('#level3_2 ~ *'));
+ this.assertEnumEqual([], $$('#level3_1 ~ em'));
+ this.assertEnumEqual([$('level3_2')], $$('#level3_1 ~ #level3_2'));
+ this.assertEnumEqual([$('level3_2')], $$('span ~ #level3_2'));
+ this.assertEnumEqual([], $$('div ~ #level3_2'));
+ this.assertEnumEqual([], $$('div ~ #level2_3'));
+ $RunBenchmarks && this.wait(500, function() {
+ this.benchmark(function() { $$('#level2_1 ~ span') }, 1000);
+ });
+ },
+
+ testSelectorWithNewAttributeOperators: function() {
+ this.assertEnumEqual($('father', 'uncle'), $$('div[class^=bro]'), 'matching beginning of string');
+ this.assertEnumEqual($('father', 'uncle'), $$('div[class$=men]'), 'matching end of string');
+ this.assertEnumEqual($('father', 'uncle'), $$('div[class*="ers m"]'), 'matching substring')
+ this.assertEnumEqual($('level2_1', 'level2_2', 'level2_3'), $$('#level1 *[id^="level2_"]'));
+ this.assertEnumEqual($('level2_1', 'level2_2', 'level2_3'), $$('#level1 *[id^=level2_]'));
+ this.assertEnumEqual($('level2_1', 'level3_1'), $$('#level1 *[id$="_1"]'));
+ this.assertEnumEqual($('level2_1', 'level3_1'), $$('#level1 *[id$=_1]'));
+ this.assertEnumEqual($('level2_1', 'level3_2', 'level2_2', 'level2_3'), $$('#level1 *[id*="2"]'));
+ this.assertEnumEqual($('level2_1', 'level3_2', 'level2_2', 'level2_3'), $$('#level1 *[id*=2]'));
+ $RunBenchmarks && this.wait(500, function() {
+ this.benchmark(function() { $$('#level1 *[id^=level2_]') }, 1000, '[^=]');
+ this.benchmark(function() { $$('#level1 *[id$=_1]') }, 1000, '[$=]');
+ this.benchmark(function() { $$('#level1 *[id*=_2]') }, 1000, '[*=]');
+ });
+ },
+
+ testSelectorWithDuplicates: function() {
+ this.assertEnumEqual($$('div div'), $$('div div').uniq());
+ this.assertEnumEqual($('dupL2', 'dupL3', 'dupL4', 'dupL5'), $$('#dupContainer span span'));
+ $RunBenchmarks && this.wait(500, function() {
+ this.benchmark(function() { $$('#dupContainer span span') }, 1000);
+ });
+ },
+
+ testSelectorWithFirstLastOnlyNthNthLastChild: function() {
+ this.assertEnumEqual([$('level2_1')], $$('#level1>*:first-child'));
+ this.assertEnumEqual($('level2_1', 'level3_1', 'level_only_child'), $$('#level1 *:first-child'));
+ this.assertEnumEqual([$('level2_3')], $$('#level1>*:last-child'));
+ this.assertEnumEqual($('level3_2', 'level_only_child', 'level2_3'), $$('#level1 *:last-child'));
+ this.assertEnumEqual([$('level2_3')], $$('#level1>div:last-child'));
+ this.assertEnumEqual([$('level2_3')], $$('#level1 div:last-child'));
+ this.assertEnumEqual([], $$('#level1>div:first-child'));
+ this.assertEnumEqual([], $$('#level1>span:last-child'));
+ this.assertEnumEqual($('level2_1', 'level3_1'), $$('#level1 span:first-child'));
+ this.assertEnumEqual([], $$('#level1:first-child'));
+ this.assertEnumEqual([], $$('#level1>*:only-child'));
+ this.assertEnumEqual([$('level_only_child')], $$('#level1 *:only-child'));
+ this.assertEnumEqual([], $$('#level1:only-child'));
+ this.assertEnumEqual([$('link_2')], $$('#p *:nth-last-child(2)'), 'nth-last-child');
+ this.assertEnumEqual([$('link_2')], $$('#p *:nth-child(3)'), 'nth-child');
+ this.assertEnumEqual([$('link_2')], $$('#p a:nth-child(3)'), 'nth-child');
+ this.assertEnumEqual($('item_2', 'item_3'), $$('#list > li:nth-child(n+2)'));
+ this.assertEnumEqual($('item_1', 'item_2'), $$('#list > li:nth-child(-n+2)'));
+ $RunBenchmarks && this.wait(500, function() {
+ this.benchmark(function() { $$('#level1 *:first-child') }, 1000, ':first-child');
+ this.benchmark(function() { $$('#level1 *:last-child') }, 1000, ':last-child');
+ this.benchmark(function() { $$('#level1 *:only-child') }, 1000, ':only-child');
+ });
+ },
+
+ testSelectorWithFirstLastNthNthLastOfType: function() {
+ this.assertEnumEqual([$('link_2')], $$('#p a:nth-of-type(2)'), 'nth-of-type');
+ this.assertEnumEqual([$('link_1')], $$('#p a:nth-of-type(1)'), 'nth-of-type');
+ this.assertEnumEqual([$('link_2')], $$('#p a:nth-last-of-type(1)'), 'nth-last-of-type');
+ this.assertEnumEqual([$('link_1')], $$('#p a:first-of-type'), 'first-of-type');
+ this.assertEnumEqual([$('link_2')], $$('#p a:last-of-type'), 'last-of-type');
+ },
+
+ testSelectorWithNot: function() {
+ this.assertEnumEqual([$('link_2')], $$('#p a:not(a:first-of-type)'), 'first-of-type');
+ this.assertEnumEqual([$('link_1')], $$('#p a:not(a:last-of-type)'), 'last-of-type');
+ this.assertEnumEqual([$('link_2')], $$('#p a:not(a:nth-of-type(1))'), 'nth-of-type');
+ this.assertEnumEqual([$('link_1')], $$('#p a:not(a:nth-last-of-type(1))'), 'nth-last-of-type');
+ this.assertEnumEqual([$('link_2')], $$('#p a:not([rel~=nofollow])'), 'attribute 1');
+ this.assertEnumEqual([$('link_2')], $$('#p a:not(a[rel^=external])'), 'attribute 2');
+ this.assertEnumEqual([$('link_2')], $$('#p a:not(a[rel$=nofollow])'), 'attribute 3');
+ this.assertEnumEqual([$('em')], $$('#p a:not(a[rel$="nofollow"]) > em'), 'attribute 4')
+ this.assertEnumEqual([$('item_2')], $$('#list li:not(#item_1):not(#item_3)'), 'adjacent :not clauses');
+ this.assertEnumEqual([$('son')], $$('#grandfather > div:not(#uncle) #son'));
+ this.assertEnumEqual([$('em')], $$('#p a:not(a[rel$="nofollow"]) em'), 'attribute 4 + all descendants');
+ this.assertEnumEqual([$('em')], $$('#p a:not(a[rel$="nofollow"])>em'), 'attribute 4 (without whitespace)');
+ },
+
+ testSelectorWithEnabledDisabledChecked: function() {
+ this.assertEnumEqual([$('disabled_text_field')], $$('#troubleForm > *:disabled'));
+ // bug 452708 this.assertEnumEqual($('troubleForm').getInputs().without($('disabled_text_field'), $('hidden')), $$('#troubleForm > *:enabled'));
+ this.assertEnumEqual($('checked_box', 'checked_radio'), $$('#troubleForm *:checked'));
+ },
+
+ testSelectorWithEmpty: function() {
+ $('level3_1').innerHTML = "";
+ this.assertEnumEqual($('level3_1', 'level3_2', 'level2_3'),
+ $$('#level1 *:empty'), '#level1 *:empty');
+ this.assertEnumEqual([], $$('#level_only_child:empty'), 'newlines count as content!');
+ },
+
+ testIdenticalResultsFromEquivalentSelectors: function() {
+ this.assertEnumEqual($$('div.brothers'), $$('div[class~=brothers]'));
+ this.assertEnumEqual($$('div.brothers'), $$('div[class~=brothers].brothers'));
+ this.assertEnumEqual($$('div:not(.brothers)'), $$('div:not([class~=brothers])'));
+ this.assertEnumEqual($$('li ~ li'), $$('li:not(:first-child)'));
+ this.assertEnumEqual($$('ul > li'), $$('ul > li:nth-child(n)'));
+ this.assertEnumEqual($$('ul > li:nth-child(even)'), $$('ul > li:nth-child(2n)'));
+ this.assertEnumEqual($$('ul > li:nth-child(odd)'), $$('ul > li:nth-child(2n+1)'));
+ this.assertEnumEqual($$('ul > li:first-child'), $$('ul > li:nth-child(1)'));
+ this.assertEnumEqual($$('ul > li:last-child'), $$('ul > li:nth-last-child(1)'));
+ this.assertEnumEqual($$('ul > li:nth-child(n-999)'), $$('ul > li'));
+ this.assertEnumEqual($$('ul>li'), $$('ul > li'));
+ this.assertEnumEqual($$('#p a:not(a[rel$="nofollow"])>em'), $$('#p a:not(a[rel$="nofollow"]) > em'))
+ },
+
+ testSelectorsThatShouldReturnNothing: function() {
+ this.assertEnumEqual([], $$('span:empty > *'));
+ this.assertEnumEqual([], $$('div.brothers:not(.brothers)'));
+ this.assertEnumEqual([], $$('#level2_2 :only-child:not(:last-child)'));
+ this.assertEnumEqual([], $$('#level2_2 :only-child:not(:first-child)'));
+ },
+
+ testCommasFor$$: function() {
+ this.assertEnumEqual($('list', 'p', 'link_1', 'item_1', 'item_3', 'troubleForm'), $$('#list, .first,*[xml:lang="es-us"] , #troubleForm'));
+ this.assertEnumEqual($('list', 'p', 'link_1', 'item_1', 'item_3', 'troubleForm'), $$('#list, .first,', '*[xml:lang="es-us"] , #troubleForm'));
+ this.assertEnumEqual($('commaParent', 'commaChild'), $$('form[title*="commas,"], input[value="#commaOne,#commaTwo"]'));
+ this.assertEnumEqual($('commaParent', 'commaChild'), $$('form[title*="commas,"]', 'input[value="#commaOne,#commaTwo"]'));
+ },
+
+ testSelectorExtendsAllNodes: function(){
+ var element = document.createElement('div');
+ (3).times(function(){
+ element.appendChild(document.createElement('div'));
+ });
+ element.setAttribute('id','scratch_element');
+ $$('body')[0].appendChild(element);
+
+ var results = $$('#scratch_element div');
+ this.assert(typeof results[0].show == 'function');
+ this.assert(typeof results[1].show == 'function');
+ this.assert(typeof results[2].show == 'function');
+ },
+
+ testCountedIsNotAnAttribute: function() {
+ var el = $('list');
+ Selector.handlers.mark([el]);
+ this.assert(!el.innerHTML.include("_counted"));
+ Selector.handlers.unmark([el]);
+ this.assert(!el.innerHTML.include("_counted"));
+ },
+
+ testCopiedNodesGetIncluded: function() {
+ this.assertElementsMatch(
+ Selector.matchElements($('counted_container').descendants(), 'div'),
+ 'div.is_counted'
+ );
+ $('counted_container').innerHTML += $('counted_container').innerHTML;
+ this.assertElementsMatch(
+ Selector.matchElements($('counted_container').descendants(), 'div'), 'div.is_counted',
+ 'div.is_counted'
+ );
+ },
+
+ testElementDown: function() {
+ var a = $('dupL4');
+ var b = $('dupContainer').down('#dupL4');
+
+ this.assertEqual(a, b);
+ }
+});
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/string_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/string_test.js
new file mode 100644
index 0000000000..c4e21f095b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/string_test.js
@@ -0,0 +1,540 @@
+new Test.Unit.Runner({
+ testInterpret: function(){
+ this.assertIdentical('true', String.interpret(true));
+ this.assertIdentical('123', String.interpret(123));
+ this.assertIdentical('foo bar', String.interpret('foo bar'));
+ this.assertIdentical(
+ 'object string',
+ String.interpret({ toString: function(){ return 'object string' } }));
+
+ this.assertIdentical('0', String.interpret(0));
+ this.assertIdentical('false', String.interpret(false));
+ this.assertIdentical('', String.interpret(undefined));
+ this.assertIdentical('', String.interpret(null));
+ this.assertIdentical('', String.interpret(''));
+ },
+
+ testGsubWithReplacementFunction: function() {
+ var source = 'foo boo boz';
+
+ this.assertEqual('Foo Boo BoZ',
+ source.gsub(/[^o]+/, function(match) {
+ return match[0].toUpperCase()
+ }));
+ this.assertEqual('f2 b2 b1z',
+ source.gsub(/o+/, function(match) {
+ return match[0].length;
+ }));
+ this.assertEqual('f0 b0 b1z',
+ source.gsub(/o+/, function(match) {
+ return match[0].length % 2;
+ }));
+
+ },
+
+ testGsubWithReplacementString: function() {
+ var source = 'foo boo boz';
+
+ this.assertEqual('foobooboz',
+ source.gsub(/\s+/, ''));
+ this.assertEqual(' z',
+ source.gsub(/(.)(o+)/, ''));
+
+ this.assertEqual('ウィメンズ2007<br/>クルーズコレクション',
+ 'ウィメンズ2007\nクルーズコレクション'.gsub(/\n/,'<br/>'));
+ this.assertEqual('ウィメンズ2007<br/>クルーズコレクション',
+ 'ウィメンズ2007\nクルーズコレクション'.gsub('\n','<br/>'));
+ },
+
+ testGsubWithReplacementTemplateString: function() {
+ var source = 'foo boo boz';
+
+ this.assertEqual('-oo-#{1}- -oo-#{1}- -o-#{1}-z',
+ source.gsub(/(.)(o+)/, '-#{2}-\\#{1}-'));
+ this.assertEqual('-foo-f- -boo-b- -bo-b-z',
+ source.gsub(/(.)(o+)/, '-#{0}-#{1}-'));
+ this.assertEqual('-oo-f- -oo-b- -o-b-z',
+ source.gsub(/(.)(o+)/, '-#{2}-#{1}-'));
+ this.assertEqual(' z',
+ source.gsub(/(.)(o+)/, '#{3}'));
+ },
+
+ testSubWithReplacementFunction: function() {
+ var source = 'foo boo boz';
+
+ this.assertEqual('Foo boo boz',
+ source.sub(/[^o]+/, function(match) {
+ return match[0].toUpperCase()
+ }), 1);
+ this.assertEqual('Foo Boo boz',
+ source.sub(/[^o]+/, function(match) {
+ return match[0].toUpperCase()
+ }, 2), 2);
+ this.assertEqual(source,
+ source.sub(/[^o]+/, function(match) {
+ return match[0].toUpperCase()
+ }, 0), 0);
+ this.assertEqual(source,
+ source.sub(/[^o]+/, function(match) {
+ return match[0].toUpperCase()
+ }, -1), -1);
+ },
+
+ testSubWithReplacementString: function() {
+ var source = 'foo boo boz';
+
+ this.assertEqual('oo boo boz',
+ source.sub(/[^o]+/, ''));
+ this.assertEqual('oooo boz',
+ source.sub(/[^o]+/, '', 2));
+ this.assertEqual('-f-oo boo boz',
+ source.sub(/[^o]+/, '-#{0}-'));
+ this.assertEqual('-f-oo- b-oo boz',
+ source.sub(/[^o]+/, '-#{0}-', 2));
+ },
+
+ testScan: function() {
+ var source = 'foo boo boz', results = [];
+ var str = source.scan(/[o]+/, function(match) {
+ results.push(match[0].length);
+ });
+ this.assertEnumEqual([2, 2, 1], results);
+ this.assertEqual(source, source.scan(/x/, this.fail));
+ this.assert(typeof str == 'string');
+ },
+
+ testToArray: function() {
+ this.assertEnumEqual([],''.toArray());
+ this.assertEnumEqual(['a'],'a'.toArray());
+ this.assertEnumEqual(['a','b'],'ab'.toArray());
+ this.assertEnumEqual(['f','o','o'],'foo'.toArray());
+ },
+
+ /*
+ Note that camelize() differs from its Rails counterpart,
+ as it is optimized for dealing with JavaScript object
+ properties in conjunction with CSS property names:
+ - Looks for dashes, not underscores
+ - CamelCases first word if there is a front dash
+ */
+ testCamelize: function() {
+ this.assertEqual('', ''.camelize());
+ this.assertEqual('', '-'.camelize());
+ this.assertEqual('foo', 'foo'.camelize());
+ this.assertEqual('foo_bar', 'foo_bar'.camelize());
+ this.assertEqual('FooBar', '-foo-bar'.camelize());
+ this.assertEqual('FooBar', 'FooBar'.camelize());
+
+ this.assertEqual('fooBar', 'foo-bar'.camelize());
+ this.assertEqual('borderBottomWidth', 'border-bottom-width'.camelize());
+
+ this.assertEqual('classNameTest','class-name-test'.camelize());
+ this.assertEqual('classNameTest','className-test'.camelize());
+ this.assertEqual('classNameTest','class-nameTest'.camelize());
+
+ /* this.benchmark(function(){
+ 'class-name-test'.camelize();
+ },10000); */
+ },
+
+ testCapitalize: function() {
+ this.assertEqual('',''.capitalize());
+ this.assertEqual('Ä','ä'.capitalize());
+ this.assertEqual('A','A'.capitalize());
+ this.assertEqual('Hello','hello'.capitalize());
+ this.assertEqual('Hello','HELLO'.capitalize());
+ this.assertEqual('Hello','Hello'.capitalize());
+ this.assertEqual('Hello world','hello WORLD'.capitalize());
+ },
+
+ testUnderscore: function() {
+ this.assertEqual('', ''.underscore());
+ this.assertEqual('_', '-'.underscore());
+ this.assertEqual('foo', 'foo'.underscore());
+ this.assertEqual('foo', 'Foo'.underscore());
+ this.assertEqual('foo_bar', 'foo_bar'.underscore());
+ this.assertEqual('border_bottom', 'borderBottom'.underscore());
+ this.assertEqual('border_bottom_width', 'borderBottomWidth'.underscore());
+ this.assertEqual('border_bottom_width', 'border-Bottom-Width'.underscore());
+ },
+
+ testDasherize: function() {
+ this.assertEqual('', ''.dasherize());
+ this.assertEqual('foo', 'foo'.dasherize());
+ this.assertEqual('Foo', 'Foo'.dasherize());
+ this.assertEqual('foo-bar', 'foo-bar'.dasherize());
+ this.assertEqual('border-bottom-width', 'border_bottom_width'.dasherize());
+ },
+
+ testTruncate: function() {
+ var source = 'foo boo boz foo boo boz foo boo boz foo boo boz';
+ this.assertEqual(source, source.truncate(source.length));
+ this.assertEqual('foo boo boz foo boo boz foo...', source.truncate(0));
+ this.assertEqual('fo...', source.truncate(5));
+ this.assertEqual('foo b', source.truncate(5, ''));
+
+ this.assert(typeof 'foo'.truncate(5) == 'string');
+ this.assert(typeof 'foo bar baz'.truncate(5) == 'string');
+ },
+
+ testStrip: function() {
+ this.assertEqual('hello world', ' hello world '.strip());
+ this.assertEqual('hello world', 'hello world'.strip());
+ this.assertEqual('hello \n world', ' hello \n world '.strip());
+ this.assertEqual('', ' '.strip());
+ },
+
+ testStripTags: function() {
+ this.assertEqual('hello world', 'hello world'.stripTags());
+ this.assertEqual('hello world', 'hello <span>world</span>'.stripTags());
+ this.assertEqual('hello world', '<a href="#" onclick="moo!">hello</a> world'.stripTags());
+ this.assertEqual('hello world', 'h<b><em>e</em></b>l<i>l</i>o w<span class="moo" id="x"><b>o</b></span>rld'.stripTags());
+ this.assertEqual('1\n2', '1\n2'.stripTags());
+ },
+
+ testStripScripts: function() {
+ this.assertEqual('foo bar', 'foo bar'.stripScripts());
+ this.assertEqual('foo bar', ('foo <script>boo();<'+'/script>bar').stripScripts());
+ this.assertEqual('foo bar', ('foo <script type="text/javascript">boo();\nmoo();<'+'/script>bar').stripScripts());
+ },
+
+ testExtractScripts: function() {
+ this.assertEnumEqual([], 'foo bar'.extractScripts());
+ this.assertEnumEqual(['boo();'], ('foo <script>boo();<'+'/script>bar').extractScripts());
+ this.assertEnumEqual(['boo();','boo();\nmoo();'],
+ ('foo <script>boo();<'+'/script><script type="text/javascript">boo();\nmoo();<'+'/script>bar').extractScripts());
+ this.assertEnumEqual(['boo();','boo();\nmoo();'],
+ ('foo <script>boo();<'+'/script>blub\nblub<script type="text/javascript">boo();\nmoo();<'+'/script>bar').extractScripts());
+
+ var russianChars = '//кПЌеМтарОй\n';
+ var longComment = '//' + Array(7000).join('.') + '\n';
+ var longScript = '\nvar foo = 1;\n' + russianChars + longComment;
+ var longString = '<script type="text/javascript">'+ longScript + '<'+'/script>';
+ this.assertEnumEqual([longScript], longString.extractScripts());
+
+ this.assertEnumEqual([], ('<!--\n<script>boo();<'+'/script>\n-->').extractScripts());
+ },
+
+ testEvalScripts: function() {
+ this.assertEqual(0, evalScriptsCounter);
+
+ ('foo <script>evalScriptsCounter++<'+'/script>bar').evalScripts();
+ this.assertEqual(1, evalScriptsCounter);
+
+ var stringWithScripts = '';
+ (3).times(function(){ stringWithScripts += 'foo <script>evalScriptsCounter++<'+'/script>bar' });
+ stringWithScripts.evalScripts();
+ this.assertEqual(4, evalScriptsCounter);
+ },
+
+ testEscapeHTML: function() {
+ this.assertEqual('foo bar', 'foo bar'.escapeHTML());
+ this.assertEqual('foo &lt;span&gt;bar&lt;/span&gt;', 'foo <span>bar</span>'.escapeHTML());
+ this.assertEqual('foo ß bar', 'foo ß bar'.escapeHTML());
+
+ this.assertEqual('ウィメンズ2007\nクルーズコレクション',
+ 'ウィメンズ2007\nクルーズコレクション'.escapeHTML());
+
+ this.assertEqual('a&lt;a href=&quot;blah&quot;&gt;blub&lt;/a&gt;b&lt;span&gt;&lt;div&gt;&lt;/div&gt;&lt;/span&gt;cdef&lt;strong&gt;!!!!&lt;/strong&gt;g',
+ 'a<a href="blah">blub</a>b<span><div></div></span>cdef<strong>!!!!</strong>g'.escapeHTML());
+
+ this.assertEqual(largeTextEscaped, largeTextUnescaped.escapeHTML());
+
+ this.assertEqual('1\n2', '1\n2'.escapeHTML());
+
+ this.benchmark(function() { largeTextUnescaped.escapeHTML() }, 1000);
+ },
+
+ testUnescapeHTML: function() {
+ this.assertEqual('foo bar', 'foo bar'.unescapeHTML());
+ this.assertEqual('foo <span>bar</span>', 'foo &lt;span&gt;bar&lt;/span&gt;'.unescapeHTML());
+ this.assertEqual('foo ß bar', 'foo ß bar'.unescapeHTML());
+
+ this.assertEqual('a<a href="blah">blub</a>b<span><div></div></span>cdef<strong>!!!!</strong>g',
+ 'a&lt;a href="blah"&gt;blub&lt;/a&gt;b&lt;span&gt;&lt;div&gt;&lt;/div&gt;&lt;/span&gt;cdef&lt;strong&gt;!!!!&lt;/strong&gt;g'.unescapeHTML());
+
+ this.assertEqual(largeTextUnescaped, largeTextEscaped.unescapeHTML());
+
+ this.assertEqual('test \xfa', 'test &uacute;'.unescapeHTML());
+ this.assertEqual('1\n2', '1\n2'.unescapeHTML());
+ this.assertEqual('Pride & Prejudice', '<h1>Pride &amp; Prejudice</h1>'.unescapeHTML());
+
+ var escapedTest = '"&lt;" means "<" in HTML';
+ this.assertEqual(escapedTest, escapedTest.escapeHTML().unescapeHTML());
+
+ this.benchmark(function() { largeTextEscaped.unescapeHTML() }, 1000);
+
+ },
+
+ testTemplateEvaluation: function() {
+ var source = '<tr><td>#{name}</td><td>#{age}</td></tr>';
+ var person = {name: 'Sam', age: 21};
+ var template = new Template(source);
+
+ this.assertEqual('<tr><td>Sam</td><td>21</td></tr>',
+ template.evaluate(person));
+ this.assertEqual('<tr><td></td><td></td></tr>',
+ template.evaluate({}));
+ },
+
+ testTemplateEvaluationWithEmptyReplacement: function() {
+ var template = new Template('##{}');
+ this.assertEqual('#', template.evaluate({}));
+ this.assertEqual('#', template.evaluate({foo: 'bar'}));
+
+ template = new Template('#{}');
+ this.assertEqual('', template.evaluate({}));
+ },
+
+ testTemplateEvaluationWithFalses: function() {
+ var source = '<tr><td>#{zero}</td><td>#{false_}</td><td>#{undef}</td><td>#{null_}</td><td>#{empty}</td></tr>';
+ var falses = {zero:0, false_:false, undef:undefined, null_:null, empty:""};
+ var template = new Template(source);
+
+ this.assertEqual('<tr><td>0</td><td>false</td><td></td><td></td><td></td></tr>',
+ template.evaluate(falses));
+ },
+
+ testTemplateEvaluationWithNested: function() {
+ var source = '#{name} #{manager.name} #{manager.age} #{manager.undef} #{manager.age.undef} #{colleagues.first.name}';
+ var subject = { manager: { name: 'John', age: 29 }, name: 'Stephan', age: 22, colleagues: { first: { name: 'Mark' }} };
+ this.assertEqual('Stephan', new Template('#{name}').evaluate(subject));
+ this.assertEqual('John', new Template('#{manager.name}').evaluate(subject));
+ this.assertEqual('29', new Template('#{manager.age}').evaluate(subject));
+ this.assertEqual('', new Template('#{manager.undef}').evaluate(subject));
+ this.assertEqual('', new Template('#{manager.age.undef}').evaluate(subject));
+ this.assertEqual('Mark', new Template('#{colleagues.first.name}').evaluate(subject));
+ this.assertEqual('Stephan John 29 Mark', new Template(source).evaluate(subject));
+ },
+
+ testTemplateEvaluationWithIndexing: function() {
+ var source = '#{0} = #{[0]} - #{1} = #{[1]} - #{[2][0]} - #{[2].name} - #{first[0]} - #{[first][0]} - #{[\\]]} - #{first[\\]]}';
+ var subject = [ 'zero', 'one', [ 'two-zero' ] ];
+ subject[2].name = 'two-zero-name';
+ subject.first = subject[2];
+ subject[']'] = '\\';
+ subject.first[']'] = 'first\\';
+ this.assertEqual('zero', new Template('#{[0]}').evaluate(subject));
+ this.assertEqual('one', new Template('#{[1]}').evaluate(subject));
+ this.assertEqual('two-zero', new Template('#{[2][0]}').evaluate(subject));
+ this.assertEqual('two-zero-name', new Template('#{[2].name}').evaluate(subject));
+ this.assertEqual('two-zero', new Template('#{first[0]}').evaluate(subject));
+ this.assertEqual('\\', new Template('#{[\\]]}').evaluate(subject));
+ this.assertEqual('first\\', new Template('#{first[\\]]}').evaluate(subject));
+ this.assertEqual('empty - empty2', new Template('#{[]} - #{m[]}').evaluate({ '': 'empty', m: {'': 'empty2'}}));
+ this.assertEqual('zero = zero - one = one - two-zero - two-zero-name - two-zero - two-zero - \\ - first\\', new Template(source).evaluate(subject));
+ },
+
+ testTemplateToTemplateReplacements: function() {
+ var source = 'My name is #{name}, my job is #{job}';
+ var subject = {
+ name: 'Stephan',
+ getJob: function() { return 'Web developer'; },
+ toTemplateReplacements: function() { return { name: this.name, job: this.getJob() } }
+ };
+ this.assertEqual('My name is Stephan, my job is Web developer', new Template(source).evaluate(subject));
+ },
+
+ testTemplateEvaluationCombined: function() {
+ var source = '#{name} is #{age} years old, managed by #{manager.name}, #{manager.age}.\n' +
+ 'Colleagues include #{colleagues[0].name} and #{colleagues[1].name}.';
+ var subject = {
+ name: 'Stephan', age: 22,
+ manager: { name: 'John', age: 29 },
+ colleagues: [ { name: 'Mark' }, { name: 'Indy' } ]
+ };
+ this.assertEqual('Stephan is 22 years old, managed by John, 29.\n' +
+ 'Colleagues include Mark and Indy.',
+ new Template(source).evaluate(subject));
+ },
+
+ testInterpolate: function() {
+ var subject = { name: 'Stephan' };
+ var pattern = /(^|.|\r|\n)(#\((.*?)\))/;
+ this.assertEqual('#{name}: Stephan', '\\#{name}: #{name}'.interpolate(subject));
+ this.assertEqual('#(name): Stephan', '\\#(name): #(name)'.interpolate(subject, pattern));
+ },
+
+ testToQueryParams: function() {
+ // only the query part
+ var result = {a:undefined, b:'c'};
+ this.assertHashEqual({}, ''.toQueryParams(), 'empty query');
+ this.assertHashEqual({}, 'foo?'.toQueryParams(), 'empty query with URL');
+ this.assertHashEqual(result, 'foo?a&b=c'.toQueryParams(), 'query with URL');
+ this.assertHashEqual(result, 'foo?a&b=c#fragment'.toQueryParams(), 'query with URL and fragment');
+ this.assertHashEqual(result, 'a;b=c'.toQueryParams(';'), 'custom delimiter');
+
+ this.assertHashEqual({a:undefined}, 'a'.toQueryParams(), 'key without value');
+ this.assertHashEqual({a:'b'}, 'a=b&=c'.toQueryParams(), 'empty key');
+ this.assertHashEqual({a:'b', c:''}, 'a=b&c='.toQueryParams(), 'empty value');
+
+ this.assertHashEqual({'a b':'c', d:'e f', g:'h'},
+ 'a%20b=c&d=e%20f&g=h'.toQueryParams(), 'proper decoding');
+ this.assertHashEqual({a:'b=c=d'}, 'a=b=c=d'.toQueryParams(), 'multiple equal signs');
+ this.assertHashEqual({a:'b', c:'d'}, '&a=b&&&c=d'.toQueryParams(), 'proper splitting');
+
+ this.assertEnumEqual($w('r g b'), 'col=r&col=g&col=b'.toQueryParams()['col'],
+ 'collection without square brackets');
+ var msg = 'empty values inside collection';
+ this.assertEnumEqual(['r', '', 'b'], 'c=r&c=&c=b'.toQueryParams()['c'], msg);
+ this.assertEnumEqual(['', 'blue'], 'c=&c=blue'.toQueryParams()['c'], msg);
+ this.assertEnumEqual(['blue', ''], 'c=blue&c='.toQueryParams()['c'], msg);
+ },
+
+ testInspect: function() {
+ this.assertEqual('\'\'', ''.inspect());
+ this.assertEqual('\'test\'', 'test'.inspect());
+ this.assertEqual('\'test \\\'test\\\' "test"\'', 'test \'test\' "test"'.inspect());
+ this.assertEqual('\"test \'test\' \\"test\\"\"', 'test \'test\' "test"'.inspect(true));
+ this.assertEqual('\'\\b\\t\\n\\f\\r"\\\\\'', '\b\t\n\f\r"\\'.inspect());
+ this.assertEqual('\"\\b\\t\\n\\f\\r\\"\\\\\"', '\b\t\n\f\r"\\'.inspect(true));
+ this.assertEqual('\'\\b\\t\\n\\f\\r\'', '\x08\x09\x0a\x0c\x0d'.inspect());
+ this.assertEqual('\'\\u001a\'', '\x1a'.inspect());
+ },
+
+ testInclude: function() {
+ this.assert('hello world'.include('h'));
+ this.assert('hello world'.include('hello'));
+ this.assert('hello world'.include('llo w'));
+ this.assert('hello world'.include('world'));
+ this.assert(!'hello world'.include('bye'));
+ this.assert(!''.include('bye'));
+ },
+
+ testStartsWith: function() {
+ this.assert('hello world'.startsWith('h'));
+ this.assert('hello world'.startsWith('hello'));
+ this.assert(!'hello world'.startsWith('bye'));
+ this.assert(!''.startsWith('bye'));
+ this.assert(!'hell'.startsWith('hello'));
+ },
+
+ testEndsWith: function() {
+ this.assert('hello world'.endsWith('d'));
+ this.assert('hello world'.endsWith(' world'));
+ this.assert(!'hello world'.endsWith('planet'));
+ this.assert(!''.endsWith('planet'));
+ this.assert('hello world world'.endsWith(' world'));
+ this.assert(!'z'.endsWith('az'));
+ },
+
+ testBlank: function() {
+ this.assert(''.blank());
+ this.assert(' '.blank());
+ this.assert('\t\r\n '.blank());
+ this.assert(!'a'.blank());
+ this.assert(!'\t y \n'.blank());
+ },
+
+ testEmpty: function() {
+ this.assert(''.empty());
+ this.assert(!' '.empty());
+ this.assert(!'\t\r\n '.empty());
+ this.assert(!'a'.empty());
+ this.assert(!'\t y \n'.empty());
+ },
+
+ testSucc: function() {
+ this.assertEqual('b', 'a'.succ());
+ this.assertEqual('B', 'A'.succ());
+ this.assertEqual('1', '0'.succ());
+ this.assertEqual('abce', 'abcd'.succ());
+ this.assertEqual('{', 'z'.succ());
+ this.assertEqual(':', '9'.succ());
+ },
+
+ testTimes: function() {
+
+ this.assertEqual('', ''.times(0));
+ this.assertEqual('', ''.times(5));
+ this.assertEqual('', 'a'.times(-1));
+ this.assertEqual('', 'a'.times(0));
+ this.assertEqual('a', 'a'.times(1));
+ this.assertEqual('aa', 'a'.times(2));
+ this.assertEqual('aaaaa', 'a'.times(5));
+ this.assertEqual('foofoofoofoofoo', 'foo'.times(5));
+ this.assertEqual('', 'foo'.times(-5));
+
+ /*window.String.prototype.oldTimes = function(count) {
+ var result = '';
+ for (var i = 0; i < count; i++) result += this;
+ return result;
+ };
+
+ this.benchmark(function() {
+ 'foo'.times(15);
+ }, 1000, 'new: ');
+
+ this.benchmark(function() {
+ 'foo'.oldTimes(15);
+ }, 1000, 'previous: ');*/
+ },
+
+ testToJSON: function() {
+ this.assertEqual('\"\"', ''.toJSON());
+ this.assertEqual('\"test\"', 'test'.toJSON());
+ },
+
+ testIsJSON: function() {
+ this.assert(!''.isJSON());
+ this.assert(!' '.isJSON());
+ this.assert('""'.isJSON());
+ this.assert('"foo"'.isJSON());
+ this.assert('{}'.isJSON());
+ this.assert('[]'.isJSON());
+ this.assert('null'.isJSON());
+ this.assert('123'.isJSON());
+ this.assert('true'.isJSON());
+ this.assert('false'.isJSON());
+ this.assert('"\\""'.isJSON());
+ this.assert(!'\\"'.isJSON());
+ this.assert(!'new'.isJSON());
+ this.assert(!'\u0028\u0029'.isJSON());
+ // we use '@' as a placeholder for characters authorized only inside brackets,
+ // so this tests make sure it is not considered authorized elsewhere.
+ this.assert(!'@'.isJSON());
+ },
+
+ testEvalJSON: function() {
+ var valid = '{"test": \n\r"hello world!"}';
+ var invalid = '{"test": "hello world!"';
+ var dangerous = '{});attackTarget = "attack succeeded!";({}';
+
+ // use smaller huge string size for KHTML
+ var size = navigator.userAgent.include('KHTML') ? 20 : 100;
+ var longString = '"' + '123456789\\"'.times(size * 10) + '"';
+ var object = '{' + longString + ': ' + longString + '},';
+ var huge = '[' + object.times(size) + '{"test": 123}]';
+
+ this.assertEqual('hello world!', valid.evalJSON().test);
+ this.assertEqual('hello world!', valid.evalJSON(true).test);
+ this.assertRaise('SyntaxError', function() { invalid.evalJSON() });
+ this.assertRaise('SyntaxError', function() { invalid.evalJSON(true) });
+
+ attackTarget = "scared";
+ dangerous.evalJSON();
+ this.assertEqual("attack succeeded!", attackTarget);
+
+ attackTarget = "Not scared!";
+ this.assertRaise('SyntaxError', function(){dangerous.evalJSON(true)});
+ this.assertEqual("Not scared!", attackTarget);
+
+ this.assertEqual('hello world!', ('/*-secure- \r \n ' + valid + ' \n */').evalJSON().test);
+ var temp = Prototype.JSONFilter;
+ Prototype.JSONFilter = /^\/\*([\s\S]*)\*\/$/; // test custom delimiters.
+ this.assertEqual('hello world!', ('/*' + valid + '*/').evalJSON().test);
+ Prototype.JSONFilter = temp;
+
+ this.assertMatch(123, huge.evalJSON(true).last().test);
+
+ this.assertEqual('', '""'.evalJSON());
+ this.assertEqual('foo', '"foo"'.evalJSON());
+ this.assert('object', typeof '{}'.evalJSON());
+ this.assert(Object.isArray('[]'.evalJSON()));
+ this.assertNull('null'.evalJSON());
+ this.assert(123, '123'.evalJSON());
+ this.assertIdentical(true, 'true'.evalJSON());
+ this.assertIdentical(false, 'false'.evalJSON());
+ this.assertEqual('"', '"\\""'.evalJSON());
+ }
+}); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/ajax_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/ajax_test.html
new file mode 100644
index 0000000000..b38fd306ca
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/ajax_test.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Ajax</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+ <script src="../fixtures/ajax.js" type="text/javascript" charset="utf-8"></script>
+
+
+ <script src="../ajax_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Ajax</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="content"></div>
+<div id="content2" style="color:red"></div>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/array_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/array_test.html
new file mode 100644
index 0000000000..cc3b9ef629
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/array_test.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Array</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../array_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Array</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="test_node">22<span id="span_1"></span><span id="span_2"></span></div>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/base_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/base_test.html
new file mode 100644
index 0000000000..bcd29f91df
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/base_test.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Base</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+ <script src="../fixtures/base.js" type="text/javascript" charset="utf-8"></script>
+
+
+ <script src="../base_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Base</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="test"></div>
+<ul id="list">
+ <li></li>
+ <li></li>
+ <li></li>
+</ul>
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/dom_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/dom_test.html
new file mode 100644
index 0000000000..c1ffb7536f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/dom_test.html
@@ -0,0 +1,326 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Dom</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+ <link rel="stylesheet" href="../fixtures/dom.css" type="text/css" charset="utf-8" />
+
+
+
+ <script src="../fixtures/dom.js" type="text/javascript" charset="utf-8"></script>
+
+
+ <script src="../dom_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Dom</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="scroll_test_1">
+ <p id="scroll_test_2">Scroll test</p>
+</div>
+
+<div id="test-visible">visible</div>
+<div id="test-hidden" style="display:none;">hidden</div>
+<div id="test-toggle-visible">visible</div>
+<div id="test-toggle-hidden" style="display:none;">hidden</div>
+<div id="test-hide-visible">visible</div>
+<div id="test-hide-hidden" style="display:none;">hidden</div>
+<div id="test-show-visible">visible</div>
+<div id="test-show-hidden" style="display:none;">hidden</div>
+<div id="removable-container"><div id="removable"></div></div>
+
+<div>
+ <table>
+ <tbody id="table">
+ <tr>
+ <td>Data</td>
+ </tr>
+ <tr>
+ <td id="a_cell">First Row</td>
+ </tr>
+ <tr id="second_row">
+ <td>Second Row</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<div id="table-container-to-replace">
+ <table>
+ <tbody id="table-to-replace">
+ <tr>
+ <td>Data</td>
+ </tr>
+ <tr>
+ <td id="a_cell-to-replace">First Row</td>
+ </tr>
+ <tr id="second_row-to-replace">
+ <td>Second Row</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<p class="test">Test paragraph outside of container</p>
+
+<div id="container">
+ <p class="test" id="intended">Test paragraph 1 inside of container</p>
+ <p class="test">Test paragraph 2 inside of container</p>
+ <p class="test">Test paragraph 3 inside of container</p>
+ <p class="test">Test paragraph 4 inside of container</p>
+</div>
+
+<div id="testdiv">to be updated</div>
+<div id="testdiv-replace-container-1"><div id="testdiv-replace-1"></div></div>
+<div id="testdiv-replace-container-2"><div id="testdiv-replace-2"></div></div>
+<div id="testdiv-replace-container-3"><div id="testdiv-replace-3"></div></div>
+<div id="testdiv-replace-container-4"><div id="testdiv-replace-4"></div></div>
+<div id="testdiv-replace-container-5"><div id="testdiv-replace-5"></div></div>
+<div id="testdiv-replace-container-element"><div id="testdiv-replace-element"></div></div>
+<div id="testdiv-replace-container-toelement"><div id="testdiv-replace-toelement"></div></div>
+<div id="testdiv-replace-container-tohtml"><div id="testdiv-replace-tohtml"></div></div>
+<div id="testtable-replace-container"><table id="testtable-replace"></table></div>
+<table id="testrow-replace-container"><tr id="testrow-replace"></tr></table>
+<select id="testoption-replace-container"><option id="testoption-replace"></option><option>stays</option></select>
+<div id="testform-replace-container"><p>some text</p><form id="testform-replace"><input id="testinput-replace" type="text" /></form><p>some text</p></div>
+
+<div id="element_with_visible_overflow" style="overflow:visible">V</div>
+<div id="element_with_hidden_overflow" style="overflow:hidden">H</div>
+<div id="element_with_scroll_overflow" style="overflow:scroll">S</div>
+
+<div id="element_extend_test"> </div>
+
+<div id="element_reextend_test"><div id="discard_1"></div></div>
+
+<div id="test_whitespace"> <span> </span>
+
+
+<div><div></div> </div><span> </span>
+</div>
+
+
+<div id="nav_tests_isolator">
+ <div id="nav_test_first_sibling"></div>
+ <div></div>
+ <p id="nav_test_p" class="test"></p>
+ <span id="nav_test_prev_sibling"></span>
+
+ <ul id="navigation_test" style="display: none">
+ <!-- comment node to screw things up -->
+ <li class="first"><em>A</em></li>
+ <li><em class="dim">B</em></li>
+ <li id="navigation_test_c">
+ <em>C</em>
+ <ul>
+ <li><em class="dim">E</em></li>
+ <li id="navigation_test_f"><em>F</em></li>
+ </ul>
+ </li>
+ <li class="last"><em>D</em></li>
+ </ul>
+
+ <div id="navigation_test_next_sibling">
+ <!-- -->
+ </div>
+
+ <p></p>
+</div>
+
+<div id="class_names">
+ <p class="A"></p>
+ <ul class="A B" id="class_names_ul">
+ <li class="C"></li>
+ <li class="A C"></li>
+ <li class="1"></li>
+ </ul>
+ <div class="B C D"></div>
+ <div id="unextended"></div>
+</div>
+
+<div id="style_test_1" style="display:none;"></div>
+<div id="style_test_2" class="style-test" style="font-size:11px;"></div>
+
+<div id="style_test_3">blah</div>
+<span id="style_test_4">blah</span>
+<span id="style_test_5">blah</span>
+
+<div id="style_test_dimensions_container">
+ <div id="style_test_dimensions" style="background:#ddd;padding:1px;margin:1px;border:1px solid #00f"><div style="height:5px;background:#eee;width:5px;padding:2px;margin:2px;border:2px solid #0f0"> </div>
+ </div>
+</div>
+
+<div id="test_csstext_1">test_csstext_1</div>
+<div id="test_csstext_2">test_csstext_2</div>
+<div id="test_csstext_3" style="border: 1px solid red">test_csstext_3</div>
+<div id="test_csstext_4" style="font-size: 20px">test_csstext_4</div>
+<div id="test_csstext_5">test_csstext_5</div>
+
+<div id="custom_attributes">
+ <div foo="1" bar="2"></div>
+ <div foo="2"></div>
+</div>
+
+<div id="cloned_element_attributes_issue" foo="original"></div>
+<a id="attributes_with_issues_1" href="test.html" accesskey="L" tabindex="50" title="a link" onclick="alert('hello world');"></a>
+<a id="attributes_with_issues_2" href="" accesskey="" tabindex="" title=""></a>
+<a id="attributes_with_issues_3"></a>
+<form id="attributes_with_issues_form" method="post" action="blah" class="blah-class">
+ <input type="hidden" id="id" />
+ <input type="hidden" name="id" />
+ <input type="checkbox" id="action" />
+ <input type="checkbox" name="action" />
+ <input type="text" id="method" />
+ <input type="hidden" name="class" />
+ <input type="checkbox" id="attributes_with_issues_checked" name="a" checked="checked"/>
+ <input type="checkbox" id="attributes_with_issues_disabled" name="b" checked="checked" disabled="disabled"/>
+ <input type="text" id="attributes_with_issues_readonly" name="c" readonly="readonly" value="blech"/>
+ <input type="text" id="attributes_with_issues_regular" name="d" value="0"/>
+ <input type="date" id="attributes_with_issues_type" value="blech" />
+ <select id="attributes_with_issues_multiple" name="e" multiple="multiple">
+ <option>blech</option>
+ <option>blah</option>
+ </select>
+</form>
+
+<!-- writeAttributes -->
+<p id="write_attribute_para"></p>
+<a id="write_attribute_link" href="test.html"></a>
+<form action="/dev/null" id="write_attribute_form" method="get" accept-charset="utf-8">
+ <label id="write_attribute_label"></label>
+ <input type="checkbox" name="write_attribute_checkbox" value="" id="write_attribute_checkbox">
+ <input type="checkbox" checked="checked" name="write_attribute_checked_checkbox" value="" id="write_attribute_checked_checkbox">
+ <input type="text" name="write_attribute_input" value="" id="write_attribute_input">
+ <select id="write_attribute_select">
+ <option>Cat</option>
+ <option>Dog</option>
+ </select>
+</form>
+
+<table id="write_attribute_table" cellpadding="6" cellspacing="4">
+ <tr><td id="write_attribute_td">A</td><td>B</td></tr>
+ <tr><td>C</td></tr>
+ <tr><td>D</td><td>E</td><td>F</td></tr>
+</table>
+
+<div id="dom_attribute_precedence">
+ <form action="blech" method="post">
+ <input type="submit" id="update" />
+ </form>
+</div>
+
+<div id="not_floating_none">NFN</div>
+<div id="not_floating_inline" style="float:none">NFI</div>
+<div id="not_floating_style">NFS</div>
+
+<div id="floating_inline" style="float:left">FI</div>
+<div id="floating_style">FS</div>
+<!-- Test Element opacity functions -->
+<img id="op1" alt="op2" src="fixtures/logo.gif" style="opacity:0.5;filter:alpha(opacity=50)" />
+<img id="op2" alt="op2" src="fixtures/logo.gif"/>
+<img id="op3" alt="op3" src="fixtures/logo.gif"/>
+<img id="op4-ie" alt="op3" src="fixtures/logo.gif" style="filter:alpha(opacity=30)" />
+<div id="dimensions-visible"></div>
+<div id="dimensions-display-none"></div>
+<div id="dimensions-visible-pos-rel"></div>
+<div id="dimensions-display-none-pos-rel"></div>
+<div id="dimensions-visible-pos-abs"></div>
+<div id="dimensions-display-none-pos-abs"></div>
+<table border="0" cellspacing="0" cellpadding="0" id="dimensions-table">
+ <tbody id="dimensions-tbody">
+ <tr id="dimensions-tr">
+ <td id="dimensions-td">Data</td>
+ </tr>
+ </tbody>
+</table>
+
+<div id="dimensions-nester" style="width: 500px;">
+ <div id="dimensions-nestee" style="display: none">This is a nested DIV. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
+</div>
+
+
+<p id="test-empty"></p>
+<p id="test-empty-but-contains-whitespace">
+
+
+</p>
+<p id="test-full">content</p>
+<div id="ancestor">
+ <div id="child">
+ <div id="grand-child">
+ <div id="great-grand-child"></div>
+ </div></div><!-- intentional formatting; don't change this line -->
+ <div id="sibling"><div id="grand-sibling"></div></div>
+</div>
+<div id="not-in-the-family"></div>
+
+<div id="insertions-container"><div id="insertions-main"><p>some content.</p></div></div>
+<div id="insertions-node-container"><div id="insertions-node-main"><p>some content.</p></div></div>
+<div id="element-insertions-container"><div id="element-insertions-main"><p>some content.</p></div></div>
+<div id="element-insertions-multiple-container"><div id="element-insertions-multiple-main"><p>some content.</p></div></div>
+<table id="table_for_insertions"></table>
+<table id="table_for_row_insertions"><tr id="row_1"></tr></table>
+<form method="post" action="blah">
+ <select id="select_for_update" name="select_for_update">
+ <option>option 1</option>
+ <option>option 2</option>
+ </select>
+ <select id="select_for_insert_bottom" name="select_for_insert_bottom">
+ <option>option 1</option>
+ <option>option 2</option>
+ </select>
+ <select id="select_for_insert_top" name="select_for_insert_top">
+ <option>option 1</option>
+ <option>option 2</option>
+ </select>
+</form>
+<div id="wrap-container"><p id="wrap"></p></div>
+
+<!-- Positioning methods bench -->
+<div id="body_absolute" style="position: absolute; top: 10px; left: 10px">
+ <div id="absolute_absolute" style="position: absolute; top: 10px; left:10px"> </div>
+ <div id="absolute_relative" style="position: relative; top: 10px; left:10px">
+ <div style="height:10px;font-size:2px">test<span id="inline">test</span></div>
+ <div id="absolute_relative_undefined">XYZ</div>
+ </div>
+ <div id="absolute_fixed" style="position: fixed; top: 10px; left: 10px">
+ <span id="absolute_fixed_absolute" style="position: absolute; top: 10px; left: 10px">foo</span>
+ <span id="absolute_fixed_undefined" style="display:block">bar</span>
+ </div></div>
+<div id="notInlineAbsoluted"></div>
+<div id="inlineAbsoluted" style="position: absolute"></div>
+
+<div id="unextended"></div>
+<div id="identification">
+ <div id="predefined_id"></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div id="anonymous_element_3"></div>
+</div>
+
+<div id='elementToViewportDimensions' style='display: none'></div>
+<div id="auto_dimensions" style="height:auto"></div>
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/element_mixins_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/element_mixins_test.html
new file mode 100644
index 0000000000..51a789e79b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/element_mixins_test.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Element mixins</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+ <script src="../fixtures/element_mixins.js" type="text/javascript" charset="utf-8"></script>
+
+
+ <script src="../element_mixins_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Element mixins</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<form id="form">
+ <input type="text" id="input" value="4" />
+ <input type="submit" />
+</form>
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/enumerable_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/enumerable_test.html
new file mode 100644
index 0000000000..8f462b6395
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/enumerable_test.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Enumerable</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+ <script src="../fixtures/enumerable.js" type="text/javascript" charset="utf-8"></script>
+
+
+ <script src="../enumerable_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Enumerable</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<table id="grepTable">
+<tbody id="grepTBody">
+ <tr id="grepRow">
+ <th id="grepHeader" class="cell"></th>
+ <td id="grepCell" class="cell"></td>
+ </tr>
+</tbody>
+</table>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/event_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/event_test.html
new file mode 100644
index 0000000000..12accf239f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/event_test.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Event</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../event_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Event</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="outer" style="display: none">
+ <p id="inner">One two three <span id="span">four</span></p>
+</div>
+<div id="container"><div></div></div>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/form_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/form_test.html
new file mode 100644
index 0000000000..14349eb511
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/form_test.html
@@ -0,0 +1,150 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Form</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../form_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Form</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<form id="form" method="get" action="fixtures/empty.js">
+ <input type="text" name="val1" id="input_enabled" value="4" />
+ <div>This is not a form element</div>
+ <input type="text" name="val2" id="input_disabled" disabled="disabled" value="5" />
+ <input type="submit" name="first_submit" value="Commit it!" />
+ <input type="submit" name="second_submit" value="Delete it!" />
+ <input type="text" name="action" value="blah" />
+</form>
+
+<form id="bigform" method="get" action="fixtures/empty.js">
+ <div id="inputs">
+ <input type="text" name="dummy" id="dummy_disabled" disabled="disabled"/>
+ <input type="submit" name="commit" id="submit" />
+ <input type="button" name="clicky" value="click me" />
+ <input type="reset" name="revert" />
+ <input type="text" name="greeting" id="focus_text" value="Hello" />
+ </div>
+
+ <div id="buttons">
+ <button type="button" id="button_type_button" name="button">Click Me</button>
+ </div>div>
+
+ <!-- some edge cases in serialization -->
+ <div id="value_checks">
+ <input name="twin" type="text" value="" />
+ <input name="twin" type="text" value="siamese" />
+ <!-- Rails checkbox hack with hidden input: -->
+ <input name="checky" type="checkbox" id="checkbox_hack" value="1" />
+ <input name="checky" type="hidden" value="0" />
+ </div>
+
+ <!-- all variations of SELECT controls -->
+ <div id="selects_wrapper">
+ <select name="vu">
+ <option value="1" selected="selected">One</option>
+ <option value="2">Two</option>
+ <option value="3">Three</option>
+ </select>
+ <select id="multiSel1" name="vm[]" multiple="multiple">
+ <option id="multiSel1_opt1" value="1" selected="selected">One</option>
+ <option id="multiSel1_opt2" value="2">Two</option>
+ <option id="multiSel1_opt3" value="3" selected="selected">Three</option>
+ </select>
+ <select name="nvu">
+ <option selected="selected">One</option>
+ <option value="2">Two</option>
+ <option value="3">Three</option>
+ </select>
+
+ <fieldset id="selects_fieldset">
+ <select name="nvm[]" multiple="multiple">
+ <option selected="selected">One</option>
+ <option>Two</option>
+ <option selected="selected">Three</option>
+ </select>
+ <select name="evu">
+ <option value="" selected="selected">One</option>
+ <option value="2">Two</option>
+ <option value="3">Three</option>
+ </select>
+ <select name="evm[]" multiple="multiple">
+ <option value="" selected="selected">One</option>
+ <option>Two</option>
+ <option selected="selected">Three</option>
+ </select>
+ </fieldset>
+ </div>
+
+ <div id="various">
+ <select name="tf_selectOne"><option selected="selected"></option><option>1</option></select>
+ <textarea name="tf_textarea"></textarea>
+ <input type="checkbox" name="tf_checkbox" value="on" />
+ <select name="tf_selectMany" multiple="multiple"></select>
+ <input type="text" name="tf_text" />
+ <div>This is not a form element</div>
+ <input type="radio" name="tf_radio" value="on" />
+ <input type="hidden" name="tf_hidden" />
+ <input type="password" name="tf_password" />
+ </div>
+</form>
+
+<form id="form_focus_hidden" style="display: none">
+ <input type="text" />
+</form>
+
+<form id="form_with_file_input">
+ <input type="file" name="file_name" value="foo" />
+</form>
+
+<!-- tabindexed forms -->
+<div id="tabindex">
+ <form id="ffe">
+ <p><input type="text" disabled="disabled" id="ffe_disabled" /></p>
+ <input type="hidden" id="ffe_hidden" />
+ <input type="checkbox" id="ffe_checkbox" />
+ </form>
+
+ <form id="ffe_ti">
+ <p><input type="text" disabled="disabled" id="ffe_ti_disabled" /></p>
+ <input type="hidden" id="ffe_ti_hidden" />
+ <input type="checkbox" id="ffe_ti_checkbox" />
+ <input type="submit" id="ffe_ti_submit" tabindex="1" />
+ </form>
+
+ <form id="ffe_ti2">
+ <p><input type="text" disabled="disabled" id="ffe_ti2_disabled" /></p>
+ <input type="hidden" id="ffe_ti2_hidden" />
+ <input type="checkbox" id="ffe_ti2_checkbox" tabindex="0" />
+ <input type="submit" id="ffe_ti2_submit" tabindex="1" />
+ </form>
+
+</div>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/hash_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/hash_test.html
new file mode 100644
index 0000000000..4e4f0be75d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/hash_test.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Hash</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+ <script src="../fixtures/hash.js" type="text/javascript" charset="utf-8"></script>
+
+
+ <script src="../hash_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Hash</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/number_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/number_test.html
new file mode 100644
index 0000000000..85eed3191b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/number_test.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Number</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../number_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Number</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/position_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/position_test.html
new file mode 100644
index 0000000000..78ed551d0e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/position_test.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Position</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../position_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Position</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="ensure_scrollbars" style="width:10000px; height:10000px; position:absolute" > </div>
+
+<div id="body_absolute" style="position: absolute; top: 10px; left: 10px">
+ <div id="absolute_absolute" style="position: absolute; top: 10px; left:10px"> </div>
+ <div id="absolute_relative" style="position: relative; top: 10px; left:10px">
+ <div style="height:10px;font-size:2px">test<span id="inline">test</span></div>
+ <div id="absolute_relative_undefined"> </div>
+ </div>
+</div>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/range_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/range_test.html
new file mode 100644
index 0000000000..cbc6f828b6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/range_test.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Range</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../range_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Range</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/selector_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/selector_test.html
new file mode 100644
index 0000000000..84bde55e50
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/selector_test.html
@@ -0,0 +1,107 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Selector</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../selector_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Selector</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="fixtures" style="display: none">
+ <h1 class="title">Some title <span>here</span></h1>
+ <p id="p" class="first summary">
+ <strong id="strong">This</strong> is a short blurb
+ <a id="link_1" class="first internal" rel="external nofollow" href="#">with a <em id="em2">link</em></a> or
+ <a id="link_2" class="internal highlight" href="#"><em id="em">two</em></a>.
+ Or <cite id="with_title" title="hello world!">a citation</cite>.
+ </p>
+ <ul id="list">
+ <li id="item_1" class="first"><a id="link_3" href="#" class="external"><span id="span">Another link</span></a></li>
+ <li id="item_2">Some text</li>
+ <li id="item_3" xml:lang="es-us" class="">Otra cosa</li>
+ </ul>
+
+ <!-- this form has a field with the name 'id',
+ therefore its ID property won't be 'troubleForm': -->
+ <form id="troubleForm">
+ <input type="hidden" name="id" id="hidden" />
+ <input type="text" name="disabled_text_field" id="disabled_text_field" disabled="disabled" />
+ <input type="text" name="enabled_text_field" id="enabled_text_field" />
+ <input type="checkbox" name="checkboxes" id="checked_box" checked="checked" value="Checked" />
+ <input type="checkbox" name="checkboxes" id="unchecked_box" value="Unchecked"/>
+ <input type="radio" name="radiobuttons" id="checked_radio" checked="checked" value="Checked" />
+ <input type="radio" name="radiobuttons" id="unchecked_radio" value="Unchecked" />
+ </form>
+
+ <form id="troubleForm2">
+ <input type="checkbox" name="brackets[5][]" id="chk_1" checked="checked" value="1" />
+ <input type="checkbox" name="brackets[5][]" id="chk_2" value="2" />
+ </form>
+
+ <div id="level1">
+ <span id="level2_1">
+ <span id="level3_1"></span>
+ <!-- This comment should be ignored by the adjacent selector -->
+ <span id="level3_2"></span>
+ </span>
+ <span id="level2_2">
+ <em id="level_only_child">
+ </em>
+ </span>
+ <div id="level2_3"></div>
+ </div> <!-- #level1 -->
+
+ <div id="dupContainer">
+ <span id="dupL1" class="span_foo span_bar">
+ <span id="dupL2">
+ <span id="dupL3">
+ <span id="dupL4">
+ <span id="dupL5"></span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </div> <!-- #dupContainer -->
+
+ <div id="grandfather"> grandfather
+ <div id="father" class="brothers men"> father
+ <div id="son"> son </div>
+ </div>
+ <div id="uncle" class="brothers men"> uncle </div>
+ </div>
+
+ <form id="commaParent" title="commas,are,good">
+ <input type="hidden" id="commaChild" name="foo" value="#commaOne,#commaTwo" />
+ <input type="hidden" id="commaTwo" name="foo2" value="oops" />
+ </form>
+ <div id="counted_container"><div class="is_counted"></div></div>
+</div>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/string_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/string_test.html
new file mode 100644
index 0000000000..74564fc0ce
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/string_test.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | String</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+ <script src="../fixtures/string.js" type="text/javascript" charset="utf-8"></script>
+
+
+ <script src="../string_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>String</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/unit_test.html b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/unit_test.html
new file mode 100644
index 0000000000..b684225ba5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/unit_test.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Prototype Unit test file | Unittest</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" charset="utf-8">
+ var eventResults = {};
+ var originalElement = window.Element;
+ </script>
+ <script src="../../../dist/prototype.js" type="text/javascript"></script>
+ <script src="../../lib/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../../test.css" type="text/css" />
+
+
+
+
+
+ <script src="../unittest_test.js" type="text/javascript"></script>
+</head>
+<body>
+<h1>Prototype Unit test file</h1>
+<h2>Unittest</h2>
+
+<!-- This file is programmatically generated. Do not attempt to modify it. Instead, modify -->
+
+<!-- Log output start -->
+<div id="testlog"></div>
+<!-- Log output end -->
+
+<!-- HTML Fixtures start -->
+<div id="testlog_2"> </div>
+
+<!-- Test elements follow -->
+<div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div>
+
+<div id="test_2"> <span> </span>
+
+
+
+<div><div></div> </div><span> </span>
+</div>
+
+<ul id="tlist"><li id="tlist_1">x1</li><li id="tlist_2">x2</li></ul>
+<ul id="tlist2"><li class="a" id="tlist2_1">x1</li><li id="tlist2_2">x2</li></ul>
+
+<div id="testmoveby" style="background-color:#333;width:100px;">XXXX</div>
+
+<div id="testcss1">testcss1<span id="testcss1_span" style="display:none;">blah</span></div><div id="testcss2">testcss1</div>
+
+<!-- HTML Fixtures end -->
+</body>
+</html>
+<script type="text/javascript" charset="utf-8">
+ eventResults.endOfDocument = true;
+</script>
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/unittest_test.js b/dom/tests/mochitest/ajax/prototype/test/unit/unittest_test.js
new file mode 100644
index 0000000000..e7afdd60bf
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/unittest_test.js
@@ -0,0 +1,143 @@
+var testObj = {
+ isNice: function() {
+ return true;
+ },
+ isBroken: function() {
+ return false;
+ }
+}
+
+new Test.Unit.Runner({
+
+ testBuildMessage: function() {
+ this.assertEqual("'foo' 'bar'", this.buildMessage('', '? ?', 'foo', 'bar'))
+ },
+
+ testAssertEqual: function() {
+ this.assertEqual(0, 0);
+ this.assertEqual(0, 0, "test");
+
+ this.assertEqual(0,'0');
+ this.assertEqual(65.0, 65);
+
+ this.assertEqual("a", "a");
+ this.assertEqual("a", "a", "test");
+
+ this.assertNotEqual(0, 1);
+ this.assertNotEqual("a","b");
+ this.assertNotEqual({},{});
+ this.assertNotEqual([],[]);
+ this.assertNotEqual([],{});
+ },
+
+ testAssertEnumEqual: function() {
+ this.assertEnumEqual([], []);
+ this.assertEnumEqual(['a', 'b'], ['a', 'b']);
+ this.assertEnumEqual(['1', '2'], [1, 2]);
+ this.assertEnumNotEqual(['1', '2'], [1, 2, 3]);
+ },
+
+ testAssertHashEqual: function() {
+ this.assertHashEqual({}, {});
+ this.assertHashEqual({a:'b'}, {a:'b'});
+ this.assertHashEqual({a:'b', c:'d'}, {c:'d', a:'b'});
+ this.assertHashNotEqual({a:'b', c:'d'}, {c:'d', a:'boo!'});
+ },
+
+ testAssertRespondsTo: function() {
+ this.assertRespondsTo('isNice', testObj);
+ this.assertRespondsTo('isBroken', testObj);
+ },
+
+ testAssertIdentical: function() {
+ this.assertIdentical(0, 0);
+ this.assertIdentical(0, 0, "test");
+ this.assertIdentical(1, 1);
+ this.assertIdentical('a', 'a');
+ this.assertIdentical('a', 'a', "test");
+ this.assertIdentical('', '');
+ this.assertIdentical(undefined, undefined);
+ this.assertIdentical(null, null);
+ this.assertIdentical(true, true);
+ this.assertIdentical(false, false);
+
+ var obj = {a:'b'};
+ this.assertIdentical(obj, obj);
+
+ this.assertNotIdentical({1:2,3:4},{1:2,3:4});
+
+ this.assertIdentical(1, 1.0); // both are typeof == 'number'
+
+ this.assertNotIdentical(1, '1');
+ this.assertNotIdentical(1, '1.0');
+ },
+
+ testAssertNullAndAssertUndefined: function() {
+ this.assertNull(null);
+ this.assertNotNull(undefined);
+ this.assertNotNull(0);
+ this.assertNotNull('');
+ this.assertNotUndefined(null);
+ this.assertUndefined(undefined);
+ this.assertNotUndefined(0);
+ this.assertNotUndefined('');
+ this.assertNullOrUndefined(null);
+ this.assertNullOrUndefined(undefined);
+ this.assertNotNullOrUndefined(0);
+ this.assertNotNullOrUndefined('');
+ },
+
+ testAssertMatch: function() {
+ this.assertMatch(/knowmad.jpg$/, 'http://script.aculo.us/images/knowmad.jpg');
+ this.assertMatch(/Fuc/, 'Thomas Fuchs');
+ this.assertMatch(/^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/, '$19.95');
+ this.assertMatch(/(\d{3}\) ?)|(\d{3}[- \.])?\d{3}[- \.]\d{4}(\s(x\d+)?){0,1}$/, '704-343-9330');
+ this.assertMatch(/^(?:(?:(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\/|-|\.)(?:0?2\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\d)?\d{2})(\/|-|\.)(?:(?:(?:0?[13578]|1[02])\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\2(?:0?[1-9]|1\d|2[0-8]))))$/, '2001-06-16');
+ this.assertMatch(/^((0?[123456789])|(1[012]))\s*:\s*([012345]\d)(\s*:\s*([012345]\d))?\s*[ap]m\s*-\s*((0?[123456789])|(1[012]))\s*:\s*([012345]\d)(\s*:\s*([012345]\d))?\s*[ap]m$/i, '2:00PM-2:15PM');
+ this.assertNoMatch(/zubar/, 'foo bar');
+ },
+
+ testAssertInstanceOf: function() {
+ this.assertInstanceOf(String, new String);
+ this.assertInstanceOf(RegExp, /foo/);
+ this.assertNotInstanceOf(String, {});
+ },
+
+ testAssertVisible: function() {
+ this.assertVisible('testcss1');
+ this.assertNotVisible('testcss1_span');
+ //this.assertNotVisible('testcss2', "Due to a Safari bug, this test fails in Safari.");
+
+ Element.hide('testcss1');
+ this.assertNotVisible('testcss1');
+ this.assertNotVisible('testcss1_span');
+ Element.show('testcss1');
+ this.assertVisible('testcss1');
+ this.assertNotVisible('testcss1_span');
+
+ Element.show('testcss1_span');
+ this.assertVisible('testcss1_span');
+ Element.hide('testcss1');
+ this.assertNotVisible('testcss1_span'); // hidden by parent
+ },
+
+ testAssertElementsMatch: function() {
+ this.assertElementsMatch($$('#tlist'), '#tlist');
+ this.assertElementMatches($('tlist'), '#tlist');
+ }
+});
+
+/* This test was disabled in bug 486256, because we don't support having two
+ * Runners in one file.
+ */
+/*
+new Test.Unit.Runner({
+ testDummy: function() {
+ this.assert(true);
+ },
+
+ testMultipleTestRunner: function() {
+ this.assertEqual('passed', $('testlog_2').down('td', 1).innerHTML);
+ }
+}, {testLog: 'testlog_2'});
+*/
diff --git a/dom/tests/mochitest/ajax/prototype/test_Prototype.html b/dom/tests/mochitest/ajax/prototype/test_Prototype.html
new file mode 100644
index 0000000000..a650949955
--- /dev/null
+++ b/dom/tests/mochitest/ajax/prototype/test_Prototype.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Prototype</title>
+ <script src="/MochiKit/Base.js"></script>
+ <script src="/MochiKit/Async.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="../lib/AJAX_setup.js"></script>
+ <link rel="stylesheet" type="text/css" href="../lib/test.css" />
+</head>
+<body>
+ <iframe width="100%" height="500" id="testframe" src=""></iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/ajax/scriptaculous/lib/prototype.js b/dom/tests/mochitest/ajax/scriptaculous/lib/prototype.js
new file mode 100644
index 0000000000..1beb8a89ab
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/lib/prototype.js
@@ -0,0 +1,3271 @@
+/* Prototype JavaScript framework, version 1.5.1_rc4
+ * (c) 2005-2007 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+/*--------------------------------------------------------------------------*/
+
+var Prototype = {
+ Version: '1.5.1_rc4',
+
+ Browser: {
+ IE: !!(window.attachEvent && !window.opera),
+ Opera: !!window.opera,
+ WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
+ Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1
+ },
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+ ElementExtensions: !!window.HTMLElement,
+ SpecificElementExtensions:
+ (document.createElement('div').__proto__ !==
+ document.createElement('form').__proto__)
+ },
+
+ ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>',
+ JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/,
+
+ emptyFunction: function() { },
+ K: function(x) { return x }
+}
+
+var Class = {
+ create: function() {
+ return function() {
+ this.initialize.apply(this, arguments);
+ }
+ }
+}
+
+var Abstract = new Object();
+
+Object.extend = function(destination, source) {
+ for (var property in source) {
+ destination[property] = source[property];
+ }
+ return destination;
+}
+
+Object.extend(Object, {
+ inspect: function(object) {
+ try {
+ if (object === undefined) return 'undefined';
+ if (object === null) return 'null';
+ return object.inspect ? object.inspect() : object.toString();
+ } catch (e) {
+ if (e instanceof RangeError) return '...';
+ throw e;
+ }
+ },
+
+ toJSON: function(object) {
+ var type = typeof object;
+ switch(type) {
+ case 'undefined':
+ case 'function':
+ case 'unknown': return;
+ case 'boolean': return object.toString();
+ }
+ if (object === null) return 'null';
+ if (object.toJSON) return object.toJSON();
+ if (object.ownerDocument === document) return;
+ var results = [];
+ for (var property in object) {
+ var value = Object.toJSON(object[property]);
+ if (value !== undefined)
+ results.push(property.toJSON() + ': ' + value);
+ }
+ return '{' + results.join(', ') + '}';
+ },
+
+ keys: function(object) {
+ var keys = [];
+ for (var property in object)
+ keys.push(property);
+ return keys;
+ },
+
+ values: function(object) {
+ var values = [];
+ for (var property in object)
+ values.push(object[property]);
+ return values;
+ },
+
+ clone: function(object) {
+ return Object.extend({}, object);
+ }
+});
+
+Function.prototype.bind = function() {
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function() {
+ return __method.apply(object, args.concat($A(arguments)));
+ }
+}
+
+Function.prototype.bindAsEventListener = function(object) {
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function(event) {
+ return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
+ }
+}
+
+Object.extend(Number.prototype, {
+ toColorPart: function() {
+ return this.toPaddedString(2, 16);
+ },
+
+ succ: function() {
+ return this + 1;
+ },
+
+ times: function(iterator) {
+ $R(0, this, true).each(iterator);
+ return this;
+ },
+
+ toPaddedString: function(length, radix) {
+ var string = this.toString(radix || 10);
+ return '0'.times(length - string.length) + string;
+ },
+
+ toJSON: function() {
+ return isFinite(this) ? this.toString() : 'null';
+ }
+});
+
+Date.prototype.toJSON = function() {
+ return '"' + this.getFullYear() + '-' +
+ (this.getMonth() + 1).toPaddedString(2) + '-' +
+ this.getDate().toPaddedString(2) + 'T' +
+ this.getHours().toPaddedString(2) + ':' +
+ this.getMinutes().toPaddedString(2) + ':' +
+ this.getSeconds().toPaddedString(2) + '"';
+};
+
+var Try = {
+ these: function() {
+ var returnValue;
+
+ for (var i = 0, length = arguments.length; i < length; i++) {
+ var lambda = arguments[i];
+ try {
+ returnValue = lambda();
+ break;
+ } catch (e) {}
+ }
+
+ return returnValue;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+ initialize: function(callback, frequency) {
+ this.callback = callback;
+ this.frequency = frequency;
+ this.currentlyExecuting = false;
+
+ this.registerCallback();
+ },
+
+ registerCallback: function() {
+ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ stop: function() {
+ if (!this.timer) return;
+ clearInterval(this.timer);
+ this.timer = null;
+ },
+
+ onTimerEvent: function() {
+ if (!this.currentlyExecuting) {
+ try {
+ this.currentlyExecuting = true;
+ this.callback(this);
+ } finally {
+ this.currentlyExecuting = false;
+ }
+ }
+ }
+}
+Object.extend(String, {
+ interpret: function(value) {
+ return value == null ? '' : String(value);
+ },
+ specialChar: {
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '\\': '\\\\'
+ }
+});
+
+Object.extend(String.prototype, {
+ gsub: function(pattern, replacement) {
+ var result = '', source = this, match;
+ replacement = arguments.callee.prepareReplacement(replacement);
+
+ while (source.length > 0) {
+ if (match = source.match(pattern)) {
+ result += source.slice(0, match.index);
+ result += String.interpret(replacement(match));
+ source = source.slice(match.index + match[0].length);
+ } else {
+ result += source, source = '';
+ }
+ }
+ return result;
+ },
+
+ sub: function(pattern, replacement, count) {
+ replacement = this.gsub.prepareReplacement(replacement);
+ count = count === undefined ? 1 : count;
+
+ return this.gsub(pattern, function(match) {
+ if (--count < 0) return match[0];
+ return replacement(match);
+ });
+ },
+
+ scan: function(pattern, iterator) {
+ this.gsub(pattern, iterator);
+ return this;
+ },
+
+ truncate: function(length, truncation) {
+ length = length || 30;
+ truncation = truncation === undefined ? '...' : truncation;
+ return this.length > length ?
+ this.slice(0, length - truncation.length) + truncation : this;
+ },
+
+ strip: function() {
+ return this.replace(/^\s+/, '').replace(/\s+$/, '');
+ },
+
+ stripTags: function() {
+ return this.replace(/<\/?[^>]+>/gi, '');
+ },
+
+ stripScripts: function() {
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+ },
+
+ extractScripts: function() {
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+ var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+ return (this.match(matchAll) || []).map(function(scriptTag) {
+ return (scriptTag.match(matchOne) || ['', ''])[1];
+ });
+ },
+
+ evalScripts: function() {
+ return this.extractScripts().map(function(script) { return eval(script) });
+ },
+
+ escapeHTML: function() {
+ var self = arguments.callee;
+ self.text.data = this;
+ return self.div.innerHTML;
+ },
+
+ unescapeHTML: function() {
+ var div = document.createElement('div');
+ div.innerHTML = this.stripTags();
+ return div.childNodes[0] ? (div.childNodes.length > 1 ?
+ $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
+ div.childNodes[0].nodeValue) : '';
+ },
+
+ toQueryParams: function(separator) {
+ var match = this.strip().match(/([^?#]*)(#.*)?$/);
+ if (!match) return {};
+
+ return match[1].split(separator || '&').inject({}, function(hash, pair) {
+ if ((pair = pair.split('='))[0]) {
+ var key = decodeURIComponent(pair.shift());
+ var value = pair.length > 1 ? pair.join('=') : pair[0];
+ if (value != undefined) value = decodeURIComponent(value);
+
+ if (key in hash) {
+ if (hash[key].constructor != Array) hash[key] = [hash[key]];
+ hash[key].push(value);
+ }
+ else hash[key] = value;
+ }
+ return hash;
+ });
+ },
+
+ toArray: function() {
+ return this.split('');
+ },
+
+ succ: function() {
+ return this.slice(0, this.length - 1) +
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+ },
+
+ times: function(count) {
+ var result = '';
+ for (var i = 0; i < count; i++) result += this;
+ return result;
+ },
+
+ camelize: function() {
+ var parts = this.split('-'), len = parts.length;
+ if (len == 1) return parts[0];
+
+ var camelized = this.charAt(0) == '-'
+ ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
+ : parts[0];
+
+ for (var i = 1; i < len; i++)
+ camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
+
+ return camelized;
+ },
+
+ capitalize: function() {
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+ },
+
+ underscore: function() {
+ return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
+ },
+
+ dasherize: function() {
+ return this.gsub(/_/,'-');
+ },
+
+ inspect: function(useDoubleQuotes) {
+ var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
+ var character = String.specialChar[match[0]];
+ return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
+ });
+ if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
+ return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+ },
+
+ toJSON: function() {
+ return this.inspect(true);
+ },
+
+ unfilterJSON: function(filter) {
+ return this.sub(filter || Prototype.JSONFilter, '#{1}');
+ },
+
+ evalJSON: function(sanitize) {
+ var json = this.unfilterJSON();
+ try {
+ if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)))
+ return eval('(' + json + ')');
+ } catch (e) { }
+ throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
+ },
+
+ include: function(pattern) {
+ return this.indexOf(pattern) > -1;
+ },
+
+ startsWith: function(pattern) {
+ return this.indexOf(pattern) === 0;
+ },
+
+ endsWith: function(pattern) {
+ var d = this.length - pattern.length;
+ return d >= 0 && this.lastIndexOf(pattern) === d;
+ },
+
+ empty: function() {
+ return this == '';
+ },
+
+ blank: function() {
+ return /^\s*$/.test(this);
+ }
+});
+
+if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
+ escapeHTML: function() {
+ return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+ },
+ unescapeHTML: function() {
+ return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
+ }
+});
+
+String.prototype.gsub.prepareReplacement = function(replacement) {
+ if (typeof replacement == 'function') return replacement;
+ var template = new Template(replacement);
+ return function(match) { return template.evaluate(match) };
+}
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+Object.extend(String.prototype.escapeHTML, {
+ div: document.createElement('div'),
+ text: document.createTextNode('')
+});
+
+with (String.prototype.escapeHTML) div.appendChild(text);
+
+var Template = Class.create();
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+Template.prototype = {
+ initialize: function(template, pattern) {
+ this.template = template.toString();
+ this.pattern = pattern || Template.Pattern;
+ },
+
+ evaluate: function(object) {
+ return this.template.gsub(this.pattern, function(match) {
+ var before = match[1];
+ if (before == '\\') return match[2];
+ return before + String.interpret(object[match[3]]);
+ });
+ }
+}
+
+var $break = {}, $continue = new Error('"throw $continue" is deprecated, use "return" instead');
+
+var Enumerable = {
+ each: function(iterator) {
+ var index = 0;
+ try {
+ this._each(function(value) {
+ iterator(value, index++);
+ });
+ } catch (e) {
+ if (e != $break) throw e;
+ }
+ return this;
+ },
+
+ eachSlice: function(number, iterator) {
+ var index = -number, slices = [], array = this.toArray();
+ while ((index += number) < array.length)
+ slices.push(array.slice(index, index+number));
+ return slices.map(iterator);
+ },
+
+ all: function(iterator) {
+ var result = true;
+ this.each(function(value, index) {
+ result = result && !!(iterator || Prototype.K)(value, index);
+ if (!result) throw $break;
+ });
+ return result;
+ },
+
+ any: function(iterator) {
+ var result = false;
+ this.each(function(value, index) {
+ if (result = !!(iterator || Prototype.K)(value, index))
+ throw $break;
+ });
+ return result;
+ },
+
+ collect: function(iterator) {
+ var results = [];
+ this.each(function(value, index) {
+ results.push((iterator || Prototype.K)(value, index));
+ });
+ return results;
+ },
+
+ detect: function(iterator) {
+ var result;
+ this.each(function(value, index) {
+ if (iterator(value, index)) {
+ result = value;
+ throw $break;
+ }
+ });
+ return result;
+ },
+
+ findAll: function(iterator) {
+ var results = [];
+ this.each(function(value, index) {
+ if (iterator(value, index))
+ results.push(value);
+ });
+ return results;
+ },
+
+ grep: function(pattern, iterator) {
+ var results = [];
+ this.each(function(value, index) {
+ var stringValue = value.toString();
+ if (stringValue.match(pattern))
+ results.push((iterator || Prototype.K)(value, index));
+ })
+ return results;
+ },
+
+ include: function(object) {
+ var found = false;
+ this.each(function(value) {
+ if (value == object) {
+ found = true;
+ throw $break;
+ }
+ });
+ return found;
+ },
+
+ inGroupsOf: function(number, fillWith) {
+ fillWith = fillWith === undefined ? null : fillWith;
+ return this.eachSlice(number, function(slice) {
+ while(slice.length < number) slice.push(fillWith);
+ return slice;
+ });
+ },
+
+ inject: function(memo, iterator) {
+ this.each(function(value, index) {
+ memo = iterator(memo, value, index);
+ });
+ return memo;
+ },
+
+ invoke: function(method) {
+ var args = $A(arguments).slice(1);
+ return this.map(function(value) {
+ return value[method].apply(value, args);
+ });
+ },
+
+ max: function(iterator) {
+ var result;
+ this.each(function(value, index) {
+ value = (iterator || Prototype.K)(value, index);
+ if (result == undefined || value >= result)
+ result = value;
+ });
+ return result;
+ },
+
+ min: function(iterator) {
+ var result;
+ this.each(function(value, index) {
+ value = (iterator || Prototype.K)(value, index);
+ if (result == undefined || value < result)
+ result = value;
+ });
+ return result;
+ },
+
+ partition: function(iterator) {
+ var trues = [], falses = [];
+ this.each(function(value, index) {
+ ((iterator || Prototype.K)(value, index) ?
+ trues : falses).push(value);
+ });
+ return [trues, falses];
+ },
+
+ pluck: function(property) {
+ var results = [];
+ this.each(function(value, index) {
+ results.push(value[property]);
+ });
+ return results;
+ },
+
+ reject: function(iterator) {
+ var results = [];
+ this.each(function(value, index) {
+ if (!iterator(value, index))
+ results.push(value);
+ });
+ return results;
+ },
+
+ sortBy: function(iterator) {
+ return this.map(function(value, index) {
+ return {value: value, criteria: iterator(value, index)};
+ }).sort(function(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }).pluck('value');
+ },
+
+ toArray: function() {
+ return this.map();
+ },
+
+ zip: function() {
+ var iterator = Prototype.K, args = $A(arguments);
+ if (typeof args.last() == 'function')
+ iterator = args.pop();
+
+ var collections = [this].concat(args).map($A);
+ return this.map(function(value, index) {
+ return iterator(collections.pluck(index));
+ });
+ },
+
+ size: function() {
+ return this.toArray().length;
+ },
+
+ inspect: function() {
+ return '#<Enumerable:' + this.toArray().inspect() + '>';
+ }
+}
+
+Object.extend(Enumerable, {
+ map: Enumerable.collect,
+ find: Enumerable.detect,
+ select: Enumerable.findAll,
+ member: Enumerable.include,
+ entries: Enumerable.toArray
+});
+var $A = Array.from = function(iterable) {
+ if (!iterable) return [];
+ if (iterable.toArray) {
+ return iterable.toArray();
+ } else {
+ var results = [];
+ for (var i = 0, length = iterable.length; i < length; i++)
+ results.push(iterable[i]);
+ return results;
+ }
+}
+
+if (Prototype.Browser.WebKit) {
+ $A = Array.from = function(iterable) {
+ if (!iterable) return [];
+ if (!(typeof iterable == 'function' && iterable == '[object NodeList]') &&
+ iterable.toArray) {
+ return iterable.toArray();
+ } else {
+ var results = [];
+ for (var i = 0, length = iterable.length; i < length; i++)
+ results.push(iterable[i]);
+ return results;
+ }
+ }
+}
+
+Object.extend(Array.prototype, Enumerable);
+
+if (!Array.prototype._reverse)
+ Array.prototype._reverse = Array.prototype.reverse;
+
+Object.extend(Array.prototype, {
+ _each: function(iterator) {
+ for (var i = 0, length = this.length; i < length; i++)
+ iterator(this[i]);
+ },
+
+ clear: function() {
+ this.length = 0;
+ return this;
+ },
+
+ first: function() {
+ return this[0];
+ },
+
+ last: function() {
+ return this[this.length - 1];
+ },
+
+ compact: function() {
+ return this.select(function(value) {
+ return value != null;
+ });
+ },
+
+ flatten: function() {
+ return this.inject([], function(array, value) {
+ return array.concat(value && value.constructor == Array ?
+ value.flatten() : [value]);
+ });
+ },
+
+ without: function() {
+ var values = $A(arguments);
+ return this.select(function(value) {
+ return !values.include(value);
+ });
+ },
+
+ indexOf: function(object) {
+ for (var i = 0, length = this.length; i < length; i++)
+ if (this[i] == object) return i;
+ return -1;
+ },
+
+ reverse: function(inline) {
+ return (inline !== false ? this : this.toArray())._reverse();
+ },
+
+ reduce: function() {
+ return this.length > 1 ? this : this[0];
+ },
+
+ uniq: function(sorted) {
+ return this.inject([], function(array, value, index) {
+ if (0 == index || (sorted ? array.last() != value : !array.include(value)))
+ array.push(value);
+ return array;
+ });
+ },
+
+ clone: function() {
+ return [].concat(this);
+ },
+
+ size: function() {
+ return this.length;
+ },
+
+ inspect: function() {
+ return '[' + this.map(Object.inspect).join(', ') + ']';
+ },
+
+ toJSON: function() {
+ var results = [];
+ this.each(function(object) {
+ var value = Object.toJSON(object);
+ if (value !== undefined) results.push(value);
+ });
+ return '[' + results.join(', ') + ']';
+ }
+});
+
+Array.prototype.toArray = Array.prototype.clone;
+
+function $w(string) {
+ string = string.strip();
+ return string ? string.split(/\s+/) : [];
+}
+
+if (Prototype.Browser.Opera){
+ Array.prototype.concat = function() {
+ var array = [];
+ for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
+ for (var i = 0, length = arguments.length; i < length; i++) {
+ if (arguments[i].constructor == Array) {
+ for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
+ array.push(arguments[i][j]);
+ } else {
+ array.push(arguments[i]);
+ }
+ }
+ return array;
+ }
+}
+var Hash = function(object) {
+ if (object instanceof Hash) this.merge(object);
+ else Object.extend(this, object || {});
+};
+
+Object.extend(Hash, {
+ toQueryString: function(obj) {
+ var parts = [];
+ parts.add = arguments.callee.addPair;
+
+ this.prototype._each.call(obj, function(pair) {
+ if (!pair.key) return;
+ var value = pair.value;
+
+ if (value && typeof value == 'object') {
+ if (value.constructor == Array) value.each(function(value) {
+ parts.add(pair.key, value);
+ });
+ return;
+ }
+ parts.add(pair.key, value);
+ });
+
+ return parts.join('&');
+ },
+
+ toJSON: function(object) {
+ var results = [];
+ this.prototype._each.call(object, function(pair) {
+ var value = Object.toJSON(pair.value);
+ if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value);
+ });
+ return '{' + results.join(', ') + '}';
+ }
+});
+
+Hash.toQueryString.addPair = function(key, value, prefix) {
+ key = encodeURIComponent(key);
+ if (value === undefined) this.push(key);
+ else this.push(key + '=' + (value == null ? '' : encodeURIComponent(value)));
+}
+
+Object.extend(Hash.prototype, Enumerable);
+Object.extend(Hash.prototype, {
+ _each: function(iterator) {
+ for (var key in this) {
+ var value = this[key];
+ if (value && value == Hash.prototype[key]) continue;
+
+ var pair = [key, value];
+ pair.key = key;
+ pair.value = value;
+ iterator(pair);
+ }
+ },
+
+ keys: function() {
+ return this.pluck('key');
+ },
+
+ values: function() {
+ return this.pluck('value');
+ },
+
+ merge: function(hash) {
+ return $H(hash).inject(this, function(mergedHash, pair) {
+ mergedHash[pair.key] = pair.value;
+ return mergedHash;
+ });
+ },
+
+ remove: function() {
+ var result;
+ for(var i = 0, length = arguments.length; i < length; i++) {
+ var value = this[arguments[i]];
+ if (value !== undefined){
+ if (result === undefined) result = value;
+ else {
+ if (result.constructor != Array) result = [result];
+ result.push(value)
+ }
+ }
+ delete this[arguments[i]];
+ }
+ return result;
+ },
+
+ toQueryString: function() {
+ return Hash.toQueryString(this);
+ },
+
+ inspect: function() {
+ return '#<Hash:{' + this.map(function(pair) {
+ return pair.map(Object.inspect).join(': ');
+ }).join(', ') + '}>';
+ },
+
+ toJSON: function() {
+ return Hash.toJSON(this);
+ }
+});
+
+function $H(object) {
+ if (object instanceof Hash) return object;
+ return new Hash(object);
+};
+
+// Safari iterates over shadowed properties
+if (function() {
+ var i = 0, Test = function(value) { this.key = value };
+ Test.prototype.key = 'foo';
+ for (var property in new Test('bar')) i++;
+ return i > 1;
+}()) Hash.prototype._each = function(iterator) {
+ var cache = [];
+ for (var key in this) {
+ var value = this[key];
+ if ((value && value == Hash.prototype[key]) || cache.include(key)) continue;
+ cache.push(key);
+ var pair = [key, value];
+ pair.key = key;
+ pair.value = value;
+ iterator(pair);
+ }
+};
+ObjectRange = Class.create();
+Object.extend(ObjectRange.prototype, Enumerable);
+Object.extend(ObjectRange.prototype, {
+ initialize: function(start, end, exclusive) {
+ this.start = start;
+ this.end = end;
+ this.exclusive = exclusive;
+ },
+
+ _each: function(iterator) {
+ var value = this.start;
+ while (this.include(value)) {
+ iterator(value);
+ value = value.succ();
+ }
+ },
+
+ include: function(value) {
+ if (value < this.start)
+ return false;
+ if (this.exclusive)
+ return value < this.end;
+ return value <= this.end;
+ }
+});
+
+var $R = function(start, end, exclusive) {
+ return new ObjectRange(start, end, exclusive);
+}
+
+var Ajax = {
+ getTransport: function() {
+ return Try.these(
+ function() {return new XMLHttpRequest()},
+ function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')}
+ ) || false;
+ },
+
+ activeRequestCount: 0
+}
+
+Ajax.Responders = {
+ responders: [],
+
+ _each: function(iterator) {
+ this.responders._each(iterator);
+ },
+
+ register: function(responder) {
+ if (!this.include(responder))
+ this.responders.push(responder);
+ },
+
+ unregister: function(responder) {
+ this.responders = this.responders.without(responder);
+ },
+
+ dispatch: function(callback, request, transport, json) {
+ this.each(function(responder) {
+ if (typeof responder[callback] == 'function') {
+ try {
+ responder[callback].apply(responder, [request, transport, json]);
+ } catch (e) {}
+ }
+ });
+ }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+ onCreate: function() {
+ Ajax.activeRequestCount++;
+ },
+ onComplete: function() {
+ Ajax.activeRequestCount--;
+ }
+});
+
+Ajax.Base = function() {};
+Ajax.Base.prototype = {
+ setOptions: function(options) {
+ this.options = {
+ method: 'post',
+ asynchronous: true,
+ contentType: 'application/x-www-form-urlencoded',
+ encoding: 'UTF-8',
+ parameters: ''
+ }
+ Object.extend(this.options, options || {});
+
+ this.options.method = this.options.method.toLowerCase();
+ if (typeof this.options.parameters == 'string')
+ this.options.parameters = this.options.parameters.toQueryParams();
+ }
+}
+
+Ajax.Request = Class.create();
+Ajax.Request.Events =
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
+ _complete: false,
+
+ initialize: function(url, options) {
+ this.transport = Ajax.getTransport();
+ this.setOptions(options);
+ this.request(url);
+ },
+
+ request: function(url) {
+ this.url = url;
+ this.method = this.options.method;
+ var params = Object.clone(this.options.parameters);
+
+ if (!['get', 'post'].include(this.method)) {
+ // simulate other verbs over post
+ params['_method'] = this.method;
+ this.method = 'post';
+ }
+
+ this.parameters = params;
+
+ if (params = Hash.toQueryString(params)) {
+ // when GET, append parameters to URL
+ if (this.method == 'get')
+ this.url += (this.url.include('?') ? '&' : '?') + params;
+ else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
+ params += '&_=';
+ }
+
+ try {
+ if (this.options.onCreate) this.options.onCreate(this.transport);
+ Ajax.Responders.dispatch('onCreate', this, this.transport);
+
+ this.transport.open(this.method.toUpperCase(), this.url,
+ this.options.asynchronous);
+
+ if (this.options.asynchronous)
+ setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
+
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
+ this.setRequestHeaders();
+
+ this.body = this.method == 'post' ? (this.options.postBody || params) : null;
+ this.transport.send(this.body);
+
+ /* Force Firefox to handle ready state 4 for synchronous requests */
+ if (!this.options.asynchronous && this.transport.overrideMimeType)
+ this.onStateChange();
+
+ }
+ catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+ onStateChange: function() {
+ var readyState = this.transport.readyState;
+ if (readyState > 1 && !((readyState == 4) && this._complete))
+ this.respondToReadyState(this.transport.readyState);
+ },
+
+ setRequestHeaders: function() {
+ var headers = {
+ 'X-Requested-With': 'XMLHttpRequest',
+ 'X-Prototype-Version': Prototype.Version,
+ 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+ };
+
+ if (this.method == 'post') {
+ headers['Content-type'] = this.options.contentType +
+ (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+ /* Force "Connection: close" for older Mozilla browsers to work
+ * around a bug where XMLHttpRequest sends an incorrect
+ * Content-length header. See Mozilla Bugzilla #246651.
+ */
+ if (this.transport.overrideMimeType &&
+ (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
+ headers['Connection'] = 'close';
+ }
+
+ // user-defined headers
+ if (typeof this.options.requestHeaders == 'object') {
+ var extras = this.options.requestHeaders;
+
+ if (typeof extras.push == 'function')
+ for (var i = 0, length = extras.length; i < length; i += 2)
+ headers[extras[i]] = extras[i+1];
+ else
+ $H(extras).each(function(pair) { headers[pair.key] = pair.value });
+ }
+
+ for (var name in headers)
+ this.transport.setRequestHeader(name, headers[name]);
+ },
+
+ success: function() {
+ return !this.transport.status
+ || (this.transport.status >= 200 && this.transport.status < 300);
+ },
+
+ respondToReadyState: function(readyState) {
+ var state = Ajax.Request.Events[readyState];
+ var transport = this.transport, json = this.evalJSON();
+
+ if (state == 'Complete') {
+ try {
+ this._complete = true;
+ (this.options['on' + this.transport.status]
+ || this.options['on' + (this.success() ? 'Success' : 'Failure')]
+ || Prototype.emptyFunction)(transport, json);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ var contentType = this.getHeader('Content-type');
+ if (contentType && contentType.strip().
+ match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
+ this.evalResponse();
+ }
+
+ try {
+ (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
+ Ajax.Responders.dispatch('on' + state, this, transport, json);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ if (state == 'Complete') {
+ // avoid memory leak in MSIE: clean up
+ this.transport.onreadystatechange = Prototype.emptyFunction;
+ }
+ },
+
+ getHeader: function(name) {
+ try {
+ return this.transport.getResponseHeader(name);
+ } catch (e) { return null }
+ },
+
+ evalJSON: function() {
+ try {
+ var json = this.getHeader('X-JSON');
+ return json ? json.evalJSON() : null;
+ } catch (e) { return null }
+ },
+
+ evalResponse: function() {
+ try {
+ return eval((this.transport.responseText || '').unfilterJSON());
+ } catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+ dispatchException: function(exception) {
+ (this.options.onException || Prototype.emptyFunction)(this, exception);
+ Ajax.Responders.dispatch('onException', this, exception);
+ }
+});
+
+Ajax.Updater = Class.create();
+
+Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
+ initialize: function(container, url, options) {
+ this.container = {
+ success: (container.success || container),
+ failure: (container.failure || (container.success ? null : container))
+ }
+
+ this.transport = Ajax.getTransport();
+ this.setOptions(options);
+
+ var onComplete = this.options.onComplete || Prototype.emptyFunction;
+ this.options.onComplete = (function(transport, param) {
+ this.updateContent();
+ onComplete(transport, param);
+ }).bind(this);
+
+ this.request(url);
+ },
+
+ updateContent: function() {
+ var receiver = this.container[this.success() ? 'success' : 'failure'];
+ var response = this.transport.responseText;
+
+ if (!this.options.evalScripts) response = response.stripScripts();
+
+ if (receiver = $(receiver)) {
+ if (this.options.insertion)
+ new this.options.insertion(receiver, response);
+ else
+ receiver.update(response);
+ }
+
+ if (this.success()) {
+ if (this.onComplete)
+ setTimeout(this.onComplete.bind(this), 10);
+ }
+ }
+});
+
+Ajax.PeriodicalUpdater = Class.create();
+Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
+ initialize: function(container, url, options) {
+ this.setOptions(options);
+ this.onComplete = this.options.onComplete;
+
+ this.frequency = (this.options.frequency || 2);
+ this.decay = (this.options.decay || 1);
+
+ this.updater = {};
+ this.container = container;
+ this.url = url;
+
+ this.start();
+ },
+
+ start: function() {
+ this.options.onComplete = this.updateComplete.bind(this);
+ this.onTimerEvent();
+ },
+
+ stop: function() {
+ this.updater.options.onComplete = undefined;
+ clearTimeout(this.timer);
+ (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+ },
+
+ updateComplete: function(request) {
+ if (this.options.decay) {
+ this.decay = (request.responseText == this.lastText ?
+ this.decay * this.options.decay : 1);
+
+ this.lastText = request.responseText;
+ }
+ this.timer = setTimeout(this.onTimerEvent.bind(this),
+ this.decay * this.frequency * 1000);
+ },
+
+ onTimerEvent: function() {
+ this.updater = new Ajax.Updater(this.container, this.url, this.options);
+ }
+});
+function $(element) {
+ if (arguments.length > 1) {
+ for (var i = 0, elements = [], length = arguments.length; i < length; i++)
+ elements.push($(arguments[i]));
+ return elements;
+ }
+ if (typeof element == 'string')
+ element = document.getElementById(element);
+ return Element.extend(element);
+}
+
+if (Prototype.BrowserFeatures.XPath) {
+ document._getElementsByXPath = function(expression, parentElement) {
+ var results = [];
+ var query = document.evaluate(expression, $(parentElement) || document,
+ null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ for (var i = 0, length = query.snapshotLength; i < length; i++)
+ results.push(query.snapshotItem(i));
+ return results;
+ };
+
+ document.getElementsByClassName = function(className, parentElement) {
+ var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
+ return document._getElementsByXPath(q, parentElement);
+ }
+
+} else document.getElementsByClassName = function(className, parentElement) {
+ var children = ($(parentElement) || document.body).getElementsByTagName('*');
+ var elements = [], child;
+ for (var i = 0, length = children.length; i < length; i++) {
+ child = children[i];
+ if (Element.hasClassName(child, className))
+ elements.push(Element.extend(child));
+ }
+ return elements;
+};
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Element) var Element = {};
+
+Element.extend = function(element) {
+ var F = Prototype.BrowserFeatures;
+ if (!element || !element.tagName || element.nodeType == 3 ||
+ element._extended || F.SpecificElementExtensions || element == window)
+ return element;
+
+ var methods = {}, tagName = element.tagName, cache = Element.extend.cache,
+ T = Element.Methods.ByTag;
+
+ // extend methods for all tags (Safari doesn't need this)
+ if (!F.ElementExtensions) {
+ Object.extend(methods, Element.Methods),
+ Object.extend(methods, Element.Methods.Simulated);
+ }
+
+ // extend methods for specific tags
+ if (T[tagName]) Object.extend(methods, T[tagName]);
+
+ for (var property in methods) {
+ var value = methods[property];
+ if (typeof value == 'function' && !(property in element))
+ element[property] = cache.findOrStore(value);
+ }
+
+ element._extended = Prototype.emptyFunction;
+ return element;
+};
+
+Element.extend.cache = {
+ findOrStore: function(value) {
+ return this[value] = this[value] || function() {
+ return value.apply(null, [this].concat($A(arguments)));
+ }
+ }
+};
+
+Element.Methods = {
+ visible: function(element) {
+ return $(element).style.display != 'none';
+ },
+
+ toggle: function(element) {
+ element = $(element);
+ Element[Element.visible(element) ? 'hide' : 'show'](element);
+ return element;
+ },
+
+ hide: function(element) {
+ $(element).style.display = 'none';
+ return element;
+ },
+
+ show: function(element) {
+ $(element).style.display = '';
+ return element;
+ },
+
+ remove: function(element) {
+ element = $(element);
+ element.parentNode.removeChild(element);
+ return element;
+ },
+
+ update: function(element, html) {
+ html = typeof html == 'undefined' ? '' : html.toString();
+ $(element).innerHTML = html.stripScripts();
+ setTimeout(function() {html.evalScripts()}, 10);
+ return element;
+ },
+
+ replace: function(element, html) {
+ element = $(element);
+ html = typeof html == 'undefined' ? '' : html.toString();
+ if (element.outerHTML) {
+ element.outerHTML = html.stripScripts();
+ } else {
+ var range = element.ownerDocument.createRange();
+ range.selectNodeContents(element);
+ element.parentNode.replaceChild(
+ range.createContextualFragment(html.stripScripts()), element);
+ }
+ setTimeout(function() {html.evalScripts()}, 10);
+ return element;
+ },
+
+ inspect: function(element) {
+ element = $(element);
+ var result = '<' + element.tagName.toLowerCase();
+ $H({'id': 'id', 'className': 'class'}).each(function(pair) {
+ var property = pair.first(), attribute = pair.last();
+ var value = (element[property] || '').toString();
+ if (value) result += ' ' + attribute + '=' + value.inspect(true);
+ });
+ return result + '>';
+ },
+
+ recursivelyCollect: function(element, property) {
+ element = $(element);
+ var elements = [];
+ while (element = element[property])
+ if (element.nodeType == 1)
+ elements.push(Element.extend(element));
+ return elements;
+ },
+
+ ancestors: function(element) {
+ return $(element).recursivelyCollect('parentNode');
+ },
+
+ descendants: function(element) {
+ return $A($(element).getElementsByTagName('*')).each(Element.extend);
+ },
+
+ firstDescendant: function(element) {
+ element = $(element).firstChild;
+ while (element && element.nodeType != 1) element = element.nextSibling;
+ return $(element);
+ },
+
+ immediateDescendants: function(element) {
+ if (!(element = $(element).firstChild)) return [];
+ while (element && element.nodeType != 1) element = element.nextSibling;
+ if (element) return [element].concat($(element).nextSiblings());
+ return [];
+ },
+
+ previousSiblings: function(element) {
+ return $(element).recursivelyCollect('previousSibling');
+ },
+
+ nextSiblings: function(element) {
+ return $(element).recursivelyCollect('nextSibling');
+ },
+
+ siblings: function(element) {
+ element = $(element);
+ return element.previousSiblings().reverse().concat(element.nextSiblings());
+ },
+
+ match: function(element, selector) {
+ if (typeof selector == 'string')
+ selector = new Selector(selector);
+ return selector.match($(element));
+ },
+
+ up: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(element.parentNode);
+ var ancestors = element.ancestors();
+ return expression ? Selector.findElement(ancestors, expression, index) :
+ ancestors[index || 0];
+ },
+
+ down: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return element.firstDescendant();
+ var descendants = element.descendants();
+ return expression ? Selector.findElement(descendants, expression, index) :
+ descendants[index || 0];
+ },
+
+ previous: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
+ var previousSiblings = element.previousSiblings();
+ return expression ? Selector.findElement(previousSiblings, expression, index) :
+ previousSiblings[index || 0];
+ },
+
+ next: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
+ var nextSiblings = element.nextSiblings();
+ return expression ? Selector.findElement(nextSiblings, expression, index) :
+ nextSiblings[index || 0];
+ },
+
+ getElementsBySelector: function() {
+ var args = $A(arguments), element = $(args.shift());
+ return Selector.findChildElements(element, args);
+ },
+
+ getElementsByClassName: function(element, className) {
+ return document.getElementsByClassName(className, element);
+ },
+
+ readAttribute: function(element, name) {
+ element = $(element);
+ if (Prototype.Browser.IE) {
+ if (!element.attributes) return null;
+ var t = Element._attributeTranslations;
+ if (t.values[name]) return t.values[name](element, name);
+ if (t.names[name]) name = t.names[name];
+ var attribute = element.attributes[name];
+ return attribute ? attribute.nodeValue : null;
+ }
+ return element.getAttribute(name);
+ },
+
+ getHeight: function(element) {
+ return $(element).getDimensions().height;
+ },
+
+ getWidth: function(element) {
+ return $(element).getDimensions().width;
+ },
+
+ classNames: function(element) {
+ return new Element.ClassNames(element);
+ },
+
+ hasClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ var elementClassName = element.className;
+ if (elementClassName.length == 0) return false;
+ if (elementClassName == className ||
+ elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
+ return true;
+ return false;
+ },
+
+ addClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ Element.classNames(element).add(className);
+ return element;
+ },
+
+ removeClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ Element.classNames(element).remove(className);
+ return element;
+ },
+
+ toggleClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
+ return element;
+ },
+
+ observe: function() {
+ Event.observe.apply(Event, arguments);
+ return $A(arguments).first();
+ },
+
+ stopObserving: function() {
+ Event.stopObserving.apply(Event, arguments);
+ return $A(arguments).first();
+ },
+
+ // removes whitespace-only text node children
+ cleanWhitespace: function(element) {
+ element = $(element);
+ var node = element.firstChild;
+ while (node) {
+ var nextNode = node.nextSibling;
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+ element.removeChild(node);
+ node = nextNode;
+ }
+ return element;
+ },
+
+ empty: function(element) {
+ return $(element).innerHTML.blank();
+ },
+
+ descendantOf: function(element, ancestor) {
+ element = $(element), ancestor = $(ancestor);
+ while (element = element.parentNode)
+ if (element == ancestor) return true;
+ return false;
+ },
+
+ scrollTo: function(element) {
+ element = $(element);
+ var pos = Position.cumulativeOffset(element);
+ window.scrollTo(pos[0], pos[1]);
+ return element;
+ },
+
+ getStyle: function(element, style) {
+ element = $(element);
+ style = style == 'float' ? 'cssFloat' : style.camelize();
+ var value = element.style[style];
+ if (!value) {
+ var css = document.defaultView.getComputedStyle(element, null);
+ value = css ? css[style] : null;
+ }
+ if (style == 'opacity') return value ? parseFloat(value) : 1.0;
+ return value == 'auto' ? null : value;
+ },
+
+ getOpacity: function(element) {
+ return $(element).getStyle('opacity');
+ },
+
+ setStyle: function(element, styles, camelized) {
+ element = $(element);
+ var elementStyle = element.style;
+
+ for (var property in styles)
+ if (property == 'opacity') element.setOpacity(styles[property])
+ else
+ elementStyle[(property == 'float' || property == 'cssFloat') ?
+ (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
+ (camelized ? property : property.camelize())] = styles[property];
+
+ return element;
+ },
+
+ setOpacity: function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1 || value === '') ? '' :
+ (value < 0.00001) ? 0 : value;
+ return element;
+ },
+
+ getDimensions: function(element) {
+ element = $(element);
+ var display = $(element).getStyle('display');
+ if (display != 'none' && display != null) // Safari bug
+ return {width: element.offsetWidth, height: element.offsetHeight};
+
+ // All *Width and *Height properties give 0 on elements with display none,
+ // so enable the element temporarily
+ var els = element.style;
+ var originalVisibility = els.visibility;
+ var originalPosition = els.position;
+ var originalDisplay = els.display;
+ els.visibility = 'hidden';
+ els.position = 'absolute';
+ els.display = 'block';
+ var originalWidth = element.clientWidth;
+ var originalHeight = element.clientHeight;
+ els.display = originalDisplay;
+ els.position = originalPosition;
+ els.visibility = originalVisibility;
+ return {width: originalWidth, height: originalHeight};
+ },
+
+ makePositioned: function(element) {
+ element = $(element);
+ var pos = Element.getStyle(element, 'position');
+ if (pos == 'static' || !pos) {
+ element._madePositioned = true;
+ element.style.position = 'relative';
+ // Opera returns the offset relative to the positioning context, when an
+ // element is position relative but top and left have not been defined
+ if (window.opera) {
+ element.style.top = 0;
+ element.style.left = 0;
+ }
+ }
+ return element;
+ },
+
+ undoPositioned: function(element) {
+ element = $(element);
+ if (element._madePositioned) {
+ element._madePositioned = undefined;
+ element.style.position =
+ element.style.top =
+ element.style.left =
+ element.style.bottom =
+ element.style.right = '';
+ }
+ return element;
+ },
+
+ makeClipping: function(element) {
+ element = $(element);
+ if (element._overflow) return element;
+ element._overflow = element.style.overflow || 'auto';
+ if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
+ element.style.overflow = 'hidden';
+ return element;
+ },
+
+ undoClipping: function(element) {
+ element = $(element);
+ if (!element._overflow) return element;
+ element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
+ element._overflow = null;
+ return element;
+ }
+};
+
+Object.extend(Element.Methods, {
+ childOf: Element.Methods.descendantOf,
+ childElements: Element.Methods.immediateDescendants
+});
+
+if (Prototype.Browser.Opera) {
+ Element.Methods._getStyle = Element.Methods.getStyle;
+ Element.Methods.getStyle = function(element, style) {
+ switch(style) {
+ case 'left':
+ case 'top':
+ case 'right':
+ case 'bottom':
+ if (Element._getStyle(element, 'position') == 'static') return null;
+ default: return Element._getStyle(element, style);
+ }
+ };
+}
+else if (Prototype.Browser.IE) {
+ Element.Methods.getStyle = function(element, style) {
+ element = $(element);
+ style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
+ var value = element.style[style];
+ if (!value && element.currentStyle) value = element.currentStyle[style];
+
+ if (style == 'opacity') {
+ if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
+ if (value[1]) return parseFloat(value[1]) / 100;
+ return 1.0;
+ }
+
+ if (value == 'auto') {
+ if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
+ return element['offset'+style.capitalize()] + 'px';
+ return null;
+ }
+ return value;
+ };
+
+ Element.Methods.setOpacity = function(element, value) {
+ element = $(element);
+ var filter = element.getStyle('filter'), style = element.style;
+ if (value == 1 || value === '') {
+ style.filter = filter.replace(/alpha\([^\)]*\)/gi,'');
+ return element;
+ } else if (value < 0.00001) value = 0;
+ style.filter = filter.replace(/alpha\([^\)]*\)/gi, '') +
+ 'alpha(opacity=' + (value * 100) + ')';
+ return element;
+ };
+
+ // IE is missing .innerHTML support for TABLE-related elements
+ Element.Methods.update = function(element, html) {
+ element = $(element);
+ html = typeof html == 'undefined' ? '' : html.toString();
+ var tagName = element.tagName.toUpperCase();
+ if (['THEAD','TBODY','TR','TD'].include(tagName)) {
+ var div = document.createElement('div');
+ switch (tagName) {
+ case 'THEAD':
+ case 'TBODY':
+ div.innerHTML = '<table><tbody>' + html.stripScripts() + '</tbody></table>';
+ depth = 2;
+ break;
+ case 'TR':
+ div.innerHTML = '<table><tbody><tr>' + html.stripScripts() + '</tr></tbody></table>';
+ depth = 3;
+ break;
+ case 'TD':
+ div.innerHTML = '<table><tbody><tr><td>' + html.stripScripts() + '</td></tr></tbody></table>';
+ depth = 4;
+ }
+ $A(element.childNodes).each(function(node) { element.removeChild(node) });
+ depth.times(function() { div = div.firstChild });
+ $A(div.childNodes).each(function(node) { element.appendChild(node) });
+ } else {
+ element.innerHTML = html.stripScripts();
+ }
+ setTimeout(function() { html.evalScripts() }, 10);
+ return element;
+ }
+}
+else if (Prototype.Browser.Gecko) {
+ Element.Methods.setOpacity = function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1) ? 0.999999 :
+ (value === '') ? '' : (value < 0.00001) ? 0 : value;
+ return element;
+ };
+}
+
+Element._attributeTranslations = {
+ names: {
+ colspan: "colSpan",
+ rowspan: "rowSpan",
+ valign: "vAlign",
+ datetime: "dateTime",
+ accesskey: "accessKey",
+ tabindex: "tabIndex",
+ enctype: "encType",
+ maxlength: "maxLength",
+ readonly: "readOnly",
+ longdesc: "longDesc"
+ },
+ values: {
+ _getAttr: function(element, attribute) {
+ return element.getAttribute(attribute, 2);
+ },
+ _flag: function(element, attribute) {
+ return $(element).hasAttribute(attribute) ? attribute : null;
+ },
+ style: function(element) {
+ return element.style.cssText.toLowerCase();
+ },
+ title: function(element) {
+ var node = element.getAttributeNode('title');
+ return node.specified ? node.nodeValue : null;
+ }
+ }
+};
+
+(function() {
+ Object.extend(this, {
+ href: this._getAttr,
+ src: this._getAttr,
+ type: this._getAttr,
+ disabled: this._flag,
+ checked: this._flag,
+ readonly: this._flag,
+ multiple: this._flag
+ });
+}).call(Element._attributeTranslations.values);
+
+Element.Methods.Simulated = {
+ hasAttribute: function(element, attribute) {
+ var t = Element._attributeTranslations, node;
+ attribute = t.names[attribute] || attribute;
+ node = $(element).getAttributeNode(attribute);
+ return node && node.specified;
+ }
+};
+
+Element.Methods.ByTag = {};
+
+Object.extend(Element, Element.Methods);
+
+if (!Prototype.BrowserFeatures.ElementExtensions &&
+ document.createElement('div').__proto__) {
+ window.HTMLElement = {};
+ window.HTMLElement.prototype = document.createElement('div').__proto__;
+ Prototype.BrowserFeatures.ElementExtensions = true;
+}
+
+Element.hasAttribute = function(element, attribute) {
+ if (element.hasAttribute) return element.hasAttribute(attribute);
+ return Element.Methods.Simulated.hasAttribute(element, attribute);
+};
+
+Element.addMethods = function(methods) {
+ var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
+
+ if (!methods) {
+ Object.extend(Form, Form.Methods);
+ Object.extend(Form.Element, Form.Element.Methods);
+ Object.extend(Element.Methods.ByTag, {
+ "FORM": Object.clone(Form.Methods),
+ "INPUT": Object.clone(Form.Element.Methods),
+ "SELECT": Object.clone(Form.Element.Methods),
+ "TEXTAREA": Object.clone(Form.Element.Methods)
+ });
+ }
+
+ if (arguments.length == 2) {
+ var tagName = methods;
+ methods = arguments[1];
+ }
+
+ if (!tagName) Object.extend(Element.Methods, methods || {});
+ else {
+ if (tagName.constructor == Array) tagName.each(extend);
+ else extend(tagName);
+ }
+
+ function extend(tagName) {
+ tagName = tagName.toUpperCase();
+ if (!Element.Methods.ByTag[tagName])
+ Element.Methods.ByTag[tagName] = {};
+ Object.extend(Element.Methods.ByTag[tagName], methods);
+ }
+
+ function copy(methods, destination, onlyIfAbsent) {
+ onlyIfAbsent = onlyIfAbsent || false;
+ var cache = Element.extend.cache;
+ for (var property in methods) {
+ var value = methods[property];
+ if (!onlyIfAbsent || !(property in destination))
+ destination[property] = cache.findOrStore(value);
+ }
+ }
+
+ function findDOMClass(tagName) {
+ var klass;
+ var trans = {
+ "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
+ "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
+ "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
+ "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
+ "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
+ "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
+ "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
+ "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
+ "FrameSet", "IFRAME": "IFrame"
+ };
+ if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
+ if (window[klass]) return window[klass];
+ klass = 'HTML' + tagName + 'Element';
+ if (window[klass]) return window[klass];
+ klass = 'HTML' + tagName.capitalize() + 'Element';
+ if (window[klass]) return window[klass];
+
+ window[klass] = {};
+ window[klass].prototype = document.createElement(tagName).__proto__;
+ return window[klass];
+ }
+
+ if (F.ElementExtensions) {
+ copy(Element.Methods, HTMLElement.prototype);
+ copy(Element.Methods.Simulated, HTMLElement.prototype, true);
+ }
+
+ if (F.SpecificElementExtensions) {
+ for (var tag in Element.Methods.ByTag) {
+ var klass = findDOMClass(tag);
+ if (typeof klass == "undefined") continue;
+ copy(T[tag], klass.prototype);
+ }
+ }
+
+ Object.extend(Element, Element.Methods);
+ delete Element.ByTag;
+};
+
+var Toggle = { display: Element.toggle };
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.Insertion = function(adjacency) {
+ this.adjacency = adjacency;
+}
+
+Abstract.Insertion.prototype = {
+ initialize: function(element, content) {
+ this.element = $(element);
+ this.content = content.stripScripts();
+
+ if (this.adjacency && this.element.insertAdjacentHTML) {
+ try {
+ this.element.insertAdjacentHTML(this.adjacency, this.content);
+ } catch (e) {
+ var tagName = this.element.tagName.toUpperCase();
+ if (['TBODY', 'TR'].include(tagName)) {
+ this.insertContent(this.contentFromAnonymousTable());
+ } else {
+ throw e;
+ }
+ }
+ } else {
+ this.range = this.element.ownerDocument.createRange();
+ if (this.initializeRange) this.initializeRange();
+ this.insertContent([this.range.createContextualFragment(this.content)]);
+ }
+
+ setTimeout(function() {content.evalScripts()}, 10);
+ },
+
+ contentFromAnonymousTable: function() {
+ var div = document.createElement('div');
+ div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
+ return $A(div.childNodes[0].childNodes[0].childNodes);
+ }
+}
+
+var Insertion = new Object();
+
+Insertion.Before = Class.create();
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
+ initializeRange: function() {
+ this.range.setStartBefore(this.element);
+ },
+
+ insertContent: function(fragments) {
+ fragments.each((function(fragment) {
+ this.element.parentNode.insertBefore(fragment, this.element);
+ }).bind(this));
+ }
+});
+
+Insertion.Top = Class.create();
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
+ initializeRange: function() {
+ this.range.selectNodeContents(this.element);
+ this.range.collapse(true);
+ },
+
+ insertContent: function(fragments) {
+ fragments.reverse(false).each((function(fragment) {
+ this.element.insertBefore(fragment, this.element.firstChild);
+ }).bind(this));
+ }
+});
+
+Insertion.Bottom = Class.create();
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
+ initializeRange: function() {
+ this.range.selectNodeContents(this.element);
+ this.range.collapse(this.element);
+ },
+
+ insertContent: function(fragments) {
+ fragments.each((function(fragment) {
+ this.element.appendChild(fragment);
+ }).bind(this));
+ }
+});
+
+Insertion.After = Class.create();
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
+ initializeRange: function() {
+ this.range.setStartAfter(this.element);
+ },
+
+ insertContent: function(fragments) {
+ fragments.each((function(fragment) {
+ this.element.parentNode.insertBefore(fragment,
+ this.element.nextSibling);
+ }).bind(this));
+ }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+ initialize: function(element) {
+ this.element = $(element);
+ },
+
+ _each: function(iterator) {
+ this.element.className.split(/\s+/).select(function(name) {
+ return name.length > 0;
+ })._each(iterator);
+ },
+
+ set: function(className) {
+ this.element.className = className;
+ },
+
+ add: function(classNameToAdd) {
+ if (this.include(classNameToAdd)) return;
+ this.set($A(this).concat(classNameToAdd).join(' '));
+ },
+
+ remove: function(classNameToRemove) {
+ if (!this.include(classNameToRemove)) return;
+ this.set($A(this).without(classNameToRemove).join(' '));
+ },
+
+ toString: function() {
+ return $A(this).join(' ');
+ }
+};
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
+ * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
+ * license. Please see http://www.yui-ext.com/ for more information. */
+
+var Selector = Class.create();
+
+Selector.prototype = {
+ initialize: function(expression) {
+ this.expression = expression.strip();
+ this.compileMatcher();
+ },
+
+ compileMatcher: function() {
+ // Selectors with namespaced attributes can't use the XPath version
+ if (Prototype.BrowserFeatures.XPath && !(/\[[\w-]*?:/).test(this.expression))
+ return this.compileXPathMatcher();
+
+ var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
+ c = Selector.criteria, le, p, m;
+
+ if (Selector._cache[e]) {
+ this.matcher = Selector._cache[e]; return;
+ }
+ this.matcher = ["this.matcher = function(root) {",
+ "var r = root, h = Selector.handlers, c = false, n;"];
+
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ p = ps[i];
+ if (m = e.match(p)) {
+ this.matcher.push(typeof c[i] == 'function' ? c[i](m) :
+ new Template(c[i]).evaluate(m));
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+
+ this.matcher.push("return h.unique(n);\n}");
+ eval(this.matcher.join('\n'));
+ Selector._cache[this.expression] = this.matcher;
+ },
+
+ compileXPathMatcher: function() {
+ var e = this.expression, ps = Selector.patterns,
+ x = Selector.xpath, le, m;
+
+ if (Selector._cache[e]) {
+ this.xpath = Selector._cache[e]; return;
+ }
+
+ this.matcher = ['.//*'];
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ if (m = e.match(ps[i])) {
+ this.matcher.push(typeof x[i] == 'function' ? x[i](m) :
+ new Template(x[i]).evaluate(m));
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+
+ this.xpath = this.matcher.join('');
+ Selector._cache[this.expression] = this.xpath;
+ },
+
+ findElements: function(root) {
+ root = root || document;
+ if (this.xpath) return document._getElementsByXPath(this.xpath, root);
+ return this.matcher(root);
+ },
+
+ match: function(element) {
+ return this.findElements(document).include(element);
+ },
+
+ toString: function() {
+ return this.expression;
+ },
+
+ inspect: function() {
+ return "#<Selector:" + this.expression.inspect() + ">";
+ }
+};
+
+Object.extend(Selector, {
+ _cache: {},
+
+ xpath: {
+ descendant: "//*",
+ child: "/*",
+ adjacent: "/following-sibling::*[1]",
+ laterSibling: '/following-sibling::*',
+ tagName: function(m) {
+ if (m[1] == '*') return '';
+ return "[local-name()='" + m[1].toLowerCase() +
+ "' or local-name()='" + m[1].toUpperCase() + "']";
+ },
+ className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
+ id: "[@id='#{1}']",
+ attrPresence: "[@#{1}]",
+ attr: function(m) {
+ m[3] = m[5] || m[6];
+ return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
+ },
+ pseudo: function(m) {
+ var h = Selector.xpath.pseudos[m[1]];
+ if (!h) return '';
+ if (typeof h === 'function') return h(m);
+ return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
+ },
+ operators: {
+ '=': "[@#{1}='#{3}']",
+ '!=': "[@#{1}!='#{3}']",
+ '^=': "[starts-with(@#{1}, '#{3}')]",
+ '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
+ '*=': "[contains(@#{1}, '#{3}')]",
+ '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
+ '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
+ },
+ pseudos: {
+ 'first-child': '[not(preceding-sibling::*)]',
+ 'last-child': '[not(following-sibling::*)]',
+ 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
+ 'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
+ 'checked': "[@checked]",
+ 'disabled': "[@disabled]",
+ 'enabled': "[not(@disabled)]",
+ 'not': function(m) {
+ var e = m[6], p = Selector.patterns,
+ x = Selector.xpath, le, m, v;
+
+ var exclusion = [];
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in p) {
+ if (m = e.match(p[i])) {
+ v = typeof x[i] == 'function' ? x[i](m) : new Template(x[i]).evaluate(m);
+ exclusion.push("(" + v.substring(1, v.length - 1) + ")");
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+ return "[not(" + exclusion.join(" and ") + ")]";
+ },
+ 'nth-child': function(m) {
+ return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
+ },
+ 'nth-last-child': function(m) {
+ return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
+ },
+ 'nth-of-type': function(m) {
+ return Selector.xpath.pseudos.nth("position() ", m);
+ },
+ 'nth-last-of-type': function(m) {
+ return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
+ },
+ 'first-of-type': function(m) {
+ m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
+ },
+ 'last-of-type': function(m) {
+ m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
+ },
+ 'only-of-type': function(m) {
+ var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
+ },
+ nth: function(fragment, m) {
+ var mm, formula = m[6], predicate;
+ if (formula == 'even') formula = '2n+0';
+ if (formula == 'odd') formula = '2n+1';
+ if (mm = formula.match(/^(\d+)$/)) // digit only
+ return '[' + fragment + "= " + mm[1] + ']';
+ if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+ if (mm[1] == "-") mm[1] = -1;
+ var a = mm[1] ? Number(mm[1]) : 1;
+ var b = mm[2] ? Number(mm[2]) : 0;
+ predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
+ "((#{fragment} - #{b}) div #{a} >= 0)]";
+ return new Template(predicate).evaluate({
+ fragment: fragment, a: a, b: b });
+ }
+ }
+ }
+ },
+
+ criteria: {
+ tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
+ className: 'n = h.className(n, r, "#{1}", c); c = false;',
+ id: 'n = h.id(n, r, "#{1}", c); c = false;',
+ attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
+ attr: function(m) {
+ m[3] = (m[5] || m[6]);
+ return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
+ },
+ pseudo: function(m) {
+ if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
+ return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
+ },
+ descendant: 'c = "descendant";',
+ child: 'c = "child";',
+ adjacent: 'c = "adjacent";',
+ laterSibling: 'c = "laterSibling";'
+ },
+
+ patterns: {
+ // combinators must be listed first
+ // (and descendant needs to be last combinator)
+ laterSibling: /^\s*~\s*/,
+ child: /^\s*>\s*/,
+ adjacent: /^\s*\+\s*/,
+ descendant: /^\s/,
+
+ // selectors follow
+ tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
+ id: /^#([\w\-\*]+)(\b|$)/,
+ className: /^\.([\w\-\*]+)(\b|$)/,
+ pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s)/,
+ attrPresence: /^\[([\w]+)\]/,
+ attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/
+ },
+
+ handlers: {
+ // UTILITY FUNCTIONS
+ // joins two collections
+ concat: function(a, b) {
+ for (var i = 0, node; node = b[i]; i++)
+ a.push(node);
+ return a;
+ },
+
+ // marks an array of nodes for counting
+ mark: function(nodes) {
+ for (var i = 0, node; node = nodes[i]; i++)
+ node._counted = true;
+ return nodes;
+ },
+
+ unmark: function(nodes) {
+ for (var i = 0, node; node = nodes[i]; i++)
+ node._counted = undefined;
+ return nodes;
+ },
+
+ // mark each child node with its position (for nth calls)
+ // "ofType" flag indicates whether we're indexing for nth-of-type
+ // rather than nth-child
+ index: function(parentNode, reverse, ofType) {
+ parentNode._counted = true;
+ if (reverse) {
+ for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
+ node = nodes[i];
+ if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
+ }
+ } else {
+ for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
+ if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
+ }
+ },
+
+ // filters out duplicates and extends all nodes
+ unique: function(nodes) {
+ if (nodes.length == 0) return nodes;
+ var results = [], n;
+ for (var i = 0, l = nodes.length; i < l; i++)
+ if (!(n = nodes[i])._counted) {
+ n._counted = true;
+ results.push(Element.extend(n));
+ }
+ return Selector.handlers.unmark(results);
+ },
+
+ // COMBINATOR FUNCTIONS
+ descendant: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ h.concat(results, node.getElementsByTagName('*'));
+ return results;
+ },
+
+ child: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
+ if (child.nodeType == 1 && child.tagName != '!') results.push(child);
+ }
+ return results;
+ },
+
+ adjacent: function(nodes) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ var next = this.nextElementSibling(node);
+ if (next) results.push(next);
+ }
+ return results;
+ },
+
+ laterSibling: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ h.concat(results, Element.nextSiblings(node));
+ return results;
+ },
+
+ nextElementSibling: function(node) {
+ while (node = node.nextSibling)
+ if (node.nodeType == 1) return node;
+ return null;
+ },
+
+ previousElementSibling: function(node) {
+ while (node = node.previousSibling)
+ if (node.nodeType == 1) return node;
+ return null;
+ },
+
+ // TOKEN FUNCTIONS
+ tagName: function(nodes, root, tagName, combinator) {
+ tagName = tagName.toUpperCase();
+ var results = [], h = Selector.handlers;
+ if (nodes) {
+ if (combinator) {
+ // fastlane for ordinary descendant combinators
+ if (combinator == "descendant") {
+ for (var i = 0, node; node = nodes[i]; i++)
+ h.concat(results, node.getElementsByTagName(tagName));
+ return results;
+ } else nodes = this[combinator](nodes);
+ if (tagName == "*") return nodes;
+ }
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node.tagName.toUpperCase() == tagName) results.push(node);
+ return results;
+ } else return root.getElementsByTagName(tagName);
+ },
+
+ id: function(nodes, root, id, combinator) {
+ var targetNode = $(id), h = Selector.handlers;
+ if (!nodes && root == document) return targetNode ? [targetNode] : [];
+ if (nodes) {
+ if (combinator) {
+ if (combinator == 'child') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (targetNode.parentNode == node) return [targetNode];
+ } else if (combinator == 'descendant') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Element.descendantOf(targetNode, node)) return [targetNode];
+ } else if (combinator == 'adjacent') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Selector.handlers.previousElementSibling(targetNode) == node)
+ return [targetNode];
+ } else nodes = h[combinator](nodes);
+ }
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node == targetNode) return [targetNode];
+ return [];
+ }
+ return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
+ },
+
+ className: function(nodes, root, className, combinator) {
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ return Selector.handlers.byClassName(nodes, root, className);
+ },
+
+ byClassName: function(nodes, root, className) {
+ if (!nodes) nodes = Selector.handlers.descendant([root]);
+ var needle = ' ' + className + ' ';
+ for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
+ nodeClassName = node.className;
+ if (nodeClassName.length == 0) continue;
+ if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
+ results.push(node);
+ }
+ return results;
+ },
+
+ attrPresence: function(nodes, root, attr) {
+ var results = [];
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Element.hasAttribute(node, attr)) results.push(node);
+ return results;
+ },
+
+ attr: function(nodes, root, attr, value, operator) {
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ var handler = Selector.operators[operator], results = [];
+ for (var i = 0, node; node = nodes[i]; i++) {
+ var nodeValue = Element.readAttribute(node, attr);
+ if (nodeValue === null) continue;
+ if (handler(nodeValue, value)) results.push(node);
+ }
+ return results;
+ },
+
+ pseudo: function(nodes, name, value, root, combinator) {
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ return Selector.pseudos[name](nodes, value, root);
+ }
+ },
+
+ pseudos: {
+ 'first-child': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ if (Selector.handlers.previousElementSibling(node)) continue;
+ results.push(node);
+ }
+ return results;
+ },
+ 'last-child': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ if (Selector.handlers.nextElementSibling(node)) continue;
+ results.push(node);
+ }
+ return results;
+ },
+ 'only-child': function(nodes, value, root) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
+ results.push(node);
+ return results;
+ },
+ 'nth-child': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root);
+ },
+ 'nth-last-child': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, true);
+ },
+ 'nth-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, false, true);
+ },
+ 'nth-last-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, true, true);
+ },
+ 'first-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, "1", root, false, true);
+ },
+ 'last-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, "1", root, true, true);
+ },
+ 'only-of-type': function(nodes, formula, root) {
+ var p = Selector.pseudos;
+ return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
+ },
+
+ // handles the an+b logic
+ getIndices: function(a, b, total) {
+ if (a == 0) return b > 0 ? [b] : [];
+ return $R(1, total).inject([], function(memo, i) {
+ if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
+ return memo;
+ });
+ },
+
+ // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
+ nth: function(nodes, formula, root, reverse, ofType) {
+ if (nodes.length == 0) return [];
+ if (formula == 'even') formula = '2n+0';
+ if (formula == 'odd') formula = '2n+1';
+ var h = Selector.handlers, results = [], indexed = [], m;
+ h.mark(nodes);
+ for (var i = 0, node; node = nodes[i]; i++) {
+ if (!node.parentNode._counted) {
+ h.index(node.parentNode, reverse, ofType);
+ indexed.push(node.parentNode);
+ }
+ }
+ if (formula.match(/^\d+$/)) { // just a number
+ formula = Number(formula);
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node.nodeIndex == formula) results.push(node);
+ } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+ if (m[1] == "-") m[1] = -1;
+ var a = m[1] ? Number(m[1]) : 1;
+ var b = m[2] ? Number(m[2]) : 0;
+ var indices = Selector.pseudos.getIndices(a, b, nodes.length);
+ for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
+ for (var j = 0; j < l; j++)
+ if (node.nodeIndex == indices[j]) results.push(node);
+ }
+ }
+ h.unmark(nodes);
+ h.unmark(indexed);
+ return results;
+ },
+
+ 'empty': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ // IE treats comments as element nodes
+ if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
+ results.push(node);
+ }
+ return results;
+ },
+
+ 'not': function(nodes, selector, root) {
+ var h = Selector.handlers, selectorType, m;
+ var exclusions = new Selector(selector).findElements(root);
+ h.mark(exclusions);
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!node._counted) results.push(node);
+ h.unmark(exclusions);
+ return results;
+ },
+
+ 'enabled': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!node.disabled) results.push(node);
+ return results;
+ },
+
+ 'disabled': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (node.disabled) results.push(node);
+ return results;
+ },
+
+ 'checked': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (node.checked) results.push(node);
+ return results;
+ }
+ },
+
+ operators: {
+ '=': function(nv, v) { return nv == v; },
+ '!=': function(nv, v) { return nv != v; },
+ '^=': function(nv, v) { return nv.startsWith(v); },
+ '$=': function(nv, v) { return nv.endsWith(v); },
+ '*=': function(nv, v) { return nv.include(v); },
+ '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
+ '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
+ },
+
+ matchElements: function(elements, expression) {
+ var matches = new Selector(expression).findElements(), h = Selector.handlers;
+ h.mark(matches);
+ for (var i = 0, results = [], element; element = elements[i]; i++)
+ if (element._counted) results.push(element);
+ h.unmark(matches);
+ return results;
+ },
+
+ findElement: function(elements, expression, index) {
+ if (typeof expression == 'number') {
+ index = expression; expression = false;
+ }
+ return Selector.matchElements(elements, expression || '*')[index || 0];
+ },
+
+ findChildElements: function(element, expressions) {
+ var exprs = expressions.join(','), expressions = [];
+ exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
+ expressions.push(m[1].strip());
+ });
+ var results = [], h = Selector.handlers;
+ for (var i = 0, l = expressions.length, selector; i < l; i++) {
+ selector = new Selector(expressions[i].strip());
+ h.concat(results, selector.findElements(element));
+ }
+ return (l > 1) ? h.unique(results) : results;
+ }
+});
+
+function $$() {
+ return Selector.findChildElements(document, $A(arguments));
+}
+var Form = {
+ reset: function(form) {
+ $(form).reset();
+ return form;
+ },
+
+ serializeElements: function(elements, getHash) {
+ var data = elements.inject({}, function(result, element) {
+ if (!element.disabled && element.name) {
+ var key = element.name, value = $(element).getValue();
+ if (value != null) {
+ if (key in result) {
+ if (result[key].constructor != Array) result[key] = [result[key]];
+ result[key].push(value);
+ }
+ else result[key] = value;
+ }
+ }
+ return result;
+ });
+
+ return getHash ? data : Hash.toQueryString(data);
+ }
+};
+
+Form.Methods = {
+ serialize: function(form, getHash) {
+ return Form.serializeElements(Form.getElements(form), getHash);
+ },
+
+ getElements: function(form) {
+ return $A($(form).getElementsByTagName('*')).inject([],
+ function(elements, child) {
+ if (Form.Element.Serializers[child.tagName.toLowerCase()])
+ elements.push(Element.extend(child));
+ return elements;
+ }
+ );
+ },
+
+ getInputs: function(form, typeName, name) {
+ form = $(form);
+ var inputs = form.getElementsByTagName('input');
+
+ if (!typeName && !name) return $A(inputs).map(Element.extend);
+
+ for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+ var input = inputs[i];
+ if ((typeName && input.type != typeName) || (name && input.name != name))
+ continue;
+ matchingInputs.push(Element.extend(input));
+ }
+
+ return matchingInputs;
+ },
+
+ disable: function(form) {
+ form = $(form);
+ Form.getElements(form).invoke('disable');
+ return form;
+ },
+
+ enable: function(form) {
+ form = $(form);
+ Form.getElements(form).invoke('enable');
+ return form;
+ },
+
+ findFirstElement: function(form) {
+ return $(form).getElements().find(function(element) {
+ return element.type != 'hidden' && !element.disabled &&
+ ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+ });
+ },
+
+ focusFirstElement: function(form) {
+ form = $(form);
+ form.findFirstElement().activate();
+ return form;
+ },
+
+ request: function(form, options) {
+ form = $(form), options = Object.clone(options || {});
+
+ var params = options.parameters;
+ options.parameters = form.serialize(true);
+
+ if (params) {
+ if (typeof params == 'string') params = params.toQueryParams();
+ Object.extend(options.parameters, params);
+ }
+
+ if (form.hasAttribute('method') && !options.method)
+ options.method = form.method;
+
+ return new Ajax.Request(form.readAttribute('action'), options);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element = {
+ focus: function(element) {
+ $(element).focus();
+ return element;
+ },
+
+ select: function(element) {
+ $(element).select();
+ return element;
+ }
+}
+
+Form.Element.Methods = {
+ serialize: function(element) {
+ element = $(element);
+ if (!element.disabled && element.name) {
+ var value = element.getValue();
+ if (value != undefined) {
+ var pair = {};
+ pair[element.name] = value;
+ return Hash.toQueryString(pair);
+ }
+ }
+ return '';
+ },
+
+ getValue: function(element) {
+ element = $(element);
+ var method = element.tagName.toLowerCase();
+ return Form.Element.Serializers[method](element);
+ },
+
+ clear: function(element) {
+ $(element).value = '';
+ return element;
+ },
+
+ present: function(element) {
+ return $(element).value != '';
+ },
+
+ activate: function(element) {
+ element = $(element);
+ try {
+ element.focus();
+ if (element.select && (element.tagName.toLowerCase() != 'input' ||
+ !['button', 'reset', 'submit'].include(element.type)))
+ element.select();
+ } catch (e) {}
+ return element;
+ },
+
+ disable: function(element) {
+ element = $(element);
+ element.blur();
+ element.disabled = true;
+ return element;
+ },
+
+ enable: function(element) {
+ element = $(element);
+ element.disabled = false;
+ return element;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Field = Form.Element;
+var $F = Form.Element.Methods.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element.Serializers = {
+ input: function(element) {
+ switch (element.type.toLowerCase()) {
+ case 'checkbox':
+ case 'radio':
+ return Form.Element.Serializers.inputSelector(element);
+ default:
+ return Form.Element.Serializers.textarea(element);
+ }
+ },
+
+ inputSelector: function(element) {
+ return element.checked ? element.value : null;
+ },
+
+ textarea: function(element) {
+ return element.value;
+ },
+
+ select: function(element) {
+ return this[element.type == 'select-one' ?
+ 'selectOne' : 'selectMany'](element);
+ },
+
+ selectOne: function(element) {
+ var index = element.selectedIndex;
+ return index >= 0 ? this.optionValue(element.options[index]) : null;
+ },
+
+ selectMany: function(element) {
+ var values, length = element.length;
+ if (!length) return null;
+
+ for (var i = 0, values = []; i < length; i++) {
+ var opt = element.options[i];
+ if (opt.selected) values.push(this.optionValue(opt));
+ }
+ return values;
+ },
+
+ optionValue: function(opt) {
+ // extend element because hasAttribute may not be native
+ return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = function() {}
+Abstract.TimedObserver.prototype = {
+ initialize: function(element, frequency, callback) {
+ this.frequency = frequency;
+ this.element = $(element);
+ this.callback = callback;
+
+ this.lastValue = this.getValue();
+ this.registerCallback();
+ },
+
+ registerCallback: function() {
+ setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ onTimerEvent: function() {
+ var value = this.getValue();
+ var changed = ('string' == typeof this.lastValue && 'string' == typeof value
+ ? this.lastValue != value : String(this.lastValue) != String(value));
+ if (changed) {
+ this.callback(this.element, value);
+ this.lastValue = value;
+ }
+ }
+}
+
+Form.Element.Observer = Class.create();
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+ getValue: function() {
+ return Form.Element.getValue(this.element);
+ }
+});
+
+Form.Observer = Class.create();
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+ getValue: function() {
+ return Form.serialize(this.element);
+ }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = function() {}
+Abstract.EventObserver.prototype = {
+ initialize: function(element, callback) {
+ this.element = $(element);
+ this.callback = callback;
+
+ this.lastValue = this.getValue();
+ if (this.element.tagName.toLowerCase() == 'form')
+ this.registerFormCallbacks();
+ else
+ this.registerCallback(this.element);
+ },
+
+ onElementEvent: function() {
+ var value = this.getValue();
+ if (this.lastValue != value) {
+ this.callback(this.element, value);
+ this.lastValue = value;
+ }
+ },
+
+ registerFormCallbacks: function() {
+ Form.getElements(this.element).each(this.registerCallback.bind(this));
+ },
+
+ registerCallback: function(element) {
+ if (element.type) {
+ switch (element.type.toLowerCase()) {
+ case 'checkbox':
+ case 'radio':
+ Event.observe(element, 'click', this.onElementEvent.bind(this));
+ break;
+ default:
+ Event.observe(element, 'change', this.onElementEvent.bind(this));
+ break;
+ }
+ }
+ }
+}
+
+Form.Element.EventObserver = Class.create();
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+ getValue: function() {
+ return Form.Element.getValue(this.element);
+ }
+});
+
+Form.EventObserver = Class.create();
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+ getValue: function() {
+ return Form.serialize(this.element);
+ }
+});
+if (!window.Event) {
+ var Event = new Object();
+}
+
+Object.extend(Event, {
+ KEY_BACKSPACE: 8,
+ KEY_TAB: 9,
+ KEY_RETURN: 13,
+ KEY_ESC: 27,
+ KEY_LEFT: 37,
+ KEY_UP: 38,
+ KEY_RIGHT: 39,
+ KEY_DOWN: 40,
+ KEY_DELETE: 46,
+ KEY_HOME: 36,
+ KEY_END: 35,
+ KEY_PAGEUP: 33,
+ KEY_PAGEDOWN: 34,
+
+ element: function(event) {
+ return $(event.target || event.srcElement);
+ },
+
+ isLeftClick: function(event) {
+ return (((event.which) && (event.which == 1)) ||
+ ((event.button) && (event.button == 1)));
+ },
+
+ pointerX: function(event) {
+ return event.pageX || (event.clientX +
+ (document.documentElement.scrollLeft || document.body.scrollLeft));
+ },
+
+ pointerY: function(event) {
+ return event.pageY || (event.clientY +
+ (document.documentElement.scrollTop || document.body.scrollTop));
+ },
+
+ stop: function(event) {
+ if (event.preventDefault) {
+ event.preventDefault();
+ event.stopPropagation();
+ } else {
+ event.returnValue = false;
+ event.cancelBubble = true;
+ }
+ },
+
+ // find the first node with the given tagName, starting from the
+ // node the event was triggered on; traverses the DOM upwards
+ findElement: function(event, tagName) {
+ var element = Event.element(event);
+ while (element.parentNode && (!element.tagName ||
+ (element.tagName.toUpperCase() != tagName.toUpperCase())))
+ element = element.parentNode;
+ return element;
+ },
+
+ observers: false,
+
+ _observeAndCache: function(element, name, observer, useCapture) {
+ if (!this.observers) this.observers = [];
+ if (element.addEventListener) {
+ this.observers.push([element, name, observer, useCapture]);
+ element.addEventListener(name, observer, useCapture);
+ } else if (element.attachEvent) {
+ this.observers.push([element, name, observer, useCapture]);
+ element.attachEvent('on' + name, observer);
+ }
+ },
+
+ unloadCache: function() {
+ if (!Event.observers) return;
+ for (var i = 0, length = Event.observers.length; i < length; i++) {
+ Event.stopObserving.apply(this, Event.observers[i]);
+ Event.observers[i][0] = null;
+ }
+ Event.observers = false;
+ },
+
+ observe: function(element, name, observer, useCapture) {
+ element = $(element);
+ useCapture = useCapture || false;
+
+ if (name == 'keypress' &&
+ (Prototype.Browser.WebKit || element.attachEvent))
+ name = 'keydown';
+
+ Event._observeAndCache(element, name, observer, useCapture);
+ },
+
+ stopObserving: function(element, name, observer, useCapture) {
+ element = $(element);
+ useCapture = useCapture || false;
+
+ if (name == 'keypress' &&
+ (Prototype.Browser.WebKit || element.attachEvent))
+ name = 'keydown';
+
+ if (element.removeEventListener) {
+ element.removeEventListener(name, observer, useCapture);
+ } else if (element.detachEvent) {
+ try {
+ element.detachEvent('on' + name, observer);
+ } catch (e) {}
+ }
+ }
+});
+
+/* prevent memory leaks in IE */
+if (Prototype.Browser.IE)
+ Event.observe(window, 'unload', Event.unloadCache, false);
+var Position = {
+ // set to true if needed, warning: firefox performance problems
+ // NOT neeeded for page scrolling, only if draggable contained in
+ // scrollable elements
+ includeScrollOffsets: false,
+
+ // must be called before calling withinIncludingScrolloffset, every time the
+ // page is scrolled
+ prepare: function() {
+ this.deltaX = window.pageXOffset
+ || document.documentElement.scrollLeft
+ || document.body.scrollLeft
+ || 0;
+ this.deltaY = window.pageYOffset
+ || document.documentElement.scrollTop
+ || document.body.scrollTop
+ || 0;
+ },
+
+ realOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.scrollTop || 0;
+ valueL += element.scrollLeft || 0;
+ element = element.parentNode;
+ } while (element);
+ return [valueL, valueT];
+ },
+
+ cumulativeOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ } while (element);
+ return [valueL, valueT];
+ },
+
+ positionedOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ if (element) {
+ if(element.tagName=='BODY') break;
+ var p = Element.getStyle(element, 'position');
+ if (p == 'relative' || p == 'absolute') break;
+ }
+ } while (element);
+ return [valueL, valueT];
+ },
+
+ offsetParent: function(element) {
+ if (element.offsetParent) return element.offsetParent;
+ if (element == document.body) return element;
+
+ while ((element = element.parentNode) && element != document.body)
+ if (Element.getStyle(element, 'position') != 'static')
+ return element;
+
+ return document.body;
+ },
+
+ // caches x/y coordinate pair to use with overlap
+ within: function(element, x, y) {
+ if (this.includeScrollOffsets)
+ return this.withinIncludingScrolloffsets(element, x, y);
+ this.xcomp = x;
+ this.ycomp = y;
+ this.offset = this.cumulativeOffset(element);
+
+ return (y >= this.offset[1] &&
+ y < this.offset[1] + element.offsetHeight &&
+ x >= this.offset[0] &&
+ x < this.offset[0] + element.offsetWidth);
+ },
+
+ withinIncludingScrolloffsets: function(element, x, y) {
+ var offsetcache = this.realOffset(element);
+
+ this.xcomp = x + offsetcache[0] - this.deltaX;
+ this.ycomp = y + offsetcache[1] - this.deltaY;
+ this.offset = this.cumulativeOffset(element);
+
+ return (this.ycomp >= this.offset[1] &&
+ this.ycomp < this.offset[1] + element.offsetHeight &&
+ this.xcomp >= this.offset[0] &&
+ this.xcomp < this.offset[0] + element.offsetWidth);
+ },
+
+ // within must be called directly before
+ overlap: function(mode, element) {
+ if (!mode) return 0;
+ if (mode == 'vertical')
+ return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+ element.offsetHeight;
+ if (mode == 'horizontal')
+ return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+ element.offsetWidth;
+ },
+
+ page: function(forElement) {
+ var valueT = 0, valueL = 0;
+
+ var element = forElement;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+
+ // Safari fix
+ if (element.offsetParent == document.body)
+ if (Element.getStyle(element,'position')=='absolute') break;
+
+ } while (element = element.offsetParent);
+
+ element = forElement;
+ do {
+ if (!window.opera || element.tagName=='BODY') {
+ valueT -= element.scrollTop || 0;
+ valueL -= element.scrollLeft || 0;
+ }
+ } while (element = element.parentNode);
+
+ return [valueL, valueT];
+ },
+
+ clone: function(source, target) {
+ var options = Object.extend({
+ setLeft: true,
+ setTop: true,
+ setWidth: true,
+ setHeight: true,
+ offsetTop: 0,
+ offsetLeft: 0
+ }, arguments[2] || {})
+
+ // find page position of source
+ source = $(source);
+ var p = Position.page(source);
+
+ // find coordinate system to use
+ target = $(target);
+ var delta = [0, 0];
+ var parent = null;
+ // delta [0,0] will do fine with position: fixed elements,
+ // position:absolute needs offsetParent deltas
+ if (Element.getStyle(target,'position') == 'absolute') {
+ parent = Position.offsetParent(target);
+ delta = Position.page(parent);
+ }
+
+ // correct by body offsets (fixes Safari)
+ if (parent == document.body) {
+ delta[0] -= document.body.offsetLeft;
+ delta[1] -= document.body.offsetTop;
+ }
+
+ // set position
+ if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
+ if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
+ if(options.setWidth) target.style.width = source.offsetWidth + 'px';
+ if(options.setHeight) target.style.height = source.offsetHeight + 'px';
+ },
+
+ absolutize: function(element) {
+ element = $(element);
+ if (element.style.position == 'absolute') return;
+ Position.prepare();
+
+ var offsets = Position.positionedOffset(element);
+ var top = offsets[1];
+ var left = offsets[0];
+ var width = element.clientWidth;
+ var height = element.clientHeight;
+
+ element._originalLeft = left - parseFloat(element.style.left || 0);
+ element._originalTop = top - parseFloat(element.style.top || 0);
+ element._originalWidth = element.style.width;
+ element._originalHeight = element.style.height;
+
+ element.style.position = 'absolute';
+ element.style.top = top + 'px';
+ element.style.left = left + 'px';
+ element.style.width = width + 'px';
+ element.style.height = height + 'px';
+ },
+
+ relativize: function(element) {
+ element = $(element);
+ if (element.style.position == 'relative') return;
+ Position.prepare();
+
+ element.style.position = 'relative';
+ var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
+ var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
+
+ element.style.top = top + 'px';
+ element.style.left = left + 'px';
+ element.style.height = element._originalHeight;
+ element.style.width = element._originalWidth;
+ }
+}
+
+// Safari returns margins on body which is incorrect if the child is absolutely
+// positioned. For performance reasons, redefine Position.cumulativeOffset for
+// KHTML/WebKit only.
+if (Prototype.Browser.WebKit) {
+ Position.cumulativeOffset = function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ if (element.offsetParent == document.body)
+ if (Element.getStyle(element, 'position') == 'absolute') break;
+
+ element = element.offsetParent;
+ } while (element);
+
+ return [valueL, valueT];
+ }
+}
+
+Element.addMethods(); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/manifest.json b/dom/tests/mochitest/ajax/scriptaculous/manifest.json
new file mode 100644
index 0000000000..b0f6322df9
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/manifest.json
@@ -0,0 +1 @@
+{testcases:["test/unit/ajax_inplaceeditor_test.html","test/unit/builder_test.html","test/unit/dragdrop_test.html","test/unit/effects_test.html","test/unit/element_test.html","test/unit/loading_test.html","test/unit/position_clone_test.html","test/unit/sortable_test.html","test/unit/string_test.html","test/unit/unit_test.html"]}
diff --git a/dom/tests/mochitest/ajax/scriptaculous/mochitest.ini b/dom/tests/mochitest/ajax/scriptaculous/mochitest.ini
new file mode 100644
index 0000000000..66a19ed2c3
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/mochitest.ini
@@ -0,0 +1,33 @@
+[DEFAULT]
+support-files =
+ manifest.json
+ lib/prototype.js
+ src/builder.js
+ src/controls.js
+ src/dragdrop.js
+ src/effects.js
+ src/scriptaculous.js
+ src/slider.js
+ src/sound.js
+ src/unittest.js
+ test/unit/_ajax_inplaceeditor_result.html
+ test/unit/_ajax_inplaceeditor_text.html
+ test/unit/_ajax_updater_result.html
+ test/unit/_autocomplete_result.html
+ test/unit/_autocomplete_result_nobr.html
+ test/unit/ajax_autocompleter_test.html
+ test/unit/ajax_inplaceeditor_test.html
+ test/unit/bdd_test.html
+ test/unit/builder_test.html
+ test/unit/dragdrop_test.html
+ test/unit/effects_test.html
+ test/unit/element_test.html
+ test/unit/icon.png
+ test/unit/loading_test.html
+ test/unit/position_clone_test.html
+ test/unit/slider_test.html
+ test/unit/sortable_test.html
+ test/unit/string_test.html
+ test/unit/unit_test.html
+
+[test_Scriptaculous.html]
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/builder.js b/dom/tests/mochitest/ajax/scriptaculous/src/builder.js
new file mode 100644
index 0000000000..0cf631b19d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/builder.js
@@ -0,0 +1,136 @@
+// script.aculo.us builder.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+var Builder = {
+ NODEMAP: {
+ AREA: 'map',
+ CAPTION: 'table',
+ COL: 'table',
+ COLGROUP: 'table',
+ LEGEND: 'fieldset',
+ OPTGROUP: 'select',
+ OPTION: 'select',
+ PARAM: 'object',
+ TBODY: 'table',
+ TD: 'table',
+ TFOOT: 'table',
+ TH: 'table',
+ THEAD: 'table',
+ TR: 'table'
+ },
+ // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
+ // due to a Firefox bug
+ node: function(elementName) {
+ elementName = elementName.toUpperCase();
+
+ // try innerHTML approach
+ var parentTag = this.NODEMAP[elementName] || 'div';
+ var parentElement = document.createElement(parentTag);
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+ parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
+ } catch(e) {}
+ var element = parentElement.firstChild || null;
+
+ // see if browser added wrapping tags
+ if(element && (element.tagName.toUpperCase() != elementName))
+ element = element.getElementsByTagName(elementName)[0];
+
+ // fallback to createElement approach
+ if(!element) element = document.createElement(elementName);
+
+ // abort if nothing could be created
+ if(!element) return;
+
+ // attributes (or text)
+ if(arguments[1])
+ if(this._isStringOrNumber(arguments[1]) ||
+ (arguments[1] instanceof Array) ||
+ arguments[1].tagName) {
+ this._children(element, arguments[1]);
+ } else {
+ var attrs = this._attributes(arguments[1]);
+ if(attrs.length) {
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+ parentElement.innerHTML = "<" +elementName + " " +
+ attrs + "></" + elementName + ">";
+ } catch(e) {}
+ element = parentElement.firstChild || null;
+ // workaround firefox 1.0.X bug
+ if(!element) {
+ element = document.createElement(elementName);
+ for(attr in arguments[1])
+ element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
+ }
+ if(element.tagName.toUpperCase() != elementName)
+ element = parentElement.getElementsByTagName(elementName)[0];
+ }
+ }
+
+ // text, or array of children
+ if(arguments[2])
+ this._children(element, arguments[2]);
+
+ return element;
+ },
+ _text: function(text) {
+ return document.createTextNode(text);
+ },
+
+ ATTR_MAP: {
+ 'className': 'class',
+ 'htmlFor': 'for'
+ },
+
+ _attributes: function(attributes) {
+ var attrs = [];
+ for(attribute in attributes)
+ attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
+ '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
+ return attrs.join(" ");
+ },
+ _children: function(element, children) {
+ if(children.tagName) {
+ element.appendChild(children);
+ return;
+ }
+ if(typeof children=='object') { // array can hold nodes and text
+ children.flatten().each( function(e) {
+ if(typeof e=='object')
+ element.appendChild(e)
+ else
+ if(Builder._isStringOrNumber(e))
+ element.appendChild(Builder._text(e));
+ });
+ } else
+ if(Builder._isStringOrNumber(children))
+ element.appendChild(Builder._text(children));
+ },
+ _isStringOrNumber: function(param) {
+ return(typeof param=='string' || typeof param=='number');
+ },
+ build: function(html) {
+ var element = this.node('div');
+ $(element).update(html.strip());
+ return element.down();
+ },
+ dump: function(scope) {
+ if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
+
+ var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
+ "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
+ "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
+
+ tags.each( function(tag){
+ scope[tag] = function() {
+ return Builder.node.apply(Builder, [tag].concat($A(arguments)));
+ }
+ });
+ }
+}
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/controls.js b/dom/tests/mochitest/ajax/scriptaculous/src/controls.js
new file mode 100644
index 0000000000..7d4f16ece0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/controls.js
@@ -0,0 +1,875 @@
+// script.aculo.us controls.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
+// Contributors:
+// Richard Livsey
+// Rahul Bhargava
+// Rob Wills
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+// Autocompleter.Base handles all the autocompletion functionality
+// that's independent of the data source for autocompletion. This
+// includes drawing the autocompletion menu, observing keyboard
+// and mouse events, and similar.
+//
+// Specific autocompleters need to provide, at the very least,
+// a getUpdatedChoices function that will be invoked every time
+// the text inside the monitored textbox changes. This method
+// should get the text for which to provide autocompletion by
+// invoking this.getToken(), NOT by directly accessing
+// this.element.value. This is to allow incremental tokenized
+// autocompletion. Specific auto-completion logic (AJAX, etc)
+// belongs in getUpdatedChoices.
+//
+// Tokenized incremental autocompletion is enabled automatically
+// when an autocompleter is instantiated with the 'tokens' option
+// in the options parameter, e.g.:
+// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
+// will incrementally autocomplete with a comma as the token.
+// Additionally, ',' in the above example can be replaced with
+// a token array, e.g. { tokens: [',', '\n'] } which
+// enables autocompletion on multiple tokens. This is most
+// useful when one of the tokens is \n (a newline), as it
+// allows smart autocompletion after linebreaks.
+
+if(typeof Effect == 'undefined')
+ throw("controls.js requires including script.aculo.us' effects.js library");
+
+var Autocompleter = {}
+Autocompleter.Base = function() {};
+Autocompleter.Base.prototype = {
+ baseInitialize: function(element, update, options) {
+ element = $(element)
+ this.element = element;
+ this.update = $(update);
+ this.hasFocus = false;
+ this.changed = false;
+ this.active = false;
+ this.index = 0;
+ this.entryCount = 0;
+
+ if(this.setOptions)
+ this.setOptions(options);
+ else
+ this.options = options || {};
+
+ this.options.paramName = this.options.paramName || this.element.name;
+ this.options.tokens = this.options.tokens || [];
+ this.options.frequency = this.options.frequency || 0.4;
+ this.options.minChars = this.options.minChars || 1;
+ this.options.onShow = this.options.onShow ||
+ function(element, update){
+ if(!update.style.position || update.style.position=='absolute') {
+ update.style.position = 'absolute';
+ Position.clone(element, update, {
+ setHeight: false,
+ offsetTop: element.offsetHeight
+ });
+ }
+ Effect.Appear(update,{duration:0.15});
+ };
+ this.options.onHide = this.options.onHide ||
+ function(element, update){ new Effect.Fade(update,{duration:0.15}) };
+
+ if(typeof(this.options.tokens) == 'string')
+ this.options.tokens = new Array(this.options.tokens);
+
+ this.observer = null;
+
+ this.element.setAttribute('autocomplete','off');
+
+ Element.hide(this.update);
+
+ Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
+ Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this));
+
+ // Turn autocomplete back on when the user leaves the page, so that the
+ // field's value will be remembered on Mozilla-based browsers.
+ Event.observe(window, 'beforeunload', function(){
+ element.setAttribute('autocomplete', 'on');
+ });
+ },
+
+ show: function() {
+ if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
+ if(!this.iefix &&
+ (Prototype.Browser.IE) &&
+ (Element.getStyle(this.update, 'position')=='absolute')) {
+ new Insertion.After(this.update,
+ '<iframe id="' + this.update.id + '_iefix" '+
+ 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
+ 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
+ this.iefix = $(this.update.id+'_iefix');
+ }
+ if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
+ },
+
+ fixIEOverlapping: function() {
+ Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
+ this.iefix.style.zIndex = 1;
+ this.update.style.zIndex = 2;
+ Element.show(this.iefix);
+ },
+
+ hide: function() {
+ this.stopIndicator();
+ if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
+ if(this.iefix) Element.hide(this.iefix);
+ },
+
+ startIndicator: function() {
+ if(this.options.indicator) Element.show(this.options.indicator);
+ },
+
+ stopIndicator: function() {
+ if(this.options.indicator) Element.hide(this.options.indicator);
+ },
+
+ onKeyPress: function(event) {
+ if(this.active)
+ switch(event.keyCode) {
+ case Event.KEY_TAB:
+ case Event.KEY_RETURN:
+ this.selectEntry();
+ Event.stop(event);
+ case Event.KEY_ESC:
+ this.hide();
+ this.active = false;
+ Event.stop(event);
+ return;
+ case Event.KEY_LEFT:
+ case Event.KEY_RIGHT:
+ return;
+ case Event.KEY_UP:
+ this.markPrevious();
+ this.render();
+ if(Prototype.Browser.WebKit) Event.stop(event);
+ return;
+ case Event.KEY_DOWN:
+ this.markNext();
+ this.render();
+ if(Prototype.Browser.WebKit) Event.stop(event);
+ return;
+ }
+ else
+ if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
+ (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
+
+ this.changed = true;
+ this.hasFocus = true;
+
+ if(this.observer) clearTimeout(this.observer);
+ this.observer =
+ setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
+ },
+
+ activate: function() {
+ this.changed = false;
+ this.hasFocus = true;
+ this.getUpdatedChoices();
+ },
+
+ onHover: function(event) {
+ var element = Event.findElement(event, 'LI');
+ if(this.index != element.autocompleteIndex)
+ {
+ this.index = element.autocompleteIndex;
+ this.render();
+ }
+ Event.stop(event);
+ },
+
+ onClick: function(event) {
+ var element = Event.findElement(event, 'LI');
+ this.index = element.autocompleteIndex;
+ this.selectEntry();
+ this.hide();
+ },
+
+ onBlur: function(event) {
+ // needed to make click events working
+ setTimeout(this.hide.bind(this), 250);
+ this.hasFocus = false;
+ this.active = false;
+ },
+
+ render: function() {
+ if(this.entryCount > 0) {
+ for (var i = 0; i < this.entryCount; i++)
+ this.index==i ?
+ Element.addClassName(this.getEntry(i),"selected") :
+ Element.removeClassName(this.getEntry(i),"selected");
+ if(this.hasFocus) {
+ this.show();
+ this.active = true;
+ }
+ } else {
+ this.active = false;
+ this.hide();
+ }
+ },
+
+ markPrevious: function() {
+ if(this.index > 0) this.index--
+ else this.index = this.entryCount-1;
+ this.getEntry(this.index).scrollIntoView(true);
+ },
+
+ markNext: function() {
+ if(this.index < this.entryCount-1) this.index++
+ else this.index = 0;
+ this.getEntry(this.index).scrollIntoView(false);
+ },
+
+ getEntry: function(index) {
+ return this.update.firstChild.childNodes[index];
+ },
+
+ getCurrentEntry: function() {
+ return this.getEntry(this.index);
+ },
+
+ selectEntry: function() {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ },
+
+ updateElement: function(selectedElement) {
+ if (this.options.updateElement) {
+ this.options.updateElement(selectedElement);
+ return;
+ }
+ var value = '';
+ if (this.options.select) {
+ var nodes = document.getElementsByClassName(this.options.select, selectedElement) || [];
+ if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
+ } else
+ value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
+
+ var lastTokenPos = this.findLastToken();
+ if (lastTokenPos != -1) {
+ var newValue = this.element.value.substr(0, lastTokenPos + 1);
+ var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
+ if (whitespace)
+ newValue += whitespace[0];
+ this.element.value = newValue + value;
+ } else {
+ this.element.value = value;
+ }
+ this.element.focus();
+
+ if (this.options.afterUpdateElement)
+ this.options.afterUpdateElement(this.element, selectedElement);
+ },
+
+ updateChoices: function(choices) {
+ if(!this.changed && this.hasFocus) {
+ this.update.innerHTML = choices;
+ Element.cleanWhitespace(this.update);
+ Element.cleanWhitespace(this.update.down());
+
+ if(this.update.firstChild && this.update.down().childNodes) {
+ this.entryCount =
+ this.update.down().childNodes.length;
+ for (var i = 0; i < this.entryCount; i++) {
+ var entry = this.getEntry(i);
+ entry.autocompleteIndex = i;
+ this.addObservers(entry);
+ }
+ } else {
+ this.entryCount = 0;
+ }
+
+ this.stopIndicator();
+ this.index = 0;
+
+ if(this.entryCount==1 && this.options.autoSelect) {
+ this.selectEntry();
+ this.hide();
+ } else {
+ this.render();
+ }
+ }
+ },
+
+ addObservers: function(element) {
+ Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
+ Event.observe(element, "click", this.onClick.bindAsEventListener(this));
+ },
+
+ onObserverEvent: function() {
+ this.changed = false;
+ if(this.getToken().length>=this.options.minChars) {
+ this.getUpdatedChoices();
+ } else {
+ this.active = false;
+ this.hide();
+ }
+ },
+
+ getToken: function() {
+ var tokenPos = this.findLastToken();
+ if (tokenPos != -1)
+ var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
+ else
+ var ret = this.element.value;
+
+ return /\n/.test(ret) ? '' : ret;
+ },
+
+ findLastToken: function() {
+ var lastTokenPos = -1;
+
+ for (var i=0; i<this.options.tokens.length; i++) {
+ var thisTokenPos = this.element.value.lastIndexOf(this.options.tokens[i]);
+ if (thisTokenPos > lastTokenPos)
+ lastTokenPos = thisTokenPos;
+ }
+ return lastTokenPos;
+ }
+}
+
+Ajax.Autocompleter = Class.create();
+Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
+ initialize: function(element, update, url, options) {
+ this.baseInitialize(element, update, options);
+ this.options.asynchronous = true;
+ this.options.onComplete = this.onComplete.bind(this);
+ this.options.defaultParams = this.options.parameters || null;
+ this.url = url;
+ },
+
+ getUpdatedChoices: function() {
+ this.startIndicator();
+
+ var entry = encodeURIComponent(this.options.paramName) + '=' +
+ encodeURIComponent(this.getToken());
+
+ this.options.parameters = this.options.callback ?
+ this.options.callback(this.element, entry) : entry;
+
+ if(this.options.defaultParams)
+ this.options.parameters += '&' + this.options.defaultParams;
+
+ new Ajax.Request(this.url, this.options);
+ },
+
+ onComplete: function(request) {
+ this.updateChoices(request.responseText);
+ }
+
+});
+
+// The local array autocompleter. Used when you'd prefer to
+// inject an array of autocompletion options into the page, rather
+// than sending out Ajax queries, which can be quite slow sometimes.
+//
+// The constructor takes four parameters. The first two are, as usual,
+// the id of the monitored textbox, and id of the autocompletion menu.
+// The third is the array you want to autocomplete from, and the fourth
+// is the options block.
+//
+// Extra local autocompletion options:
+// - choices - How many autocompletion choices to offer
+//
+// - partialSearch - If false, the autocompleter will match entered
+// text only at the beginning of strings in the
+// autocomplete array. Defaults to true, which will
+// match text at the beginning of any *word* in the
+// strings in the autocomplete array. If you want to
+// search anywhere in the string, additionally set
+// the option fullSearch to true (default: off).
+//
+// - fullSsearch - Search anywhere in autocomplete array strings.
+//
+// - partialChars - How many characters to enter before triggering
+// a partial match (unlike minChars, which defines
+// how many characters are required to do any match
+// at all). Defaults to 2.
+//
+// - ignoreCase - Whether to ignore case when autocompleting.
+// Defaults to true.
+//
+// It's possible to pass in a custom function as the 'selector'
+// option, if you prefer to write your own autocompletion logic.
+// In that case, the other options above will not apply unless
+// you support them.
+
+Autocompleter.Local = Class.create();
+Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
+ initialize: function(element, update, array, options) {
+ this.baseInitialize(element, update, options);
+ this.options.array = array;
+ },
+
+ getUpdatedChoices: function() {
+ this.updateChoices(this.options.selector(this));
+ },
+
+ setOptions: function(options) {
+ this.options = Object.extend({
+ choices: 10,
+ partialSearch: true,
+ partialChars: 2,
+ ignoreCase: true,
+ fullSearch: false,
+ selector: function(instance) {
+ var ret = []; // Beginning matches
+ var partial = []; // Inside matches
+ var entry = instance.getToken();
+ var count = 0;
+
+ for (var i = 0; i < instance.options.array.length &&
+ ret.length < instance.options.choices ; i++) {
+
+ var elem = instance.options.array[i];
+ var foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase()) :
+ elem.indexOf(entry);
+
+ while (foundPos != -1) {
+ if (foundPos == 0 && elem.length != entry.length) {
+ ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
+ elem.substr(entry.length) + "</li>");
+ break;
+ } else if (entry.length >= instance.options.partialChars &&
+ instance.options.partialSearch && foundPos != -1) {
+ if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
+ partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
+ elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
+ foundPos + entry.length) + "</li>");
+ break;
+ }
+ }
+
+ foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
+ elem.indexOf(entry, foundPos + 1);
+
+ }
+ }
+ if (partial.length)
+ ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
+ return "<ul>" + ret.join('') + "</ul>";
+ }
+ }, options || {});
+ }
+});
+
+// AJAX in-place editor
+//
+// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
+
+// Use this if you notice weird scrolling problems on some browsers,
+// the DOM might be a bit confused when this gets called so do this
+// waits 1 ms (with setTimeout) until it does the activation
+Field.scrollFreeActivate = function(field) {
+ setTimeout(function() {
+ Field.activate(field);
+ }, 1);
+}
+
+Ajax.InPlaceEditor = Class.create();
+Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99";
+Ajax.InPlaceEditor.prototype = {
+ initialize: function(element, url, options) {
+ this.url = url;
+ this.element = $(element);
+
+ this.options = Object.extend({
+ paramName: "value",
+ okButton: true,
+ okLink: false,
+ okText: "ok",
+ cancelButton: false,
+ cancelLink: true,
+ cancelText: "cancel",
+ textBeforeControls: '',
+ textBetweenControls: '',
+ textAfterControls: '',
+ savingText: "Saving...",
+ clickToEditText: "Click to edit",
+ okText: "ok",
+ rows: 1,
+ onComplete: function(transport, element) {
+ new Effect.Highlight(element, {startcolor: this.options.highlightcolor});
+ },
+ onFailure: function(transport) {
+ alert("Error communicating with the server: " + transport.responseText.stripTags());
+ },
+ callback: function(form) {
+ return Form.serialize(form);
+ },
+ handleLineBreaks: true,
+ loadingText: 'Loading...',
+ savingClassName: 'inplaceeditor-saving',
+ loadingClassName: 'inplaceeditor-loading',
+ formClassName: 'inplaceeditor-form',
+ highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
+ highlightendcolor: "#FFFFFF",
+ externalControl: null,
+ submitOnBlur: false,
+ ajaxOptions: {},
+ evalScripts: false
+ }, options || {});
+
+ if(!this.options.formId && this.element.id) {
+ this.options.formId = this.element.id + "-inplaceeditor";
+ if ($(this.options.formId)) {
+ // there's already a form with that name, don't specify an id
+ this.options.formId = null;
+ }
+ }
+
+ if (this.options.externalControl) {
+ this.options.externalControl = $(this.options.externalControl);
+ }
+
+ this.originalBackground = Element.getStyle(this.element, 'background-color');
+ if (!this.originalBackground) {
+ this.originalBackground = "transparent";
+ }
+
+ this.element.title = this.options.clickToEditText;
+
+ this.onclickListener = this.enterEditMode.bindAsEventListener(this);
+ this.mouseoverListener = this.enterHover.bindAsEventListener(this);
+ this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
+ Event.observe(this.element, 'click', this.onclickListener);
+ Event.observe(this.element, 'mouseover', this.mouseoverListener);
+ Event.observe(this.element, 'mouseout', this.mouseoutListener);
+ if (this.options.externalControl) {
+ Event.observe(this.options.externalControl, 'click', this.onclickListener);
+ Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener);
+ Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener);
+ }
+ },
+ enterEditMode: function(evt) {
+ if (this.saving) return;
+ if (this.editing) return;
+ this.editing = true;
+ this.onEnterEditMode();
+ if (this.options.externalControl) {
+ Element.hide(this.options.externalControl);
+ }
+ Element.hide(this.element);
+ this.createForm();
+ this.element.parentNode.insertBefore(this.form, this.element);
+ if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField);
+ // stop the event to avoid a page refresh in Safari
+ if (evt) {
+ Event.stop(evt);
+ }
+ return false;
+ },
+ createForm: function() {
+ this.form = document.createElement("form");
+ this.form.id = this.options.formId;
+ Element.addClassName(this.form, this.options.formClassName)
+ this.form.onsubmit = this.onSubmit.bind(this);
+
+ this.createEditField();
+
+ if (this.options.textarea) {
+ var br = document.createElement("br");
+ this.form.appendChild(br);
+ }
+
+ if (this.options.textBeforeControls)
+ this.form.appendChild(document.createTextNode(this.options.textBeforeControls));
+
+ if (this.options.okButton) {
+ var okButton = document.createElement("input");
+ okButton.type = "submit";
+ okButton.value = this.options.okText;
+ okButton.className = 'editor_ok_button';
+ this.form.appendChild(okButton);
+ }
+
+ if (this.options.okLink) {
+ var okLink = document.createElement("a");
+ okLink.href = "#";
+ okLink.appendChild(document.createTextNode(this.options.okText));
+ okLink.onclick = this.onSubmit.bind(this);
+ okLink.className = 'editor_ok_link';
+ this.form.appendChild(okLink);
+ }
+
+ if (this.options.textBetweenControls &&
+ (this.options.okLink || this.options.okButton) &&
+ (this.options.cancelLink || this.options.cancelButton))
+ this.form.appendChild(document.createTextNode(this.options.textBetweenControls));
+
+ if (this.options.cancelButton) {
+ var cancelButton = document.createElement("input");
+ cancelButton.type = "submit";
+ cancelButton.value = this.options.cancelText;
+ cancelButton.onclick = this.onclickCancel.bind(this);
+ cancelButton.className = 'editor_cancel_button';
+ this.form.appendChild(cancelButton);
+ }
+
+ if (this.options.cancelLink) {
+ var cancelLink = document.createElement("a");
+ cancelLink.href = "#";
+ cancelLink.appendChild(document.createTextNode(this.options.cancelText));
+ cancelLink.onclick = this.onclickCancel.bind(this);
+ cancelLink.className = 'editor_cancel editor_cancel_link';
+ this.form.appendChild(cancelLink);
+ }
+
+ if (this.options.textAfterControls)
+ this.form.appendChild(document.createTextNode(this.options.textAfterControls));
+ },
+ hasHTMLLineBreaks: function(string) {
+ if (!this.options.handleLineBreaks) return false;
+ return string.match(/<br/i) || string.match(/<p>/i);
+ },
+ convertHTMLLineBreaks: function(string) {
+ return string.replace(/<br>/gi, "\n").replace(/<br\/>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<p>/gi, "");
+ },
+ createEditField: function() {
+ var text;
+ if(this.options.loadTextURL) {
+ text = this.options.loadingText;
+ } else {
+ text = this.getText();
+ }
+
+ var obj = this;
+
+ if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
+ this.options.textarea = false;
+ var textField = document.createElement("input");
+ textField.obj = this;
+ textField.type = "text";
+ textField.name = this.options.paramName;
+ textField.value = text;
+ textField.style.backgroundColor = this.options.highlightcolor;
+ textField.className = 'editor_field';
+ var size = this.options.size || this.options.cols || 0;
+ if (size != 0) textField.size = size;
+ if (this.options.submitOnBlur)
+ textField.onblur = this.onSubmit.bind(this);
+ this.editField = textField;
+ } else {
+ this.options.textarea = true;
+ var textArea = document.createElement("textarea");
+ textArea.obj = this;
+ textArea.name = this.options.paramName;
+ textArea.value = this.convertHTMLLineBreaks(text);
+ textArea.rows = this.options.rows;
+ textArea.cols = this.options.cols || 40;
+ textArea.className = 'editor_field';
+ if (this.options.submitOnBlur)
+ textArea.onblur = this.onSubmit.bind(this);
+ this.editField = textArea;
+ }
+
+ if(this.options.loadTextURL) {
+ this.loadExternalText();
+ }
+ this.form.appendChild(this.editField);
+ },
+ getText: function() {
+ return this.element.innerHTML;
+ },
+ loadExternalText: function() {
+ Element.addClassName(this.form, this.options.loadingClassName);
+ this.editField.disabled = true;
+ new Ajax.Request(
+ this.options.loadTextURL,
+ Object.extend({
+ asynchronous: true,
+ onComplete: this.onLoadedExternalText.bind(this)
+ }, this.options.ajaxOptions)
+ );
+ },
+ onLoadedExternalText: function(transport) {
+ Element.removeClassName(this.form, this.options.loadingClassName);
+ this.editField.disabled = false;
+ this.editField.value = transport.responseText.stripTags();
+ Field.scrollFreeActivate(this.editField);
+ },
+ onclickCancel: function() {
+ this.onComplete();
+ this.leaveEditMode();
+ return false;
+ },
+ onFailure: function(transport) {
+ this.options.onFailure(transport);
+ if (this.oldInnerHTML) {
+ this.element.innerHTML = this.oldInnerHTML;
+ this.oldInnerHTML = null;
+ }
+ return false;
+ },
+ onSubmit: function() {
+ // onLoading resets these so we need to save them away for the Ajax call
+ var form = this.form;
+ var value = this.editField.value;
+
+ // do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
+ // which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
+ // to be displayed indefinitely
+ this.onLoading();
+
+ if (this.options.evalScripts) {
+ new Ajax.Request(
+ this.url, Object.extend({
+ parameters: this.options.callback(form, value),
+ onComplete: this.onComplete.bind(this),
+ onFailure: this.onFailure.bind(this),
+ asynchronous:true,
+ evalScripts:true
+ }, this.options.ajaxOptions));
+ } else {
+ new Ajax.Updater(
+ { success: this.element,
+ // don't update on failure (this could be an option)
+ failure: null },
+ this.url, Object.extend({
+ parameters: this.options.callback(form, value),
+ onComplete: this.onComplete.bind(this),
+ onFailure: this.onFailure.bind(this)
+ }, this.options.ajaxOptions));
+ }
+ // stop the event to avoid a page refresh in Safari
+ if (arguments.length > 1) {
+ Event.stop(arguments[0]);
+ }
+ return false;
+ },
+ onLoading: function() {
+ this.saving = true;
+ this.removeForm();
+ this.leaveHover();
+ this.showSaving();
+ },
+ showSaving: function() {
+ this.oldInnerHTML = this.element.innerHTML;
+ this.element.innerHTML = this.options.savingText;
+ Element.addClassName(this.element, this.options.savingClassName);
+ this.element.style.backgroundColor = this.originalBackground;
+ Element.show(this.element);
+ },
+ removeForm: function() {
+ if(this.form) {
+ if (this.form.parentNode) Element.remove(this.form);
+ this.form = null;
+ }
+ },
+ enterHover: function() {
+ if (this.saving) return;
+ this.element.style.backgroundColor = this.options.highlightcolor;
+ if (this.effect) {
+ this.effect.cancel();
+ }
+ Element.addClassName(this.element, this.options.hoverClassName)
+ },
+ leaveHover: function() {
+ if (this.options.backgroundColor) {
+ this.element.style.backgroundColor = this.oldBackground;
+ }
+ Element.removeClassName(this.element, this.options.hoverClassName)
+ if (this.saving) return;
+ this.effect = new Effect.Highlight(this.element, {
+ startcolor: this.options.highlightcolor,
+ endcolor: this.options.highlightendcolor,
+ restorecolor: this.originalBackground
+ });
+ },
+ leaveEditMode: function() {
+ Element.removeClassName(this.element, this.options.savingClassName);
+ this.removeForm();
+ this.leaveHover();
+ this.element.style.backgroundColor = this.originalBackground;
+ Element.show(this.element);
+ if (this.options.externalControl) {
+ Element.show(this.options.externalControl);
+ }
+ this.editing = false;
+ this.saving = false;
+ this.oldInnerHTML = null;
+ this.onLeaveEditMode();
+ },
+ onComplete: function(transport) {
+ this.leaveEditMode();
+ this.options.onComplete.bind(this)(transport, this.element);
+ },
+ onEnterEditMode: function() {},
+ onLeaveEditMode: function() {},
+ dispose: function() {
+ if (this.oldInnerHTML) {
+ this.element.innerHTML = this.oldInnerHTML;
+ }
+ this.leaveEditMode();
+ Event.stopObserving(this.element, 'click', this.onclickListener);
+ Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
+ Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
+ if (this.options.externalControl) {
+ Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
+ Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
+ Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
+ }
+ }
+};
+
+Ajax.InPlaceCollectionEditor = Class.create();
+Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype);
+Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
+ createEditField: function() {
+ if (!this.cached_selectTag) {
+ var selectTag = document.createElement("select");
+ var collection = this.options.collection || [];
+ var optionTag;
+ collection.each(function(e,i) {
+ optionTag = document.createElement("option");
+ optionTag.value = (e instanceof Array) ? e[0] : e;
+ if((typeof this.options.value == 'undefined') &&
+ ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true;
+ if(this.options.value==optionTag.value) optionTag.selected = true;
+ optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
+ selectTag.appendChild(optionTag);
+ }.bind(this));
+ this.cached_selectTag = selectTag;
+ }
+
+ this.editField = this.cached_selectTag;
+ if(this.options.loadTextURL) this.loadExternalText();
+ this.form.appendChild(this.editField);
+ this.options.callback = function(form, value) {
+ return "value=" + encodeURIComponent(value);
+ }
+ }
+});
+
+// Delayed observer, like Form.Element.Observer,
+// but waits for delay after last key input
+// Ideal for live-search fields
+
+Form.Element.DelayedObserver = Class.create();
+Form.Element.DelayedObserver.prototype = {
+ initialize: function(element, delay, callback) {
+ this.delay = delay || 0.5;
+ this.element = $(element);
+ this.callback = callback;
+ this.timer = null;
+ this.lastValue = $F(this.element);
+ Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
+ },
+ delayedListener: function(event) {
+ if(this.lastValue == $F(this.element)) return;
+ if(this.timer) clearTimeout(this.timer);
+ this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
+ this.lastValue = $F(this.element);
+ },
+ onTimerEvent: function() {
+ this.timer = null;
+ this.callback(this.element, $F(this.element));
+ }
+};
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/dragdrop.js b/dom/tests/mochitest/ajax/scriptaculous/src/dragdrop.js
new file mode 100644
index 0000000000..10c7c93264
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/dragdrop.js
@@ -0,0 +1,970 @@
+// script.aculo.us dragdrop.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+if(typeof Effect == 'undefined')
+ throw("dragdrop.js requires including script.aculo.us' effects.js library");
+
+var Droppables = {
+ drops: [],
+
+ remove: function(element) {
+ this.drops = this.drops.reject(function(d) { return d.element==$(element) });
+ },
+
+ add: function(element) {
+ element = $(element);
+ var options = Object.extend({
+ greedy: true,
+ hoverclass: null,
+ tree: false
+ }, arguments[1] || {});
+
+ // cache containers
+ if(options.containment) {
+ options._containers = [];
+ var containment = options.containment;
+ if((typeof containment == 'object') &&
+ (containment.constructor == Array)) {
+ containment.each( function(c) { options._containers.push($(c)) });
+ } else {
+ options._containers.push($(containment));
+ }
+ }
+
+ if(options.accept) options.accept = [options.accept].flatten();
+
+ Element.makePositioned(element); // fix IE
+ options.element = element;
+
+ this.drops.push(options);
+ },
+
+ findDeepestChild: function(drops) {
+ deepest = drops[0];
+
+ for (i = 1; i < drops.length; ++i)
+ if (Element.isParent(drops[i].element, deepest.element))
+ deepest = drops[i];
+
+ return deepest;
+ },
+
+ isContained: function(element, drop) {
+ var containmentNode;
+ if(drop.tree) {
+ containmentNode = element.treeNode;
+ } else {
+ containmentNode = element.parentNode;
+ }
+ return drop._containers.detect(function(c) { return containmentNode == c });
+ },
+
+ isAffected: function(point, element, drop) {
+ return (
+ (drop.element!=element) &&
+ ((!drop._containers) ||
+ this.isContained(element, drop)) &&
+ ((!drop.accept) ||
+ (Element.classNames(element).detect(
+ function(v) { return drop.accept.include(v) } ) )) &&
+ Position.within(drop.element, point[0], point[1]) );
+ },
+
+ deactivate: function(drop) {
+ if(drop.hoverclass)
+ Element.removeClassName(drop.element, drop.hoverclass);
+ this.last_active = null;
+ },
+
+ activate: function(drop) {
+ if(drop.hoverclass)
+ Element.addClassName(drop.element, drop.hoverclass);
+ this.last_active = drop;
+ },
+
+ show: function(point, element) {
+ if(!this.drops.length) return;
+ var affected = [];
+
+ if(this.last_active) this.deactivate(this.last_active);
+ this.drops.each( function(drop) {
+ if(Droppables.isAffected(point, element, drop))
+ affected.push(drop);
+ });
+
+ if(affected.length>0) {
+ drop = Droppables.findDeepestChild(affected);
+ Position.within(drop.element, point[0], point[1]);
+ if(drop.onHover)
+ drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
+
+ Droppables.activate(drop);
+ }
+ },
+
+ fire: function(event, element) {
+ if(!this.last_active) return;
+ Position.prepare();
+
+ if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
+ if (this.last_active.onDrop) {
+ this.last_active.onDrop(element, this.last_active.element, event);
+ return true;
+ }
+ },
+
+ reset: function() {
+ if(this.last_active)
+ this.deactivate(this.last_active);
+ }
+}
+
+var Draggables = {
+ drags: [],
+ observers: [],
+
+ register: function(draggable) {
+ if(this.drags.length == 0) {
+ this.eventMouseUp = this.endDrag.bindAsEventListener(this);
+ this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
+ this.eventKeypress = this.keyPress.bindAsEventListener(this);
+
+ Event.observe(document, "mouseup", this.eventMouseUp);
+ Event.observe(document, "mousemove", this.eventMouseMove);
+ Event.observe(document, "keypress", this.eventKeypress);
+ }
+ this.drags.push(draggable);
+ },
+
+ unregister: function(draggable) {
+ this.drags = this.drags.reject(function(d) { return d==draggable });
+ if(this.drags.length == 0) {
+ Event.stopObserving(document, "mouseup", this.eventMouseUp);
+ Event.stopObserving(document, "mousemove", this.eventMouseMove);
+ Event.stopObserving(document, "keypress", this.eventKeypress);
+ }
+ },
+
+ activate: function(draggable) {
+ if(draggable.options.delay) {
+ this._timeout = setTimeout(function() {
+ Draggables._timeout = null;
+ window.focus();
+ Draggables.activeDraggable = draggable;
+ }.bind(this), draggable.options.delay);
+ } else {
+ window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
+ this.activeDraggable = draggable;
+ }
+ },
+
+ deactivate: function() {
+ this.activeDraggable = null;
+ },
+
+ updateDrag: function(event) {
+ if(!this.activeDraggable) return;
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ // Mozilla-based browsers fire successive mousemove events with
+ // the same coordinates, prevent needless redrawing (moz bug?)
+ if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
+ this._lastPointer = pointer;
+
+ this.activeDraggable.updateDrag(event, pointer);
+ },
+
+ endDrag: function(event) {
+ if(this._timeout) {
+ clearTimeout(this._timeout);
+ this._timeout = null;
+ }
+ if(!this.activeDraggable) return;
+ this._lastPointer = null;
+ this.activeDraggable.endDrag(event);
+ this.activeDraggable = null;
+ },
+
+ keyPress: function(event) {
+ if(this.activeDraggable)
+ this.activeDraggable.keyPress(event);
+ },
+
+ addObserver: function(observer) {
+ this.observers.push(observer);
+ this._cacheObserverCallbacks();
+ },
+
+ removeObserver: function(element) { // element instead of observer fixes mem leaks
+ this.observers = this.observers.reject( function(o) { return o.element==element });
+ this._cacheObserverCallbacks();
+ },
+
+ notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
+ if(this[eventName+'Count'] > 0)
+ this.observers.each( function(o) {
+ if(o[eventName]) o[eventName](eventName, draggable, event);
+ });
+ if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
+ },
+
+ _cacheObserverCallbacks: function() {
+ ['onStart','onEnd','onDrag'].each( function(eventName) {
+ Draggables[eventName+'Count'] = Draggables.observers.select(
+ function(o) { return o[eventName]; }
+ ).length;
+ });
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Draggable = Class.create();
+Draggable._dragging = {};
+
+Draggable.prototype = {
+ initialize: function(element) {
+ var defaults = {
+ handle: false,
+ reverteffect: function(element, top_offset, left_offset) {
+ var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
+ new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
+ queue: {scope:'_draggable', position:'end'}
+ });
+ },
+ endeffect: function(element) {
+ var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0;
+ new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
+ queue: {scope:'_draggable', position:'end'},
+ afterFinish: function(){
+ Draggable._dragging[element] = false
+ }
+ });
+ },
+ zindex: 1000,
+ revert: false,
+ quiet: false,
+ scroll: false,
+ scrollSensitivity: 20,
+ scrollSpeed: 15,
+ snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
+ delay: 0
+ };
+
+ if(!arguments[1] || typeof arguments[1].endeffect == 'undefined')
+ Object.extend(defaults, {
+ starteffect: function(element) {
+ element._opacity = Element.getOpacity(element);
+ Draggable._dragging[element] = true;
+ new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
+ }
+ });
+
+ var options = Object.extend(defaults, arguments[1] || {});
+
+ this.element = $(element);
+
+ if(options.handle && (typeof options.handle == 'string'))
+ this.handle = this.element.down('.'+options.handle, 0);
+
+ if(!this.handle) this.handle = $(options.handle);
+ if(!this.handle) this.handle = this.element;
+
+ if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
+ options.scroll = $(options.scroll);
+ this._isScrollChild = Element.childOf(this.element, options.scroll);
+ }
+
+ Element.makePositioned(this.element); // fix IE
+
+ this.delta = this.currentDelta();
+ this.options = options;
+ this.dragging = false;
+
+ this.eventMouseDown = this.initDrag.bindAsEventListener(this);
+ Event.observe(this.handle, "mousedown", this.eventMouseDown);
+
+ Draggables.register(this);
+ },
+
+ destroy: function() {
+ Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
+ Draggables.unregister(this);
+ },
+
+ currentDelta: function() {
+ return([
+ parseInt(Element.getStyle(this.element,'left') || '0'),
+ parseInt(Element.getStyle(this.element,'top') || '0')]);
+ },
+
+ initDrag: function(event) {
+ if(typeof Draggable._dragging[this.element] != 'undefined' &&
+ Draggable._dragging[this.element]) return;
+ if(Event.isLeftClick(event)) {
+ // abort on form elements, fixes a Firefox issue
+ var src = Event.element(event);
+ if((tag_name = src.tagName.toUpperCase()) && (
+ tag_name=='INPUT' ||
+ tag_name=='SELECT' ||
+ tag_name=='OPTION' ||
+ tag_name=='BUTTON' ||
+ tag_name=='TEXTAREA')) return;
+
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ var pos = Position.cumulativeOffset(this.element);
+ this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
+
+ Draggables.activate(this);
+ Event.stop(event);
+ }
+ },
+
+ startDrag: function(event) {
+ this.dragging = true;
+
+ if(this.options.zindex) {
+ this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
+ this.element.style.zIndex = this.options.zindex;
+ }
+
+ if(this.options.ghosting) {
+ this._clone = this.element.cloneNode(true);
+ Position.absolutize(this.element);
+ this.element.parentNode.insertBefore(this._clone, this.element);
+ }
+
+ if(this.options.scroll) {
+ if (this.options.scroll == window) {
+ var where = this._getWindowScroll(this.options.scroll);
+ this.originalScrollLeft = where.left;
+ this.originalScrollTop = where.top;
+ } else {
+ this.originalScrollLeft = this.options.scroll.scrollLeft;
+ this.originalScrollTop = this.options.scroll.scrollTop;
+ }
+ }
+
+ Draggables.notify('onStart', this, event);
+
+ if(this.options.starteffect) this.options.starteffect(this.element);
+ },
+
+ updateDrag: function(event, pointer) {
+ if(!this.dragging) this.startDrag(event);
+
+ if(!this.options.quiet){
+ Position.prepare();
+ Droppables.show(pointer, this.element);
+ }
+
+ Draggables.notify('onDrag', this, event);
+
+ this.draw(pointer);
+ if(this.options.change) this.options.change(this);
+
+ if(this.options.scroll) {
+ this.stopScrolling();
+
+ var p;
+ if (this.options.scroll == window) {
+ with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
+ } else {
+ p = Position.page(this.options.scroll);
+ p[0] += this.options.scroll.scrollLeft + Position.deltaX;
+ p[1] += this.options.scroll.scrollTop + Position.deltaY;
+ p.push(p[0]+this.options.scroll.offsetWidth);
+ p.push(p[1]+this.options.scroll.offsetHeight);
+ }
+ var speed = [0,0];
+ if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
+ if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
+ if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
+ if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
+ this.startScrolling(speed);
+ }
+
+ // fix AppleWebKit rendering
+ if(Prototype.Browser.WebKit) window.scrollBy(0,0);
+
+ Event.stop(event);
+ },
+
+ finishDrag: function(event, success) {
+ this.dragging = false;
+
+ if(this.options.quiet){
+ Position.prepare();
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ Droppables.show(pointer, this.element);
+ }
+
+ if(this.options.ghosting) {
+ Position.relativize(this.element);
+ Element.remove(this._clone);
+ this._clone = null;
+ }
+
+ var dropped = false;
+ if(success) {
+ dropped = Droppables.fire(event, this.element);
+ if (!dropped) dropped = false;
+ }
+ if(dropped && this.options.onDropped) this.options.onDropped(this.element);
+ Draggables.notify('onEnd', this, event);
+
+ var revert = this.options.revert;
+ if(revert && typeof revert == 'function') revert = revert(this.element);
+
+ var d = this.currentDelta();
+ if(revert && this.options.reverteffect) {
+ if (dropped == 0 || revert != 'failure')
+ this.options.reverteffect(this.element,
+ d[1]-this.delta[1], d[0]-this.delta[0]);
+ } else {
+ this.delta = d;
+ }
+
+ if(this.options.zindex)
+ this.element.style.zIndex = this.originalZ;
+
+ if(this.options.endeffect)
+ this.options.endeffect(this.element);
+
+ Draggables.deactivate(this);
+ Droppables.reset();
+ },
+
+ keyPress: function(event) {
+ if(event.keyCode!=Event.KEY_ESC) return;
+ this.finishDrag(event, false);
+ Event.stop(event);
+ },
+
+ endDrag: function(event) {
+ if(!this.dragging) return;
+ this.stopScrolling();
+ this.finishDrag(event, true);
+ Event.stop(event);
+ },
+
+ draw: function(point) {
+ var pos = Position.cumulativeOffset(this.element);
+ if(this.options.ghosting) {
+ var r = Position.realOffset(this.element);
+ pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
+ }
+
+ var d = this.currentDelta();
+ pos[0] -= d[0]; pos[1] -= d[1];
+
+ if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
+ pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
+ pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
+ }
+
+ var p = [0,1].map(function(i){
+ return (point[i]-pos[i]-this.offset[i])
+ }.bind(this));
+
+ if(this.options.snap) {
+ if(typeof this.options.snap == 'function') {
+ p = this.options.snap(p[0],p[1],this);
+ } else {
+ if(this.options.snap instanceof Array) {
+ p = p.map( function(v, i) {
+ return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
+ } else {
+ p = p.map( function(v) {
+ return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
+ }
+ }}
+
+ var style = this.element.style;
+ if((!this.options.constraint) || (this.options.constraint=='horizontal'))
+ style.left = p[0] + "px";
+ if((!this.options.constraint) || (this.options.constraint=='vertical'))
+ style.top = p[1] + "px";
+
+ if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
+ },
+
+ stopScrolling: function() {
+ if(this.scrollInterval) {
+ clearInterval(this.scrollInterval);
+ this.scrollInterval = null;
+ Draggables._lastScrollPointer = null;
+ }
+ },
+
+ startScrolling: function(speed) {
+ if(!(speed[0] || speed[1])) return;
+ this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
+ this.lastScrolled = new Date();
+ this.scrollInterval = setInterval(this.scroll.bind(this), 10);
+ },
+
+ scroll: function() {
+ var current = new Date();
+ var delta = current - this.lastScrolled;
+ this.lastScrolled = current;
+ if(this.options.scroll == window) {
+ with (this._getWindowScroll(this.options.scroll)) {
+ if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
+ var d = delta / 1000;
+ this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
+ }
+ }
+ } else {
+ this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
+ this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
+ }
+
+ Position.prepare();
+ Droppables.show(Draggables._lastPointer, this.element);
+ Draggables.notify('onDrag', this);
+ if (this._isScrollChild) {
+ Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
+ Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
+ Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
+ if (Draggables._lastScrollPointer[0] < 0)
+ Draggables._lastScrollPointer[0] = 0;
+ if (Draggables._lastScrollPointer[1] < 0)
+ Draggables._lastScrollPointer[1] = 0;
+ this.draw(Draggables._lastScrollPointer);
+ }
+
+ if(this.options.change) this.options.change(this);
+ },
+
+ _getWindowScroll: function(w) {
+ var T, L, W, H;
+ with (w.document) {
+ if (w.document.documentElement && documentElement.scrollTop) {
+ T = documentElement.scrollTop;
+ L = documentElement.scrollLeft;
+ } else if (w.document.body) {
+ T = body.scrollTop;
+ L = body.scrollLeft;
+ }
+ if (w.innerWidth) {
+ W = w.innerWidth;
+ H = w.innerHeight;
+ } else if (w.document.documentElement && documentElement.clientWidth) {
+ W = documentElement.clientWidth;
+ H = documentElement.clientHeight;
+ } else {
+ W = body.offsetWidth;
+ H = body.offsetHeight
+ }
+ }
+ return { top: T, left: L, width: W, height: H };
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var SortableObserver = Class.create();
+SortableObserver.prototype = {
+ initialize: function(element, observer) {
+ this.element = $(element);
+ this.observer = observer;
+ this.lastValue = Sortable.serialize(this.element);
+ },
+
+ onStart: function() {
+ this.lastValue = Sortable.serialize(this.element);
+ },
+
+ onEnd: function() {
+ Sortable.unmark();
+ if(this.lastValue != Sortable.serialize(this.element))
+ this.observer(this.element)
+ }
+}
+
+var Sortable = {
+ SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
+
+ sortables: {},
+
+ _findRootElement: function(element) {
+ while (element.tagName.toUpperCase() != "BODY") {
+ if(element.id && Sortable.sortables[element.id]) return element;
+ element = element.parentNode;
+ }
+ },
+
+ options: function(element) {
+ element = Sortable._findRootElement($(element));
+ if(!element) return;
+ return Sortable.sortables[element.id];
+ },
+
+ destroy: function(element){
+ var s = Sortable.options(element);
+
+ if(s) {
+ Draggables.removeObserver(s.element);
+ s.droppables.each(function(d){ Droppables.remove(d) });
+ s.draggables.invoke('destroy');
+
+ delete Sortable.sortables[s.element.id];
+ }
+ },
+
+ create: function(element) {
+ element = $(element);
+ var options = Object.extend({
+ element: element,
+ tag: 'li', // assumes li children, override with tag: 'tagname'
+ dropOnEmpty: false,
+ tree: false,
+ treeTag: 'ul',
+ overlap: 'vertical', // one of 'vertical', 'horizontal'
+ constraint: 'vertical', // one of 'vertical', 'horizontal', false
+ containment: element, // also takes array of elements (or id's); or false
+ handle: false, // or a CSS class
+ only: false,
+ delay: 0,
+ hoverclass: null,
+ ghosting: false,
+ quiet: false,
+ scroll: false,
+ scrollSensitivity: 20,
+ scrollSpeed: 15,
+ format: this.SERIALIZE_RULE,
+
+ // these take arrays of elements or ids and can be
+ // used for better initialization performance
+ elements: false,
+ handles: false,
+
+ onChange: Prototype.emptyFunction,
+ onUpdate: Prototype.emptyFunction
+ }, arguments[1] || {});
+
+ // clear any old sortable with same element
+ this.destroy(element);
+
+ // build options for the draggables
+ var options_for_draggable = {
+ revert: true,
+ quiet: options.quiet,
+ scroll: options.scroll,
+ scrollSpeed: options.scrollSpeed,
+ scrollSensitivity: options.scrollSensitivity,
+ delay: options.delay,
+ ghosting: options.ghosting,
+ constraint: options.constraint,
+ handle: options.handle };
+
+ if(options.starteffect)
+ options_for_draggable.starteffect = options.starteffect;
+
+ if(options.reverteffect)
+ options_for_draggable.reverteffect = options.reverteffect;
+ else
+ if(options.ghosting) options_for_draggable.reverteffect = function(element) {
+ element.style.top = 0;
+ element.style.left = 0;
+ };
+
+ if(options.endeffect)
+ options_for_draggable.endeffect = options.endeffect;
+
+ if(options.zindex)
+ options_for_draggable.zindex = options.zindex;
+
+ // build options for the droppables
+ var options_for_droppable = {
+ overlap: options.overlap,
+ containment: options.containment,
+ tree: options.tree,
+ hoverclass: options.hoverclass,
+ onHover: Sortable.onHover
+ }
+
+ var options_for_tree = {
+ onHover: Sortable.onEmptyHover,
+ overlap: options.overlap,
+ containment: options.containment,
+ hoverclass: options.hoverclass
+ }
+
+ // fix for gecko engine
+ Element.cleanWhitespace(element);
+
+ options.draggables = [];
+ options.droppables = [];
+
+ // drop on empty handling
+ if(options.dropOnEmpty || options.tree) {
+ Droppables.add(element, options_for_tree);
+ options.droppables.push(element);
+ }
+
+ (options.elements || this.findElements(element, options) || []).each( function(e,i) {
+ var handle = options.handles ? $(options.handles[i]) :
+ (options.handle ? $(e).getElementsByClassName(options.handle)[0] : e);
+ options.draggables.push(
+ new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
+ Droppables.add(e, options_for_droppable);
+ if(options.tree) e.treeNode = element;
+ options.droppables.push(e);
+ });
+
+ if(options.tree) {
+ (Sortable.findTreeElements(element, options) || []).each( function(e) {
+ Droppables.add(e, options_for_tree);
+ e.treeNode = element;
+ options.droppables.push(e);
+ });
+ }
+
+ // keep reference
+ this.sortables[element.id] = options;
+
+ // for onupdate
+ Draggables.addObserver(new SortableObserver(element, options.onUpdate));
+
+ },
+
+ // return all suitable-for-sortable elements in a guaranteed order
+ findElements: function(element, options) {
+ return Element.findChildren(
+ element, options.only, options.tree ? true : false, options.tag);
+ },
+
+ findTreeElements: function(element, options) {
+ return Element.findChildren(
+ element, options.only, options.tree ? true : false, options.treeTag);
+ },
+
+ onHover: function(element, dropon, overlap) {
+ if(Element.isParent(dropon, element)) return;
+
+ if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
+ return;
+ } else if(overlap>0.5) {
+ Sortable.mark(dropon, 'before');
+ if(dropon.previousSibling != element) {
+ var oldParentNode = element.parentNode;
+ element.style.visibility = "hidden"; // fix gecko rendering
+ dropon.parentNode.insertBefore(element, dropon);
+ if(dropon.parentNode!=oldParentNode)
+ Sortable.options(oldParentNode).onChange(element);
+ Sortable.options(dropon.parentNode).onChange(element);
+ }
+ } else {
+ Sortable.mark(dropon, 'after');
+ var nextElement = dropon.nextSibling || null;
+ if(nextElement != element) {
+ var oldParentNode = element.parentNode;
+ element.style.visibility = "hidden"; // fix gecko rendering
+ dropon.parentNode.insertBefore(element, nextElement);
+ if(dropon.parentNode!=oldParentNode)
+ Sortable.options(oldParentNode).onChange(element);
+ Sortable.options(dropon.parentNode).onChange(element);
+ }
+ }
+ },
+
+ onEmptyHover: function(element, dropon, overlap) {
+ var oldParentNode = element.parentNode;
+ var droponOptions = Sortable.options(dropon);
+
+ if(!Element.isParent(dropon, element)) {
+ var index;
+
+ var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
+ var child = null;
+
+ if(children) {
+ var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
+
+ for (index = 0; index < children.length; index += 1) {
+ if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
+ offset -= Element.offsetSize (children[index], droponOptions.overlap);
+ } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
+ child = index + 1 < children.length ? children[index + 1] : null;
+ break;
+ } else {
+ child = children[index];
+ break;
+ }
+ }
+ }
+
+ dropon.insertBefore(element, child);
+
+ Sortable.options(oldParentNode).onChange(element);
+ droponOptions.onChange(element);
+ }
+ },
+
+ unmark: function() {
+ if(Sortable._marker) Sortable._marker.hide();
+ },
+
+ mark: function(dropon, position) {
+ // mark on ghosting only
+ var sortable = Sortable.options(dropon.parentNode);
+ if(sortable && !sortable.ghosting) return;
+
+ if(!Sortable._marker) {
+ Sortable._marker =
+ ($('dropmarker') || Element.extend(document.createElement('DIV'))).
+ hide().addClassName('dropmarker').setStyle({position:'absolute'});
+ document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
+ }
+ var offsets = Position.cumulativeOffset(dropon);
+ Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
+
+ if(position=='after')
+ if(sortable.overlap == 'horizontal')
+ Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
+ else
+ Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
+
+ Sortable._marker.show();
+ },
+
+ _tree: function(element, options, parent) {
+ var children = Sortable.findElements(element, options) || [];
+
+ for (var i = 0; i < children.length; ++i) {
+ var match = children[i].id.match(options.format);
+
+ if (!match) continue;
+
+ var child = {
+ id: encodeURIComponent(match ? match[1] : null),
+ element: element,
+ parent: parent,
+ children: [],
+ position: parent.children.length,
+ container: $(children[i]).down(options.treeTag)
+ }
+
+ /* Get the element containing the children and recurse over it */
+ if (child.container)
+ this._tree(child.container, options, child)
+
+ parent.children.push (child);
+ }
+
+ return parent;
+ },
+
+ tree: function(element) {
+ element = $(element);
+ var sortableOptions = this.options(element);
+ var options = Object.extend({
+ tag: sortableOptions.tag,
+ treeTag: sortableOptions.treeTag,
+ only: sortableOptions.only,
+ name: element.id,
+ format: sortableOptions.format
+ }, arguments[1] || {});
+
+ var root = {
+ id: null,
+ parent: null,
+ children: [],
+ container: element,
+ position: 0
+ }
+
+ return Sortable._tree(element, options, root);
+ },
+
+ /* Construct a [i] index for a particular node */
+ _constructIndex: function(node) {
+ var index = '';
+ do {
+ if (node.id) index = '[' + node.position + ']' + index;
+ } while ((node = node.parent) != null);
+ return index;
+ },
+
+ sequence: function(element) {
+ element = $(element);
+ var options = Object.extend(this.options(element), arguments[1] || {});
+
+ return $(this.findElements(element, options) || []).map( function(item) {
+ return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
+ });
+ },
+
+ setSequence: function(element, new_sequence) {
+ element = $(element);
+ var options = Object.extend(this.options(element), arguments[2] || {});
+
+ var nodeMap = {};
+ this.findElements(element, options).each( function(n) {
+ if (n.id.match(options.format))
+ nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
+ n.parentNode.removeChild(n);
+ });
+
+ new_sequence.each(function(ident) {
+ var n = nodeMap[ident];
+ if (n) {
+ n[1].appendChild(n[0]);
+ delete nodeMap[ident];
+ }
+ });
+ },
+
+ serialize: function(element) {
+ element = $(element);
+ var options = Object.extend(Sortable.options(element), arguments[1] || {});
+ var name = encodeURIComponent(
+ (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
+
+ if (options.tree) {
+ return Sortable.tree(element, arguments[1]).children.map( function (item) {
+ return [name + Sortable._constructIndex(item) + "[id]=" +
+ encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
+ }).flatten().join('&');
+ } else {
+ return Sortable.sequence(element, arguments[1]).map( function(item) {
+ return name + "[]=" + encodeURIComponent(item);
+ }).join('&');
+ }
+ }
+}
+
+// Returns true if child is contained within element
+Element.isParent = function(child, element) {
+ if (!child.parentNode || child == element) return false;
+ if (child.parentNode == element) return true;
+ return Element.isParent(child.parentNode, element);
+}
+
+Element.findChildren = function(element, only, recursive, tagName) {
+ if(!element.hasChildNodes()) return null;
+ tagName = tagName.toUpperCase();
+ if(only) only = [only].flatten();
+ var elements = [];
+ $A(element.childNodes).each( function(e) {
+ if(e.tagName && e.tagName.toUpperCase()==tagName &&
+ (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
+ elements.push(e);
+ if(recursive) {
+ var grandchildren = Element.findChildren(e, only, recursive, tagName);
+ if(grandchildren) elements.push(grandchildren);
+ }
+ });
+
+ return (elements.length>0 ? elements.flatten() : []);
+}
+
+Element.offsetSize = function (element, type) {
+ return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
+}
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/effects.js b/dom/tests/mochitest/ajax/scriptaculous/src/effects.js
new file mode 100644
index 0000000000..eb69587e60
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/effects.js
@@ -0,0 +1,1094 @@
+// script.aculo.us effects.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// Contributors:
+// Justin Palmer (http://encytemedia.com/)
+// Mark Pilgrim (http://diveintomark.org/)
+// Martin Bialasinki
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+// converts rgb() and #xxx to #xxxxxx format,
+// returns self (or first argument) if not convertable
+String.prototype.parseColor = function() {
+ var color = '#';
+ if(this.slice(0,4) == 'rgb(') {
+ var cols = this.slice(4,this.length-1).split(',');
+ var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
+ } else {
+ if(this.slice(0,1) == '#') {
+ if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
+ if(this.length==7) color = this.toLowerCase();
+ }
+ }
+ return(color.length==7 ? color : (arguments[0] || this));
+}
+
+/*--------------------------------------------------------------------------*/
+
+Element.collectTextNodes = function(element) {
+ return $A($(element).childNodes).collect( function(node) {
+ return (node.nodeType==3 ? node.nodeValue :
+ (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
+ }).flatten().join('');
+}
+
+Element.collectTextNodesIgnoreClass = function(element, className) {
+ return $A($(element).childNodes).collect( function(node) {
+ return (node.nodeType==3 ? node.nodeValue :
+ ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
+ Element.collectTextNodesIgnoreClass(node, className) : ''));
+ }).flatten().join('');
+}
+
+Element.setContentZoom = function(element, percent) {
+ element = $(element);
+ element.setStyle({fontSize: (percent/100) + 'em'});
+ if(Prototype.Browser.WebKit) window.scrollBy(0,0);
+ return element;
+}
+
+Element.getInlineOpacity = function(element){
+ return $(element).style.opacity || '';
+}
+
+Element.forceRerendering = function(element) {
+ try {
+ element = $(element);
+ var n = document.createTextNode(' ');
+ element.appendChild(n);
+ element.removeChild(n);
+ } catch(e) { }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Array.prototype.call = function() {
+ var args = arguments;
+ this.each(function(f){ f.apply(this, args) });
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Effect = {
+ _elementDoesNotExistError: {
+ name: 'ElementDoesNotExistError',
+ message: 'The specified DOM element does not exist, but is required for this effect to operate'
+ },
+ tagifyText: function(element) {
+ if(typeof Builder == 'undefined')
+ throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
+
+ var tagifyStyle = 'position:relative';
+ if(Prototype.Browser.IE) tagifyStyle += ';zoom:1';
+
+ element = $(element);
+ $A(element.childNodes).each( function(child) {
+ if(child.nodeType==3) {
+ child.nodeValue.toArray().each( function(character) {
+ element.insertBefore(
+ Builder.node('span',{style: tagifyStyle},
+ character == ' ' ? String.fromCharCode(160) : character),
+ child);
+ });
+ Element.remove(child);
+ }
+ });
+ },
+ multiple: function(element, effect) {
+ var elements;
+ if(((typeof element == 'object') ||
+ (typeof element == 'function')) &&
+ (element.length))
+ elements = element;
+ else
+ elements = $(element).childNodes;
+
+ var options = Object.extend({
+ speed: 0.1,
+ delay: 0.0
+ }, arguments[2] || {});
+ var masterDelay = options.delay;
+
+ $A(elements).each( function(element, index) {
+ new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
+ });
+ },
+ PAIRS: {
+ 'slide': ['SlideDown','SlideUp'],
+ 'blind': ['BlindDown','BlindUp'],
+ 'appear': ['Appear','Fade']
+ },
+ toggle: function(element, effect) {
+ element = $(element);
+ effect = (effect || 'appear').toLowerCase();
+ var options = Object.extend({
+ queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
+ }, arguments[2] || {});
+ Effect[element.visible() ?
+ Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+ }
+};
+
+var Effect2 = Effect; // deprecated
+
+/* ------------- transitions ------------- */
+
+Effect.Transitions = {
+ linear: Prototype.K,
+ sinoidal: function(pos) {
+ return (-Math.cos(pos*Math.PI)/2) + 0.5;
+ },
+ reverse: function(pos) {
+ return 1-pos;
+ },
+ flicker: function(pos) {
+ var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
+ return (pos > 1 ? 1 : pos);
+ },
+ wobble: function(pos) {
+ return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+ },
+ pulse: function(pos, pulses) {
+ pulses = pulses || 5;
+ return (
+ Math.round((pos % (1/pulses)) * pulses) == 0 ?
+ ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) :
+ 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
+ );
+ },
+ none: function(pos) {
+ return 0;
+ },
+ full: function(pos) {
+ return 1;
+ }
+};
+
+/* ------------- core effects ------------- */
+
+Effect.ScopedQueue = Class.create();
+Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
+ initialize: function() {
+ this.effects = [];
+ this.interval = null;
+ },
+ _each: function(iterator) {
+ this.effects._each(iterator);
+ },
+ add: function(effect) {
+ var timestamp = new Date().getTime();
+
+ var position = (typeof effect.options.queue == 'string') ?
+ effect.options.queue : effect.options.queue.position;
+
+ switch(position) {
+ case 'front':
+ // move unstarted effects after this effect
+ this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
+ e.startOn += effect.finishOn;
+ e.finishOn += effect.finishOn;
+ });
+ break;
+ case 'with-last':
+ timestamp = this.effects.pluck('startOn').max() || timestamp;
+ break;
+ case 'end':
+ // start effect after last queued effect has finished
+ timestamp = this.effects.pluck('finishOn').max() || timestamp;
+ break;
+ }
+
+ effect.startOn += timestamp;
+ effect.finishOn += timestamp;
+
+ if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
+ this.effects.push(effect);
+
+ if(!this.interval)
+ this.interval = setInterval(this.loop.bind(this), 15);
+ },
+ remove: function(effect) {
+ this.effects = this.effects.reject(function(e) { return e==effect });
+ if(this.effects.length == 0) {
+ clearInterval(this.interval);
+ this.interval = null;
+ }
+ },
+ loop: function() {
+ var timePos = new Date().getTime();
+ for(var i=0, len=this.effects.length;i<len;i++)
+ this.effects[i] && this.effects[i].loop(timePos);
+ }
+});
+
+Effect.Queues = {
+ instances: $H(),
+ get: function(queueName) {
+ if(typeof queueName != 'string') return queueName;
+
+ if(!this.instances[queueName])
+ this.instances[queueName] = new Effect.ScopedQueue();
+
+ return this.instances[queueName];
+ }
+}
+Effect.Queue = Effect.Queues.get('global');
+
+Effect.DefaultOptions = {
+ transition: Effect.Transitions.sinoidal,
+ duration: 1.0, // seconds
+ fps: 100, // 100= assume 66fps max.
+ sync: false, // true for combining
+ from: 0.0,
+ to: 1.0,
+ delay: 0.0,
+ queue: 'parallel'
+}
+
+Effect.Base = function() {};
+Effect.Base.prototype = {
+ position: null,
+ start: function(options) {
+ function codeForEvent(options,eventName){
+ return (
+ (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
+ (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
+ );
+ }
+ if(options.transition === false) options.transition = Effect.Transitions.linear;
+ this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
+ this.currentFrame = 0;
+ this.state = 'idle';
+ this.startOn = this.options.delay*1000;
+ this.finishOn = this.startOn+(this.options.duration*1000);
+ this.fromToDelta = this.options.to-this.options.from;
+ this.totalTime = this.finishOn-this.startOn;
+ this.totalFrames = this.options.fps*this.options.duration;
+
+ eval('this.render = function(pos){ '+
+ 'if(this.state=="idle"){this.state="running";'+
+ codeForEvent(options,'beforeSetup')+
+ (this.setup ? 'this.setup();':'')+
+ codeForEvent(options,'afterSetup')+
+ '};if(this.state=="running"){'+
+ 'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
+ 'this.position=pos;'+
+ codeForEvent(options,'beforeUpdate')+
+ (this.update ? 'this.update(pos);':'')+
+ codeForEvent(options,'afterUpdate')+
+ '}}');
+
+ this.event('beforeStart');
+ if(!this.options.sync)
+ Effect.Queues.get(typeof this.options.queue == 'string' ?
+ 'global' : this.options.queue.scope).add(this);
+ },
+ loop: function(timePos) {
+ if(timePos >= this.startOn) {
+ if(timePos >= this.finishOn) {
+ this.render(1.0);
+ this.cancel();
+ this.event('beforeFinish');
+ if(this.finish) this.finish();
+ this.event('afterFinish');
+ return;
+ }
+ var pos = (timePos - this.startOn) / this.totalTime,
+ frame = Math.round(pos * this.totalFrames);
+ if(frame > this.currentFrame) {
+ this.render(pos);
+ this.currentFrame = frame;
+ }
+ }
+ },
+ cancel: function() {
+ if(!this.options.sync)
+ Effect.Queues.get(typeof this.options.queue == 'string' ?
+ 'global' : this.options.queue.scope).remove(this);
+ this.state = 'finished';
+ },
+ event: function(eventName) {
+ if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
+ if(this.options[eventName]) this.options[eventName](this);
+ },
+ inspect: function() {
+ var data = $H();
+ for(property in this)
+ if(typeof this[property] != 'function') data[property] = this[property];
+ return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
+ }
+}
+
+Effect.Parallel = Class.create();
+Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
+ initialize: function(effects) {
+ this.effects = effects || [];
+ this.start(arguments[1]);
+ },
+ update: function(position) {
+ this.effects.invoke('render', position);
+ },
+ finish: function(position) {
+ this.effects.each( function(effect) {
+ effect.render(1.0);
+ effect.cancel();
+ effect.event('beforeFinish');
+ if(effect.finish) effect.finish(position);
+ effect.event('afterFinish');
+ });
+ }
+});
+
+Effect.Event = Class.create();
+Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), {
+ initialize: function() {
+ var options = Object.extend({
+ duration: 0
+ }, arguments[0] || {});
+ this.start(options);
+ },
+ update: Prototype.emptyFunction
+});
+
+Effect.Opacity = Class.create();
+Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
+ initialize: function(element) {
+ this.element = $(element);
+ if(!this.element) throw(Effect._elementDoesNotExistError);
+ // make this work on IE on elements without 'layout'
+ if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+ this.element.setStyle({zoom: 1});
+ var options = Object.extend({
+ from: this.element.getOpacity() || 0.0,
+ to: 1.0
+ }, arguments[1] || {});
+ this.start(options);
+ },
+ update: function(position) {
+ this.element.setOpacity(position);
+ }
+});
+
+Effect.Move = Class.create();
+Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
+ initialize: function(element) {
+ this.element = $(element);
+ if(!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ x: 0,
+ y: 0,
+ mode: 'relative'
+ }, arguments[1] || {});
+ this.start(options);
+ },
+ setup: function() {
+ // Bug in Opera: Opera returns the "real" position of a static element or
+ // relative element that does not have top/left explicitly set.
+ // ==> Always set top and left for position relative elements in your stylesheets
+ // (to 0 if you do not need them)
+ this.element.makePositioned();
+ this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
+ this.originalTop = parseFloat(this.element.getStyle('top') || '0');
+ if(this.options.mode == 'absolute') {
+ // absolute movement, so we need to calc deltaX and deltaY
+ this.options.x = this.options.x - this.originalLeft;
+ this.options.y = this.options.y - this.originalTop;
+ }
+ },
+ update: function(position) {
+ this.element.setStyle({
+ left: Math.round(this.options.x * position + this.originalLeft) + 'px',
+ top: Math.round(this.options.y * position + this.originalTop) + 'px'
+ });
+ }
+});
+
+// for backwards compatibility
+Effect.MoveBy = function(element, toTop, toLeft) {
+ return new Effect.Move(element,
+ Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
+};
+
+Effect.Scale = Class.create();
+Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
+ initialize: function(element, percent) {
+ this.element = $(element);
+ if(!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ scaleX: true,
+ scaleY: true,
+ scaleContent: true,
+ scaleFromCenter: false,
+ scaleMode: 'box', // 'box' or 'contents' or {} with provided values
+ scaleFrom: 100.0,
+ scaleTo: percent
+ }, arguments[2] || {});
+ this.start(options);
+ },
+ setup: function() {
+ this.restoreAfterFinish = this.options.restoreAfterFinish || false;
+ this.elementPositioning = this.element.getStyle('position');
+
+ this.originalStyle = {};
+ ['top','left','width','height','fontSize'].each( function(k) {
+ this.originalStyle[k] = this.element.style[k];
+ }.bind(this));
+
+ this.originalTop = this.element.offsetTop;
+ this.originalLeft = this.element.offsetLeft;
+
+ var fontSize = this.element.getStyle('font-size') || '100%';
+ ['em','px','%','pt'].each( function(fontSizeType) {
+ if(fontSize.indexOf(fontSizeType)>0) {
+ this.fontSize = parseFloat(fontSize);
+ this.fontSizeType = fontSizeType;
+ }
+ }.bind(this));
+
+ this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
+
+ this.dims = null;
+ if(this.options.scaleMode=='box')
+ this.dims = [this.element.offsetHeight, this.element.offsetWidth];
+ if(/^content/.test(this.options.scaleMode))
+ this.dims = [this.element.scrollHeight, this.element.scrollWidth];
+ if(!this.dims)
+ this.dims = [this.options.scaleMode.originalHeight,
+ this.options.scaleMode.originalWidth];
+ },
+ update: function(position) {
+ var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
+ if(this.options.scaleContent && this.fontSize)
+ this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
+ this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
+ },
+ finish: function(position) {
+ if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
+ },
+ setDimensions: function(height, width) {
+ var d = {};
+ if(this.options.scaleX) d.width = Math.round(width) + 'px';
+ if(this.options.scaleY) d.height = Math.round(height) + 'px';
+ if(this.options.scaleFromCenter) {
+ var topd = (height - this.dims[0])/2;
+ var leftd = (width - this.dims[1])/2;
+ if(this.elementPositioning == 'absolute') {
+ if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
+ if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
+ } else {
+ if(this.options.scaleY) d.top = -topd + 'px';
+ if(this.options.scaleX) d.left = -leftd + 'px';
+ }
+ }
+ this.element.setStyle(d);
+ }
+});
+
+Effect.Highlight = Class.create();
+Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
+ initialize: function(element) {
+ this.element = $(element);
+ if(!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
+ this.start(options);
+ },
+ setup: function() {
+ // Prevent executing on elements not in the layout flow
+ if(this.element.getStyle('display')=='none') { this.cancel(); return; }
+ // Disable background image during the effect
+ this.oldStyle = {};
+ if (!this.options.keepBackgroundImage) {
+ this.oldStyle.backgroundImage = this.element.getStyle('background-image');
+ this.element.setStyle({backgroundImage: 'none'});
+ }
+ if(!this.options.endcolor)
+ this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
+ if(!this.options.restorecolor)
+ this.options.restorecolor = this.element.getStyle('background-color');
+ // init color calculations
+ this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
+ this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
+ },
+ update: function(position) {
+ this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
+ return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
+ },
+ finish: function() {
+ this.element.setStyle(Object.extend(this.oldStyle, {
+ backgroundColor: this.options.restorecolor
+ }));
+ }
+});
+
+Effect.ScrollTo = Class.create();
+Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
+ initialize: function(element) {
+ this.element = $(element);
+ this.start(arguments[1] || {});
+ },
+ setup: function() {
+ Position.prepare();
+ var offsets = Position.cumulativeOffset(this.element);
+ if(this.options.offset) offsets[1] += this.options.offset;
+ var max = window.innerHeight ?
+ window.height - window.innerHeight :
+ document.body.scrollHeight -
+ (document.documentElement.clientHeight ?
+ document.documentElement.clientHeight : document.body.clientHeight);
+ this.scrollStart = Position.deltaY;
+ this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
+ },
+ update: function(position) {
+ Position.prepare();
+ window.scrollTo(Position.deltaX,
+ this.scrollStart + (position*this.delta));
+ }
+});
+
+/* ------------- combination effects ------------- */
+
+Effect.Fade = function(element) {
+ element = $(element);
+ var oldOpacity = element.getInlineOpacity();
+ var options = Object.extend({
+ from: element.getOpacity() || 1.0,
+ to: 0.0,
+ afterFinishInternal: function(effect) {
+ if(effect.options.to!=0) return;
+ effect.element.hide().setStyle({opacity: oldOpacity});
+ }}, arguments[1] || {});
+ return new Effect.Opacity(element,options);
+}
+
+Effect.Appear = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
+ to: 1.0,
+ // force Safari to render floated elements properly
+ afterFinishInternal: function(effect) {
+ effect.element.forceRerendering();
+ },
+ beforeSetup: function(effect) {
+ effect.element.setOpacity(effect.options.from).show();
+ }}, arguments[1] || {});
+ return new Effect.Opacity(element,options);
+}
+
+Effect.Puff = function(element) {
+ element = $(element);
+ var oldStyle = {
+ opacity: element.getInlineOpacity(),
+ position: element.getStyle('position'),
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height
+ };
+ return new Effect.Parallel(
+ [ new Effect.Scale(element, 200,
+ { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
+ new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
+ Object.extend({ duration: 1.0,
+ beforeSetupInternal: function(effect) {
+ Position.absolutize(effect.effects[0].element)
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().setStyle(oldStyle); }
+ }, arguments[1] || {})
+ );
+}
+
+Effect.BlindUp = function(element) {
+ element = $(element);
+ element.makeClipping();
+ return new Effect.Scale(element, 0,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
+ restoreAfterFinish: true,
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping();
+ }
+ }, arguments[1] || {})
+ );
+}
+
+Effect.BlindDown = function(element) {
+ element = $(element);
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: 0,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.undoClipping();
+ }
+ }, arguments[1] || {}));
+}
+
+Effect.SwitchOff = function(element) {
+ element = $(element);
+ var oldOpacity = element.getInlineOpacity();
+ return new Effect.Appear(element, Object.extend({
+ duration: 0.4,
+ from: 0,
+ transition: Effect.Transitions.flicker,
+ afterFinishInternal: function(effect) {
+ new Effect.Scale(effect.element, 1, {
+ duration: 0.3, scaleFromCenter: true,
+ scaleX: false, scaleContent: false, restoreAfterFinish: true,
+ beforeSetup: function(effect) {
+ effect.element.makePositioned().makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
+ }
+ })
+ }
+ }, arguments[1] || {}));
+}
+
+Effect.DropOut = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.getStyle('top'),
+ left: element.getStyle('left'),
+ opacity: element.getInlineOpacity() };
+ return new Effect.Parallel(
+ [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
+ new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
+ Object.extend(
+ { duration: 0.5,
+ beforeSetup: function(effect) {
+ effect.effects[0].element.makePositioned();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
+ }
+ }, arguments[1] || {}));
+}
+
+Effect.Shake = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.getStyle('top'),
+ left: element.getStyle('left') };
+ return new Effect.Move(element,
+ { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
+ effect.element.undoPositioned().setStyle(oldStyle);
+ }}) }}) }}) }}) }}) }});
+}
+
+Effect.SlideDown = function(element) {
+ element = $(element).cleanWhitespace();
+ // SlideDown need to have the content of the element wrapped in a container element with fixed height!
+ var oldInnerBottom = element.down().getStyle('bottom');
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: window.opera ? 0 : 1,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makePositioned();
+ effect.element.down().makePositioned();
+ if(window.opera) effect.element.setStyle({top: ''});
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
+ },
+ afterUpdateInternal: function(effect) {
+ effect.element.down().setStyle({bottom:
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.undoClipping().undoPositioned();
+ effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
+ }, arguments[1] || {})
+ );
+}
+
+Effect.SlideUp = function(element) {
+ element = $(element).cleanWhitespace();
+ var oldInnerBottom = element.down().getStyle('bottom');
+ return new Effect.Scale(element, window.opera ? 0 : 1,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
+ scaleMode: 'box',
+ scaleFrom: 100,
+ restoreAfterFinish: true,
+ beforeStartInternal: function(effect) {
+ effect.element.makePositioned();
+ effect.element.down().makePositioned();
+ if(window.opera) effect.element.setStyle({top: ''});
+ effect.element.makeClipping().show();
+ },
+ afterUpdateInternal: function(effect) {
+ effect.element.down().setStyle({bottom:
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom});
+ effect.element.down().undoPositioned();
+ }
+ }, arguments[1] || {})
+ );
+}
+
+// Bug in opera makes the TD containing this element expand for a instance after finish
+Effect.Squish = function(element) {
+ return new Effect.Scale(element, window.opera ? 1 : 0, {
+ restoreAfterFinish: true,
+ beforeSetup: function(effect) {
+ effect.element.makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping();
+ }
+ });
+}
+
+Effect.Grow = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ direction: 'center',
+ moveTransition: Effect.Transitions.sinoidal,
+ scaleTransition: Effect.Transitions.sinoidal,
+ opacityTransition: Effect.Transitions.full
+ }, arguments[1] || {});
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: element.getInlineOpacity() };
+
+ var dims = element.getDimensions();
+ var initialMoveX, initialMoveY;
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ initialMoveX = initialMoveY = moveX = moveY = 0;
+ break;
+ case 'top-right':
+ initialMoveX = dims.width;
+ initialMoveY = moveY = 0;
+ moveX = -dims.width;
+ break;
+ case 'bottom-left':
+ initialMoveX = moveX = 0;
+ initialMoveY = dims.height;
+ moveY = -dims.height;
+ break;
+ case 'bottom-right':
+ initialMoveX = dims.width;
+ initialMoveY = dims.height;
+ moveX = -dims.width;
+ moveY = -dims.height;
+ break;
+ case 'center':
+ initialMoveX = dims.width / 2;
+ initialMoveY = dims.height / 2;
+ moveX = -dims.width / 2;
+ moveY = -dims.height / 2;
+ break;
+ }
+
+ return new Effect.Move(element, {
+ x: initialMoveX,
+ y: initialMoveY,
+ duration: 0.01,
+ beforeSetup: function(effect) {
+ effect.element.hide().makeClipping().makePositioned();
+ },
+ afterFinishInternal: function(effect) {
+ new Effect.Parallel(
+ [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
+ new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
+ new Effect.Scale(effect.element, 100, {
+ scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
+ sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
+ ], Object.extend({
+ beforeSetup: function(effect) {
+ effect.effects[0].element.setStyle({height: '0px'}).show();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
+ }
+ }, options)
+ )
+ }
+ });
+}
+
+Effect.Shrink = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ direction: 'center',
+ moveTransition: Effect.Transitions.sinoidal,
+ scaleTransition: Effect.Transitions.sinoidal,
+ opacityTransition: Effect.Transitions.none
+ }, arguments[1] || {});
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: element.getInlineOpacity() };
+
+ var dims = element.getDimensions();
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ moveX = moveY = 0;
+ break;
+ case 'top-right':
+ moveX = dims.width;
+ moveY = 0;
+ break;
+ case 'bottom-left':
+ moveX = 0;
+ moveY = dims.height;
+ break;
+ case 'bottom-right':
+ moveX = dims.width;
+ moveY = dims.height;
+ break;
+ case 'center':
+ moveX = dims.width / 2;
+ moveY = dims.height / 2;
+ break;
+ }
+
+ return new Effect.Parallel(
+ [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
+ new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
+ new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
+ ], Object.extend({
+ beforeStartInternal: function(effect) {
+ effect.effects[0].element.makePositioned().makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
+ }, options)
+ );
+}
+
+Effect.Pulsate = function(element) {
+ element = $(element);
+ var options = arguments[1] || {};
+ var oldOpacity = element.getInlineOpacity();
+ var transition = options.transition || Effect.Transitions.sinoidal;
+ var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
+ reverser.bind(transition);
+ return new Effect.Opacity(element,
+ Object.extend(Object.extend({ duration: 2.0, from: 0,
+ afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
+ }, options), {transition: reverser}));
+}
+
+Effect.Fold = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height };
+ element.makeClipping();
+ return new Effect.Scale(element, 5, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ afterFinishInternal: function(effect) {
+ new Effect.Scale(element, 1, {
+ scaleContent: false,
+ scaleY: false,
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().setStyle(oldStyle);
+ } });
+ }}, arguments[1] || {}));
+};
+
+Effect.Morph = Class.create();
+Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
+ initialize: function(element) {
+ this.element = $(element);
+ if(!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ style: {}
+ }, arguments[1] || {});
+ if (typeof options.style == 'string') {
+ if(options.style.indexOf(':') == -1) {
+ var cssText = '', selector = '.' + options.style;
+ $A(document.styleSheets).reverse().each(function(styleSheet) {
+ if (styleSheet.cssRules) cssRules = styleSheet.cssRules;
+ else if (styleSheet.rules) cssRules = styleSheet.rules;
+ $A(cssRules).reverse().each(function(rule) {
+ if (selector == rule.selectorText) {
+ cssText = rule.style.cssText;
+ throw $break;
+ }
+ });
+ if (cssText) throw $break;
+ });
+ this.style = cssText.parseStyle();
+ options.afterFinishInternal = function(effect){
+ effect.element.addClassName(effect.options.style);
+ effect.transforms.each(function(transform) {
+ if(transform.style != 'opacity')
+ effect.element.style[transform.style] = '';
+ });
+ }
+ } else this.style = options.style.parseStyle();
+ } else this.style = $H(options.style)
+ this.start(options);
+ },
+ setup: function(){
+ function parseColor(color){
+ if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
+ color = color.parseColor();
+ return $R(0,2).map(function(i){
+ return parseInt( color.slice(i*2+1,i*2+3), 16 )
+ });
+ }
+ this.transforms = this.style.map(function(pair){
+ var property = pair[0], value = pair[1], unit = null;
+
+ if(value.parseColor('#zzzzzz') != '#zzzzzz') {
+ value = value.parseColor();
+ unit = 'color';
+ } else if(property == 'opacity') {
+ value = parseFloat(value);
+ if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+ this.element.setStyle({zoom: 1});
+ } else if(Element.CSS_LENGTH.test(value)) {
+ var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
+ value = parseFloat(components[1]);
+ unit = (components.length == 3) ? components[2] : null;
+ }
+
+ var originalValue = this.element.getStyle(property);
+ return {
+ style: property.camelize(),
+ originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
+ targetValue: unit=='color' ? parseColor(value) : value,
+ unit: unit
+ };
+ }.bind(this)).reject(function(transform){
+ return (
+ (transform.originalValue == transform.targetValue) ||
+ (
+ transform.unit != 'color' &&
+ (isNaN(transform.originalValue) || isNaN(transform.targetValue))
+ )
+ )
+ });
+ },
+ update: function(position) {
+ var style = {}, transform, i = this.transforms.length;
+ while(i--)
+ style[(transform = this.transforms[i]).style] =
+ transform.unit=='color' ? '#'+
+ (Math.round(transform.originalValue[0]+
+ (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
+ (Math.round(transform.originalValue[1]+
+ (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
+ (Math.round(transform.originalValue[2]+
+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
+ transform.originalValue + Math.round(
+ ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit;
+ this.element.setStyle(style, true);
+ }
+});
+
+Effect.Transform = Class.create();
+Object.extend(Effect.Transform.prototype, {
+ initialize: function(tracks){
+ this.tracks = [];
+ this.options = arguments[1] || {};
+ this.addTracks(tracks);
+ },
+ addTracks: function(tracks){
+ tracks.each(function(track){
+ var data = $H(track).values().first();
+ this.tracks.push($H({
+ ids: $H(track).keys().first(),
+ effect: Effect.Morph,
+ options: { style: data }
+ }));
+ }.bind(this));
+ return this;
+ },
+ play: function(){
+ return new Effect.Parallel(
+ this.tracks.map(function(track){
+ var elements = [$(track.ids) || $$(track.ids)].flatten();
+ return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) });
+ }).flatten(),
+ this.options
+ );
+ }
+});
+
+Element.CSS_PROPERTIES = $w(
+ 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
+ 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
+ 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
+ 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
+ 'fontSize fontWeight height left letterSpacing lineHeight ' +
+ 'marginBottom marginLeft marginRight marginTop maxHeight '+
+ 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
+ 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
+ 'right textIndent top width wordSpacing zIndex');
+
+Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
+
+String.prototype.parseStyle = function(){
+ var element = document.createElement('div');
+ element.innerHTML = '<div style="' + this + '"></div>';
+ var style = element.childNodes[0].style, styleRules = $H();
+
+ Element.CSS_PROPERTIES.each(function(property){
+ if(style[property]) styleRules[property] = style[property];
+ });
+ if(Prototype.Browser.IE && this.indexOf('opacity') > -1) {
+ styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
+ }
+ return styleRules;
+};
+
+Element.morph = function(element, style) {
+ new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {}));
+ return element;
+};
+
+['getInlineOpacity','forceRerendering','setContentZoom',
+ 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each(
+ function(f) { Element.Methods[f] = Element[f]; }
+);
+
+Element.Methods.visualEffect = function(element, effect, options) {
+ s = effect.dasherize().camelize();
+ effect_class = s.charAt(0).toUpperCase() + s.substring(1);
+ new Effect[effect_class](element, options);
+ return $(element);
+};
+
+Element.addMethods(); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/scriptaculous.js b/dom/tests/mochitest/ajax/scriptaculous/src/scriptaculous.js
new file mode 100644
index 0000000000..13f91cd6fb
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/scriptaculous.js
@@ -0,0 +1,58 @@
+// script.aculo.us scriptaculous.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+var Scriptaculous = {
+ Version: '1.7.1_beta2',
+ require: function(libraryName) {
+ // inserting via DOM fails in Safari 2.0, so brute force approach
+ document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
+ },
+ REQUIRED_PROTOTYPE: '1.5.1',
+ load: function() {
+ function convertVersionString(versionString){
+ var r = versionString.split('.');
+ return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
+ }
+
+ if((typeof Prototype=='undefined') ||
+ (typeof Element == 'undefined') ||
+ (typeof Element.Methods=='undefined') ||
+ (convertVersionString(Prototype.Version) <
+ convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
+ throw("script.aculo.us requires the Prototype JavaScript framework >= " +
+ Scriptaculous.REQUIRED_PROTOTYPE);
+
+ $A(document.getElementsByTagName("script")).findAll( function(s) {
+ return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
+ }).each( function(s) {
+ var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
+ var includes = s.src.match(/\?.*load=([a-z,]*)/);
+ (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
+ function(include) { Scriptaculous.require(path+include+'.js') });
+ });
+ }
+}
+
+Scriptaculous.load(); \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/slider.js b/dom/tests/mochitest/ajax/scriptaculous/src/slider.js
new file mode 100644
index 0000000000..b9c96bfbd6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/slider.js
@@ -0,0 +1,277 @@
+// script.aculo.us slider.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+if(!Control) var Control = {};
+Control.Slider = Class.create();
+
+// options:
+// axis: 'vertical', or 'horizontal' (default)
+//
+// callbacks:
+// onChange(value)
+// onSlide(value)
+Control.Slider.prototype = {
+ initialize: function(handle, track, options) {
+ var slider = this;
+
+ if(handle instanceof Array) {
+ this.handles = handle.collect( function(e) { return $(e) });
+ } else {
+ this.handles = [$(handle)];
+ }
+
+ this.track = $(track);
+ this.options = options || {};
+
+ this.axis = this.options.axis || 'horizontal';
+ this.increment = this.options.increment || 1;
+ this.step = parseInt(this.options.step || '1');
+ this.range = this.options.range || $R(0,1);
+
+ this.value = 0; // assure backwards compat
+ this.values = this.handles.map( function() { return 0 });
+ this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
+ this.options.startSpan = $(this.options.startSpan || null);
+ this.options.endSpan = $(this.options.endSpan || null);
+
+ this.restricted = this.options.restricted || false;
+
+ this.maximum = this.options.maximum || this.range.end;
+ this.minimum = this.options.minimum || this.range.start;
+
+ // Will be used to align the handle onto the track, if necessary
+ this.alignX = parseInt(this.options.alignX || '0');
+ this.alignY = parseInt(this.options.alignY || '0');
+
+ this.trackLength = this.maximumOffset() - this.minimumOffset();
+
+ this.handleLength = this.isVertical() ?
+ (this.handles[0].offsetHeight != 0 ?
+ this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
+ (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
+ this.handles[0].style.width.replace(/px$/,""));
+
+ this.active = false;
+ this.dragging = false;
+ this.disabled = false;
+
+ if(this.options.disabled) this.setDisabled();
+
+ // Allowed values array
+ this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
+ if(this.allowedValues) {
+ this.minimum = this.allowedValues.min();
+ this.maximum = this.allowedValues.max();
+ }
+
+ this.eventMouseDown = this.startDrag.bindAsEventListener(this);
+ this.eventMouseUp = this.endDrag.bindAsEventListener(this);
+ this.eventMouseMove = this.update.bindAsEventListener(this);
+
+ // Initialize handles in reverse (make sure first handle is active)
+ this.handles.each( function(h,i) {
+ i = slider.handles.length-1-i;
+ slider.setValue(parseFloat(
+ (slider.options.sliderValue instanceof Array ?
+ slider.options.sliderValue[i] : slider.options.sliderValue) ||
+ slider.range.start), i);
+ Element.makePositioned(h); // fix IE
+ Event.observe(h, "mousedown", slider.eventMouseDown);
+ });
+
+ Event.observe(this.track, "mousedown", this.eventMouseDown);
+ Event.observe(document, "mouseup", this.eventMouseUp);
+ Event.observe(document, "mousemove", this.eventMouseMove);
+
+ this.initialized = true;
+ },
+ dispose: function() {
+ var slider = this;
+ Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
+ Event.stopObserving(document, "mouseup", this.eventMouseUp);
+ Event.stopObserving(document, "mousemove", this.eventMouseMove);
+ this.handles.each( function(h) {
+ Event.stopObserving(h, "mousedown", slider.eventMouseDown);
+ });
+ },
+ setDisabled: function(){
+ this.disabled = true;
+ },
+ setEnabled: function(){
+ this.disabled = false;
+ },
+ getNearestValue: function(value){
+ if(this.allowedValues){
+ if(value >= this.allowedValues.max()) return(this.allowedValues.max());
+ if(value <= this.allowedValues.min()) return(this.allowedValues.min());
+
+ var offset = Math.abs(this.allowedValues[0] - value);
+ var newValue = this.allowedValues[0];
+ this.allowedValues.each( function(v) {
+ var currentOffset = Math.abs(v - value);
+ if(currentOffset <= offset){
+ newValue = v;
+ offset = currentOffset;
+ }
+ });
+ return newValue;
+ }
+ if(value > this.range.end) return this.range.end;
+ if(value < this.range.start) return this.range.start;
+ return value;
+ },
+ setValue: function(sliderValue, handleIdx){
+ if(!this.active) {
+ this.activeHandleIdx = handleIdx || 0;
+ this.activeHandle = this.handles[this.activeHandleIdx];
+ this.updateStyles();
+ }
+ handleIdx = handleIdx || this.activeHandleIdx || 0;
+ if(this.initialized && this.restricted) {
+ if((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
+ sliderValue = this.values[handleIdx-1];
+ if((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
+ sliderValue = this.values[handleIdx+1];
+ }
+ sliderValue = this.getNearestValue(sliderValue);
+ this.values[handleIdx] = sliderValue;
+ this.value = this.values[0]; // assure backwards compat
+
+ this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
+ this.translateToPx(sliderValue);
+
+ this.drawSpans();
+ if(!this.dragging || !this.event) this.updateFinished();
+ },
+ setValueBy: function(delta, handleIdx) {
+ this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
+ handleIdx || this.activeHandleIdx || 0);
+ },
+ translateToPx: function(value) {
+ return Math.round(
+ ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
+ (value - this.range.start)) + "px";
+ },
+ translateToValue: function(offset) {
+ return ((offset/(this.trackLength-this.handleLength) *
+ (this.range.end-this.range.start)) + this.range.start);
+ },
+ getRange: function(range) {
+ var v = this.values.sortBy(Prototype.K);
+ range = range || 0;
+ return $R(v[range],v[range+1]);
+ },
+ minimumOffset: function(){
+ return(this.isVertical() ? this.alignY : this.alignX);
+ },
+ maximumOffset: function(){
+ return(this.isVertical() ?
+ (this.track.offsetHeight != 0 ? this.track.offsetHeight :
+ this.track.style.height.replace(/px$/,"")) - this.alignY :
+ (this.track.offsetWidth != 0 ? this.track.offsetWidth :
+ this.track.style.width.replace(/px$/,"")) - this.alignY);
+ },
+ isVertical: function(){
+ return (this.axis == 'vertical');
+ },
+ drawSpans: function() {
+ var slider = this;
+ if(this.spans)
+ $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
+ if(this.options.startSpan)
+ this.setSpan(this.options.startSpan,
+ $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
+ if(this.options.endSpan)
+ this.setSpan(this.options.endSpan,
+ $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
+ },
+ setSpan: function(span, range) {
+ if(this.isVertical()) {
+ span.style.top = this.translateToPx(range.start);
+ span.style.height = this.translateToPx(range.end - range.start + this.range.start);
+ } else {
+ span.style.left = this.translateToPx(range.start);
+ span.style.width = this.translateToPx(range.end - range.start + this.range.start);
+ }
+ },
+ updateStyles: function() {
+ this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
+ Element.addClassName(this.activeHandle, 'selected');
+ },
+ startDrag: function(event) {
+ if(Event.isLeftClick(event)) {
+ if(!this.disabled){
+ this.active = true;
+
+ var handle = Event.element(event);
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ var track = handle;
+ if(track==this.track) {
+ var offsets = Position.cumulativeOffset(this.track);
+ this.event = event;
+ this.setValue(this.translateToValue(
+ (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
+ ));
+ var offsets = Position.cumulativeOffset(this.activeHandle);
+ this.offsetX = (pointer[0] - offsets[0]);
+ this.offsetY = (pointer[1] - offsets[1]);
+ } else {
+ // find the handle (prevents issues with Safari)
+ while((this.handles.indexOf(handle) == -1) && handle.parentNode)
+ handle = handle.parentNode;
+
+ if(this.handles.indexOf(handle)!=-1) {
+ this.activeHandle = handle;
+ this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
+ this.updateStyles();
+
+ var offsets = Position.cumulativeOffset(this.activeHandle);
+ this.offsetX = (pointer[0] - offsets[0]);
+ this.offsetY = (pointer[1] - offsets[1]);
+ }
+ }
+ }
+ Event.stop(event);
+ }
+ },
+ update: function(event) {
+ if(this.active) {
+ if(!this.dragging) this.dragging = true;
+ this.draw(event);
+ if(Prototype.Browser.WebKit) window.scrollBy(0,0);
+ Event.stop(event);
+ }
+ },
+ draw: function(event) {
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ var offsets = Position.cumulativeOffset(this.track);
+ pointer[0] -= this.offsetX + offsets[0];
+ pointer[1] -= this.offsetY + offsets[1];
+ this.event = event;
+ this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
+ if(this.initialized && this.options.onSlide)
+ this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
+ },
+ endDrag: function(event) {
+ if(this.active && this.dragging) {
+ this.finishDrag(event, true);
+ Event.stop(event);
+ }
+ this.active = false;
+ this.dragging = false;
+ },
+ finishDrag: function(event, success) {
+ this.active = false;
+ this.dragging = false;
+ this.updateFinished();
+ },
+ updateFinished: function() {
+ if(this.initialized && this.options.onChange)
+ this.options.onChange(this.values.length>1 ? this.values : this.value, this);
+ this.event = null;
+ }
+} \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/sound.js b/dom/tests/mochitest/ajax/scriptaculous/src/sound.js
new file mode 100644
index 0000000000..46618d9012
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/sound.js
@@ -0,0 +1,60 @@
+// script.aculo.us sound.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// Based on code created by Jules Gravinese (http://www.webveteran.com/)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+Sound = {
+ tracks: {},
+ _enabled: true,
+ template:
+ new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
+ enable: function(){
+ Sound._enabled = true;
+ },
+ disable: function(){
+ Sound._enabled = false;
+ },
+ play: function(url){
+ if(!Sound._enabled) return;
+ var options = Object.extend({
+ track: 'global', url: url, replace: false
+ }, arguments[1] || {});
+
+ if(options.replace && this.tracks[options.track]) {
+ $R(0, this.tracks[options.track].id).each(function(id){
+ var sound = $('sound_'+options.track+'_'+id);
+ sound.Stop && sound.Stop();
+ sound.remove();
+ })
+ this.tracks[options.track] = null;
+ }
+
+ if(!this.tracks[options.track])
+ this.tracks[options.track] = { id: 0 }
+ else
+ this.tracks[options.track].id++;
+
+ options.id = this.tracks[options.track].id;
+ if (Prototype.Browser.IE) {
+ var sound = document.createElement('bgsound');
+ sound.setAttribute('id','sound_'+options.track+'_'+options.id);
+ sound.setAttribute('src',options.url);
+ sound.setAttribute('loop','1');
+ sound.setAttribute('autostart','true');
+ $$('body')[0].appendChild(sound);
+ }
+ else
+ new Insertion.Bottom($$('body')[0], Sound.template.evaluate(options));
+ }
+};
+
+if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
+ if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
+ Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
+ else
+ Sound.play = function(){}
+}
diff --git a/dom/tests/mochitest/ajax/scriptaculous/src/unittest.js b/dom/tests/mochitest/ajax/scriptaculous/src/unittest.js
new file mode 100644
index 0000000000..9844b1ce8a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/unittest.js
@@ -0,0 +1,586 @@
+// script.aculo.us unittest.js v1.7.1_beta2, Tue May 15 15:15:45 EDT 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
+// (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+// experimental, Firefox-only
+Event.simulateMouse = function(element, eventName) {
+ var options = Object.extend({
+ pointerX: 0,
+ pointerY: 0,
+ buttons: 0,
+ ctrlKey: false,
+ altKey: false,
+ shiftKey: false,
+ metaKey: false
+ }, arguments[2] || {});
+ var oEvent = document.createEvent("MouseEvents");
+ oEvent.initMouseEvent(eventName, true, true, document.defaultView,
+ options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
+ options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element));
+
+ if(this.mark) Element.remove(this.mark);
+ this.mark = document.createElement('div');
+ this.mark.appendChild(document.createTextNode(" "));
+ document.body.appendChild(this.mark);
+ this.mark.style.position = 'absolute';
+ this.mark.style.top = options.pointerY + "px";
+ this.mark.style.left = options.pointerX + "px";
+ this.mark.style.width = "5px";
+ this.mark.style.height = "5px;";
+ this.mark.style.borderTop = "1px solid red;"
+ this.mark.style.borderLeft = "1px solid red;"
+
+ if(this.step)
+ alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
+
+ $(element).dispatchEvent(oEvent);
+};
+
+// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2.
+// You need to downgrade to 1.0.4 for now to get this working
+// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much
+Event.simulateKey = function(element, eventName) {
+ var options = Object.extend({
+ ctrlKey: false,
+ altKey: false,
+ shiftKey: false,
+ metaKey: false,
+ keyCode: 0,
+ charCode: 0
+ }, arguments[2] || {});
+
+ var oEvent = document.createEvent("KeyboardEvent");
+ oEvent.initKeyEvent(eventName, true, true, window,
+ options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
+ options.keyCode, options.charCode );
+ $(element).dispatchEvent(oEvent);
+};
+
+Event.simulateKeys = function(element, command) {
+ for(var i=0; i<command.length; i++) {
+ Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)});
+ }
+};
+
+var Test = {}
+Test.Unit = {};
+
+// security exception workaround
+Test.Unit.inspect = Object.inspect;
+
+Test.Unit.Logger = Class.create();
+Test.Unit.Logger.prototype = {
+ initialize: function(log) {
+ this.log = $(log);
+ if (this.log) {
+ this._createLogTable();
+ }
+ },
+ start: function(testName) {
+ if (!this.log) return;
+ this.testName = testName;
+ this.lastLogLine = document.createElement('tr');
+ this.statusCell = document.createElement('td');
+ this.nameCell = document.createElement('td');
+ this.nameCell.className = "nameCell";
+ this.nameCell.appendChild(document.createTextNode(testName));
+ this.messageCell = document.createElement('td');
+ this.lastLogLine.appendChild(this.statusCell);
+ this.lastLogLine.appendChild(this.nameCell);
+ this.lastLogLine.appendChild(this.messageCell);
+ this.loglines.appendChild(this.lastLogLine);
+ },
+ finish: function(status, summary) {
+ if (!this.log) return;
+ this.lastLogLine.className = status;
+ this.statusCell.innerHTML = status;
+ this.messageCell.innerHTML = this._toHTML(summary);
+ this.addLinksToResults();
+ },
+ message: function(message) {
+ if (!this.log) return;
+ this.messageCell.innerHTML = this._toHTML(message);
+ },
+ summary: function(summary) {
+ if (!this.log) return;
+ this.logsummary.innerHTML = this._toHTML(summary);
+ },
+ _createLogTable: function() {
+ this.log.innerHTML =
+ '<div id="logsummary"></div>' +
+ '<table id="logtable">' +
+ '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
+ '<tbody id="loglines"></tbody>' +
+ '</table>';
+ this.logsummary = $('logsummary')
+ this.loglines = $('loglines');
+ },
+ _toHTML: function(txt) {
+ return txt.escapeHTML().replace(/\n/g,"<br/>");
+ },
+ addLinksToResults: function(){
+ $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
+ td.title = "Run only this test"
+ Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
+ });
+ $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log
+ td.title = "Run all tests"
+ Event.observe(td, 'click', function(){ window.location.search = "";});
+ });
+ }
+}
+
+Test.Unit.Runner = Class.create();
+Test.Unit.Runner.prototype = {
+ initialize: function(testcases) {
+ this.options = Object.extend({
+ testLog: 'testlog'
+ }, arguments[1] || {});
+ this.options.resultsURL = this.parseResultsURLQueryParameter();
+ this.options.tests = this.parseTestsQueryParameter();
+ if (this.options.testLog) {
+ this.options.testLog = $(this.options.testLog) || null;
+ }
+ if(this.options.tests) {
+ this.tests = [];
+ for(var i = 0; i < this.options.tests.length; i++) {
+ if(/^test/.test(this.options.tests[i])) {
+ this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
+ }
+ }
+ } else {
+ if (this.options.test) {
+ this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
+ } else {
+ this.tests = [];
+ for(var testcase in testcases) {
+ if(/^test/.test(testcase)) {
+ this.tests.push(
+ new Test.Unit.Testcase(
+ this.options.context ? ' -> ' + this.options.titles[testcase] : testcase,
+ testcases[testcase], testcases["setup"], testcases["teardown"]
+ ));
+ }
+ }
+ }
+ }
+ this.currentTest = 0;
+ this.logger = new Test.Unit.Logger(this.options.testLog);
+ setTimeout(this.runTests.bind(this), 1000);
+ },
+ parseResultsURLQueryParameter: function() {
+ return window.location.search.parseQuery()["resultsURL"];
+ },
+ parseTestsQueryParameter: function(){
+ if (window.location.search.parseQuery()["tests"]){
+ return window.location.search.parseQuery()["tests"].split(',');
+ };
+ },
+ // Returns:
+ // "ERROR" if there was an error,
+ // "FAILURE" if there was a failure, or
+ // "SUCCESS" if there was neither
+ getResult: function() {
+ var hasFailure = false;
+ for(var i=0;i<this.tests.length;i++) {
+ if (this.tests[i].errors > 0) {
+ return "ERROR";
+ }
+ if (this.tests[i].failures > 0) {
+ hasFailure = true;
+ }
+ }
+ if (hasFailure) {
+ return "FAILURE";
+ } else {
+ return "SUCCESS";
+ }
+ },
+ postResults: function() {
+ if (this.options.resultsURL) {
+ new Ajax.Request(this.options.resultsURL,
+ { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false });
+ }
+ },
+ runTests: function() {
+ var test = this.tests[this.currentTest];
+ if (!test) {
+ // finished!
+ this.postResults();
+ this.logger.summary(this.summary());
+ return;
+ }
+ if(!test.isWaiting) {
+ this.logger.start(test.name);
+ }
+ test.run();
+ if(test.isWaiting) {
+ this.logger.message("Waiting for " + test.timeToWait + "ms");
+ setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
+ } else {
+ this.logger.finish(test.status(), test.summary());
+ this.currentTest++;
+ // tail recursive, hopefully the browser will skip the stackframe
+ this.runTests();
+ }
+ },
+ summary: function() {
+ var assertions = 0;
+ var failures = 0;
+ var errors = 0;
+ var messages = [];
+ for(var i=0;i<this.tests.length;i++) {
+ assertions += this.tests[i].assertions;
+ failures += this.tests[i].failures;
+ errors += this.tests[i].errors;
+ }
+ return (
+ (this.options.context ? this.options.context + ': ': '') +
+ this.tests.length + " tests, " +
+ assertions + " assertions, " +
+ failures + " failures, " +
+ errors + " errors");
+ }
+}
+
+Test.Unit.Assertions = Class.create();
+Test.Unit.Assertions.prototype = {
+ initialize: function() {
+ this.assertions = 0;
+ this.failures = 0;
+ this.errors = 0;
+ this.messages = [];
+ },
+ summary: function() {
+ return (
+ this.assertions + " assertions, " +
+ this.failures + " failures, " +
+ this.errors + " errors" + "\n" +
+ this.messages.join("\n"));
+ },
+ pass: function() {
+ this.assertions++;
+ },
+ fail: function(message) {
+ this.failures++;
+ this.messages.push("Failure: " + message);
+ },
+ info: function(message) {
+ this.messages.push("Info: " + message);
+ },
+ error: function(error) {
+ this.errors++;
+ this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")");
+ },
+ status: function() {
+ if (this.failures > 0) return 'failed';
+ if (this.errors > 0) return 'error';
+ return 'passed';
+ },
+ assert: function(expression) {
+ var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"';
+ try { expression ? this.pass() :
+ this.fail(message); }
+ catch(e) { this.error(e); }
+ },
+ assertEqual: function(expected, actual) {
+ var message = arguments[2] || "assertEqual";
+ try { (expected == actual) ? this.pass() :
+ this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
+ '", actual "' + Test.Unit.inspect(actual) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertInspect: function(expected, actual) {
+ var message = arguments[2] || "assertInspect";
+ try { (expected == actual.inspect()) ? this.pass() :
+ this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
+ '", actual "' + Test.Unit.inspect(actual) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertEnumEqual: function(expected, actual) {
+ var message = arguments[2] || "assertEnumEqual";
+ try { $A(expected).length == $A(actual).length &&
+ expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ?
+ this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) +
+ ', actual ' + Test.Unit.inspect(actual)); }
+ catch(e) { this.error(e); }
+ },
+ assertNotEqual: function(expected, actual) {
+ var message = arguments[2] || "assertNotEqual";
+ try { (expected != actual) ? this.pass() :
+ this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertIdentical: function(expected, actual) {
+ var message = arguments[2] || "assertIdentical";
+ try { (expected === actual) ? this.pass() :
+ this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
+ '", actual "' + Test.Unit.inspect(actual) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertNotIdentical: function(expected, actual) {
+ var message = arguments[2] || "assertNotIdentical";
+ try { !(expected === actual) ? this.pass() :
+ this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
+ '", actual "' + Test.Unit.inspect(actual) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertNull: function(obj) {
+ var message = arguments[1] || 'assertNull'
+ try { (obj==null) ? this.pass() :
+ this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertMatch: function(expected, actual) {
+ var message = arguments[2] || 'assertMatch';
+ var regex = new RegExp(expected);
+ try { (regex.exec(actual)) ? this.pass() :
+ this.fail(message + ' : regex: "' + Test.Unit.inspect(expected) + ' did not match: ' + Test.Unit.inspect(actual) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertHidden: function(element) {
+ var message = arguments[1] || 'assertHidden';
+ this.assertEqual("none", element.style.display, message);
+ },
+ assertNotNull: function(object) {
+ var message = arguments[1] || 'assertNotNull';
+ this.assert(object != null, message);
+ },
+ assertType: function(expected, actual) {
+ var message = arguments[2] || 'assertType';
+ try {
+ (actual.constructor == expected) ? this.pass() :
+ this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
+ '", actual "' + (actual.constructor) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertNotOfType: function(expected, actual) {
+ var message = arguments[2] || 'assertNotOfType';
+ try {
+ (actual.constructor != expected) ? this.pass() :
+ this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
+ '", actual "' + (actual.constructor) + '"'); }
+ catch(e) { this.error(e); }
+ },
+ assertInstanceOf: function(expected, actual) {
+ var message = arguments[2] || 'assertInstanceOf';
+ try {
+ (actual instanceof expected) ? this.pass() :
+ this.fail(message + ": object was not an instance of the expected type"); }
+ catch(e) { this.error(e); }
+ },
+ assertNotInstanceOf: function(expected, actual) {
+ var message = arguments[2] || 'assertNotInstanceOf';
+ try {
+ !(actual instanceof expected) ? this.pass() :
+ this.fail(message + ": object was an instance of the not expected type"); }
+ catch(e) { this.error(e); }
+ },
+ assertRespondsTo: function(method, obj) {
+ var message = arguments[2] || 'assertRespondsTo';
+ try {
+ (obj[method] && typeof obj[method] == 'function') ? this.pass() :
+ this.fail(message + ": object doesn't respond to [" + method + "]"); }
+ catch(e) { this.error(e); }
+ },
+ assertReturnsTrue: function(method, obj) {
+ var message = arguments[2] || 'assertReturnsTrue';
+ try {
+ var m = obj[method];
+ if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
+ m() ? this.pass() :
+ this.fail(message + ": method returned false"); }
+ catch(e) { this.error(e); }
+ },
+ assertReturnsFalse: function(method, obj) {
+ var message = arguments[2] || 'assertReturnsFalse';
+ try {
+ var m = obj[method];
+ if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
+ !m() ? this.pass() :
+ this.fail(message + ": method returned true"); }
+ catch(e) { this.error(e); }
+ },
+ assertRaise: function(exceptionName, method) {
+ var message = arguments[2] || 'assertRaise';
+ try {
+ method();
+ this.fail(message + ": exception expected but none was raised"); }
+ catch(e) {
+ ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e);
+ }
+ },
+ assertElementsMatch: function() {
+ var expressions = $A(arguments), elements = $A(expressions.shift());
+ if (elements.length != expressions.length) {
+ this.fail('assertElementsMatch: size mismatch: ' + elements.length + ' elements, ' + expressions.length + ' expressions');
+ return false;
+ }
+ elements.zip(expressions).all(function(pair, index) {
+ var element = $(pair.first()), expression = pair.last();
+ if (element.match(expression)) return true;
+ this.fail('assertElementsMatch: (in index ' + index + ') expected ' + expression.inspect() + ' but got ' + element.inspect());
+ }.bind(this)) && this.pass();
+ },
+ assertElementMatches: function(element, expression) {
+ this.assertElementsMatch([element], expression);
+ },
+ benchmark: function(operation, iterations) {
+ var startAt = new Date();
+ (iterations || 1).times(operation);
+ var timeTaken = ((new Date())-startAt);
+ this.info((arguments[2] || 'Operation') + ' finished ' +
+ iterations + ' iterations in ' + (timeTaken/1000)+'s' );
+ return timeTaken;
+ },
+ _isVisible: function(element) {
+ element = $(element);
+ if(!element.parentNode) return true;
+ this.assertNotNull(element);
+ if(element.style && Element.getStyle(element, 'display') == 'none')
+ return false;
+
+ return this._isVisible(element.parentNode);
+ },
+ assertNotVisible: function(element) {
+ this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
+ },
+ assertVisible: function(element) {
+ this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
+ },
+ benchmark: function(operation, iterations) {
+ var startAt = new Date();
+ (iterations || 1).times(operation);
+ var timeTaken = ((new Date())-startAt);
+ this.info((arguments[2] || 'Operation') + ' finished ' +
+ iterations + ' iterations in ' + (timeTaken/1000)+'s' );
+ return timeTaken;
+ }
+}
+
+Test.Unit.Testcase = Class.create();
+Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
+ initialize: function(name, test, setup, teardown) {
+ Test.Unit.Assertions.prototype.initialize.bind(this)();
+ this.name = name;
+
+ if(typeof test == 'string') {
+ test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,');
+ test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)');
+ this.test = function() {
+ eval('with(this){'+test+'}');
+ }
+ } else {
+ this.test = test || function() {};
+ }
+
+ this.setup = setup || function() {};
+ this.teardown = teardown || function() {};
+ this.isWaiting = false;
+ this.timeToWait = 1000;
+ },
+ wait: function(time, nextPart) {
+ this.isWaiting = true;
+ this.test = nextPart;
+ this.timeToWait = time;
+ },
+ run: function() {
+ try {
+ try {
+ if (!this.isWaiting) this.setup.bind(this)();
+ this.isWaiting = false;
+ this.test.bind(this)();
+ } finally {
+ if(!this.isWaiting) {
+ this.teardown.bind(this)();
+ }
+ }
+ }
+ catch(e) { this.error(e); }
+ }
+});
+
+// *EXPERIMENTAL* BDD-style testing to please non-technical folk
+// This draws many ideas from RSpec http://rspec.rubyforge.org/
+
+Test.setupBDDExtensionMethods = function(){
+ var METHODMAP = {
+ shouldEqual: 'assertEqual',
+ shouldNotEqual: 'assertNotEqual',
+ shouldEqualEnum: 'assertEnumEqual',
+ shouldBeA: 'assertType',
+ shouldNotBeA: 'assertNotOfType',
+ shouldBeAn: 'assertType',
+ shouldNotBeAn: 'assertNotOfType',
+ shouldBeNull: 'assertNull',
+ shouldNotBeNull: 'assertNotNull',
+
+ shouldBe: 'assertReturnsTrue',
+ shouldNotBe: 'assertReturnsFalse',
+ shouldRespondTo: 'assertRespondsTo'
+ };
+ Test.BDDMethods = {};
+ for(m in METHODMAP) {
+ Test.BDDMethods[m] = eval(
+ 'function(){'+
+ 'var args = $A(arguments);'+
+ 'var scope = args.shift();'+
+ 'scope.'+METHODMAP[m]+'.apply(scope,(args || []).concat([this])); }');
+ }
+ [Array.prototype, String.prototype, Number.prototype].each(
+ function(p){ Object.extend(p, Test.BDDMethods) }
+ );
+}
+
+Test.context = function(name, spec, log){
+ Test.setupBDDExtensionMethods();
+
+ var compiledSpec = {};
+ var titles = {};
+ for(specName in spec) {
+ switch(specName){
+ case "setup":
+ case "teardown":
+ compiledSpec[specName] = spec[specName];
+ break;
+ default:
+ var testName = 'test'+specName.gsub(/\s+/,'-').camelize();
+ var body = spec[specName].toString().split('\n').slice(1);
+ if(/^\{/.test(body[0])) body = body.slice(1);
+ body.pop();
+ body = body.map(function(statement){
+ return statement.strip()
+ });
+ compiledSpec[testName] = body.join('\n');
+ titles[testName] = specName;
+ }
+ }
+ new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name });
+};
+
+if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
+ var finish = Test.Unit.Logger.prototype.finish;
+ Test.Unit.Logger.prototype.finish = function(status,summary){
+ var match = summary.match(/(\d+).*(\d+).*(\d+)/)
+ var fail = parseInt(match[2]) + parseInt(match[3]);
+ var pass = match[1] - fail;
+
+ for ( var i = 0; i < pass; i++ )
+ parent.SimpleTest.ok( true, `${this.testName}: ${summary}` );
+
+ for ( var i = 0; i < fail; i++ )
+ parent.SimpleTest.ok( false, `${this.testName}: ${summary}` );
+
+ return finish.apply( this, arguments );
+ };
+
+ // Intentionally overwrite (to stop the Ajax request)
+ Test.Unit.Runner.prototype.postResults = parent.runAJAXTest;
+
+ Ajax.InPlaceEditor.prototype.onFailure = function(){};
+})();
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_result.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_result.html
new file mode 100644
index 0000000000..55dcbeae1c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_result.html
@@ -0,0 +1 @@
+Server received: To be edited \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_text.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_text.html
new file mode 100644
index 0000000000..a6f35d1324
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_inplaceeditor_text.html
@@ -0,0 +1 @@
+Text from server \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_updater_result.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_updater_result.html
new file mode 100644
index 0000000000..5f11f56ce8
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_ajax_updater_result.html
@@ -0,0 +1,20 @@
+Test text
+
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+ alert('fragment1 hit!');
+// ]]>
+</script>
+
+more test text
+
+
+<script>alert('fragment2 hit!')</script>
+
+
+even more test text
+
+<script type="text/javascript">
+ alert('fragment3 hit!');
+</script> some other test text
+
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result.html
new file mode 100644
index 0000000000..f03b34ffc7
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result.html
@@ -0,0 +1,11 @@
+<ul>
+ <li>test1</li><li>test2</li>
+ <li>test3</li>
+<li><b>BOLD</b></li>
+
+ <li><span class="informal">(GET ME NOT)</span>(GET &lt;ME&gt; INSTEAD)</li>
+
+ <li>Here we have <a href="_autocomplete_result.html">a link</a> which should work</li>
+
+ <li>Here we have some international ©∏Á®Äç†∑rß</li>
+</ul> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result_nobr.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result_nobr.html
new file mode 100644
index 0000000000..742ff18f1c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/_autocomplete_result_nobr.html
@@ -0,0 +1 @@
+<ul><li>test1</li><li>test2</li><li>test3</li><li><b>BOLD</b></li><li><span class="informal">(GET ME NOT)</span>(GET &lt;ME&gt; INSTEAD)</li><li>Here we have <a href="_autocomplete_result.html">a link</a> which should work</li><li>Here we have some international ©∏Á®Äç†∑rß</li></ul> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_autocompleter_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_autocompleter_test.html
new file mode 100644
index 0000000000..69c1fadc78
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_autocompleter_test.html
@@ -0,0 +1,232 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+ <style>
+ .selected { background-color: #888; }
+ </style>
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for Ajax.Autocompleter in controls.js.
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<input id="ac_input" type="text" autocomplete="off" />
+<div id="ac_update" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
+
+<input id="ac_input_br" type="text" autocomplete="off" />
+<div id="ac_update_br" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
+
+<input id="ac2_input" type="text" autocomplete="off" />
+<div id="ac2_update" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
+
+<input id="actoken_input" type="text" autocomplete="off" />
+<div id="actoken_update" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
+
+<input id="dummy_element" type="text" autocomplete="off" />
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+
+ new Test.Unit.Runner({
+
+ // Integration test, tests the entire cycle
+ testAjaxAutocompleter: function() { with(this) {
+ var ac = new Ajax.Autocompleter('ac_input','ac_update','_autocomplete_result.html',
+ { method: 'get' }); //override so we can use a static for the result
+ assertInstanceOf(Ajax.Autocompleter, ac);
+
+ // box not visible
+ assertNotVisible('ac_update');
+
+ // focus, but box not visible
+ Event.simulateMouse('ac_input', 'click');
+ assertNotVisible('ac_update');
+
+ Event.simulateKeys('ac_input','abcdefg');
+ assertEqual('abcdefg', $('ac_input').value);
+
+ // check box popping up on input
+ wait(1000, function() { with(this) {
+ assertVisible('ac_update');
+ assertEqual('test1', $('ac_update').firstChild.firstChild.innerHTML);
+ assertEqual('test2', $('ac_update').firstChild.firstChild.nextSibling.innerHTML);
+
+ // intl. characters return (UTF-8)
+ assertEqual('Here we have some international ©∏Á®Äç†∑rß', $('ac_update').firstChild.lastChild.innerHTML);
+
+ // first entry should be selected
+ assert(Element.hasClassName($('ac_update').firstChild.firstChild, 'selected'),'Selected item should have a className of: selected');
+
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_DOWN});
+
+ // second entry should be selected
+ assert(!Element.hasClassName($('ac_update').firstChild.firstChild),'Item shouldn\'t have a className of: selected');
+ assert(Element.hasClassName($('ac_update').firstChild.firstChild.nextSibling, 'selected'),'Second entry should have a className of: selected');
+
+ // check selecting with <TAB>
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_TAB});
+ assertEqual('test2',$('ac_input').value);
+
+ // check box going away
+ wait(500, function() { with(this) {
+ assertNotVisible('ac_update');
+
+ // check selecting with mouse click
+ Event.simulateKeys('ac_input','3');
+ assertEqual('test23', $('ac_input').value);
+ wait(1000, function() { with(this) {
+ assertVisible('ac_update');
+ Event.simulateMouse($('ac_update').firstChild.childNodes[4],'click');
+
+ wait(1000, function() { with(this) {
+ // tests if removal of 'informal' nodes and HTML escaping works
+ assertEqual('(GET <ME> INSTEAD)',$('ac_input').value);
+ assertNotVisible('ac_update');
+
+ // check cancelling with <ESC>
+ Event.simulateKeys('ac_input','abcdefg');
+
+ wait(1000, function() { with(this) {
+ assertVisible('ac_update');
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input').value);
+
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_DOWN});
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_ESC});
+
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input').value);
+ }});
+ }});
+ }});
+ }});
+ }});
+ }},
+
+ testAfterUpdateElement: function() { with(this) {
+ var ac = new Ajax.Autocompleter('ac2_input','ac2_update','_autocomplete_result.html',
+ { method: 'get',
+ afterUpdateElement: function(element,selectedElement) {
+ element.value = 'afterupdate:' + selectedElement.tagName;
+ }
+ });
+ assertInstanceOf(Ajax.Autocompleter, ac);
+
+ Event.simulateMouse('ac2_input', 'click');
+ Event.simulateKeys('ac2_input','abcdefg');
+
+ wait(1000, function() { with(this) {
+ assertVisible('ac2_update');
+ Event.simulateKey('ac2_input','keypress',{keyCode:Event.KEY_TAB});
+
+ assertEqual('afterupdate:LI',$('ac2_input').value);
+ }});
+ }},
+
+ testTokenizing: function() { with(this) {
+ var actoken = new Ajax.Autocompleter('actoken_input','ac_update','_autocomplete_result.html',
+ { tokens:',', method: 'get' });
+ assertInstanceOf(Ajax.Autocompleter, actoken);
+
+ Event.simulateKeys('actoken_input','abc');
+
+ wait(1000, function() { with(this) {
+ Event.simulateKey('actoken_input','keypress',{keyCode:Event.KEY_TAB});
+ assertEqual('test1',$('actoken_input').value);
+ Event.simulateKeys('actoken_input',',abc');
+ wait(1000, function() { with(this) {
+ Event.simulateKey('actoken_input','keypress',{keyCode:Event.KEY_DOWN});
+ Event.simulateKey('actoken_input','keypress',{keyCode:Event.KEY_TAB});
+ assertEqual('test1,test2',$('actoken_input').value);
+ }});
+ }});
+ }},
+
+ // Same integration test, results has no linebreaks
+ testAjaxAutocompleterNoLinebreaksInResult: function() { with(this) {
+ var ac = new Ajax.Autocompleter('ac_input_br','ac_update_br','_autocomplete_result_nobr.html',
+ { method: 'get' }); //override so we can use a static for the result
+ assertInstanceOf(Ajax.Autocompleter, ac);
+
+ // box not visible
+ assertNotVisible('ac_update_br');
+
+ // focus, but box not visible
+ Event.simulateMouse('ac_input_br', 'click');
+ assertNotVisible('ac_update_br');
+
+ Event.simulateKeys('ac_input_br','abcdefg');
+ assertEqual('abcdefg', $('ac_input_br').value);
+
+ // check box popping up on input
+ wait(1000, function() { with(this) {
+ assertVisible('ac_update_br');
+ assertEqual('test1', $('ac_update_br').firstChild.firstChild.innerHTML);
+ assertEqual('test2', $('ac_update_br').firstChild.firstChild.nextSibling.innerHTML);
+
+ // intl. characters return (UTF-8)
+ assertEqual('Here we have some international ©∏Á®Äç†∑rß', $('ac_update_br').firstChild.lastChild.innerHTML);
+
+ // first entry should be selected
+ assert(Element.hasClassName($('ac_update_br').firstChild.firstChild, 'selected'),'Selected item should have a className of: selected');
+
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_DOWN});
+
+ // second entry should be selected
+ assert(!Element.hasClassName($('ac_update_br').firstChild.firstChild),'Item shouldn\'t have a className of: selected');
+ assert(Element.hasClassName($('ac_update_br').firstChild.firstChild.nextSibling, 'selected'),'Second entry should have a className of: selected');
+
+ // check selecting with <TAB>
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_TAB});
+ assertEqual('test2',$('ac_input_br').value);
+
+ // check box going away
+ wait(500, function() { with(this) {
+ assertNotVisible('ac_update_br');
+
+ // check selecting with mouse click
+ Event.simulateKeys('ac_input_br','3');
+ assertEqual('test23', $('ac_input_br').value);
+ wait(1000, function() { with(this) {
+ assertVisible('ac_update_br');
+ Event.simulateMouse($('ac_update_br').firstChild.childNodes[4],'click');
+
+ wait(1000, function() { with(this) {
+ // tests if removal of 'informal' nodes and HTML escaping works
+ assertEqual('(GET <ME> INSTEAD)',$('ac_input_br').value);
+ assertNotVisible('ac_update_br');
+
+ // check cancelling with <ESC>
+ Event.simulateKeys('ac_input_br','abcdefg');
+
+ wait(1000, function() { with(this) {
+ assertVisible('ac_update_br');
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input_br').value);
+
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_DOWN});
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_ESC});
+
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input_br').value);
+ }});
+ }});
+ }});
+ }});
+ }});
+ }}
+
+ });
+// ]]>
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_inplaceeditor_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_inplaceeditor_test.html
new file mode 100644
index 0000000000..4104d9959d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/ajax_inplaceeditor_test.html
@@ -0,0 +1,152 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for Ajax.InPlaceEditor in controls.js
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<h1 id="tobeedited">To be edited</h1>
+<a id="tobeeditedEditControl" href="#">edit</a>
+
+<div id="tobeeditedMultiLine">First line<br/>Second line<br/>Third line</div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ new Test.Unit.Runner({
+
+ setup: function() { with(this) {
+ inPlaceEditor = new Ajax.InPlaceEditor($('tobeedited'), '_ajax_inplaceeditor_result.html', {
+ externalControl: $('tobeeditedEditControl'),
+ ajaxOptions: {method: 'get'} //override so we can use a static for the result
+ });
+ inPlaceEditorMultiLine = new Ajax.InPlaceEditor($('tobeeditedMultiLine'), '_ajax_inplaceeditor_result.html', {
+ ajaxOptions: {method: 'get'} //override so we can use a static for the result
+ });
+ }},
+
+ teardown: function() { with(this) {
+ inPlaceEditor.dispose();
+ }},
+
+ testDisposesProperly: function() { with(this) {
+ assertEqual("rgba(0, 0, 0, 0)", Element.getStyle('tobeedited','background-color'));
+ inPlaceEditor.dispose();
+ assertEqual("rgba(0, 0, 0, 0)", Element.getStyle('tobeedited','background-color'));
+ assertVisible($('tobeedited'));
+ Event.simulateMouse('tobeedited','click');
+ assertVisible($('tobeedited'));
+ }},
+
+ testUsesTextAreaWhenMoreThanOneRows: function() { with(this) {
+ inPlaceEditor.options.rows = 5;
+ inPlaceEditor.enterEditMode();
+ assertEqual("TEXTAREA", document.forms[0].firstChild.tagName);
+ assertEqual("BR", document.forms[0].childNodes[1].tagName);
+ }},
+
+ testCanSpecifyAllTextsThroughOptions: function() { with(this) {
+ // swedish translation ;-)
+ inPlaceEditor.options.okText = "spara";
+ inPlaceEditor.options.cancelText = "avbryt";
+ inPlaceEditor.options.savingText = "Sparar...";
+ inPlaceEditor.enterEditMode();
+ assertEqual("spara", document.forms[0].lastChild.previousSibling.value);
+ assertEqual("avbryt", document.forms[0].lastChild.innerHTML);
+ inPlaceEditor.showSaving();
+ assertEqual("Sparar...", $('tobeedited').innerHTML);
+ }},
+
+ testCanSpecifyFormIdThroughOptions: function() { with(this) {
+ inPlaceEditor.enterEditMode();
+ // default form id
+ assertEqual("tobeedited-inplaceeditor", document.forms[0].id);
+ inPlaceEditor.leaveEditMode();
+ inPlaceEditor.options.formId = "myFormId";
+ inPlaceEditor.enterEditMode();
+ assertEqual("myFormId", document.forms[0].id);
+ }},
+
+ testCantEditWhileSaving: function() { with(this) {
+ inPlaceEditor.onLoading();
+ Event.simulateMouse('tobeedited','mouseover');
+ assertEqual("rgba(0, 0, 0, 0)", Element.getStyle('tobeedited','background-color'));
+ Event.simulateMouse('tobeedited','click');
+ assertVisible($('tobeedited'));
+ }},
+
+ testCallbackFunctionGetsCalled: function() { with(this) {
+ called = false;
+ inPlaceEditor.options.callback = function(form) {
+ called = true;
+ }
+ Event.simulateMouse('tobeedited','click');
+ Event.simulateMouse(document.forms[0].childNodes[1],'click');
+ assert(called, "callback was not called");
+ }},
+
+ testCanUseExternalElementToGoIntoEditMode: function() { with(this) {
+ Event.simulateMouse('tobeeditedEditControl','click');
+ assertNotNull(document.forms[0], "external control didn't work");
+ // doesn't work if you click it again while in edit mode
+ Event.simulateMouse('tobeeditedEditControl','click');
+ assertNull(document.forms[1], "external control created two forms");
+ assertNotVisible($('tobeeditedEditControl'));
+ Event.simulateMouse(document.forms[0].childNodes[2],'click');
+ assertVisible($('tobeeditedEditControl'));
+ }},
+
+ testHasLineBreaksDetectsHTMLLineBreaks: function() { with(this) {
+ assert(inPlaceEditorMultiLine.hasHTMLLineBreaks("Line 1<br/>Line 2"));
+ assert(inPlaceEditorMultiLine.hasHTMLLineBreaks("Line 1<br>Line 2"));
+ assert(inPlaceEditorMultiLine.hasHTMLLineBreaks("<p>Line 1</p>Line 2"));
+ assert(inPlaceEditorMultiLine.hasHTMLLineBreaks("Line 1<BR/>Line 2"));
+ assert(inPlaceEditorMultiLine.hasHTMLLineBreaks("Line 1<BR>Line 2"));
+ assert(inPlaceEditorMultiLine.hasHTMLLineBreaks("<P>Line 1</P>Line 2"));
+ assert(inPlaceEditorMultiLine.hasHTMLLineBreaks("<P>Line 1<P>Line 2"));
+ assert(!inPlaceEditorMultiLine.hasHTMLLineBreaks("One line"));
+ }},
+
+ testConvertsHTMLLineBreaksIntoNewLines: function() { with(this) {
+ assertEqual("Line 1\nLine 2", inPlaceEditorMultiLine.convertHTMLLineBreaks("Line 1<br/>Line 2"));
+ assertEqual("Line 1\nLine 2", inPlaceEditorMultiLine.convertHTMLLineBreaks("Line 1<br>Line 2"));
+ // <p> not supported (too hard)
+ //assertEqual("Line 1\nLine 2", inPlaceEditorMultiLine.convertHTMLLineBreaks("<p>Line 1</p>Line 2"));
+ assertEqual("Line 1\nLine 2", inPlaceEditorMultiLine.convertHTMLLineBreaks("Line 1<BR/>Line 2"));
+ assertEqual("Line 1\nLine 2", inPlaceEditorMultiLine.convertHTMLLineBreaks("Line 1<BR>Line 2"));
+ // <p> not supported (too hard)
+ //assertEqual("Line 1\nLine 2", inPlaceEditorMultiLine.convertHTMLLineBreaks("<P>Line 1</P>Line 2"));
+ // unclosed <P>s not supported yet
+ //assertEqual("Line 1\nLine 2", inPlaceEditorMultiLine.convertHTMLLineBreaks("<P>Line 1<P>Line 2"));
+ // <p> not supported (too hard)
+ //assertEqual("Line 1\nLine 2\nLine 3\nLine 4", inPlaceEditorMultiLine.convertHTMLLineBreaks("<P>Line 1</P>Line 2<br>Line 3<p>Line 4</P>"));
+ assertEqual("One line", inPlaceEditorMultiLine.convertHTMLLineBreaks("One line"));
+ }},
+
+ testConvertsParagraphsAndBRsIntoLineBreaks: function() { with(this) {
+ inPlaceEditorMultiLine.enterEditMode();
+ assertEqual("TEXTAREA", document.forms[0].firstChild.tagName);
+ assertEqual("First line\nSecond line\nThird line", document.forms[0].firstChild.value)
+ // doesn't automatically determine size yet
+ //assertEqual(3, document.forms[0].firstChild.rows);
+ }}
+
+ });
+// ]]>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/bdd_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/bdd_test.html
new file mode 100644
index 0000000000..02cb10bff7
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/bdd_test.html
@@ -0,0 +1,138 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<div id="d">initial</div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+var moo = 0;
+
+var assertMethods = [];
+for(method in Test.Unit.Assertions.prototype) {
+ if(/^assert/.test(method)) assertMethods.push(method);
+}
+
+var testObj = {
+ isNice: function(){
+ return true;
+ },
+ isBroken: function(){
+ return false;
+ }
+}
+
+Test.context("BDD-style testing",{
+
+ setup: function() {
+ $('d').update('setup!');
+ moo++;
+ },
+
+ teardown: function() {
+ moo--;
+ },
+
+ 'should run setup before each specification': function(){
+ assert($('d').innerHTML == 'setup!');
+ assert(moo == 1);
+ },
+
+ 'should run teardown after each specification': function(){
+ assert(moo == 1);
+ },
+
+ 'should provide extensions to tie in isSomething and respondsTo object methods': function(){
+ Object.extend(testObj, Test.BDDMethods);
+
+ testObj.shouldBe('nice');
+ testObj.shouldNotBe('broken');
+
+ testObj.shouldRespondTo('isNice');
+ testObj.shouldRespondTo('isBroken');
+ },
+
+ 'should automatically add extensions to strings': function(){
+ 'a'.shouldEqual('a');
+ 'a'.shouldNotEqual('b');
+ 'a'.shouldNotBeNull();
+ 'a'.shouldBeA(String);
+
+ var aString = 'boo!';
+ aString.shouldEqual('boo!');
+ aString.shouldBeA(String);
+ aString.shouldNotBeA(Number);
+ },
+
+ 'should automatically add extensions to numbers': function(){
+ var n = 123;
+ n.shouldEqual(123);
+ n.shouldNotEqual(4);
+
+ n.shouldBeA(Number);
+ n.shouldNotBeA(Test);
+ },
+
+ 'should automatically add extensions to arrays': function(){
+ ['a'].shouldNotBeA(String);
+ [1,2,3].shouldBeAn(Array);
+ [1,2,3].shouldEqualEnum([1,2,3]);
+ },
+
+ 'should support the eval() method': function(){
+ eval('2*2').shouldEqual(4);
+ },
+
+ 'should support equality assertion': function(){
+ assertEqual(1, 1);
+ assertEqual('a', 'a');
+ assertEqual(1, '1');
+
+ var x = 1;
+ var y = 1;
+ assertEqual(1, x)
+ assertEqual(x, y);
+ },
+
+ 'should provide all assertions': function(){
+ assertMethods.each(function(m){
+ assert(typeof this[m] == 'function');
+ }.bind(this));
+ },
+
+ 'should support deferred execution': function(){
+ wait(10,function(){
+ 'a'.shouldEqual('a');
+ });
+
+ wait(10,function(){
+ 'a'.shouldEqual('a');
+ wait(10,function(){
+ 'a'.shouldEqual('a');
+ wait(10,function(){
+ 'a'.shouldEqual('a');
+ });
+ });
+ });
+ }
+
+});
+
+// ]]>
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/builder_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/builder_test.html
new file mode 100644
index 0000000000..3475198385
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/builder_test.html
@@ -0,0 +1,258 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for builder.js
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<div id="result"></div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ // Serializes a node and its contents to plain old HTML
+ // IMPORTANT: style attributes can't be correctly serialized cross-browser wise,
+ // so the contents of style attributes must match what IE thinks is correct
+ function serializeNode(node){
+ if(node.nodeType == 3) return node.nodeValue;
+ node = $(node);
+ var tag = node.tagName.toLowerCase();
+ return '<' + ([tag].concat($A(node.attributes).map(function(attr){
+ // Filter out stuff that we don't need
+ if(attr.nodeName == '_extended' || attr.nodeName == '_counted' ||
+ typeof attr.nodeValue == 'function' ||!Element.hasAttribute(node, attr.nodeName)) return;
+ // remove trailing ; in style attributes on Firefox
+ var value = node.readAttribute(attr.nodeName);
+ if(attr.nodeName == 'style' && value.endsWith(';'))
+ value = value.substr(0, value.length-1);
+ return attr.nodeName + '="' + value + '"'
+ }).compact().sort())).join(' ') + '>' + $A(node.childNodes).map(serializeNode).join('') +
+ '</' + tag + '>';
+ }
+
+ new Test.Unit.Runner({
+
+ setup: function() {
+ $('result').innerHTML = '';
+ },
+
+ testBuilderBasics: function() { with(this) {
+ var element = Builder.node('div');
+ assertEqual('DIV', element.nodeName);
+
+ var element = Builder.node('div',{id:'mydiv'})
+ assertEqual('mydiv', element.id);
+
+ var element = Builder.node('div',{id:'mydiv',className:'one two'})
+ assertEqual('mydiv', element.id);
+ assertEqual('one two', element.className);
+
+ var element = Builder.node('span','text 123 <blah>');
+ assertEqual('SPAN', element.nodeName);
+ assertEqual('text 123 &lt;blah&gt;', element.innerHTML);
+
+ var element = Builder.node('span',123);
+ assertEqual('SPAN', element.nodeName);
+ assertEqual('123', element.innerHTML);
+
+ var element = Builder.node('span',['test']);
+ assertEqual('SPAN', element.nodeName);
+ assertEqual('test', element.innerHTML);
+
+ var element = Builder.node('span',['test',123]);
+ assertEqual('SPAN', element.nodeName);
+ assertEqual('test123', element.innerHTML);
+
+ var element = Builder.node('span',{},['test',123]);
+ assertEqual('SPAN', element.nodeName);
+ assertEqual('test123', element.innerHTML);
+
+ var element = Builder.node('span',{id:'myspan'},['test',123]);
+ assertEqual('SPAN', element.nodeName);
+ assertEqual('myspan', element.id);
+ assertEqual('test123', element.innerHTML);
+
+ var element = Builder.node('div',[1,2,[3],[[[4],5],6],7,8,[[[[9]]],0]]);
+ assertEqual('1234567890',element.innerHTML);
+
+ var element = Builder.node('div',[1,'2',['3'],[[[4],'5'],6],7,'8',[[[['9']]],0]]);
+ assertEqual('1234567890',element.innerHTML);
+
+ var element = Builder.node('div',{id:'mydiv'},[1,2,[3],[[[4],5],6],7,8,[[[[9]]],0]]);
+ assertEqual('1234567890',element.innerHTML);
+
+ var element = Builder.node('div',{id:'mydiv'},[1,'2',['3'],[[[4],'5'],6],7,'8',[[[['9']]],0]]);
+ assertEqual('1234567890',element.innerHTML);
+ assertEqual(10, element.childNodes.length);
+
+ var element = Builder.node('div', Builder.node('span'));
+ assertEqual(1, element.childNodes.length);
+ assertEqual('SPAN', element.childNodes[0].tagName);
+
+ var element = Builder.node('div', {id:'mydiv'}, Builder.node('span'));
+ assertEqual(1, element.childNodes.length);
+ assertEqual('mydiv', element.id);
+ assertEqual('SPAN', element.childNodes[0].tagName);
+ }},
+
+ testBuilderClassAndFor: function() { with(this) {
+ var elt = Builder.node('div', { className: 'demoClass' });
+ assertEqual('demoClass', elt.className);
+ var elt = Builder.node('label', { htmlFor: 'mydiv' });
+ assertEqual('mydiv', elt.htmlFor);
+ }},
+
+ testBuilderAllXHTMLTags: function() { with(this) {
+ var XHTML_TAGS = [
+ 'a','abbr','acronym','address','applet','area',
+ 'b','bdo','big','blockquote','br','button',
+ 'caption','cite','code','col','colgroup',
+ 'dd','del','dfn','div','dl','dt',
+ 'em',
+ 'fieldset','form',
+ 'h1','h2','h3','h4','h5','h6','hr',
+ 'i','iframe','img','input','ins',
+ 'kbd',
+ 'label','legend','li',
+ 'map',
+ 'object','ol','optgroup','option',
+ 'p','param','pre',
+ 'q',
+ 'samp','script','select','small','span','strong','style','sub','sup',
+ 'table','tbody','td','textarea','tfoot','th','thead','tr','tt',
+ 'ul','var']
+
+ XHTML_TAGS.each(function(tag) {
+ try {
+ var element = Builder.node(tag);
+ assertNotNull(element, 'Tag "'+tag+'" expected, but was null.');
+ assertEqual(tag.toUpperCase(), element.nodeName);
+
+ var element = Builder.node(tag,{id:'tag_'+tag+'_test_id'});
+ assertEqual(tag.toUpperCase(), element.nodeName);
+ assertEqual('tag_'+tag+'_test_id', element.id, 'Setting id attribute for "'+tag+'" failed!');
+ } catch(e) {
+ assert(false, 'Error while creating node of type '+tag+'. Note: Firefox bug in 1.0.X on option and optgroup, fixed in 1.5b1. Internet Explorer 6 doesn\'t support the ABBR tag and has no standard DOM implementation for tables.');
+ }
+ });
+ }},
+
+ // special case, because requires workarounds on IE and Firefox < 1.5
+ testBuilderOptionTag: function() { with(this) {
+ assertEqual('', Builder.node('option').innerHTML);
+ assertEqual('test', Builder.node('option','test').innerHTML);
+ assertEqual('', Builder.node('option',{className:'test'}).innerHTML);
+ assertEqual('test', Builder.node('option',{className:'test'},'test').innerHTML);
+ assertEqual('test', Builder.node('option',{},'test').innerHTML);
+
+ var selectElement = Builder.node('select');
+ var optionElement = Builder.node('option',{className:'test',id:'option_123'},123);
+ selectElement.appendChild(optionElement);
+ document.body.appendChild(selectElement);
+ assertEqual('123', $('option_123').innerHTML);
+ }},
+
+ testBuilderContatenation: function() { with(this) {
+ var element = Builder.node('div', [Builder.node('span')]);
+ assertEqual('DIV', element.nodeName);
+ assertEqual(1, element.childNodes.length);
+ assertEqual('SPAN', element.firstChild.nodeName);
+
+ var element = Builder.node('div', [Builder.node('span'),'text']);
+ assertEqual(2, element.childNodes.length);
+ assertEqual(0, element.firstChild.childNodes.length);
+ assertEqual('DIV', element.nodeName);
+ assertEqual('SPAN', element.firstChild.nodeName);
+ assertEqual(3, element.firstChild.nextSibling.nodeType);
+
+ var element = Builder.node('div', [Builder.node('span',[Builder.node('strong','blah')]),'text']);
+ assertEqual(2, element.childNodes.length);
+ assertEqual(1, element.firstChild.childNodes.length);
+ assertEqual('DIV', element.nodeName);
+ assertEqual('SPAN', element.firstChild.nodeName);
+ assertEqual('STRONG', element.firstChild.firstChild.nodeName);
+ assertEqual('blah', element.firstChild.firstChild.innerHTML);
+ assertEqual(3, element.firstChild.nextSibling.nodeType);
+ }},
+
+ testBuilderComplexExample: function() { with(this) {
+ var element = Builder.node('div',{id:'ghosttrain'},[
+ Builder.node('div',{style:'font-weight: bold; font-size: 11px'},[
+ Builder.node('h1','Ghost Train'),
+ "testtext", 2, 3, 4,
+ Builder.node('ul',[
+ Builder.node('li',{onclick:'alert(\'test\')'},'click me')
+ ]),
+ ]),
+ ]);
+ assertEqual('DIV', element.nodeName);
+
+ $('result').appendChild(element);
+
+ // browsers aren't sure about upper and lower case on elements
+ assertEqual(
+ '<div id="ghosttrain"><div style="font-weight: bold; font-size: 11px">' +
+ '<h1>Ghost Train</h1>testtext234<ul><li onclick="alert(\'test\')">click me</li></ul></div></div>',
+ serializeNode($('result').childNodes[0]));
+ }},
+
+ testBuilderShortcuts: function() { with(this) {
+ Builder.dump();
+
+ var element = DIV(SPAN());
+ assertEqual('SPAN', element.childNodes[0].tagName);
+
+ var element = DIV({id:'test'},SPAN());
+ assertEqual('SPAN', element.childNodes[0].tagName);
+
+ var element = DIV({id:'ghosttrain'},[
+ DIV({style:'font-weight: bold; font-size: 11px'},[
+ H1('Ghost Train'),
+ "testtext", 2, 3, 4,
+ UL([
+ LI({onclick:'alert(\'test\')'},'click me')
+ ]),
+ ]),
+ ]);
+ assertEqual('DIV', element.nodeName);
+
+ $('result').appendChild(element);
+
+ assertEqual(
+ '<div id="ghosttrain"><div style="font-weight: bold; font-size: 11px">' +
+ '<h1>Ghost Train</h1>testtext234<ul><li onclick="alert(\'test\')">click me</li></ul></div></div>',
+ serializeNode($('result').childNodes[0]));
+ }},
+
+ testBuilderBuild: function() { with(this) {
+ ['<span>this is <b>neat!</b></span>',' \n<span>this is <b>neat!</b></span>\n '].each(
+ function(html){
+ var node = Builder.build(html);
+ assertEqual('<span>this is <b>neat!</b></span>', serializeNode(node));
+ });
+ }},
+
+ testBuilderAttributeEscaping: function() { with(this) {
+ var element = Builder.node('div',{blah:"<foo'bar&baz\"bat>"});
+ assertEqual("<foo'bar&baz\"bat>", $(element).readAttribute('blah'));
+ }}
+
+ });
+// ]]>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html
new file mode 100644
index 0000000000..686bd0f6f9
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html
@@ -0,0 +1,131 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+ <style type="text/css" media="screen">
+ /* <![CDATA[ */
+ #div_absolute_test { position: absolute }
+ /* ]]> */
+ </style>
+
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Test of drag &amp; drop functions in dragdrop.js
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<p id="p_test">p_test</p>
+<p id="p_test2">p_test2</p>
+<p id="p_test3">p_test3</p>
+<img id="img_test" src="icon.png" alt="img_text"/>
+<div id="droppable_test">droppable_test</div>
+
+<div id="div_test">div_test</div>
+<div id="div_absolute_test">div_absolute_test</div>
+<div id="div_absolute_inline_test" style="position:absolute">div_absolute_inline_test</div>
+
+<div id="droppable_container">
+ <div id="d1">droppable_test</div>
+ <div id="d2">droppable_test</div>
+</div>
+
+<div id="droppable_container_2">
+ <div id="d3">droppable_test</div>
+</div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ new Test.Unit.Runner({
+
+ testDraggableBasics: function() { with(this) {
+ var d = new Draggable('p_test');
+ assertInstanceOf(Draggable, d);
+ }},
+
+ testDraggableStartEffect: function() { with(this) {
+ var d = new Draggable('p_test2');
+ assert(d.options.starteffect, 'There should be a default start effect.');
+ d = new Draggable('p_test3', { endeffect: Prototype.EmptyFunction });
+ assert(undefined === d.options.startEffect, 'There should be no default start effect.');
+ }},
+
+ testAutoPositioning: function() { with(this) {
+ assertEqual('static', Element.getStyle('div_test','position'));
+ new Draggable('div_test');
+ new Draggable('div_absolute_test');
+ new Draggable('div_absolute_inline_test');
+ assertEqual('relative', Element.getStyle('div_test','position'));
+ assertEqual('absolute', Element.getStyle('div_absolute_test','position'));
+ assertEqual('absolute', Element.getStyle('div_absolute_inline_test','position'));
+ }},
+
+ testDroppbalesBasics: function() { with(this) {
+ assertEqual(0, Droppables.drops.length);
+ assertEqual('static', Element.getStyle('droppable_test','position'));
+
+ Droppables.add('droppable_test');
+ assertEqual(1, Droppables.drops.length);
+ assertEqual('relative', Element.getStyle('droppable_test','position'));
+
+ Droppables.remove('droppable_test');
+ assertEqual(0, Droppables.drops.length);
+
+ // accept option should take strings or array of strings
+ Droppables.add('droppable_test',{accept:'document'});
+ assertEqual(['document'].inspect(), Droppables.drops[0].accept.inspect());
+ Droppables.remove('droppable_test');
+
+ Droppables.add('droppable_test',{accept:['document','image']});
+ assertEqual(['document','image'].inspect(), Droppables.drops[0].accept.inspect());
+ Droppables.remove('droppable_test');
+ }},
+
+ testDroppableContainment: function() { with(this) {
+ // Droppable containers should be cached
+ Droppables.add('droppable_test', {
+ containment:'droppable_container' });
+ assertEqual(1, Droppables.drops[0]._containers.length);
+ assertEqual($('droppable_container'), Droppables.drops[0]._containers[0]);
+ assert(Droppables.isContained($('d1'), Droppables.drops[0]));
+ assert(Droppables.isContained($('d2'), Droppables.drops[0]));
+ assert(!Droppables.isContained($('d3'), Droppables.drops[0]));
+ Droppables.remove('droppable_test');
+
+ Droppables.add('droppable_test', {
+ containment:['droppable_container','droppable_container_2'] });
+ assertEqual(2, Droppables.drops[0]._containers.length);
+ assertEqual($('droppable_container'), Droppables.drops[0]._containers[0]);
+ assertEqual($('droppable_container_2'), Droppables.drops[0]._containers[1]);
+ assert(Droppables.isContained($('d1'), Droppables.drops[0]));
+ assert(Droppables.isContained($('d2'), Droppables.drops[0]));
+ assert(Droppables.isContained($('d3'), Droppables.drops[0]));
+ Droppables.remove('droppable_test');
+ }},
+
+ testDroppablesIsAffected: function() { with(this) {
+ Droppables.add('droppable_test');
+
+ Position.prepare();
+ assert(!Droppables.isAffected([-10, -10], null, Droppables.drops[0]));
+
+ var p = Position.page($('droppable_test'));
+ assert(Droppables.isAffected(p, null, Droppables.drops[0]));
+ }}
+
+ }, "testlog");
+// ]]>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/effects_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/effects_test.html
new file mode 100644
index 0000000000..4fb6296589
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/effects_test.html
@@ -0,0 +1,250 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+ <style type="text/css" media="screen">
+ #rotfl {
+ color: red;
+ font-family: serif;
+ font-style: italic;
+ font-size: 40px;
+ background: #fed;
+ padding: 1em;
+ width: 400px;
+ }
+ .final {
+ color: #fff;
+ font-style: italic;
+ font-size: 20px;
+ background: #000;
+ opacity: 0.5;
+ }
+ </style>
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for effects.js
+</p>
+
+<!-- generated elements go in here -->
+<div id="sandbox"></div>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<div class="morphing blub" style="font-size:25px;color:#f00">Well</div>
+<div class="morphing">You know</div>
+<div id="blah" style="border:1px solid black;width:100px">Whoo-hoo!</div>
+
+<div id="error_message">ERROR MESSAGE</div>
+<div id="error_message_2">SECOND ERROR MESSAGE</div>
+<div id="error_message_3" style="border:1px solid red; width:100px; color: #f00">THIRD ERROR MESSAGE</div>
+
+<ul class="error-list" id="error_test_ul">
+ <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</li>
+ <li>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
+ <li>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris</li>
+ <li>nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in</li>
+ <li>reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</li>
+</ul>
+
+<div id="rotfl">ROTFL</div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ var TAGS =
+ ['div','span','ol','ul','table','p','h1','h2','h3','h4','h5','h6'];
+
+ var COMBINED_EFFECTS =
+ ['Fade','Appear','BlindUp','BlindDown','Puff','SwitchOff','DropOut','Shake',
+ 'SlideUp','SlideDown','Pulsate','Squish','Fold','Grow','Shrink'];
+
+ var COMBINED_RJS_EFFECTS = $w('fade appear blind_up blind_down puff switch_off '+
+ 'drop_out shake slide_up slide_down pulsate squish fold grow shrink');
+
+ var tmp, tmp2;
+
+ new Test.Unit.Runner({
+
+ setup: function() { with (this) {
+ $('sandbox').innerHTML = "";
+ }},
+
+ teardown: function() { with(this) {
+ // remove all queued effects
+ Effect.Queue.each(function(e) { e.cancel() });
+ }},
+
+ testBackwardsCompat: function() { with(this) {
+ assertInstanceOf(Effect.Opacity, new Effect2.Fade('sandbox'));
+ }},
+
+ testExceptionOnNonExistingElement: function() { with(this) {
+ assertRaise('ElementDoesNotExistError',
+ function(){new Effect.Opacity('nothing-to-see-here')});
+ assertRaise('ElementDoesNotExistError',
+ function(){new Effect.Move('nothing-to-see-here')});
+ assertRaise('ElementDoesNotExistError',
+ function(){new Effect.Scale('nothing-to-see-here')});
+ assertRaise('ElementDoesNotExistError',
+ function(){new Effect.Highlight('nothing-to-see-here')});
+ }},
+
+ testEffectsQueue: function() { with(this) {
+ var e1 = new Effect.Highlight('sandbox');
+ var e2 = new Effect.Appear('sandbox');
+
+ assertEqual(2, Effect.Queue.effects.length);
+
+ tmp = 0;
+ Effect.Queue.each(function(e) { tmp++ });
+ assertEqual(2, tmp);
+
+ // the internal interval timer should be active
+ assertNotNull(Effect.Queue.interval);
+ e1.cancel();
+ e2.cancel();
+ assertEqual(0, Effect.Queue.effects.length);
+
+ // should be inactive after all effects are removed from queue
+ assertNull(Effect.Queue.interval);
+
+ // should be in e3,e1,e2 order
+ var e1 = new Effect.Highlight('sandbox');
+ var e2 = new Effect.Appear('sandbox',{queue:'end'});
+ var e3 = new Effect.Fade('sandbox',{queue:'front'});
+ assert(e2.startOn > e1.startOn);
+ assert(e3.startOn < e1.startOn);
+ assert(e3.startOn < e2.startOn);
+ assertEqual(3, Effect.Queue.effects.length);
+
+ Effect.Queue.each(function(e) { e.cancel() });
+ assertEqual(0, Effect.Queue.effects.length);
+ }},
+
+ testScopedEffectsQueue: function() { with(this) {
+ var e1 = new Effect.Highlight('sandbox', {queue: {scope:'myscope'} } );
+ var e2 = new Effect.Appear('sandbox', {queue: {scope:'myscope'} } );
+ var e3 = new Effect.Highlight('sandbox', {queue: {scope:'secondscope'} } );
+ var e4 = new Effect.Appear('sandbox');
+
+ assertEqual(2, Effect.Queues.get('myscope').effects.length);
+ assertEqual(1, Effect.Queues.get('secondscope').effects.length);
+ assertEqual(1, Effect.Queues.get('global').effects.length);
+ assertEqual(Effect.Queue.effects.length, Effect.Queues.get('global').effects.length);
+
+ var tmp = 0;
+ Effect.Queues.get('myscope').effects.each(function(e) { tmp++ });
+ assertEqual(2, tmp);
+
+ // the internal interval timer should be active
+ assertNotNull(Effect.Queues.get('myscope').interval);
+ assertNotNull(Effect.Queues.get('secondscope').interval);
+ assertNotNull(Effect.Queues.get('global').interval);
+
+ e1.cancel(); e2.cancel(); e3.cancel(); e4.cancel();
+
+ assertEqual(0, Effect.Queues.get('myscope').effects.length);
+ assertEqual(0, Effect.Queues.get('secondscope').effects.length);
+ assertEqual(0, Effect.Queues.get('global').effects.length);
+
+ // should be inactive after all effects are removed from queues
+ assertNull(Effect.Queues.get('myscope').interval);
+ assertNull(Effect.Queues.get('secondscope').interval);
+ assertNull(Effect.Queues.get('global').interval);
+
+ // should be in e3 and e4 together and then e1,e2 order
+ var e1 = new Effect.Highlight('sandbox', {queue: {scope:'myscope'} } );
+ var e2 = new Effect.Appear('sandbox', {queue: {position: 'end', scope:'myscope'} } );
+ var e3 = new Effect.Fade('sandbox', {queue: {position: 'front', scope:'myscope'} } );
+ var e4 = new Effect.Appear('sandbox');
+ assert(e2.startOn > e1.startOn);
+ assert(e3.startOn < e1.startOn);
+ assert(e3.startOn < e2.startOn);
+ assert(e3.startOn = e4.startOn);
+ assertEqual(3, Effect.Queues.get('myscope').effects.length);
+
+ Effect.Queues.get('myscope').each(function(e) { e.cancel() });
+ assertEqual(0, Effect.Queues.get('myscope').effects.length);
+
+ Effect.Queues.get('global').each(function(e) { e.cancel() });
+ assertEqual(0, Effect.Queues.get('global').effects.length);
+
+ // should only allow the first two effects and ignore the third
+ var e1 = new Effect.Highlight('sandbox', {queue: {scope:'myscope', limit: 2} } );
+ var e2 = new Effect.Appear('sandbox', {queue: {position: 'end', scope:'myscope', limit: 2} } );
+ var e3 = new Effect.Fade('sandbox', {queue: {position: 'front', scope:'myscope', limit: 2} } );
+
+ assertEqual(2, Effect.Queues.get('myscope').effects.length);
+ }},
+
+ testEffectMultiple: function() { with(this) {
+ $('sandbox').appendChild(Builder.node('div',{id:'test_1'}));
+ $('sandbox').appendChild(Builder.node('div',{id:'test_2'},[Builder.node('div',{id:'test_2a'})]));
+ $('sandbox').appendChild(Builder.node('div',{id:'test_3'}));
+
+ // only direct child elements
+ Effect.multiple('sandbox',Effect.Fade);
+ assertEqual(3, Effect.Queue.effects.length);
+
+ Effect.Queue.each(function(e) { e.cancel() });
+ assertEqual(0, Effect.Queue.effects.length);
+
+ // call with array
+ Effect.multiple(['test_1','test_3'],Effect.Puff);
+ assertEqual(2, Effect.Queue.effects.length);
+ }},
+
+ testEffectTagifyText: function() { with(this) {
+ $('sandbox').innerHTML = "Blah<strong>bleb</strong> Blub";
+ assertEqual(3, $('sandbox').childNodes.length);
+ Effect.tagifyText('sandbox');
+ assertEqual(10, $('sandbox').childNodes.length);
+
+ Effect.multiple('sandbox', Effect.Fade);
+ assertEqual(10, Effect.Queue.effects.length);
+ }},
+
+ // test if all combined effects correctly initialize themselves
+ testCombinedEffectsInitialize: function() { with(this) {
+ COMBINED_EFFECTS.each(function(fx,idx){
+ info('Effect.'+fx);
+ $('sandbox').innerHTML = "";
+ $('sandbox').appendChild(
+ Builder.node('div',{id:'test_element'},
+ Builder.node('span','test'))); //some effects require a child element
+
+ // should work with new Effect.Blah syntax
+ var effect = new Effect[fx]('test_element');
+ assertEqual(0, effect.currentFrame);
+
+ // and without the 'new'
+ var effect = Effect[fx]('test_element');
+ assertEqual(0, effect.currentFrame);
+
+ // and, for visualEffect
+ assert($('test_element') == $('test_element').visualEffect(COMBINED_RJS_EFFECTS[idx]));
+
+ // options parsing (shake, squish and grow are special here)
+ if(!['Shake','Squish','Grow'].include(fx)) {
+ var effect = Effect[fx]('test_element',{duration:2.0});
+ assertEqual(2.0, effect.options.duration, fx);
+ }
+ });
+ }},
+
+ });
+
+// ]]>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/element_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/element_test.html
new file mode 100644
index 0000000000..88fcb3f417
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/element_test.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+ <style type="text/css" media="screen">
+ #style_test_1 { color:rgb(0, 0, 255); background-color: rgb(0, 0, 255); }
+ blah { color:rgb(0, 255, 0); }
+ #op2 { opacity:0.5;filter:alpha(opacity=50)progid:DXImageTransform.Microsoft.Blur(strength=10);}
+ </style>
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for Element extensions in effects.js
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<!-- Test elements follow -->
+<div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div>
+
+<div id="test_2" class="classA-foobar classB-foobar"> </div> <span> </span>
+
+<div id="style_test_1" style="display:none;"></div>
+<div id="style_test_2" class="blah" style="font-size:11px;"></div>
+
+<div id="style_test_3">blah</div>
+
+<div id="test_whitespace"> <span> </span>
+
+
+
+<div><div></div> </div><span> </span>
+</div>
+
+<!-- Test Element opacity functions -->
+<img id="op1" alt="op2" src="icon.png" style="opacity:0.5;filter:alpha(opacity=50)" />
+<img id="op2" alt="op2" src="icon.png"/>
+<img id="op3" alt="op3" src="icon.png"/>
+<img id="op4-ie" alt="op3" src="icon.png" style="filter:alpha(opacity=30)" />
+
+<!-- Test Element.childrenWithClassName -->
+<div id="Container" class="moo hoo">
+ <span id="1" class="firstClass">First class</span>
+ <span id="2" class="secondClass">Second class</span>
+ <span id="3" class="firstClass secondClass">First and Second class</span>
+ <span id="4" class="thirdClass">Third class <span id="5" class="firstClass">Nested First class</span></span>
+
+ <div id="collect">1<span class="ignore"><span class="someclass">2</span>3</span><ul><li class="ignore">4</li></ul></div>
+
+</div>
+
+<div id="perftest1"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ new Test.Unit.Runner({
+
+ testElementCollectTextNodes: function() { with(this) {
+ assertEqual('1234', Element.collectTextNodes('collect'));
+ assert(benchmark(function(){
+ Element.collectTextNodes('collect')
+ },50) < 1000);
+
+ benchmark(function(){
+ Element.collectTextNodes('collect')
+ },10,'Element.collectTextNodes');
+
+ assertEqual('1234', Element.collectTextNodesIgnoreClass('collect', 'somethingcompletelydifferent'));
+ assertEqual('1', $('collect').collectTextNodesIgnoreClass('ignore'));
+ benchmark(function(){
+ Element.collectTextNodesIgnoreClass('collect','ignore')
+ },10,'Element.collectTextNodesIgnoreClass');
+
+ assertEqual('134', Element.collectTextNodesIgnoreClass('collect', 'someclass'));
+ }},
+
+ testVisualEffect: function() { with(this) {
+ assert($('style_test_3') == $('style_test_3').visualEffect('fade'));
+ wait(1500,function(){
+ assert(!$('style_test_3').visible())
+ });
+ }},
+
+ testParseStylePerformance: function() { with(this) {
+ benchmark(function(){
+ "font:12px/15pt Verdana;opacity:0.4;border:4px dotted red".parseStyle();
+ },100);
+ }}
+
+ }, "testlog");
+// ]]>
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/icon.png b/dom/tests/mochitest/ajax/scriptaculous/test/unit/icon.png
new file mode 100644
index 0000000000..f752986b7e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/icon.png
Binary files differ
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/loading_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/loading_test.html
new file mode 100644
index 0000000000..d36f96ccc1
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/loading_test.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js?load=effects,dragdrop" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Test dynamic loading in scriptaculous.js
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ new Test.Unit.Runner({
+
+ testDynamicLoading: function() { with(this) {
+
+ // not loaded: controls
+ assertNull(Ajax.Autocompleter || null);
+ assertNull(Form.Element.DelayedObserver || null);
+
+ // we loading dragdrop
+ assertNotNull(Draggable || null);
+ }}
+
+ }, "testlog");
+// ]]>
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/position_clone_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/position_clone_test.html
new file mode 100644
index 0000000000..0644c631b5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/position_clone_test.html
@@ -0,0 +1,312 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for Postion.clone (to be moved to Prototype)
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ function prepareTarget(contained, position1, position2) {
+ var target;
+ if($('target_div')) Element.remove('target_div');
+ if($('container_div')) Element.remove('container_div');
+ if(contained) {
+ target = Builder.node('div',
+ {id: 'container_div', style: 'position:' + position1},
+ [Builder.node('div', {id: 'target_div', style: 'position: ' +position2})]);
+ } else {
+ target = Builder.node('div',
+ {id: 'target_div', style: 'position:' + position1}, '456');
+ }
+ document.body.appendChild(target);
+ Position.clone($('source_div'),$('target_div'));
+ }
+
+ function prepareTargetHidden(contained, position1, position2) {
+ var target;
+ if($('target_div')) Element.remove('target_div');
+ if($('container_div')) Element.remove('container_div');
+ if(contained) {
+ target = Builder.node('div',
+ {id: 'container_div', style: 'position:' + position1},
+ [Builder.node('div', {id: 'target_div', style: 'display:none; position: ' +position2})]);
+ } else {
+ target = Builder.node('div',
+ {id: 'target_div', style: 'display:none; position:' + position1}, '456');
+ }
+ document.body.appendChild(target);
+ Position.clone($('source_div'),$('target_div'));
+ Element.show($('target_div'));
+ }
+
+ new Test.Unit.Runner({
+
+ teardown: function() {
+ Element.remove($('source_div'));
+ },
+
+ testPositionCloneFromAbsolute: function() { with(this) {
+ var source = Builder.node('div',
+ {id: 'source_div', style: 'position:absolute; top:20px; left:120px; width:100px; height:50px;'}, '123');
+ document.body.appendChild(source);
+ var expected = Object.inspect([120, 20]);
+ assertEqual(expected, Object.inspect(Position.page($('source_div'))));
+
+ prepareTarget(false, 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute BODY child");
+
+ prepareTarget(false, 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed BODY child");
+
+ prepareTarget(true, 'absolute', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of absolute BODY child");
+
+ prepareTarget(true, 'absolute', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of absolute BODY child");
+
+ prepareTarget(true, 'relative', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of relative BODY child");
+
+ prepareTarget(true, 'relative', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of relative BODY child");
+
+ prepareTarget(true, 'static', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of static BODY child");
+
+ prepareTarget(true, 'static', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of static BODY child");
+ }},
+
+ testPositionCloneFromRelative: function() { with(this) {
+ var source = Builder.node('div',
+ {id: 'source_div', style: 'position:relative; top:20px; left:120px; width:100px; height:50px;'}, '123');
+ document.body.appendChild(source);
+ var expected = Object.inspect(Position.page($('source_div')));
+ assertEqual(expected, Object.inspect(Position.page($('source_div'))));
+
+ prepareTarget(false, 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute BODY child");
+
+ prepareTarget(false, 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed BODY child");
+
+ prepareTarget(true, 'absolute', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of absolute BODY child");
+
+ prepareTarget(true, 'absolute', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of absolute BODY child");
+
+ prepareTarget(true, 'relative', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of relative BODY child");
+
+ prepareTarget(true, 'relative', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of relative BODY child");
+
+ prepareTarget(true, 'static', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of static BODY child");
+
+ prepareTarget(true, 'static', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of static BODY child");
+ }},
+
+ testPositionCloneFromStatic: function() { with(this) {
+ var source = Builder.node('div',
+ {id: 'source_div', style: 'top:20px; left:120px; width:100px; height:50px;'}, '123');
+ document.body.appendChild(source);
+ var expected = Object.inspect(Position.page($('source_div')));
+ assertEqual(expected, Object.inspect(Position.page($('source_div'))));
+
+ prepareTarget(false, 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute BODY child");
+
+ prepareTarget(false, 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed BODY child");
+
+ prepareTarget(true, 'absolute', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of absolute BODY child");
+
+ prepareTarget(true, 'absolute', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of absolute BODY child");
+
+ prepareTarget(true, 'relative', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of relative BODY child");
+
+ prepareTarget(true, 'relative', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of relative BODY child");
+
+ prepareTarget(true, 'static', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of static BODY child");
+
+ prepareTarget(true, 'static', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of static BODY child");
+ }},
+
+ testPositionCloneFromAbsoluteWithHiddenTarget: function() { with(this) {
+ var source = Builder.node('div',
+ {id: 'source_div', style: 'position:absolute; top:20px; left:120px; width:100px; height:50px;'}, '123');
+ document.body.appendChild(source);
+ var expected = Object.inspect([120, 20]);
+ assertEqual(expected, Object.inspect(Position.page($('source_div'))));
+
+ prepareTargetHidden(false, 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute BODY child");
+
+ prepareTargetHidden(false, 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed BODY child");
+
+ prepareTargetHidden(true, 'absolute', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of absolute BODY child");
+
+ prepareTargetHidden(true, 'absolute', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of absolute BODY child");
+
+ prepareTargetHidden(true, 'relative', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of relative BODY child");
+
+ prepareTargetHidden(true, 'relative', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of relative BODY child");
+
+ prepareTargetHidden(true, 'static', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of static BODY child");
+
+ prepareTargetHidden(true, 'static', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of static BODY child");
+ }},
+
+ testPositionCloneFromRelativeWithHiddenTarget: function() { with(this) {
+ var source = Builder.node('div',
+ {id: 'source_div', style: 'position:relative; top:20px; left:120px; width:100px; height:50px;'}, '123');
+ document.body.appendChild(source);
+ var expected = Object.inspect(Position.page($('source_div')));
+ assertEqual(expected, Object.inspect(Position.page($('source_div'))));
+
+ prepareTargetHidden(false, 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute BODY child");
+
+ prepareTargetHidden(false, 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed BODY child");
+
+ prepareTargetHidden(true, 'absolute', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of absolute BODY child");
+
+ prepareTargetHidden(true, 'absolute', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of absolute BODY child");
+
+ prepareTargetHidden(true, 'relative', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of relative BODY child");
+
+ prepareTargetHidden(true, 'relative', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of relative BODY child");
+
+ prepareTargetHidden(true, 'static', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of static BODY child");
+
+ prepareTargetHidden(true, 'static', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of static BODY child");
+ }},
+
+ testPositionCloneFromStaticWithHiddenTarget: function() { with(this) {
+ var source = Builder.node('div',
+ {id: 'source_div', style: 'top:20px; left:120px; width:100px; height:50px;'}, '123');
+ document.body.appendChild(source);
+ var expected = Object.inspect(Position.page($('source_div')));
+ assertEqual(expected, Object.inspect(Position.page($('source_div'))));
+
+ prepareTargetHidden(false, 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute BODY child");
+
+ prepareTargetHidden(false, 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed BODY child");
+
+ prepareTargetHidden(true, 'absolute', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of absolute BODY child");
+
+ prepareTargetHidden(true, 'absolute', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of absolute BODY child");
+
+ prepareTargetHidden(true, 'relative', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of relative BODY child");
+
+ prepareTargetHidden(true, 'relative', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of relative BODY child");
+
+ prepareTargetHidden(true, 'static', 'absolute');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to absolute child of static BODY child");
+
+ prepareTargetHidden(true, 'static', 'fixed');
+ assertEqual(expected, Object.inspect(Position.page($('target_div'))),
+ "Clone to fixed child of static BODY child");
+ }}
+
+ });
+
+// ]]>
+</script>
+
+<!-- Test elements will be inserted after this -->
+
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/slider_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/slider_test.html
new file mode 100644
index 0000000000..018b45d078
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/slider_test.html
@@ -0,0 +1,438 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for slider.js
+</p>
+
+<div id="track1" style="width:200px;background-color:#aaa;height:5px;">
+ <div id="handle1" style="width:15px;height:25px;background-color:#f00;"> </div>
+</div>
+
+<div id="track2-vertical" style="height:100px;background-color:#aaa;width:5px;">
+ <div id="handle2-vertical" style="width:25px;height:10px;background-color:#f00;"> </div>
+</div>
+
+<div id="track2-horizontal" style="height:5px;background-color:#aaa;width:100px;">
+ <div id="handle2-horizontal" style="width:10px;height:25px;background-color:#f00;"> </div>
+</div>
+
+<div id="track3" style="width:300px;background-color:#cfb;height:30px;">
+ <span id="handle3-1">1</span>
+ <span id="handle3-2">2</span>
+ <span id="handle3-3">3</span>
+</div>
+
+<div id="track4" style="width:300px;position:relative;background-color:#cbf;height:30px;">
+ <span id="handle4-1" style="top:0;left:0;position:absolute;background-color:#f00;">1</span>
+ <span id="handle4-2" style="top:0;left:0;position:absolute;background-color:#0f0;">2</span>
+ <span id="handle4-3" style="top:0;left:0;position:absolute;background-color:#00f;">3</span>
+</div>
+
+<div id="track5" style="width:300px;background-color:#cbf;height:30px;position:relative;z-index:0;">
+ <div id="handle5-1" style="top:0;left:0;position:absolute;background-color:#f00;z-index:2">1</div>
+ <div id="handle5-2" style="top:0;left:0;position:absolute;background-color:#0f0;z-index:2">2</div>
+ <div id="handle5-3" style="top:0;left:0;position:absolute;background-color:#00f;z-index:2">3</div>
+
+ <div id="span5-1" style="top:0;left:0;position:absolute;background-color:#000;height:20px;z-index:1;"> </div>
+ <div id="span5-2" style="top:0;left:0;position:absolute;background-color:#444;height:20px;z-index:1;"> </div>
+</div>
+
+<div id="track6" style="width:20px;background-color:#cbf;height:100px;position:relative;z-index:0;">
+ <div id="handle6-1" style="top:0;left:0;height:13px;position:absolute;background-color:#f00;z-index:2">1</div>
+ <div id="handle6-2" style="top:0;left:0;height:13px;position:absolute;background-color:#0f0;z-index:2">2</div>
+ <div id="handle6-3" style="top:0;left:0;height:13px;position:absolute;background-color:#00f;z-index:2">3</div>
+
+ <div id="span6-1" style="top:0;left:0;position:absolute;background-color:#000;width:20px;z-index:1;"> </div>
+ <div id="span6-2" style="top:0;left:0;position:absolute;background-color:#444;width:20px;z-index:1;"> </div>
+</div>
+
+<div id="track7" style="width:200px;background-color:#cbf;height:30px;position:relative;z-index:0;">
+ <div id="handle7-1" style="top:0;left:0;position:absolute;background-color:#f88;z-index:2">1</div>
+ <div id="handle7-2" style="top:0;left:0;position:absolute;background-color:#8f8;z-index:2">2</div>
+ <div id="handle7-3" style="top:0;left:0;position:absolute;background-color:#88f;z-index:2">3</div>
+
+ <div id="span7-1" style="top:0;left:0;position:absolute;background-color:#000;height:20px;z-index:1;"> </div>
+ <div id="span7-2" style="top:0;left:0;position:absolute;background-color:#444;height:20px;z-index:1;"> </div>
+
+ <div id="span7-start" style="top:0;left:0;position:absolute;background-color:#f00;height:20px;z-index:1;"> </div>
+ <div id="span7-end" style="top:0;left:0;position:absolute;background-color:#00f;height:20px;z-index:1;"> </div>
+</div>
+
+
+<div id="debug"> </div>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+ var globalValue;
+
+ new Test.Unit.Runner({
+
+ testSliderBasics: function() { with(this) {
+ var slider = new Control.Slider('handle1', 'track1');
+ assertInstanceOf(Control.Slider, slider);
+ assertEqual(Prototype.Browser.IE ? 5 : 4, Event.observers.length);
+
+ assertEqual('horizontal', slider.axis);
+ assertEqual(false, slider.disabled);
+ assertEqual(0, slider.value);
+
+ slider.dispose();
+ }},
+
+ testSliderValues: function() { with(this) {
+ ['horizontal', 'vertical'].each( function(axis) {
+ var slider = new Control.Slider('handle2-'+axis, 'track2-'+axis, {values:[0.2,0.4,0.6,0.8,1],axis:axis});
+ assertEqual(axis, slider.axis);
+ assertEqual(0.2, slider.value);
+
+ slider.setValue(0.35);
+ assertEqual(0.4, slider.value);
+
+ slider.setValueBy(0.1);
+ assertEqual(0.6, slider.value);
+ slider.setValueBy(-0.6);
+ assertEqual(0.2, slider.value);
+
+ slider.setValue(1);
+ assertEqual(1, slider.value);
+
+ slider.setValue(-2);
+ assertEqual(0.2, slider.value);
+
+ slider.setValue(55555);
+ assertEqual(1, slider.value);
+
+ // leave active to be able to play around with the sliders
+ // slider.dispose();
+ });
+ assertEqual("90px", $('handle2-horizontal').style.left);
+ assertEqual("90px", $('handle2-vertical').style.top);
+ }},
+
+ testSliderInitialValues: function() { with(this) {
+ var slider = new Control.Slider('handle1', 'track1',{sliderValue:0.5});
+ assertEqual(0.5, slider.value);
+
+ var slider = new Control.Slider(['handle4-1','handle4-2','handle4-3'], 'track4', {
+ sliderValue:[50,145,170],
+ values:[50,150,160,170,180],
+ range:$R(50,180)
+ });
+ assertEqual(50, slider.value);
+ assertEqual(50, slider.values[0]);
+ assertEqual(150, slider.values[1]);
+ assertEqual(170, slider.values[2]);
+ slider.dispose();
+
+ var slider = new Control.Slider(['handle4-1','handle4-2','handle4-3'], 'track4', {
+ sliderValue:[50,145,170],
+ values:[50,150,160,170,180]
+ });
+ assertEqual(50, slider.value);
+ assertEqual(50, slider.values[0]);
+ assertEqual(150, slider.values[1]);
+ assertEqual(170, slider.values[2]);
+ slider.dispose();
+
+ var slider = new Control.Slider(['handle4-1','handle4-2','handle4-3'], 'track4', {
+ restricted:true,
+ sliderValue:[50,145,170],
+ values:[50,150,160,170,180]
+ });
+ assertEqual(50, slider.value);
+ assertEqual(50, slider.values[0]);
+ assertEqual(150, slider.values[1]);
+ assertEqual(170, slider.values[2]);
+ slider.dispose();
+ }},
+
+ testSliderOnChange: function() { with(this) {
+ var slider = new Control.Slider('handle1', 'track1', { onChange:function(v){ globalValue = v; } });
+ slider.setValue(1);
+ assert(1, globalValue);
+ assert(1, slider.value);
+
+ slider.setDisabled();
+ slider.setValue(0.5);
+ assert(1, globalValue);
+ assert(1, slider.value);
+
+ slider.setEnabled();
+ slider.setValue(0.2);
+ assert(0.2, globalValue);
+ assert(0.2, slider.value);
+
+ // s.event should be null if setValue is called from script
+ var slider = new Control.Slider(['handle3-1','handle3-2','handle3-3'], 'track3', {
+ onChange:function(v, s){ if(!s.event) globalValue = v; } });
+
+ slider.setValue(0.5,1);
+ assertEqual([0,0.5,0].inspect(), globalValue.inspect());
+ assert(!slider.event);
+
+ slider.dispose();
+ }},
+
+ testMultipleHandles: function() { with(this) {
+ var slider = new Control.Slider(['handle3-1','handle3-2','handle3-3'], 'track3', {range:$R(0,300)});
+ assertInstanceOf(Control.Slider, slider);
+
+ slider.setValue(20, 0);
+ slider.setValue(50, 1);
+ slider.setValue(70, 2);
+ assertEqual(20, slider.values[0]);
+ assertEqual(50, slider.values[1]);
+ assertEqual(70, slider.values[2]);
+ assertEqual("20px", slider.handles[0].style.left);
+ assertEqual("49px", slider.handles[1].style.left);
+ assertEqual("68px", slider.handles[2].style.left);
+
+ // should change last manipulated handled by -10,
+ // so check for handle with idx 2
+ slider.setValueBy(-10);
+ assertEqual(60, slider.values[2]);
+
+ slider.setValueBy(10, 0);
+ assertEqual(20, slider.values[0]);
+ slider.setValueBy(10, 1);
+ assertEqual(60, slider.values[1]);
+ slider.setValueBy(20, slider.activeHandleIdx);
+ assertEqual(80, slider.values[1]);
+ }},
+
+ testMultipleHandlesValues: function() { with(this) {
+ var slider = new Control.Slider(['handle4-1','handle4-2','handle4-3'], 'track4', {values:[50,150,160,170,180],range:$R(50,180)});
+ assertInstanceOf(Control.Slider, slider);
+
+ slider.setValue(20, 0);
+ slider.setValue(150, 2);
+ slider.setValue(179, 1);
+
+ assertEqual(50, slider.values[0]);
+ assertEqual(150, slider.values[2]);
+ assertEqual(180, slider.values[1]);
+
+ assertEqual("0px", slider.handles[0].style.left);
+ assertEqual("225px", slider.handles[2].style.left);
+ assertEqual("293px", slider.handles[1].style.left);
+
+ assertEqual($R(50,150).inspect(), slider.getRange().inspect());
+ assertEqual(30, slider.getRange(1).end-slider.getRange(1).start);
+ }},
+
+ testMultipleHandlesSpans: function() { with(this) {
+ var slider = new Control.Slider(['handle5-1','handle5-2','handle5-3'], 'track5',
+ {spans:['span5-1','span5-2'],range:$R(0,300)});
+ assertInstanceOf(Control.Slider, slider);
+
+ slider.setValue(20, 0);
+ slider.setValue(100, 1);
+ slider.setValue(150, 2);
+
+ assertEqual("20px", $('span5-1').style.left);
+ assertEqual("78px", $('span5-1').style.width);
+ assertEqual("98px", $('span5-2').style.left);
+ assertEqual("49px", $('span5-2').style.width);
+
+ slider.setValue(30, 0);
+ slider.setValue(110, 1);
+ slider.setValue(90, 2);
+
+ assertEqual("29px", $('span5-1').style.left);
+ assertEqual("59px", $('span5-1').style.width);
+ assertEqual("88px", $('span5-2').style.left);
+ assertEqual("20px", $('span5-2').style.width);
+
+ slider.dispose();
+ }},
+
+ testMultipleHandlesSpansStartEnd: function() { with(this) {
+ var slider = new Control.Slider(['handle7-1','handle7-2','handle7-3'], 'track7',
+ { spans:['span7-1','span7-2'],
+ startSpan:'span7-start',
+ endSpan:'span7-end',
+ range:$R(0,200) });
+ assertInstanceOf(Control.Slider, slider);
+
+ slider.setValue(20, 0);
+ slider.setValue(100, 1);
+ slider.setValue(150, 2);
+ assertEqual("0px", $('span7-start').style.left);
+ assertEqual("19px", $('span7-start').style.width);
+ assertEqual("145px", $('span7-end').style.left);
+ assertEqual("48px", $('span7-end').style.width);
+
+ slider.dispose();
+ }},
+
+ testSingleHandleSpansStartEnd: function() { with(this) {
+ var slider = new Control.Slider('handle7-1', 'track7',
+ { spans:['span7-1','span7-2'],
+ startSpan:'span7-start',
+ endSpan:'span7-end',
+ range:$R(0,200) });
+ assertInstanceOf(Control.Slider, slider);
+
+ slider.setValue(20, 0);
+ assertEqual("0px", $('span7-start').style.left);
+ assertEqual("19px", $('span7-start').style.width);
+ assertEqual("19px", $('span7-end').style.left);
+ assertEqual("174px", $('span7-end').style.width);
+
+ slider.dispose();
+ }},
+
+ testMultipleHandlesStyles: function() { with(this) {
+ var slider = new Control.Slider(['handle7-1','handle7-2','handle7-3'], 'track7',
+ { spans:['span7-1','span7-2'],
+ startSpan:'span7-start',
+ endSpan:'span7-end',
+ range:$R(0,200) });
+ assertInstanceOf(Control.Slider, slider);
+ assert(Element.hasClassName('handle7-1','selected'));
+ assert(!Element.hasClassName('handle7-2','selected'));
+ assert(!Element.hasClassName('handle7-3','selected'));
+
+ slider.setValue(20, 0);
+ assert(Element.hasClassName('handle7-1','selected'));
+ assert(!Element.hasClassName('handle7-2','selected'));
+ assert(!Element.hasClassName('handle7-3','selected'));
+
+ slider.setValue(100, 1);
+ assert(!Element.hasClassName('handle7-1','selected'));
+ assert(Element.hasClassName('handle7-2','selected'));
+ assert(!Element.hasClassName('handle7-3','selected'));
+
+ slider.setValue(150, 2);
+ assert(!Element.hasClassName('handle7-1','selected'));
+ assert(!Element.hasClassName('handle7-2','selected'));
+ assert(Element.hasClassName('handle7-3','selected'));
+
+ slider.dispose();
+ }},
+
+ testMultipleHandlesSpansRestricted: function() { with(this) {
+ var slider = new Control.Slider(['handle5-1','handle5-2','handle5-3'], 'track5',
+ {restricted:true,spans:['span5-1','span5-2'],range:$R(0,300)});
+ assertInstanceOf(Control.Slider, slider);
+
+ slider.setValue(20, 0);
+ slider.setValue(100, 1);
+ slider.setValue(150, 2);
+ assertEqual(0, slider.values[0]);
+ assertEqual(0, slider.values[1]);
+ assertEqual(150, slider.values[2]);
+
+ slider.setValue(150, 2);
+ slider.setValue(100, 1);
+ slider.setValue(20, 0);
+ assertEqual(20, slider.values[0]);
+ assertEqual(100, slider.values[1]);
+ assertEqual(150, slider.values[2]);
+ assertEqual("20px", $('span5-1').style.left);
+ assertEqual("78px", $('span5-1').style.width);
+ assertEqual("98px", $('span5-2').style.left);
+ assertEqual("49px", $('span5-2').style.width);
+
+ slider.setValue(30, 0);
+ slider.setValue(110, 1);
+ slider.setValue(90, 2);
+ assertEqual(30, slider.values[0]);
+ assertEqual(110, slider.values[1]);
+ assertEqual(110, slider.values[2], '???');
+
+ assertEqual("29px", $('span5-1').style.left);
+ assertEqual("78px", $('span5-1').style.width);
+ assertEqual("107px", $('span5-2').style.left);
+ assertEqual("0px", $('span5-2').style.width);
+
+ slider.dispose();
+ }},
+
+ testMultipleHandlesSpansVertical: function() { with(this) {
+ var slider = new Control.Slider(['handle6-1','handle6-2','handle6-3'], 'track6', {axis:'vertical',spans:['span6-1','span6-2'],range:$R(0,100)});
+ assertInstanceOf(Control.Slider, slider);
+
+ slider.setValue(20, 0);
+ slider.setValue(80, 1);
+ slider.setValue(90, 2);
+
+ assertEqual("17px", $('span6-1').style.top);
+ assertEqual("52px", $('span6-1').style.height);
+ assertEqual("70px", $('span6-2').style.top);
+ assertEqual("9px", $('span6-2').style.height);
+
+ slider.setValue(30, 0);
+ slider.setValue(20, 1);
+ slider.setValue(95, 2);
+
+ assertEqual("17px", $('span6-1').style.top);
+ assertEqual("9px", $('span6-1').style.height);
+ assertEqual("26px", $('span6-2').style.top);
+ assertEqual("57px", $('span6-2').style.height);
+ }},
+
+ testRange: function() { with(this) {
+ var slider = new Control.Slider('handle1','track1');
+ assertEqual(0, slider.value);
+ slider.setValue(1);
+ assertEqual("185px", $('handle1').style.left);
+ slider.dispose();
+
+ var slider = new Control.Slider('handle1','track1',{range:$R(10,20)});
+ assertEqual(10, slider.value);
+ assertEqual("0px", $('handle1').style.left);
+ slider.setValue(15);
+ assertEqual("93px", $('handle1').style.left);
+ slider.setValue(20);
+ assertEqual("185px", $('handle1').style.left);
+ slider.dispose();
+ }},
+
+ // test for #3732
+ testRangeValues: function() { with(this) {
+ // test for non-zero starting range
+ var slider = new Control.Slider('handle1','track1',{
+ range:$R(1,3), values:[1,2,3]
+ });
+ assertEqual(1, slider.value);
+ assertEqual("0px", $('handle1').style.left);
+ slider.setValue(2);
+ assertEqual("93px", $('handle1').style.left);
+ slider.setValue(3);
+ assertEqual("185px", $('handle1').style.left);
+ slider.dispose();
+
+ // test zero-starting range
+ var slider = new Control.Slider('handle1','track1',{
+ range:$R(0,2), values:[0,1,2]
+ });
+ assertEqual(0, slider.value);
+ assertEqual("0px", $('handle1').style.left);
+ slider.setValue(1);
+ assertEqual("93px", $('handle1').style.left);
+ slider.setValue(2);
+ assertEqual("185px", $('handle1').style.left);
+ slider.dispose();
+ }}
+
+ }, "testlog");
+// ]]>
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/sortable_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/sortable_test.html
new file mode 100644
index 0000000000..c2bafd0b9d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/sortable_test.html
@@ -0,0 +1,205 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Test of sortable functions in dragdrop.js
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+
+<ul id="sortable1">
+ <li id="item_1" class="a">item 1</li>
+ <li id="item_2" class="c b">item 1<ul><li id="item_99">!!!</li></ul></li>
+ <li id="item_3" class="b">item 1</li>
+ <li id="item_xy" class="x y">item 1</li>
+ <!-- a comment -->
+</ul>
+
+<div id="sortable2">
+ <div id="item_4">item 4</div> <div id="item_5">item 5</div>
+ <img src="icon.png" alt="img"/>
+ <!-- a comment -->
+</div>
+
+<div id="sortable3">
+
+</div>
+
+<!--
+ By default, _ is the only valid seperator
+ for the DOM ids. Complex element ids as in
+ the form of "some_element_id_1" should also
+ be parsed correctly (only the last part should
+ be serialized)
+-->
+<ul id="sortable_complex">
+ <li id="a_b_item_1" class="a">item 1</li>
+ <li id="ab_item_2" class="c b">item 1
+ <ul>
+ <li id="item_99">!!!</li>
+ </ul>
+ </li>
+ <li id="a-b-item_3z_33" class="b">item 1</li>
+ <li id="a-item-xy" class="x y">item 1</li>
+ <!-- a comment -->
+</ul>
+
+
+<ul id="sortable_specialcreate">
+ <li id="y1item">item 1</li>
+ <li id="y2item">item 1<ul><li id="yyyy9928282hjhd">!!!</li></ul></li>
+</ul>
+
+<ul id="sortable_specialformat">
+ <li id="x1item">item 1</li>
+ <li id="x2item">item 1<ul><li id="xxxxx88888item">!!!</li></ul></li>
+</ul>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ new Test.Unit.Runner({
+
+ setup: function() { with(this) {
+ Sortable.create('sortable1',{only:['a','b']});
+ Sortable.create('sortable2',{tag:'div'});
+ Sortable.create('sortable3');
+ Sortable.create('sortable_specialcreate',{ format:/(\d+)/ });
+ Sortable.create('sortable_specialformat');
+ Sortable.create('sortable_complex');
+ }},
+
+ teardown: function() { with(this) {
+ Sortable.destroy('sortable1');
+ Sortable.destroy('sortable2');
+ Sortable.destroy('sortable3');
+ Sortable.destroy('sortable_specialformat');
+ Sortable.destroy('sortable_specialcreate');
+ Sortable.destroy('sortable_complex');
+ }},
+
+ testSortableSerializeSequenceBasics: function() { with(this) {
+ assertEqual('sortable1[]=1&sortable1[]=2&sortable1[]=3', Sortable.serialize('sortable1'));
+
+ // test empty sortable
+ assertEqual('', Sortable.serialize('sortable3'));
+ assertEnumEqual([], Sortable.sequence('sortable3'));
+
+ Element.remove('item_4');
+ assertEqual('sortable2[]=5', Sortable.serialize('sortable2'));
+ assertEnumEqual(['5'], Sortable.sequence('sortable2'));
+ }},
+
+ testSortableSerializeFormat: function() { with(this) {
+ // should correctly serialize from option given to Sortable.create()
+ assertEqual('sortable_specialcreate[]=1&sortable_specialcreate[]=2',
+ Sortable.serialize('sortable_specialcreate'));
+
+ benchmark(function(){
+ Sortable.serialize('sortable_specialcreate')
+ },1,'Sortable.serialize');
+
+ // test special format given explicitly
+ assertEqual('sortable_specialformat[]=1&sortable_specialformat[]=2',
+ Sortable.serialize('sortable_specialformat', {format:/(\d+)/}));
+
+ // return full id
+ assertEqual('sortable_specialformat[]=x1item&sortable_specialformat[]=x2item',
+ Sortable.serialize('sortable_specialformat', {format:/(.*)/}));
+
+ // test default format given explicitly
+ assertEqual('sortable1[]=1&sortable1[]=2&sortable1[]=3',
+ Sortable.serialize('sortable1',{format:/^[^_]*_(.*)$/}));
+
+ // Ensure default options.format handles longer, more complex list
+ // item IDs
+ assertEqual('sortable_complex[]=1&sortable_complex[]=2&sortable_complex[]=33&sortable_complex[]=',
+ Sortable.serialize('sortable_complex'));
+ }},
+
+ testSortableSerializeRule: function() { with(this) {
+ var ids = ['x','x-y','test_test','x_y_z','x_y-x_z'];
+ ids.each(function(id){
+ assertEqual('1',
+ (id+'_1').match(Sortable.SERIALIZE_RULE)[1]);
+ });
+
+ assertNull('x'.match(Sortable.SERIALIZE_RULE));
+ }},
+
+ testSortableSerializeName: function() { with(this) {
+ assertEqual('dumdidu[]=1&dumdidu[]=2',
+ Sortable.serialize('sortable_specialcreate',{name:'dumdidu'}));
+ }},
+
+ testSortableSequenceFormat: function() { with(this) {
+ // shauld correctly serialize from option given to Sortable.create()
+ assertEnumEqual(['1','2'],
+ Sortable.sequence('sortable_specialcreate'));
+
+ // test special format given explicitly
+ assertEnumEqual(['1','2'],
+ Sortable.sequence('sortable_specialformat', {format:/(\d+)/}));
+
+ // return full id
+ assertEnumEqual(['x1item','x2item'],
+ Sortable.sequence('sortable_specialformat', {format:/(.*)/}));
+
+ // test default format given explicitly
+ assertEnumEqual(['1','2','3'],
+ Sortable.sequence('sortable1',{format:/^[^_]*_(.*)$/}));
+ }},
+
+ testSortableFindElements: function() { with(this) {
+ assertEqual(3, Sortable.findElements($('sortable1'),{tag:'li',only:['a','b']}).length);
+ benchmark(function(){
+ Sortable.findElements($('sortable1'),{tag:'li',only:['a','b']})
+ },1,'Sortable.findElements/1');
+
+ assertEqual(1, Sortable.findElements($('sortable1'),{tag:'li',only:['x']}).length);
+ assertEqual(1, Sortable.findElements($('sortable1'),{tag:'li',only:'a'}).length);
+ assertEqual(2, Sortable.findElements($('sortable1'),{tag:'li',only:'b'}).length);
+ assertEqual(4, Sortable.findElements($('sortable1'),{tag:'li',only:['a','b','x']}).length);
+ }},
+
+ testSortableSetSequence: function() { with(this) {
+ // make sure assigning current sequence is a no-op
+ var o = Sortable.sequence('sortable1');
+ Sortable.setSequence('sortable1', ['1','2','3']);
+ assertEnumEqual(o, Sortable.sequence('sortable1'));
+
+ // check new sequence
+ Sortable.setSequence('sortable1', ['3','2','1']);
+ assertEnumEqual(['3','2','1'], Sortable.sequence('sortable1'));
+
+ // non-default format
+ Sortable.setSequence('sortable_specialformat', ['2','1'], { format:/(\d+)/ });
+ assertEnumEqual(['2','1'], Sortable.sequence('sortable_specialformat'));
+
+ // invalid sequence ids should be ignored
+ Sortable.setSequence('sortable1', ['x', '1', 'y', '2', '3', 'z']);
+ assertEnumEqual(['1', '2', '3'], Sortable.sequence('sortable1'));
+
+ // elements omitted in new sequence should be cropped
+ Sortable.setSequence('sortable1', ['1', '3']);
+ assertEnumEqual(['1', '3'], Sortable.sequence('sortable1'));
+ }}
+
+ }, "testlog");
+// ]]>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html
new file mode 100644
index 0000000000..995dba496c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ Tests for String.prototype extensions in effects.js
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ new Test.Unit.Runner({
+
+ testStringParseColor: function() { with(this) {
+ assertEqual('#000000', "#000000".parseColor());
+ assertEqual('#000000', "rgb(0,0,0)".parseColor());
+ assertEqual('#000000', "rgb(0, 0, 0)".parseColor());
+ assertEqual('#000000', "#000".parseColor());
+
+ assertEqual('#1', "#1".parseColor());
+ assertEqual('#12', "#12".parseColor());
+ assertEqual('#112233', "#123".parseColor());
+ assertEqual('#1234', "#1234".parseColor());
+ assertEqual('#12345', "#12345".parseColor());
+ assertEqual('#123456', "#123456".parseColor());
+
+ assertEqual('#abcdef', "#aBcDeF".parseColor());
+ assertEqual('#aabbcc', "#aBc".parseColor());
+
+ assertEqual('white', "white".parseColor());
+ assertEqual('#123456', "#123456".parseColor('#000000')); // default to #000000 if not parseable
+ assertEqual('#000000', "white".parseColor('#000000')); // default to #000000 if not parseable
+
+ assertEqual('#ffffff', "rgb(255,255,255)".parseColor());
+ assertEqual('#ff0000', "rgb(255,0,0)".parseColor());
+ assertEqual('#00ff00', "rgb(0,255,0)".parseColor());
+ assertEqual('#0000ff', "rgb(0,0,255)".parseColor());
+ }},
+
+ testStringParseStyle: function() { with(this) {
+ var expected = "#<Hash:{'fontSize': '11px'}>";
+
+ assertInspect(expected, "font-size:11px".parseStyle());
+ assertInspect(expected, "font-SIZE: 11px".parseStyle());
+ assertInspect(expected, "font-size:11px ".parseStyle());
+ assertInspect(expected, " Font-size: 11px ".parseStyle());
+ }}
+
+ });
+
+// ]]>
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/unit_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/unit_test.html
new file mode 100644
index 0000000000..39c078959c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/unit_test.html
@@ -0,0 +1,154 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="../test.css" type="text/css" />
+ <style type="text/css" media="screen">
+ /* <![CDATA[ */
+ #testcss1 { font-size:11px; color: #f00; }
+ #testcss2 { font-size:12px; color: #0f0; display: none; }
+ /* ]]> */
+ </style>
+</head>
+<body>
+<h1>script.aculo.us Unit test file</h1>
+<p>
+ This is a preliminary version mostly for testing the unittest library.
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<!-- Test elements follow -->
+<div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div>
+
+<div id="test_2"> <span> </span>
+
+
+
+<div><div></div> </div><span> </span>
+</div>
+
+<ul id="tlist"><li id="tlist_1">x1</li><li id="tlist_2">x2</li></ul>
+<ul id="tlist2"><li class="a" id="tlist2_1">x1</li><li id="tlist2_2">x2</li></ul>
+
+<div id="testmoveby" style="background-color:#333;width:100px;">XXXX</div>
+
+<div id="testcss1">testcss1<span id="testcss1_span" style="display:none;">blah</span></div><div id="testcss2">testcss1</div>
+
+<!-- Tests follow -->
+<script type="text/javascript" language="javascript" charset="utf-8">
+// <![CDATA[
+
+ var testObj = {
+ isNice: function(){
+ return true;
+ },
+ isBroken: function(){
+ return false;
+ }
+ }
+
+ new Test.Unit.Runner({
+
+ testAssertEqual: function() { with(this) {
+ assertEqual(0, 0);
+ assertEqual(0, 0, "test");
+
+ assertEqual(0,'0');
+ assertEqual(65.0, 65);
+
+ assertEqual("a", "a");
+ assertEqual("a", "a", "test");
+
+ assertNotEqual(0, 1);
+ assertNotEqual("a","b");
+ assertNotEqual({},{});
+ assertNotEqual([],[]);
+ assertNotEqual([],{});
+ }},
+
+ testAssertRespondsTo: function() { with(this) {
+ assertRespondsTo('isNice', testObj);
+ assertRespondsTo('isBroken', testObj);
+ }},
+
+ testAssertIndentical: function() { with(this) {
+ assertIdentical(0, 0);
+ assertIdentical(0, 0, "test");
+ assertIdentical(1, 1);
+ assertIdentical('a', 'a');
+ assertIdentical('a', 'a', "test");
+ assertIdentical('', '');
+ assertIdentical(undefined, undefined);
+ assertIdentical(null, null);
+ assertIdentical(true, true);
+ assertIdentical(false, false);
+
+ var obj = {a:'b'};
+ assertIdentical(obj, obj);
+
+ assertNotIdentical({1:2,3:4},{1:2,3:4});
+
+ assertIdentical(1, 1.0); // both are typeof == 'number'
+
+ assertNotIdentical(1, '1');
+ assertNotIdentical(1, '1.0');
+ }},
+
+ testAssertMatch: function() { with(this) {
+ assertMatch(/knowmad.jpg$/, 'http://script.aculo.us/images/knowmad.jpg');
+ assertMatch(/Fuc/, 'Thomas Fuchs');
+ assertMatch(/^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/, '$19.95');
+ assertMatch(/(\d{3}\) ?)|(\d{3}[- \.])?\d{3}[- \.]\d{4}(\s(x\d+)?){0,1}$/, '704-343-9330');
+ assertMatch(/^(?:(?:(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\/|-|\.)(?:0?2\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\d)?\d{2})(\/|-|\.)(?:(?:(?:0?[13578]|1[02])\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\2(?:0?[1-9]|1\d|2[0-8]))))$/, '2001-06-16');
+ assertMatch(/^((0?[123456789])|(1[012]))\s*:\s*([012345]\d)(\s*:\s*([012345]\d))?\s*[ap]m\s*-\s*((0?[123456789])|(1[012]))\s*:\s*([012345]\d)(\s*:\s*([012345]\d))?\s*[ap]m$/i, '2:00PM-2:15PM');
+
+ }},
+
+ testAssertInstanceOf: function() { with(this) {
+ assertInstanceOf(Effect.Opacity, new Effect.Opacity('testcss1',{sync:true}));
+ assertNotInstanceOf(String, new Effect.Opacity('testcss1',{sync:true}));
+
+ // note: fails with firefox 1.0.X (bug, fixed in Deer Park)
+ assertNotInstanceOf(Effect.Parallel, new Effect.Opacity('testcss1',{sync:true}), "(note: fails with firefox 1.0.X, fixed in Deer Park)");
+ }},
+
+ testAssertReturns: function() { with(this) {
+
+ assertReturnsTrue('isNice',testObj);
+ assertReturnsFalse('isBroken',testObj);
+
+ assertReturnsTrue('nice',testObj);
+ assertReturnsFalse('broken',testObj);
+
+ }},
+
+ testAssertVisible: function() { with(this) {
+ assertVisible('testcss1');
+ assertNotVisible('testcss1_span');
+ assertNotVisible('testcss2', "Due to a Safari bug, this test fails in Safari.");
+
+ Element.hide('testcss1');
+ assertNotVisible('testcss1');
+ assertNotVisible('testcss1_span');
+ Element.show('testcss1');
+ assertVisible('testcss1');
+ assertNotVisible('testcss1_span');
+
+ Element.show('testcss1_span');
+ assertVisible('testcss1_span');
+ Element.hide('testcss1');
+ assertNotVisible('testcss1_span'); // hidden by parent
+ }}
+
+ }, "testlog");
+// ]]>
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test_Scriptaculous.html b/dom/tests/mochitest/ajax/scriptaculous/test_Scriptaculous.html
new file mode 100644
index 0000000000..f0bf2cbe65
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/test_Scriptaculous.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Scriptaculous</title>
+ <script src="/MochiKit/Base.js"></script>
+ <script src="/MochiKit/Async.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="../lib/AJAX_setup.js"></script>
+ <link rel="stylesheet" type="text/css" href="../lib/test.css" />
+</head>
+<body>
+ <iframe width="100%" height="500" id="testframe" src=""></iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/beacon/beacon-frame.html b/dom/tests/mochitest/beacon/beacon-frame.html
new file mode 100644
index 0000000000..f50e04e90a
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-frame.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Inner frame performing a basic sendBeacon from within an iframe</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+</head>
+<body>
+<script type="text/javascript">
+
+function sendBeacon()
+{
+ var frame = window.parent.document.getElementById("frame");
+ var data = window.parent.beaconConvert(frame.getAttribute("data"));
+
+ var result = navigator.sendBeacon("http://mochi.test:8888/tests/dom/tests/mochitest/beacon/beacon-handler.sjs", data);
+ window.parent.beaconSent(result);
+}
+
+window.addEventListener("load", function() { setTimeout(sendBeacon, 0); });
+
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/beacon/beacon-handler.sjs b/dom/tests/mochitest/beacon/beacon-handler.sjs
new file mode 100644
index 0000000000..a1e851ac5b
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-handler.sjs
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const CC = Components.Constructor;
+const BinaryInputStream = CC(
+ "@mozilla.org/binaryinputstream;1",
+ "nsIBinaryInputStream",
+ "setInputStream"
+);
+
+function DEBUG(str) {
+ // dump("********** " + str + "\n");
+}
+
+function setOurState(data) {
+ x = {
+ data,
+ QueryInterface(iid) {
+ return this;
+ },
+ };
+ x.wrappedJSObject = x;
+ setObjectState("beacon-handler", x);
+ DEBUG("our state is " + data);
+}
+
+function getOurState() {
+ var data;
+ getObjectState("beacon-handler", function (x) {
+ // x can be null if no one has set any state yet
+ if (x) {
+ data = x.wrappedJSObject.data;
+ }
+ });
+ return data;
+}
+
+function handleRequest(request, response) {
+ DEBUG("Entered request handler");
+ response.setHeader("Cache-Control", "no-cache", false);
+
+ function finishControlResponse(response) {
+ DEBUG("********* sending out the control GET response");
+ var data = getState("beaconData");
+ var mimetype = getState("beaconMimetype");
+ DEBUG("GET was sending : " + data + "\n");
+ DEBUG("GET was sending : " + mimetype + "\n");
+ var result = {
+ data,
+ mimetype,
+ };
+ response.write(JSON.stringify(result));
+ setOurState(null);
+ }
+
+ if (request.method == "GET") {
+ DEBUG(" ------------ GET --------------- ");
+ response.setHeader("Content-Type", "application/json", false);
+ switch (request.queryString) {
+ case "getLastBeaconCors":
+ // Allow CORS responses of the last beacon
+ var originHeader = request.getHeader("origin");
+ response.setHeader(
+ "Access-Control-Allow-Headers",
+ "content-type",
+ false
+ );
+ response.setHeader("Access-Control-Allow-Methods", "POST, GET", false);
+ response.setHeader("Access-Control-Allow-Origin", originHeader, false);
+ response.setHeader("Access-Control-Allow-Credentials", "true", false);
+ // fallthrough
+ case "getLastBeacon":
+ var state = getOurState();
+ if (state === "unblocked") {
+ finishControlResponse(response);
+ } else {
+ DEBUG("GET has arrived, but POST has not, blocking response!");
+ setOurState(response);
+ response.processAsync();
+ }
+ break;
+ default:
+ response.setStatusLine(request.httpVersion, 400, "Bad Request");
+ break;
+ }
+ return;
+ }
+
+ if (request.method == "POST") {
+ DEBUG(" ------------ POST --------------- ");
+ var body = new BinaryInputStream(request.bodyInputStream);
+ var avail;
+ var bytes = [];
+
+ while ((avail = body.available()) > 0) {
+ Array.prototype.push.apply(bytes, body.readByteArray(avail));
+ }
+
+ var data = "";
+ for (var i = 0; i < bytes.length; i++) {
+ // We are only passing strings at this point.
+ if (bytes[i] < 32) {
+ continue;
+ }
+ var charcode = String.fromCharCode(bytes[i]);
+ data += charcode;
+ }
+
+ var mimetype = "";
+ if (request.hasHeader("Content-Type")) {
+ mimetype = request.getHeader("Content-Type");
+ }
+
+ // check to see if this is form data.
+ if (mimetype.indexOf("multipart/form-data") != -1) {
+ // trim the mime type to make testing easier.
+ mimetype = "multipart/form-data";
+ // Extract only the form-data name.
+
+ var pattern = /; name=\"(.+)\";/;
+ data = data.split(pattern)[1];
+ }
+
+ DEBUG("********** POST was sending : " + data + "\n");
+ DEBUG("********** POST was sending : " + mimetype + "\n");
+ setState("beaconData", data);
+ setState("beaconMimetype", mimetype);
+
+ response.setHeader("Content-Type", "text/plain", false);
+ response.write("ok");
+
+ var blockedResponse = getOurState();
+ if (typeof blockedResponse == "object" && blockedResponse) {
+ DEBUG("GET is already pending, finishing!");
+ finishControlResponse(blockedResponse);
+ blockedResponse.finish();
+ } else {
+ DEBUG("GET has not arrived, marking it as unblocked");
+ setOurState("unblocked");
+ }
+
+ return;
+ }
+
+ response.setStatusLine(request.httpVersion, 402, "Bad Request");
+}
diff --git a/dom/tests/mochitest/beacon/beacon-originheader-handler.sjs b/dom/tests/mochitest/beacon/beacon-originheader-handler.sjs
new file mode 100644
index 0000000000..96304187a8
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-originheader-handler.sjs
@@ -0,0 +1,45 @@
+/*
+ * TestSever customized specifically for the needs of:
+ * Bug 1280692 - navigator.sendBeacon() should not send origin header
+ */
+
+function handleRequest(request, response) {
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "text/plain", false);
+
+ // case XHR-REQUEST: the xhr-request tries to query the
+ // stored header from the beacon request.
+ if (request.queryString == "queryheader") {
+ var header = getState("originHeader");
+ // if the beacon already stored the header - return.
+ if (header) {
+ response.write(header);
+ setState("originHeader", "");
+ return;
+ }
+ // otherwise wait for the beacon request
+ response.processAsync();
+ setObjectState("xhr-response", response);
+ return;
+ }
+
+ // case BEACON-REQUEST: get the beacon header and
+ // store the header on the server.
+ var header = "reset";
+ try {
+ header = request.getHeader("origin");
+ } catch (e) {
+ header = "no-header";
+ }
+ setState("originHeader", header);
+
+ // if there is an xhr-request waiting, return the header now.
+ getObjectState("xhr-response", function (xhrResponse) {
+ if (!xhrResponse) {
+ return;
+ }
+ setState("originHeader", "");
+ xhrResponse.write(header);
+ xhrResponse.finish();
+ });
+}
diff --git a/dom/tests/mochitest/beacon/beacon-preflight-handler.sjs b/dom/tests/mochitest/beacon/beacon-preflight-handler.sjs
new file mode 100644
index 0000000000..f4a89b9828
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-preflight-handler.sjs
@@ -0,0 +1,38 @@
+function handleRequest(request, response) {
+ response.setHeader("Cache-Control", "no-cache, must-revalidate", false);
+
+ if (request.queryString === "verify") {
+ var preflightState = getState("preflight");
+ response.write(preflightState === "done" ? "green" : "red");
+ return;
+ }
+
+ var originHeader = request.getHeader("origin");
+ response.setHeader("Access-Control-Allow-Headers", "content-type", false);
+ response.setHeader("Access-Control-Allow-Methods", "POST, GET", false);
+ response.setHeader("Access-Control-Allow-Origin", originHeader, false);
+ response.setHeader("Access-Control-Allow-Credentials", "true", false);
+
+ if (request.queryString === "beacon") {
+ if (request.method == "OPTIONS") {
+ setState("preflight", "done");
+ response.setStatusLine(null, 200, "OK");
+ return;
+ }
+ response.setStatusLine(null, 200, "OK");
+ response.write("DONE");
+ return;
+ }
+
+ if (request.queryString === "fail") {
+ if (request.method == "OPTIONS") {
+ setState("preflight", "done");
+ response.setStatusLine(null, 400, "Bad Request");
+ return;
+ }
+ setState("preflight", "oops");
+ response.setStatusLine(null, 200, "OK");
+ response.write("DONE");
+ return;
+ }
+}
diff --git a/dom/tests/mochitest/beacon/beacon-redirect-handler.sjs b/dom/tests/mochitest/beacon/beacon-redirect-handler.sjs
new file mode 100644
index 0000000000..5496353588
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-redirect-handler.sjs
@@ -0,0 +1,46 @@
+/*
+ * TestSever customized specifically for the needs of:
+ * Bug 1280692 - sendBeacon() should follow 30x redirect
+ *
+ * Here is a sequence of the test:
+ * [1] sendBeacon (identified by the queryString 'beacon') which gets redirected
+ * [2] redirected sendBeacon (identified by the queryString 'redirected') which
+ * updates the state idniciating that redirected sendBeacon succeeds.
+ * [3] xhr request (identified by the queryString 'verifyRedirectDidSucceed')
+ * which checks if the state was not changed from 'reset' to 'gree'. If the channel
+ * woulnd't be blocked correctly the redirected channel would set the state to 'red'.
+ *
+ */
+
+function handleRequest(request, response) {
+ response.setHeader("Cache-Control", "no-cache, must-revalidate", false);
+
+ // [Sequence 3]
+ if (request.queryString === "verifyRedirectDidSucceed") {
+ var redirectState = getState("redirectState");
+ response.write(redirectState);
+ return;
+ }
+
+ // [Sequence 1]
+ if (request.queryString === "beacon") {
+ setState("redirectState", "reset");
+ var newLocation =
+ "http://mochi.test:8888/tests/dom/tests/mochitest/beacon/beacon-redirect-handler.sjs?redirected";
+ response.setStatusLine("1.1", 302, "Found");
+ response.setHeader("Location", newLocation, false);
+ return;
+ }
+
+ // [Sequence 2]
+ if (request.queryString === "redirected") {
+ setState("redirectState", "green");
+ response.setStatusLine(null, 200, "OK");
+ return;
+ }
+
+ // we should never get here, but just in case let's
+ // set the state to something unexpected
+ setState("redirectState", "red");
+ response.setStatusLine(null, 200, "OK");
+}
diff --git a/dom/tests/mochitest/beacon/beacon-set-cookie.sjs b/dom/tests/mochitest/beacon/beacon-set-cookie.sjs
new file mode 100644
index 0000000000..e2dce0b3c6
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-set-cookie.sjs
@@ -0,0 +1,10 @@
+function handleRequest(request, response) {
+ response.setHeader(
+ "Set-Cookie",
+ "cookie=" + request.host + "~" + Math.random()
+ );
+ response.setHeader("Content-Type", "text/plain", false);
+ response.setHeader("Cache-Control", "no-cache", false);
+
+ response.setStatusLine(request.httpVersion, 200, "OK");
+}
diff --git a/dom/tests/mochitest/beacon/chrome.ini b/dom/tests/mochitest/beacon/chrome.ini
new file mode 100644
index 0000000000..27f8f93952
--- /dev/null
+++ b/dom/tests/mochitest/beacon/chrome.ini
@@ -0,0 +1,10 @@
+[DEFAULT]
+skip-if = os == 'android'
+
+[test_beaconCookies.html]
+skip-if = (verify && !debug && (os == 'win'))
+support-files = beacon-set-cookie.sjs
+ file_beaconCookies.html
+[test_beaconWithSafelistedContentType.html]
+support-files = beacon-handler.sjs
+ file_beaconSafelist.html
diff --git a/dom/tests/mochitest/beacon/file_beaconCookies.html b/dom/tests/mochitest/beacon/file_beaconCookies.html
new file mode 100644
index 0000000000..aeecb2263e
--- /dev/null
+++ b/dom/tests/mochitest/beacon/file_beaconCookies.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<script class="testbody" type="text/javascript">
+
+var beaconUrl = "http://mochi.test:8888/chrome/dom/tests/mochitest/beacon/beacon-set-cookie.sjs";
+
+navigator.sendBeacon(beaconUrl, "ceci n'est pas une demande");
+
+</script>
diff --git a/dom/tests/mochitest/beacon/file_beaconSafelist.html b/dom/tests/mochitest/beacon/file_beaconSafelist.html
new file mode 100644
index 0000000000..0079ed5074
--- /dev/null
+++ b/dom/tests/mochitest/beacon/file_beaconSafelist.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<script class="testbody" type="text/javascript">
+
+var beaconUrl = "http://example.com/tests/dom/tests/mochitest/beacon/beacon-handler.sjs?beacon";
+
+var value = ["text"];
+var blob = new Blob(value, {type: "application/x-www-form-urlencoded"});
+navigator.sendBeacon(beaconUrl, blob);
+var intervalID = null;
+
+</script>
diff --git a/dom/tests/mochitest/beacon/mochitest.ini b/dom/tests/mochitest/beacon/mochitest.ini
new file mode 100644
index 0000000000..9f51091c52
--- /dev/null
+++ b/dom/tests/mochitest/beacon/mochitest.ini
@@ -0,0 +1,22 @@
+[DEFAULT]
+support-files = beacon-frame.html
+ beacon-handler.sjs
+ beacon-preflight-handler.sjs
+ beacon-originheader-handler.sjs
+ beacon-redirect-handler.sjs
+
+[test_beacon.html]
+[test_beaconFrame.html]
+skip-if =
+ http3
+[test_beaconPreflightWithCustomContentType.html]
+skip-if =
+ http3
+[test_beaconContentPolicy.html]
+[test_beaconOriginHeader.html]
+skip-if =
+ verify
+ http3
+[test_beaconRedirect.html]
+skip-if =
+ http3
diff --git a/dom/tests/mochitest/beacon/test_beacon.html b/dom/tests/mochitest/beacon/test_beacon.html
new file mode 100644
index 0000000000..4df99cfe8e
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beacon.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=936340
+-->
+<head>
+ <title>Test whether sendBeacon fails for non-HTTP URIs and syntactically incorrect calls</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936340">Mozilla Bug 936340</a>
+<p id="display"></p>
+
+<div id="content">
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
+
+function beginTest() {
+ var threw;
+ for(let scheme of ["bad", "ftp", "data"]) {
+ try {
+ is(false, navigator.sendBeacon(`${scheme}://example.com`, "0"));
+ threw = false;
+ } catch (ex) {
+ threw = true;
+ }
+ ok(threw, `sendBeacon not supported for ${scheme} scheme.`);
+ }
+
+ for(let scheme of ["http", "https"]) {
+ try {
+ is(false, navigator.sendBeacon(`${scheme}://invalid:URL`, "0"));
+ threw = false;
+ } catch (ex) {
+ threw = true;
+ }
+ ok(threw, `sendBeacon not supported for invalid ${scheme} URLs.`);
+ }
+
+ try {
+ is(false, navigator.sendBeacon());
+ threw = false;
+ } catch (e) {
+ threw = true;
+ }
+ ok(threw, "sendBeacon needs more parameters.");
+
+ SimpleTest.finish()
+}
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/beacon/test_beaconContentPolicy.html b/dom/tests/mochitest/beacon/test_beaconContentPolicy.html
new file mode 100644
index 0000000000..0e1bce574e
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconContentPolicy.html
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=936340
+-->
+<head>
+ <title>Test that sendBeacon obeys content policy directives</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936340">Mozilla Bug 936340</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var beaconUrl = "http://mochi.test:8888/tests/dom/tests/mochitest/beacon/beacon-handler.sjs";
+
+const Cc = SpecialPowers.Cc;
+const Ci = SpecialPowers.Ci;
+
+// not enabled by default yet.
+SimpleTest.waitForExplicitFinish();
+
+var policy;
+
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
+
+function setupPolicy() {
+ var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{b80e19d0-878f-d41b-2654-194714a4115c}");
+ var policyName = "@mozilla.org/testpolicy;1";
+ var policy = {
+ // nsISupports implementation
+ QueryInterface(iid) {
+ iid = SpecialPowers.wrap(iid);
+ if (iid.equals(Ci.nsISupports) ||
+ iid.equals(Ci.nsIFactory) ||
+ iid.equals(Ci.nsIContentPolicy))
+ return this;
+ throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
+ },
+
+ // nsIFactory implementation
+ createInstance(iid) {
+ return this.QueryInterface(iid);
+ },
+
+ // nsIContentPolicy implementation
+ shouldLoad(contentLocation, loadInfo, mimeTypeGuess) {
+ // Remember last content type seen for the test url
+ let contentType = loadInfo.externalContentPolicyType;
+
+ if (SpecialPowers.wrap(contentLocation).spec == beaconUrl) {
+ is(contentType, Ci.nsIContentPolicy.TYPE_BEACON, "Beacon content type should match expected. is: " + contentType + " should be: " + Ci.nsIContentPolicy.TYPE_BEACON);
+ teardownPolicy();
+ SimpleTest.finish();
+ }
+
+ return Ci.nsIContentPolicy.ACCEPT;
+ },
+
+ shouldProcess(contentLocation, loadInfo, mimeTypeGuess) {
+ return Ci.nsIContentPolicy.ACCEPT;
+ }
+ }
+ policy = SpecialPowers.wrapCallbackObject(policy);
+
+ // Register content policy
+ var componentManager = SpecialPowers.wrap(SpecialPowers.Components).manager.QueryInterface(Ci.nsIComponentRegistrar);
+ componentManager.registerFactory(policyID, "Test content policy", policyName, policy);
+
+ var categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
+ categoryManager.addCategoryEntry("content-policy", policyName, policyName, false, true);
+
+ return { 'policy': policy, 'policyID': policyID, 'policyName': policyName };
+}
+
+function teardownPolicy() {
+ setTimeout(function() {
+ // policy will not be removed from the category correctly
+ var componentManager = SpecialPowers.wrap(SpecialPowers.Components).manager.QueryInterface(Ci.nsIComponentRegistrar);
+ componentManager.unregisterFactory(policy.policyID, policy.policy);
+ var categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
+ categoryManager.deleteCategoryEntry("content-policy", policy.policyName, false);
+ }, 0);
+}
+
+function beginTest() {
+ policy = setupPolicy();
+ // Make sure to hit the event loop here in order to ensure that nsContentPolicy
+ // has been notified of the newly registered policy.
+ SimpleTest.executeSoon(function() {
+ navigator.sendBeacon(beaconUrl, "bacon would have been a better name than beacon");
+ });
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/beacon/test_beaconCookies.html b/dom/tests/mochitest/beacon/test_beaconCookies.html
new file mode 100644
index 0000000000..192e1395f5
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconCookies.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=936340
+-->
+<head>
+ <title>Test whether sendBeacon sets cookies</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936340">Mozilla Bug 936340</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+// not enabled by default yet.
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
+
+const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
+
+var baseURL = "http://mochi.test:8888/chrome/dom/tests/mochitest/beacon/";
+
+function whenDelayedStartupFinished(aWindow, aCallback) {
+ Services.obs.addObserver(function observer(aSubject, aTopic) {
+ if (aWindow == aSubject) {
+ Services.obs.removeObserver(observer, aTopic);
+ setTimeout(aCallback, 0);
+ }
+ }, "browser-delayed-startup-finished");
+}
+
+function testOnWindow(options, callback) {
+ var mainWindow = window.browsingContext.topChromeWindow;
+
+ var win = mainWindow.OpenBrowserWindow(options);
+ windowsToClose.push(win);
+ whenDelayedStartupFinished(win, function() {
+ callback(win);
+ });
+};
+
+var windowsToClose = [];
+var next;
+
+function beginTest() {
+ testOnWindow({}, function(aNormalWindow) {
+ Services.obs.addObserver(function waitCookie() {
+ Services.obs.removeObserver(waitCookie, "cookie-changed");
+ ok(true, "cookie set by beacon request in normal window");
+ testOnPrivateWindow();
+ }, "cookie-changed");
+ BrowserTestUtils.loadURIString(aNormalWindow.gBrowser.selectedBrowser, baseURL + "file_beaconCookies.html");
+ });
+}
+
+function testOnPrivateWindow() {
+ testOnWindow({private: true}, function(aPrivateWindow) {
+ Services.obs.addObserver(function waitCookie() {
+ Services.obs.removeObserver(waitCookie, "private-cookie-changed");
+ ok(true, "private cookie set by beacon request in private window");
+ cleanup();
+ }, "private-cookie-changed");
+ BrowserTestUtils.loadURIString(aPrivateWindow.gBrowser.selectedBrowser, baseURL + "file_beaconCookies.html");
+ });
+}
+
+function cleanup() {
+ for (var i = 0; i < windowsToClose.length; ++i) {
+ windowsToClose[i].close();
+ }
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/beacon/test_beaconFrame.html b/dom/tests/mochitest/beacon/test_beaconFrame.html
new file mode 100644
index 0000000000..940cb9ecf6
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconFrame.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=936340
+-->
+<head>
+ <title>Test for beacon</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936340">Mozilla Bug 936340</a>
+<p id="display"></p>
+
+<div id="content">
+</div>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+// not enabled by default yet.
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, runNextTest);
+
+function getBeaconServerStatus(callback) {
+ var request = new XMLHttpRequest();
+ request.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/beacon/beacon-handler.sjs?getLastBeacon", true);
+ request.onload = function() {
+ if (request.readyState === request.DONE) {
+ callback(request.responseText);
+ }
+ };
+ request.send(null);
+}
+
+function createIframeWithData(data, mimetype, convert) {
+ beaconConvert = convert;
+
+ var frame = document.createElement("IFRAME");
+ frame.setAttribute("src", "beacon-frame.html");
+ frame.id = "frame";
+ frame.setAttribute("data", data.toString());
+ frame.setAttribute("mimetype", mimetype);
+ var c = document.getElementById("content");
+ c.appendChild(frame);
+}
+
+function beaconSent(result) {
+ // This function gets called from beacon-frame.html in the inner frame
+ // Check that the beacon was actually sent
+ ok(result, "Beacon was not sent")
+
+ // remove the frame.
+ var frame = document.getElementById("frame");
+ var data = frame.getAttribute("data");
+ var mimetype = frame.getAttribute("mimetype");
+
+ var c = document.getElementById("content");
+ c.removeChild(frame);
+
+ getBeaconServerStatus( function(response) {
+ console.log(response);
+ var result = JSON.parse(response);
+
+ is(result.data, data, "Beacon status should match expected. is: " + result.data + " should be: " + data);
+ is(result.mimetype, mimetype, "Beacon mimetype should match expected. is: " + result.mimetype + " should be: " + mimetype);
+
+ runNextTest();
+ });
+}
+
+function runNextTest() {
+ var test = tests.shift();
+ setTimeout(test, 0);
+}
+
+var beaconConvert = function() {};
+
+function stringToArrayBuffer(input) {
+
+ var buffer = new ArrayBuffer(input.length * 2);
+ var array = new Uint16Array(buffer);
+
+ // dumbly copy over the bytes
+ for (var i = 0, len = input.length; i < len; i++) {
+ array[i] = input.charCodeAt(i);
+ }
+ return array;
+}
+
+function stringToBlob(input) {
+ var blob = new Blob([input], {type : 'text/html'});
+ return blob;
+}
+
+function stringToFormData(input) {
+ var formdata = new FormData();
+ formdata.append(input, new Blob(['hi']));
+ return formdata;
+}
+
+function identity(data) {
+ return data;
+}
+
+var tests = [
+ function() { createIframeWithData("hi!", "text/plain;charset=UTF-8", identity); },
+ function() { createIframeWithData("123", "", stringToArrayBuffer); },
+ function() { createIframeWithData("abc", "text/html", stringToBlob); },
+ function() { createIframeWithData("qwerty", "multipart/form-data", stringToFormData); },
+ function() { SimpleTest.finish(); },
+];
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/beacon/test_beaconOriginHeader.html b/dom/tests/mochitest/beacon/test_beaconOriginHeader.html
new file mode 100644
index 0000000000..177ca94dba
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconOriginHeader.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1280692 - navigator.sendBeacon() should send origin header</title>
+ <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <p id="display"></p>
+ <div id="content" style="visibility: hidden">
+ <iframe style="width:100%;" id="testframe"></iframe>
+ </div>
+
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+const BEACON_URL = "http://example.com/tests/dom/tests/mochitest/beacon/beacon-originheader-handler.sjs";
+// server returns any origin-header or 'no-header' if there is no header sent.
+const ORIGIN_HEADER = "http://mochi.test:8888";
+
+/* Description of the test:
+ * We call sendBeacon() cross origin and make sure that the
+ * origin header is actually set in the request.
+ *
+ * Since sendBeacon() does not expect any response, we are storing any
+ * header on the server (*.sjs) and use an XMLHttpRequest to actually
+ * retrieve the potentially set header back from the server. We assert
+ * that the header is indeed *not* sent with the request. Since sendBeacon()
+ * and also the XMLHttpRequest() are performed in an asynchronous fashion,
+ * there is no guarantee that the sendBeacon() is actually executed before
+ * the XMLHttpRequest().
+ * Hence the xhr-response might be processed asynchronously.
+ */
+
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, runTest);
+
+function queryHeaderFromServer() {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "beacon-originheader-handler.sjs?queryheader", true);
+ xhr.onload = function() {
+ is(xhr.responseText, ORIGIN_HEADER, "SendBeacon should send origin header");
+ SimpleTest.finish();
+ };
+ xhr.onerror = function() {
+ ok(false, "xhr request returned error");
+ SimpleTest.finish();
+ };
+ xhr.send();
+}
+
+function runTest() {
+ // generate data and send beacon
+ var formData = new FormData();
+ formData.append('name', 'value');
+ navigator.sendBeacon(BEACON_URL, formData);
+
+ // start quering the result from the server
+ queryHeaderFromServer();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/beacon/test_beaconPreflightWithCustomContentType.html b/dom/tests/mochitest/beacon/test_beaconPreflightWithCustomContentType.html
new file mode 100644
index 0000000000..d1007b78c5
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconPreflightWithCustomContentType.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1210302
+-->
+<head>
+ <title>Test for Bug 1210302</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1210302">Mozilla Bug 936340</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var beaconUrl = "http://example.com/tests/dom/tests/mochitest/beacon/beacon-preflight-handler.sjs?beacon";
+
+var intervalID = null;
+
+function queryIfBeaconSucceeded() {
+ clearInterval(intervalID);
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "beacon-preflight-handler.sjs?verify", true);
+ xhr.onload = function() {
+ is(xhr.responseText, "green", "SendBeacon should have succeeded after preflight!");
+ SimpleTest.finish();
+ };
+ xhr.onerror = function() {
+ ok(false, "xhr request returned error");
+ SimpleTest.finish();
+ };
+ xhr.send();
+}
+
+// not enabled by default yet.
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
+
+function beginTest() {
+ var abv = new Uint8Array([0,1,2,3]);
+ var blob = new Blob(abv, {type: "application/badness, text/plain"});
+ var sent = navigator.sendBeacon(beaconUrl, blob);
+ ok(sent, "sending the beacon should start successfully");
+
+ // we have to make sure sending the beacon did not fail, so
+ // we have to wait for 2 seconds before we can query the result.
+ intervalID = setInterval(queryIfBeaconSucceeded, 2000);
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/beacon/test_beaconRedirect.html b/dom/tests/mochitest/beacon/test_beaconRedirect.html
new file mode 100644
index 0000000000..210b7a1e98
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconRedirect.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1280692 - sendBeacon() should follow 30x redirect</title>
+ <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <p id="display"></p>
+ <div id="content" style="visibility: hidden">
+ <iframe style="width:100%;" id="testframe"></iframe>
+ </div>
+
+<script class="testbody" type="text/javascript">
+
+/* Description of the test:
+ * We do perform a non simple sendBeacon request which should not use CORS and should follow
+ * a 30x cross origin redirect, which is allowed by the spec.
+ */
+
+SimpleTest.waitForExplicitFinish();
+
+const BEACON_URL = "http://example.com/tests/dom/tests/mochitest/beacon/beacon-redirect-handler.sjs?beacon";
+
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, runTest);
+
+var intervalID = null;
+
+function queryIfRedirectSucceeded() {
+ clearInterval(intervalID);
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "beacon-redirect-handler.sjs?verifyRedirectDidSucceed", true);
+ xhr.onload = function() {
+ is(xhr.responseText, "green", "SendBeacon should follow cross origin redirects!");
+ SimpleTest.finish();
+ };
+ xhr.onerror = function() {
+ ok(false, "xhr request returned error");
+ SimpleTest.finish();
+ };
+ xhr.send();
+}
+
+function runTest() {
+ var data = new Uint8Array([0,1,2,3]);
+ navigator.sendBeacon(BEACON_URL, data);
+
+ // we have to make sure the channel did follow the redirect hence
+ // we have to wait for 4 seconds before we can query the result.
+ intervalID = setInterval(queryIfRedirectSucceeded, 4000);
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/beacon/test_beaconWithSafelistedContentType.html b/dom/tests/mochitest/beacon/test_beaconWithSafelistedContentType.html
new file mode 100644
index 0000000000..d2348d7892
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconWithSafelistedContentType.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1557386
+-->
+<head>
+ <title>Test for Bug 1557386</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1557386">Mozilla Bug 1557386</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+// not enabled by default yet.
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
+
+const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
+const { clearInterval, setInterval } = ChromeUtils.import(
+ "resource://gre/modules/Timer.jsm"
+);
+
+function whenDelayedStartupFinished(aWindow, aCallback) {
+ Services.obs.addObserver(function observer(aSubject, aTopic) {
+ if (aWindow == aSubject) {
+ Services.obs.removeObserver(observer, aTopic);
+ setTimeout(aCallback, 0);
+ }
+ }, "browser-delayed-startup-finished");
+}
+
+let baseURL = "http://mochi.test:8888/chrome/dom/tests/mochitest/beacon/";
+let windowsToClose = [];
+let listener = msg => {
+ if (!(msg instanceof Ci.nsIConsoleMessage)) {
+ return;
+ }
+ if (msg.message.match("Cross-Origin Request Blocked:")) {
+ ok(false, "CORS response console warning found");
+ }
+};
+
+function beginTest() {
+ Services.console.registerListener(listener);
+
+ let mainWindow = window.docShell.rootTreeItem.domWindow;
+
+ let win = mainWindow.OpenBrowserWindow({});
+ windowsToClose.push(win);
+ whenDelayedStartupFinished(win, async function() {
+ Services.obs.addObserver(function waitCookie() {
+ Services.obs.removeObserver(waitCookie, "cookie-changed");
+ ok(true, "cookie set by beacon request in normal window");
+ testOnPrivateWindow();
+ }, "cookie-changed");
+ let testURL = baseURL + "file_beaconSafelist.html";
+ BrowserTestUtils.loadURIString(win.gBrowser.selectedBrowser, testURL);
+ await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser, false, testURL);
+ await SpecialPowers.spawn(win.gBrowser.selectedBrowser, [], async () => {
+ await new Promise((resolve, reject) => {
+ let intervalId;
+ function queryIfBeaconSucceeded() {
+ content.clearInterval(intervalId);
+ let xhr = new content.XMLHttpRequest();
+ let baseURL = "http://example.com/tests/dom/tests/mochitest/beacon/";
+ let checkUrl = baseURL + "beacon-handler.sjs?getLastBeaconCors";
+ xhr.open("GET", checkUrl, true);
+ xhr.onload = function() {
+ let res = JSON.parse(xhr.responseText);
+ is(res.data, "text", "Got correct data");
+ resolve();
+ };
+ xhr.onerror = function() {
+ ok(false, "Error getting last beacon");
+ reject();
+ };
+ xhr.send();
+ }
+ intervalID = content.setInterval(queryIfBeaconSucceeded, 2000);
+ });
+ });
+ cleanup();
+ });
+}
+
+function cleanup() {
+ Services.console.unregisterListener(listener);
+ for (let i = 0; i < windowsToClose.length; ++i) {
+ windowsToClose[i].close();
+ }
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/bug289714.sjs b/dom/tests/mochitest/bugs/bug289714.sjs
new file mode 100644
index 0000000000..ac0f1d1f47
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug289714.sjs
@@ -0,0 +1,16 @@
+// Send a payload that's over 32k in size, which for a plain response should be
+// large enough to ensure that OnDataAvailable is called more than once (and so
+// the XHR will be triggered to send more than one "loading" event if desired).
+
+function handleRequest(request, response) {
+ // Send 81920 bytes of こんにちは in Shift-JIS encoding, framed in XML.
+ let data =
+ "<?xml version='1.0' encoding='shift-jis'?><xml>" +
+ new Array(1 << 13).join("\x82\xb1\x82\xf1\x82\xc9\x82\xbf\x82\xcd") +
+ "</xml>";
+ response.processAsync();
+ response.setHeader("Content-Type", "text/xml", false);
+ response.setHeader("Content-Length", "" + data.length, false);
+ response.write(data, data.length);
+ response.finish();
+}
diff --git a/dom/tests/mochitest/bugs/bug346659-echoer.html b/dom/tests/mochitest/bugs/bug346659-echoer.html
new file mode 100644
index 0000000000..bc6f6a9031
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-echoer.html
@@ -0,0 +1,4 @@
+<script>
+ window.opener.postMessage("1 - " + window.x, "http://mochi.test:8888");
+ window.close();
+</script>
diff --git a/dom/tests/mochitest/bugs/bug346659-opener-echoer.html b/dom/tests/mochitest/bugs/bug346659-opener-echoer.html
new file mode 100644
index 0000000000..fde456a36a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-opener-echoer.html
@@ -0,0 +1,6 @@
+<script>
+ var testNum = decodeURIComponent(window.location.search.substring(1));
+ window.opener.opener.postMessage(testNum + " - " + window.x, "http://mochi.test:8888");
+ window.opener.close();
+ window.close();
+</script>
diff --git a/dom/tests/mochitest/bugs/bug346659-opener.html b/dom/tests/mochitest/bugs/bug346659-opener.html
new file mode 100644
index 0000000000..d9d6128047
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-opener.html
@@ -0,0 +1,9 @@
+<body onload="postBack();">
+ <script>
+ function postBack() {
+ var s = decodeURIComponent(window.location.search.substring(1));
+ window.opener.postMessage(s, "http://mochi.test:8888");
+ }
+ var childWin = window.open();
+ </script>
+</body>
diff --git a/dom/tests/mochitest/bugs/bug346659-parent-echoer.html b/dom/tests/mochitest/bugs/bug346659-parent-echoer.html
new file mode 100644
index 0000000000..3096153725
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-parent-echoer.html
@@ -0,0 +1,5 @@
+<script>
+ var testNum = decodeURIComponent(window.location.search.substring(1));
+ window.parent.opener.postMessage(testNum + " - " + window.x, "http://mochi.test:8888");
+ window.parent.close();
+</script>
diff --git a/dom/tests/mochitest/bugs/bug346659-parent.html b/dom/tests/mochitest/bugs/bug346659-parent.html
new file mode 100644
index 0000000000..7d675cf20e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-parent.html
@@ -0,0 +1,11 @@
+<body onload="postBack();">
+ <script>
+ var childWin;
+ function postBack() {
+ childWin = window.frames[0];
+ var s = decodeURIComponent(window.location.search.substring(1));
+ window.opener.postMessage(s, "http://mochi.test:8888");
+ }
+ </script>
+ <iframe></iframe>
+</body>
diff --git a/dom/tests/mochitest/bugs/bug458091_child.html b/dom/tests/mochitest/bugs/bug458091_child.html
new file mode 100644
index 0000000000..2173e9e6d8
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug458091_child.html
@@ -0,0 +1,13 @@
+<html> <head>
+<title></title>
+<script type="text/javascript">
+function finish() {
+ window.opener.finish(sessionStorage.testItem);
+ window.close();
+}
+</script>
+</head>
+
+<body onload="finish();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/child_bug260264.html b/dom/tests/mochitest/bugs/child_bug260264.html
new file mode 100644
index 0000000000..e8f7d578b9
--- /dev/null
+++ b/dom/tests/mochitest/bugs/child_bug260264.html
@@ -0,0 +1,11 @@
+<html>
+ <head>
+ </head>
+ <body>
+ <iframe id="frame"></iframe>
+ <script type="application/javascript">
+ var tempstr = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')+1);
+ document.getElementById("frame").src = "http://mochi.test:8888" + tempstr + "grandchild_bug260264.html" + window.location.hash;
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/bugs/devicemotion_inner.html b/dom/tests/mochitest/bugs/devicemotion_inner.html
new file mode 100644
index 0000000000..c3ceb858b4
--- /dev/null
+++ b/dom/tests/mochitest/bugs/devicemotion_inner.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script>
+function handler(ev) {}
+window.addEventListener("devicemotion", handler);
+window.ondeviceorientation = handler;
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/devicemotion_outer.html b/dom/tests/mochitest/bugs/devicemotion_outer.html
new file mode 100644
index 0000000000..43bcb6028a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/devicemotion_outer.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script>
+var total = 50;
+var loaded = 0;
+for (var i = 0; i < total; i++) {
+ var f = document.createElement("iframe");
+ document.body.appendChild(f);
+ f.onload = function() {
+ loaded++;
+ if (loaded == total - 1)
+ document.location.replace("about:blank");
+ }
+ f.setAttribute('src', 'devicemotion_inner.html');
+}
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file1_bug414291.html b/dom/tests/mochitest/bugs/file1_bug414291.html
new file mode 100644
index 0000000000..0d8be9d052
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file1_bug414291.html
@@ -0,0 +1 @@
+<html><body onload='close(); opener.result0 = 1;'>
diff --git a/dom/tests/mochitest/bugs/file2_bug414291.html b/dom/tests/mochitest/bugs/file2_bug414291.html
new file mode 100644
index 0000000000..fdb590c807
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file2_bug414291.html
@@ -0,0 +1 @@
+<html><body onload='close(); opener.result2 = 2;'>
diff --git a/dom/tests/mochitest/bugs/file3_bug414291.html b/dom/tests/mochitest/bugs/file3_bug414291.html
new file mode 100644
index 0000000000..e9095f76e1
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file3_bug414291.html
@@ -0,0 +1 @@
+<html><body onload='close(); returnValue = 3;'>
diff --git a/dom/tests/mochitest/bugs/file_bug593174_1.html b/dom/tests/mochitest/bugs/file_bug593174_1.html
new file mode 100644
index 0000000000..ec455fcf22
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug593174_1.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+Nothing to see here. Move along.
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_bug593174_2.html b/dom/tests/mochitest/bugs/file_bug593174_2.html
new file mode 100644
index 0000000000..080b016d7c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug593174_2.html
@@ -0,0 +1,30 @@
+<html>
+<body>
+Page 2 has an iframe of its own.
+<iframe id='inner-iframe' onload='innerIframeLoaded()' srcdoc='
+ <html><body>
+ <script>function go() { window.location = "file_bug593174_1.html"; }</script>
+ </body></html>'>
+</iframe>
+
+<script>
+function innerIframeLoaded() {
+ if (parent.iframeLoaded) {
+ parent.iframeLoaded('inner');
+ }
+ else if(opener.iframeLoaded) {
+ opener.iframeLoaded('popup/inner');
+ }
+}
+
+function navigateInnerIframe() {
+ document.getElementById('inner-iframe').contentWindow.go();
+}
+
+function getInnerIframeReferrer() {
+ return document.getElementById('inner-iframe').contentWindow.document.referrer;
+}
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_bug809290_b1.html b/dom/tests/mochitest/bugs/file_bug809290_b1.html
new file mode 100644
index 0000000000..3a3863a61c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug809290_b1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function innerLoad() {
+ var win = document.getElementById('ifr').contentWindow;
+ win.location = "file_bug809290_c.html";
+}
+</script>
+</head>
+<body>
+<iframe id="ifr" src="file_empty.html">
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_bug809290_b2.html b/dom/tests/mochitest/bugs/file_bug809290_b2.html
new file mode 100644
index 0000000000..83c6f894c1
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug809290_b2.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function eventHandlerLoad() {
+ var win = document.getElementById('ifr').contentWindow;
+ win.location = "file_bug809290_c.html";
+}
+</script>
+</head>
+<body onload="eventHandlerLoad();">
+<iframe id="ifr" src="file_empty.html">
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_bug809290_c.html b/dom/tests/mochitest/bugs/file_bug809290_c.html
new file mode 100644
index 0000000000..2d8c135e95
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug809290_c.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+window.parent.parent.notifyReferrer(document.referrer);
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_bug873229.js b/dom/tests/mochitest/bugs/file_bug873229.js
new file mode 100644
index 0000000000..e2be3f08a2
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug873229.js
@@ -0,0 +1,6 @@
+// This is a script that will let you get an exception thrown by
+// calling bar() with no arguments, say.
+var foo = "Some string";
+function bar(x) {
+ x.trySomething();
+}
diff --git a/dom/tests/mochitest/bugs/file_bug927901.html b/dom/tests/mochitest/bugs/file_bug927901.html
new file mode 100644
index 0000000000..907b0d96c6
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug927901.html
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <title></title>
+ <script>
+ var ret = "pass";
+ try {
+ window.foo = window.crypto.getRandomValues;
+ } catch(ex) {
+ ret = "" + ex;
+ }
+ parent.postMessage(ret, "*");
+ </script>
+ <style>
+ </style>
+ </head>
+ <body onload="document.body.textContent = 'Crypto test file on ' + location">
+ </body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_cookieOutputter.html b/dom/tests/mochitest/bugs/file_cookieOutputter.html
new file mode 100644
index 0000000000..edc004ad10
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_cookieOutputter.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html>
+<head>
+<meta charset=UTF-8>
+</head>
+<body>
+ <script>
+parent.postMessage(document.cookie, "*");
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_empty.html b/dom/tests/mochitest/bugs/file_empty.html
new file mode 100644
index 0000000000..ca105f950d
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_empty.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<html><head></head><body></body></html>
diff --git a/dom/tests/mochitest/bugs/file_prime_cookie.html b/dom/tests/mochitest/bugs/file_prime_cookie.html
new file mode 100644
index 0000000000..ee9240e3ae
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_prime_cookie.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html>
+<head>
+<meta charset=UTF-8>
+</head>
+<body>
+<script>
+document.cookie = "b=c";
+parent.postMessage("done", "*");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_redirector.sjs b/dom/tests/mochitest/bugs/file_redirector.sjs
new file mode 100644
index 0000000000..70478e69af
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_redirector.sjs
@@ -0,0 +1,9 @@
+/* vim: set ft=javascript: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+function handleRequest(request, response) {
+ response.setHeader("Content-type", "text/html", false);
+ response.setStatusLine(request.httpVersion, "302", "Found");
+ response.setHeader("Location", request.queryString, false);
+ response.write("<!DOCTYPE html><html><body>Look away!</body></html>");
+}
diff --git a/dom/tests/mochitest/bugs/file_resize_move_windows_1.html b/dom/tests/mochitest/bugs/file_resize_move_windows_1.html
new file mode 100644
index 0000000000..ebeb993b90
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_resize_move_windows_1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Helper file for test_resize_move_windows.html</title>
+</head>
+<body>
+<script>
+function check(next) {
+ var is_range = function(aTest, aValue, aRange, aMsg) {
+ window.opener.ok(aTest < aValue + aRange && aTest > aValue - aRange, aMsg + `: ${aTest} vs. ${aValue}`);
+ };
+ is_range(window.innerWidth, 170, 5, 'parameter width should be taken into account');
+ is_range(window.innerHeight, 170, 5, 'parameter height should be taken into account');
+ is_range(window.screenX, 65, 5, 'parameter screenX should be taken into account');
+ is_range(window.screenY, 65, 5, 'parameter screenY should be taken into account');
+ window.opener.checkChangeIsEnabled(window, next);
+}
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_resize_move_windows_2.html b/dom/tests/mochitest/bugs/file_resize_move_windows_2.html
new file mode 100644
index 0000000000..7b8764fa7e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_resize_move_windows_2.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Helper file for test_resize_move_windows.html</title>
+</head>
+<body>
+<script>
+function check(next) {
+ window.opener.checkChangeIsDisabled(window).then(next);
+}
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_window_bar.html b/dom/tests/mochitest/bugs/file_window_bar.html
new file mode 100644
index 0000000000..59b2c16014
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_window_bar.html
@@ -0,0 +1,7 @@
+<html>
+<body onload='opener.testWindow(window)'>
+
+Nothing to see here!
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/grandchild_bug260264.html b/dom/tests/mochitest/bugs/grandchild_bug260264.html
new file mode 100644
index 0000000000..11258fde4e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/grandchild_bug260264.html
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="utils_bug260264.js"></script>
+ </head>
+ <body>
+ <a id="nested link" href="javascript:(function(){})()">nested link</a>
+ <script type="application/javascript">
+ var event = location.hash.split("#").pop();
+ send(document.getElementById("nested link"), event, function() {
+ var popup = window.open("http://example.com"),
+ grandparent = window.open("", "parent260264");
+ try { grandparent.report(popup) }
+ finally { popup && popup.close() }
+ });
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/bugs/iframe_bug304459-1.html b/dom/tests/mochitest/bugs/iframe_bug304459-1.html
new file mode 100644
index 0000000000..2721c5c781
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug304459-1.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+ <title>Iframe test for bug 304459</title>
+</head>
+<body">
+<script>
+
+Object.prototype.x = "oops";
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/iframe_bug304459-2.html b/dom/tests/mochitest/bugs/iframe_bug304459-2.html
new file mode 100644
index 0000000000..3a922b9b21
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug304459-2.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+ <title>Iframe test for bug 304459</title>
+</head>
+<body">
+<script>
+
+var result;
+try {
+ x == undefined;
+} catch (e) {
+ result = true;
+}
+window.parent.postMessage(result, "http://mochi.test:8888");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/iframe_bug430276-2.html b/dom/tests/mochitest/bugs/iframe_bug430276-2.html
new file mode 100644
index 0000000000..0d495cc979
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug430276-2.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title></title>
+ <script type="application/javascript">
+ new XMLHttpRequest();
+ function runTest() {
+ document.open();
+ var succeeded = true;
+ try {
+ new XMLHttpRequest();
+ } catch(e) {
+ succeeded = false;
+ }
+ window.parent.ok(succeeded, "Creating XMLHttpRequest failed!");
+ window.parent.SimpleTest.finish();
+ document.close();
+ }
+ </script>
+</head>
+<body onload="runTest()">
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/iframe_bug430276.html b/dom/tests/mochitest/bugs/iframe_bug430276.html
new file mode 100644
index 0000000000..703eb5dd55
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug430276.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title></title>
+ <script type="application/javascript">
+ function runTest() {
+ document.write("<body>");
+ var succeeded = true;
+ try {
+ new XMLHttpRequest();
+ } catch(e) {
+ succeeded = false;
+ }
+ window.parent.ok(succeeded, "Creating XMLHttpRequest failed!");
+ window.parent.nextTest();
+ }
+ </script>
+</head>
+<body onload="runTest()">
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/iframe_bug440572.html b/dom/tests/mochitest/bugs/iframe_bug440572.html
new file mode 100644
index 0000000000..fd69442bee
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug440572.html
@@ -0,0 +1,23 @@
+<html>
+<body>
+<script>
+
+var success = 0;
+
+try {
+ parent[name].success = 1;
+ parent.postMessage({
+ from: name,
+ result: success ? "success" : "failure"
+ }, "http://mochi.test:8888");
+} catch (e) {
+ parent.postMessage({
+ from: name,
+ result: e.toString()
+ }, "http://mochi.test:8888");
+}
+
+</script>
+<p>Move on, nothing to see here...</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/iframe_bug49312.html b/dom/tests/mochitest/bugs/iframe_bug49312.html
new file mode 100644
index 0000000000..e1df2f6ded
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug49312.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<script>
+ window.onload = function() {
+ var win = window.opener ? window.opener : window.parent;
+ win.subframeLoaded(window);
+ }
+</script>
diff --git a/dom/tests/mochitest/bugs/iframe_domparser_after_blank.html b/dom/tests/mochitest/bugs/iframe_domparser_after_blank.html
new file mode 100644
index 0000000000..f373393772
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_domparser_after_blank.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head><meta charset=utf-8>
+ <title></title>
+ <script type="application/javascript">
+ function runTest() {
+ document.write("<body>");
+ var succeeded = true;
+ try {
+ new DOMParser();
+ } catch(e) {
+ succeeded = false;
+ }
+ window.parent.ok(succeeded, "Creating DOMParser failed!");
+ window.parent.SimpleTest.finish();
+ document.close();
+ }
+ </script>
+</head>
+<body onload="runTest()">
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/mochitest.ini b/dom/tests/mochitest/bugs/mochitest.ini
new file mode 100644
index 0000000000..520398c9ab
--- /dev/null
+++ b/dom/tests/mochitest/bugs/mochitest.ini
@@ -0,0 +1,192 @@
+[DEFAULT]
+tags = condprof
+support-files =
+ bug289714.sjs
+ bug346659-echoer.html
+ bug346659-opener-echoer.html
+ bug346659-opener.html
+ bug346659-parent-echoer.html
+ bug346659-parent.html
+ bug458091_child.html
+ child_bug260264.html
+ devicemotion_inner.html
+ devicemotion_outer.html
+ file_bug593174_1.html
+ file_bug593174_2.html
+ file_bug809290_b1.html
+ file_bug809290_b2.html
+ file_bug809290_c.html
+ file_empty.html
+ file_window_bar.html
+ grandchild_bug260264.html
+ iframe_bug304459-1.html
+ iframe_bug304459-2.html
+ iframe_bug430276-2.html
+ iframe_bug430276.html
+ iframe_bug440572.html
+ iframe_bug49312.html
+ iframe_domparser_after_blank.html
+ utils_bug260264.js
+ utils_bug743615.js
+ worker_bug743615.js
+ file_bug927901.html
+ file_cookieOutputter.html
+ file_redirector.sjs
+ file_prime_cookie.html
+ test1_bug369306.html
+ test2_bug369306.html
+ test1_bug622361.html
+ test2_bug622361.html
+ file1_bug414291.html
+ file2_bug414291.html
+
+[test_DOMWindowCreated_chromeonly.html]
+[test_bug132255.html]
+skip-if =
+ http3
+[test_bug1551425_reference_to_childnodes_nodelist_keeps_childnodes_alive.html]
+[test_bug159849.html]
+[test_bug289714.html]
+fail-if = xorigin
+[test_bug260264.html]
+skip-if = toolkit == 'android'
+[test_bug260264_nested.html]
+skip-if =
+ http3
+[test_bug265203.html]
+[test_bug291377.html]
+[test_bug304459.html]
+skip-if =
+ http3
+[test_bug308856.html]
+[test_bug327891.html]
+[test_bug333983.html]
+[test_bug335976.xhtml]
+[test_bug342448.html]
+[test_bug345521.html]
+[test_bug346659.html]
+skip-if =
+ toolkit == 'android' && debug
+ http3
+[test_bug369306.html]
+skip-if = condprof #: "The focus should not have been changed with URL=test2_bug369306.htm"
+[test_bug370098.html]
+[test_bug377539.html]
+[test_bug384122.html]
+[test_bug389366.html]
+[test_bug393974.html]
+[test_bug394769.html]
+[test_bug396843.html]
+[test_bug400204.html]
+[test_bug404748.html]
+[test_bug414291.html]
+tags = openwindow
+[test_bug42976.html]
+[test_bug430276.html]
+[test_bug440572.html]
+skip-if =
+ http3
+[test_bug456151.html]
+[test_bug458091.html]
+skip-if = toolkit == 'android' # Bug 1525959
+[test_bug459848.html]
+[test_bug465263.html]
+skip-if =
+ http3
+[test_bug484775.html]
+[test_bug492925.html]
+[test_bug49312.html]
+fail-if = xorigin
+[test_bug495219.html]
+[test_bug529328.html]
+[test_bug531176.html]
+[test_bug531542.html]
+[test_bug534149.html]
+[test_bug541530.html]
+[test_bug545314.html]
+[test_bug548828.html]
+[test_bug558973.html]
+[test_bug562433.html]
+[test_bug563487.html]
+[test_bug581072.html]
+[test_bug583225.html]
+[test_bug585240.html]
+[test_bug585819.html]
+[test_bug593174.html]
+[test_bug61098.html]
+[test_bug612267.html]
+[test_bug617296.html]
+[test_bug620947.html]
+[test_bug622361.html]
+[test_bug633133.html]
+[test_bug642026.html]
+[test_bug648465.html]
+[test_bug654137.html]
+[test_bug664737.html]
+[test_bug665548.html]
+[test_bug684544.html]
+[test_bug691707.html]
+[test_bug698061.html]
+[test_bug698551.html]
+[test_bug707749.html]
+[test_bug739038.html]
+[test_bug740811.html]
+[test_bug743615.html]
+[test_bug755320.html]
+[test_bug777628.html]
+[test_bug809290.html]
+[test_bug817476.html]
+[test_bug823173.html]
+[test_bug848088.html]
+[test_bug850517.html]
+[test_bug857555.html]
+[test_bug862540.html]
+[test_bug873229.html]
+support-files = file_bug873229.js
+skip-if =
+ http3
+[test_bug876098.html]
+[test_bug927901.html]
+skip-if =
+ http3
+[test_devicemotion_multiple_listeners.html]
+skip-if =
+ os == 'android' # Bug 1780219
+ http3
+[test_domparser_after_blank.html]
+[test_errorReporting.html]
+[test_navigator_buildID.html]
+skip-if =
+ http3
+[test_onerror_message.html]
+[test_protochains.html]
+[test_resize_move_windows.html]
+skip-if = toolkit == 'android'
+ os == 'linux'
+ os == "mac" # Bug 1781569
+ (devedition && os == 'win' && bits == 32) #Windows can't change size and position on Android; Windows: bug 1540554, osx: bug 1661132
+support-files =
+ file_resize_move_windows_1.html
+ file_resize_move_windows_2.html
+[test_sizetocontent_clamp.html]
+skip-if = toolkit == 'android' #Windows can't change size on Android
+[test_toJSON.html]
+[test_window_bar.html]
+[test_bug1022869.html]
+[test_bug1112040.html]
+[test_bug1160342_marquee.html]
+[test_bug1171215.html]
+support-files = window_bug1171215.html
+skip-if =
+ http3
+[test_bug1530292.html]
+[test_instanceof_error_message.html]
+[test_no_find_showDialog.html]
+skip-if = toolkit == 'android' # Bug 1358633 - window.find doesn't work for Android
+[test_postmessage.html]
+skip-if =
+ xorigin # JavaScript error: http://mochi.xorigin-test:8888/tests/SimpleTest/TestRunner.js, line 157: SecurityError: Permission denied to access property "wrappedJSObject" on cross-origin object
+ http3
+[test_bug1774135.html]
+skip-if =
+ http3
diff --git a/dom/tests/mochitest/bugs/test1_bug369306.html b/dom/tests/mochitest/bugs/test1_bug369306.html
new file mode 100644
index 0000000000..f1c58929eb
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test1_bug369306.html
@@ -0,0 +1 @@
+<script>opener.focus();</script>
diff --git a/dom/tests/mochitest/bugs/test1_bug622361.html b/dom/tests/mochitest/bugs/test1_bug622361.html
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test1_bug622361.html
@@ -0,0 +1 @@
+1
diff --git a/dom/tests/mochitest/bugs/test2_bug369306.html b/dom/tests/mochitest/bugs/test2_bug369306.html
new file mode 100644
index 0000000000..f4a5b5ac46
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test2_bug369306.html
@@ -0,0 +1 @@
+<script>blur();</script>
diff --git a/dom/tests/mochitest/bugs/test2_bug622361.html b/dom/tests/mochitest/bugs/test2_bug622361.html
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test2_bug622361.html
@@ -0,0 +1 @@
+2
diff --git a/dom/tests/mochitest/bugs/test_DOMWindowCreated_chromeonly.html b/dom/tests/mochitest/bugs/test_DOMWindowCreated_chromeonly.html
new file mode 100644
index 0000000000..fef6714523
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_DOMWindowCreated_chromeonly.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+ <title>DOMWindowCreated not visible in content</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+<body onload="ok(true, 'Test finished'); SimpleTest.finish();">
+ <p id="display"></p>
+
+ <script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ window.addEventListener("DOMWindowCreated", function() { ok(false, "DOMWindowCreated should not have fired"); });
+ window.addEventListener("DOMDocElementInserted", function() { ok(false, "DOMDocElementInserted should not have fired"); });
+ </script>
+
+ <iframe src="data:text/plain,Hi"></iframe>
diff --git a/dom/tests/mochitest/bugs/test_bug1022869.html b/dom/tests/mochitest/bugs/test_bug1022869.html
new file mode 100644
index 0000000000..da618d48cd
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1022869.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1022869
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1022869</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <iframe srcdoc="<html><body>"></iframe>
+ <script type="application/javascript">
+
+ var f = document.getElementsByTagName("iframe")[0];
+
+ SimpleTest.waitForExplicitFinish();
+
+ /** Test for Bug 1022869 **/
+ function startTest() {
+ var div = f.contentDocument.createElement("div");
+ div.innerHTML = "<template>x";
+ is(div.firstChild.content.ownerDocument.parentNode, null, "Should be able to access property on document.");
+ f.contentDocument.open();
+ is(div.firstChild.content.ownerDocument.parentNode, null, "Should be able to access property on document after document.open().");
+
+ SimpleTest.finish();
+ }
+
+ </script>
+</head>
+<body onload="startTest()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1022869">Mozilla Bug 1022869</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug1112040.html b/dom/tests/mochitest/bugs/test_bug1112040.html
new file mode 100644
index 0000000000..69680a8b93
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1112040.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1112040
+-->
+<head>
+ <title>Test for Bug 1112040</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <base href="http://mochi.test:8888/tests/dom/tests/mochitest/">
+ <meta charset="UTF-8">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1112040">Mozilla Bug 1112040</a>
+<p id="display">
+</p>
+<div id="content">
+ <input id="i" type="text" pattern="^.**$">
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 1112040 **/
+SimpleTest.runTestExpectingConsoleMessages(
+ function() { $('i').value = "42"; },
+ [{ errorMessage: /nothing to repeat/ }]
+);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug1160342_marquee.html b/dom/tests/mochitest/bugs/test_bug1160342_marquee.html
new file mode 100644
index 0000000000..6fa2f8997b
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1160342_marquee.html
@@ -0,0 +1,288 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1160342
+-->
+<head>
+ <title>Test for Bug 411103</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1160342">Mozilla Bug 1160342</a>
+<p id="display"></p>
+<div id="content">
+<marquee id="a" style="border: 1px solid black;">marquee</marquee>
+</div>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/* The todos are cases where IE/Edge is throwing errors, but
+ for Mozilla it was decided to not do that for now */
+ var x=document.getElementById('a');
+
+ SimpleTest.waitForExplicitFinish();
+
+ setTimeout(function() {
+ is(x.behavior, "scroll", "Wrong behavior value");
+ x.setAttribute('behavior', 'alternate');
+ is(x.behavior, "alternate", "Wrong behavior value");
+ x.setAttribute('behavior', 'invalid');
+ is(x.behavior, "scroll", "Wrong behavior value");;
+ x.setAttribute('behavior', 'Scroll');
+ is(x.behavior, "scroll", "Wrong behavior value");
+ x.setAttribute('behavior', 'Slide');
+ is(x.behavior, "slide", "Wrong behavior value");
+ x.setAttribute('behavior', '');
+ is(x.behavior, "scroll", "Wrong behavior value");
+ x.setAttribute('behavior', 'slide');
+ x.removeAttribute('behavior');
+ is(x.behavior, "scroll", "Wrong behavior value");
+ is(x.getAttribute('behavior'), null, "Wrong behavior attribute");
+
+ x.behavior = 'alternate';
+ is(x.behavior, "alternate", "Wrong behavior value");
+ x.behavior = 'invalid';
+ is(x.behavior, "scroll", "Wrong behavior value");
+ is(x.getAttribute('behavior'), "invalid", "Wrong behavior attribute");
+ x.behavior = 'Slide';
+ is(x.behavior, "slide", "Wrong behavior value");
+ is(x.getAttribute('behavior'), "Slide", "Wrong behavior attribute");
+ x.behavior = 'invalid';
+ is(x.behavior, "scroll", "Wrong behavior value");
+ x.behavior = null;
+ is(x.behavior, "scroll", "Wrong behavior value");
+ x.behavior = undefined;
+ is(x.behavior, "scroll", "Wrong behavior value");
+ is(x.getAttribute('behavior'), 'undefined', "Wrong behavior attribute");
+ // This doesn't work in Mozilla due to chrome XBL security issues
+ x.behavior = { toString: function _toString() { return "scroll"} }
+ is(x.behavior, x.getAttribute('behavior'), "Wrong behavior value");
+ x.behavior = 'scroll';
+ is(x.behavior, "scroll", "Wrong behavior value");
+
+ is(x.loop, -1, "Wrong loop value");
+ x.setAttribute('loop', '1');
+ is(x.loop, 1, "Wrong loop value");
+ x.setAttribute('loop', 'invalid');
+ is(x.loop, -1, "Wrong loop value");
+ x.setAttribute('loop', '');
+ is(x.loop, -1, "Wrong loop value");
+ x.setAttribute('loop', '0');
+ is(x.loop, -1, "Wrong loop value");
+ x.setAttribute('loop', '1000');
+ is(x.loop, 1000, "Wrong loop value");
+ x.setAttribute('loop', '-0.123');
+ is(x.loop, -1, "Wrong loop value");
+ x.setAttribute('loop', '-1.123');
+ is(x.loop, -1, "Wrong loop value");
+ x.setAttribute('loop', '-1');
+ is(x.loop, -1, "Wrong loop value");
+ x.setAttribute('loop', '1000');
+ is(x.loop, 1000, "Wrong loop value");
+ x.removeAttribute('loop');
+ is(x.loop, -1, "Wrong loop value");
+ is(x.getAttribute('loop'), null, "Wrong loop attribute");
+
+ x.loop = 1;
+ is(x.loop, 1, "Wrong loop value");
+ is(x.getAttribute('loop'), "1", "Wrong loop attribute");
+ try {
+ x.loop = -2;
+ todo_is(false, true, "marquee.loop = -2 should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.loop, 1, "Wrong loop value");
+ is(x.getAttribute('loop'), "1", "Wrong loop attribute");
+ try {
+ x.loop = 'invalid';
+ todo_is(false, true, ".loop = 'invalid' should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.loop, 1, "Wrong loop value");
+ is(x.getAttribute('loop'), "1", "Wrong loop attribute");
+ try {
+ x.loop = null;
+ todo_is(false, true, "marquee.loop = null should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.loop, 1, "Wrong loop value");
+ is(x.getAttribute('loop'), "1", "Wrong loop attribute");
+ x.loop = -1;
+ is(x.loop, -1, "Wrong loop value");
+ is(x.getAttribute('loop'), "-1", "Wrong loop attribute");
+ x.loop = '100';
+ is(x.loop, 100, "Wrong loop value");
+ is(x.getAttribute('loop'), "100", "Wrong loop attribute");
+ try {
+ x.loop = -0.123;
+ todo_is(false, true, "marquee.loop = -0.123 should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.loop, 100, "Wrong loop value");
+ is(x.getAttribute('loop'), "100", "Wrong loop attribute");
+ try {
+ x.loop = 0;
+ todo_is(false, true, "marquee.loop = 0 should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.loop, 100, "Wrong loop value");
+ is(x.getAttribute('loop'), "100", "Wrong loop attribute");
+ x.loop = -1.123;
+ is(x.loop, -1, "Wrong loop value");
+ is(x.getAttribute('loop'), "-1", "Wrong loop attribute");
+
+
+ is(x.scrollAmount, 6, "Wrong scrollAmount value");
+ x.setAttribute('scrollAmount', '1');
+ is(x.scrollAmount, 1, "Wrong scrollAmount value");
+ x.setAttribute('scrollAmount', 'invalid');
+ is(x.scrollAmount, 6, "Wrong scrollAmount value");
+ x.setAttribute('scrollAmount', '1000');
+ is(x.scrollAmount, 1000, "Wrong scrollAmount value");
+ x.setAttribute('scrollAmount', '-1');
+ is(x.scrollAmount, 6, "Wrong scrollAmount value");
+ x.setAttribute('scrollAmount', '999');
+ is(x.scrollAmount, 999, "Wrong scrollAmount value");
+ x.setAttribute('scrollAmount', '');
+ is(x.scrollAmount, 6, "Wrong scrollAmount value");
+ x.setAttribute('scrollAmount', '999');
+ x.removeAttribute('scrollAmount');
+ is(x.scrollAmount, 6, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), null, "Wrong scrollamount attribute");
+
+ x.scrollAmount = 1;
+ is(x.scrollAmount, 1, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "1", "Wrong scrollamount attribute");
+ x.scrollAmount = -2;
+ is(x.scrollAmount, 6, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "6", "Wrong scrollamount attribute");
+ x.scrollAmount = 'invalid';
+ is(x.scrollAmount, 0, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "0", "Wrong scrollamount attribute");
+ x.scrollAmount = 1;
+ x.scrollAmount = null;
+ is(x.scrollAmount, 0, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "0", "Wrong scrollamount attribute");
+ x.scrollAmount = '2';
+ is(x.scrollAmount, 2, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "2", "Wrong scrollamount attribute");
+
+ is(x.scrollDelay, 85, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', '1');
+ is(x.scrollDelay, 1, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', 'invalid');
+ is(x.scrollDelay, 85, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', '70');
+ is(x.scrollDelay, 70, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', '59');
+ is(x.scrollDelay, 59, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', '1000');
+ is(x.scrollDelay, 1000, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', '-1');
+ is(x.scrollDelay, 85, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', '');
+ is(x.scrollDelay, 85, "Wrong scrollDelay value");
+ x.setAttribute('scrollDelay', '1000');
+ x.removeAttribute('scrollDelay');
+ is(x.scrollDelay, 85, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), null, "Wrong scrolldelay attribute");
+
+ x.scrollDelay = 100;
+ is(x.scrollDelay, 100, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute");
+ x.scrollDelay = -2;
+ is(x.scrollDelay, 85, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "85", "Wrong scrolldelay attribute");
+ x.scrollDelay = 'invalid';
+ is(x.scrollDelay, 0, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "0", "Wrong scrolldelay attribute");
+ x.scrollDelay = null;
+ is(x.scrollDelay, 0, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "0", "Wrong scrolldelay attribute");
+ x.scrollDelay = -1;
+ is(x.scrollDelay, 85, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "85", "Wrong scrolldelay attribute");
+ x.scrollDelay = '50';
+ is(x.scrollDelay, 50, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "50", "Wrong scrolldelay attribute");
+
+
+ is(x.trueSpeed, false, "Wrong trueSpeed value");
+ x.setAttribute('trueSpeed', '1');
+ is(x.trueSpeed, true, "Wrong trueSpeed value");
+ x.setAttribute('trueSpeed', 'false');
+ is(x.trueSpeed, true, "Wrong trueSpeed value");
+ x.setAttribute('trueSpeed', '');
+ is(x.trueSpeed, true, "Wrong trueSpeed value");
+ x.removeAttribute('trueSpeed');
+ is(x.trueSpeed, false, "Wrong trueSpeed value");
+ is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute");
+
+ x.trueSpeed = 1;
+ is(x.trueSpeed, true, "Wrong trueSpeed value");
+ is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
+ x.trueSpeed = -2;
+ is(x.trueSpeed, true, "Wrong trueSpeed value");
+ is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
+ x.trueSpeed = null;
+ is(x.trueSpeed, false, "Wrong trueSpeed value");
+ is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute");
+ x.trueSpeed = '100';
+ is(x.trueSpeed, true, "Wrong trueSpeed value");
+ is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
+
+
+ is(x.direction, "left", "Wrong direction value");
+ x.setAttribute('direction', 'right');
+ is(x.direction, "right", "Wrong direction value");
+ x.setAttribute('direction', 'invalid');
+ is(x.direction, "left", "Wrong direction value");
+ x.setAttribute('direction', 'RIGHT');
+ is(x.direction, "right", "Wrong direction value");
+ x.setAttribute('direction', '');
+ is(x.direction, "left", "Wrong direction value");
+ x.setAttribute('direction', 'right');
+ x.removeAttribute('direction');
+ is(x.direction, "left", "Wrong direction value");
+ is(x.getAttribute('direction'), null, "Wrong direction attribute");
+ x.setAttribute('direction', 'up');
+ is(x.direction, "up", "Wrong direction value");
+ x.setAttribute('direction', 'down');
+ is(x.direction, "down", "Wrong direction value");
+ x.removeAttribute('direction');
+ is(x.direction, "left", "Wrong direction value");
+ is(x.getAttribute('direction'), null, "Wrong direction attribute");
+
+ x.direction = 'right';
+ is(x.direction, "right", "Wrong direction value");
+ is(x.getAttribute('direction'), "right", "Wrong direction attribute");
+ x.direction = 'up';
+ is(x.direction, "up", "Wrong direction value");
+ is(x.getAttribute('direction'), "up", "Wrong direction attribute");
+ x.direction = 'down';
+ is(x.direction, "down", "Wrong direction value");
+ is(x.getAttribute('direction'), "down", "Wrong direction attribute");
+ x.direction = 1;
+ is(x.direction, "left", "Wrong direction value");
+ is(x.getAttribute('direction'), "1", "Wrong direction attribute");
+ x.direction = null;
+ is(x.direction, "left", "Wrong direction value");
+ is(x.getAttribute('direction'), "null", "Wrong direction attribute");
+ // This doesn't work in Mozilla due to chrome XBL security issues
+ x.direction = { toString: function _toString() { return "right"} }
+ is(x.direction, x.getAttribute('direction'), "Wrong direction value");
+ x.direction = 'left';
+ is(x.direction, "left", "Wrong direction value");
+ SimpleTest.finish();
+ }, 0);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug1171215.html b/dom/tests/mochitest/bugs/test_bug1171215.html
new file mode 100644
index 0000000000..edd4f5d824
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1171215.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1022869
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1022869</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="text/javascript">
+
+ SimpleTest.waitForExplicitFinish();
+
+ /** Test for Bug 1022869 **/
+ async function startTest() {
+ // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
+ // Acquire storage access permission here so that the storage used to
+ // hold cookies with the opened windows works in xorigin tests. Otherwise,
+ // the iframe containing this page is isolated from first-party storage
+ // access, which denies access to the same cookie store
+ if (isXOrigin) {
+ SpecialPowers.wrap(document).notifyUserGestureActivation();
+ await SpecialPowers.addPermission(
+ "storageAccessAPI",
+ true,
+ window.location.href
+ );
+ await SpecialPowers.wrap(document).requestStorageAccess();
+ }
+ // Initialize our cookie.
+ document.cookie = "a=b";
+
+ let w = window.open("window_bug1171215.html");
+ onmessage = e => {
+ if (e.data.type == "finish") {
+ w.close();
+ SpecialPowers.clearUserPref("network.cookie.sameSite.laxByDefault");
+ SimpleTest.finish();
+ return;
+ }
+
+ if (e.data.type == "info") {
+ info(e.data.msg);
+ return;
+ }
+
+ if (e.data.type == "test") {
+ ok(e.data.test, e.data.msg);
+ return;
+ }
+
+ ok(false, "Unknown message");
+ };
+ }
+
+ // Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default"
+ SpecialPowers.pushPrefEnv({ set: [["network.cookie.cookieBehavior", 1], ["network.cookie.sameSite.laxByDefault", false]] })
+ .then(startTest);
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1022869">Mozilla Bug 1022869</a>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug132255.html b/dom/tests/mochitest/bugs/test_bug132255.html
new file mode 100644
index 0000000000..31a4016285
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug132255.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=132255
+-->
+<head>
+ <title>Test for Bug 132255</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <base href="http://mochi.test:8888/tests/dom/tests/mochitest/">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=132255">Mozilla Bug 132255</a>
+<p id="display">
+ <iframe src="javascript:'<a href=\'foo.html\'>test-anchor</a>'"></iframe>
+ <iframe src="javascript:'<base href=\'http://example.com/\'><a href=\'foo.html\'>test-anchor</a>'"></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 132255 **/
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function() {
+ is(window.frames[0].document.links[0].href,
+ window.location.href.replace(/\?.*/, "")
+ .replace(/bugs\/test_bug132255\.html/, "foo.html"),
+ "Unexpected anchor href");
+ is(window.frames[1].document.links[0].href,
+ "http://example.com/foo.html",
+ "Unexpected anchor href when base set");
+})
+addLoadEvent(SimpleTest.finish);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug1530292.html b/dom/tests/mochitest/bugs/test_bug1530292.html
new file mode 100644
index 0000000000..3761c21cd1
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1530292.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1530292
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1530292</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 1530292 **/
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(() => {
+ // This is really a crashtest, but we need some cross-origin (and hence
+ // cross-compartment) windows to test it, so can't use the crashtest
+ // harness.
+ try {
+ ({} instanceof frames[0]);
+ ok(false, "Should have thrown for same-process window");
+ } catch (e) {
+ is(e.message, "frames[0] is not a function", "frames[0] is not a function");
+ }
+ try {
+ ({} instanceof frames[1]);
+ ok(false, "Should have thrown for maybe other-process window");
+ } catch (e) {
+ is(e.message, "frames[1] is not a function", "frames[1] is not a function");
+ }
+ SimpleTest.finish();
+ });
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1530292">Mozilla Bug 1530292</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <!-- Cross-origin but same-site; must be same-process -->
+ <iframe src="//test1.mochi.test:8888/tests/dom/tests/mochitest/bugs/file_empty.html"></iframe>
+ <!-- Completely cross-origin; might be cross-process -->
+ <iframe src="//example.org/tests/dom/tests/mochitest/bugs/file_empty.html"></iframe>
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug1551425_reference_to_childnodes_nodelist_keeps_childnodes_alive.html b/dom/tests/mochitest/bugs/test_bug1551425_reference_to_childnodes_nodelist_keeps_childnodes_alive.html
new file mode 100644
index 0000000000..be2e297f17
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1551425_reference_to_childnodes_nodelist_keeps_childnodes_alive.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1551425
+-->
+<head>
+ <meta charset="utf-8">
+ <title>
+ Test for bug 1551425: check reference to childNodes' NodeList keeps the
+ child nodes alive.
+ </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1551425">Mozilla bug 1551425</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <div id="d"><div>d2</div></div>
+</div>
+
+<pre id="test">
+ <script>
+ var d = document.getElementById("d");
+
+ // Get childNodes, don't keep reference to parent.
+ var childNodes = d.cloneNode(true).childNodes;
+
+ // Trigger GC to remove the cloned node.
+ SpecialPowers.gc();
+
+ is(childNodes.length, 1);
+ is(childNodes[0].textContent, "d2");
+ </script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug159849.html b/dom/tests/mochitest/bugs/test_bug159849.html
new file mode 100644
index 0000000000..0cb1c07bdf
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug159849.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=159849
+-->
+<head>
+ <title>Test for Bug 159849</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159849">Mozilla Bug 159849</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 159849 **/
+function testFunc() {
+}
+
+var c = $("content");
+// Intentionally testing the 'with' statement.
+/* eslint-disable-next-line no-with */
+with (c) {
+ onmouseover = testFunc;
+ fooExpando = testFunc;
+}
+
+is(c.onmouseover, testFunc, "Event handler should have been set on node");
+ok(c.fooExpando === undefined,
+ "Expando should not have been set on node - " +
+ "got " + repr(c.fooExpando) + ", expected undefined");
+ok(window.onmouseover === null,
+ "Event handler should not have been set on window - " +
+ "got " + repr(window.onmouseover) + ", expected undefined");
+is(window.fooExpando, testFunc, "Expando should have been set on window");
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug1774135.html b/dom/tests/mochitest/bugs/test_bug1774135.html
new file mode 100644
index 0000000000..6d511e75ec
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1774135.html
@@ -0,0 +1,114 @@
+<!DOCTYPE HTML>
+<html>
+<meta charset="utf-8">
+<title>Test for Bug 1774135</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+<style>
+ .split {
+ width: 299px;
+ display: flex;
+ background: red; /* so we can see if it's visible. It should NOT be visible */
+ }
+ .split>* {
+ flex: 1 1 auto;
+ height: 50px;
+ }
+ .left {
+ background: pink;
+ }
+ .middle {
+ background: lightgreen;
+ }
+ .right {
+ background: lightblue;
+ }
+</style>
+<script>
+ function WidthTracker(observed) {
+ this._observer = new ResizeObserver(this._handleNotification.bind(this));
+ this._observed = observed;
+ }
+
+ WidthTracker.prototype = {
+ _handleNotification(entries) {
+ for (let entry of entries) {
+ this._elemToWidth.set(
+ entry.target,
+ entry.devicePixelContentBoxSize[0].inlineSize
+ );
+ }
+ for (let elem of this._observed) {
+ if (!this._elemToWidth.has(elem)) {
+ return;
+ }
+ }
+ // Note(dshin): Wait a tick - we need to let the resize observer loop exit
+ // and avoid resize loop error.
+ const resolve = this._resolve;
+ const result = new Map(this._elemToWidth);
+ this._observer.disconnect();
+ delete this._resolve;
+ delete this._elemToWidth;
+ window.requestAnimationFrame(function() {
+ resolve(result);
+ });
+ },
+ start() {
+ this._elemToWidth = new Map();
+ for (const elem of this._observed) {
+ this._observer.observe(elem);
+ }
+ return new Promise(res => { this._resolve = res; });
+ },
+ };
+ async function run_test(tracker, container, children, relativeZoom) {
+ SpecialPowers.setFullZoom(window, relativeZoom);
+ let result = await tracker.start(Array.from(children).concat([container]));
+ let observedChildrenWidths = 0;
+ for (const child of children) {
+ observedChildrenWidths += result.get(child);
+ }
+ let containerWidth = result.get(container);
+ is(observedChildrenWidths, containerWidth, "Combined widths of children == container width");
+ }
+
+ const originalZoom = SpecialPowers.getFullZoom(window);
+ let tracker;
+ let container;
+ let children;
+
+ const zoomsToTest = [
+ 300,
+ 240,
+ 200,
+ 170,
+ 150,
+ 133,
+ 120,
+ 110,
+ 100,
+ 90,
+ 80,
+ 67,
+ 50,
+ 30,
+ ];
+
+ add_task(async () => {
+ container = document.querySelector('.split');
+ children = document.querySelectorAll('.split>*');
+ tracker = new WidthTracker(Array.from(children).concat([container]));
+ });
+ for (let i = 0; i < zoomsToTest.length; ++i) {
+ let relativeZoom = originalZoom * zoomsToTest[i] / 100;
+ add_task(async () => { await run_test(tracker, container, children, relativeZoom); });
+ }
+ add_task(async () => { SpecialPowers.setFullZoom(window, originalZoom); });
+</script>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1774135">Mozilla Bug 1774135</a>
+<div class="split">
+ <div class="left"></div>
+ <div class="middle"></div>
+ <div class="right"></div>
+</div>
diff --git a/dom/tests/mochitest/bugs/test_bug260264.html b/dom/tests/mochitest/bugs/test_bug260264.html
new file mode 100644
index 0000000000..9259320b4b
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug260264.html
@@ -0,0 +1,198 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=260264
+-->
+<head>
+ <title>Test for Bug 260264</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="utils_bug260264.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=260264">Mozilla Bug 260264</a>
+<p id="display">
+ <a id="link" href="javascript:(function(){})()">link</a>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 260264 **/
+
+SimpleTest.requestFlakyTimeout("untriaged");
+
+var a = $("link"),
+ checkOpened = function() { ok(window.open("http://example.com"), "not properly opened") },
+ checkBlocked = function() { ok(!window.open("http://example.com"), "not properly blocked") };
+
+add_task(async function check_sanity() {
+ await new Promise(resolve => setTimeout(resolve, 200));
+
+ await SpecialPowers.pushPermissions([{'type': 'popup', 'remove': true, 'context': document}]);
+ ok(await SpecialPowers.testPermission('popup', UNKNOWN_ACTION, document), 'popup value should have UNKNOWN permission');
+
+ await SpecialPowers.pushPermissions([{'type': 'popup', 'allow': true, 'context': document}]);
+ ok(await SpecialPowers.testPermission('popup', ALLOW_ACTION, document), 'popup value should have ALLOW permission');
+
+ await SpecialPowers.pushPrefEnv({"set": [["dom.disable_open_during_load", true],
+ ["dom.popup_allowed_events", "click mouseup"],
+ ["dom.popup_maximum", 3]]});
+
+ // Note: UNKNOWN_ACTION is the same as DENY_ACTION.
+ await SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION, 'context': document}]);
+});
+
+add_task(async function run_tests() {
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ await window.open.close();
+
+ await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]});
+});
+
+add_task(async function run_tests2() {
+ for (var count = 0, n = 0; n < 3; n++) {
+ send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
+ }
+ send(a, "mouseup", checkBlocked);
+
+ await window.open.close(1);
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkBlocked);
+ send(a, "mouseup", checkBlocked);
+
+ await window.open.close();
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0) {
+ send(a, "mouseup", checkOpened);
+ }
+ send(a, "mouseup", checkBlocked);
+
+ await window.open.close();
+ await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]});
+});
+
+add_task(async function run_tests3() {
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close();
+ await SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}]);
+ await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]});
+});
+
+add_task(async function run_tests4() {
+ var count;
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+
+ await window.open.close();
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkOpened);
+
+ await window.open.close();
+ for (count = 0, n = 0; n < 3; n++) {
+ send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
+ }
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close(1);
+ send(a, "mouseover", checkOpened);
+ send(a, "mouseover", checkBlocked);
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close();
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0) {
+ send(a, "mouseover", checkOpened);
+ }
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close();
+ await SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events", "click"]]});
+});
+
+add_task(async function run_tests5() {
+ await SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION, 'context': document}]);
+});
+
+add_task(async function run_tests6() {
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+
+ await window.open.close();
+ await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]});
+});
+
+add_task(async function run_tests7() {
+ send(a, "mouseup", checkBlocked);
+
+ await window.open.close();
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close();
+ await SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}]);
+ await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]});
+});
+
+add_task(async function run_tests8() {
+ var count;
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+
+ await window.open.close();
+ for (count = 0, n = 0; n < 3; n++) {
+ send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
+ }
+ send(a, "mouseup", checkBlocked);
+
+ await window.open.close(1);
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkBlocked);
+ send(a, "mouseup", checkBlocked);
+
+ await window.open.close();
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0) {
+ send(a, "mouseup", checkOpened);
+ }
+ send(a, "mouseup", checkBlocked);
+
+ await window.open.close();
+ for (count = 0, n = 0; n < 3; n++) {
+ send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
+ }
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close(1);
+ send(a, "mouseover", checkOpened);
+ send(a, "mouseover", checkBlocked);
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close();
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0) {
+ send(a, "mouseover", checkOpened);
+ }
+ send(a, "mouseover", checkBlocked);
+
+ await window.open.close();
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug260264_nested.html b/dom/tests/mochitest/bugs/test_bug260264_nested.html
new file mode 100644
index 0000000000..1021220275
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug260264_nested.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=260264
+-->
+<head>
+ <title>Test for Bug 260264</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="utils_bug260264.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=260264">Mozilla Bug 260264</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 260264 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function makeIframe(aEvent) {
+ var tempURL = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')+1);
+ tempURL = 'http://example.com' + tempURL + "child_bug260264.html#" + aEvent;
+ $("display").appendChild(document.createElement("iframe")).src = tempURL;
+}
+
+function test_nested_frames() {
+ SpecialPowers.pushPrefEnv({"set": [["dom.disable_open_during_load", true]]}, test_nested_frames2);
+}
+
+function test_nested_frames2() {
+ // Grandchild will use this name to refer to the current window:
+ window.name = "parent260264";
+
+ if (tests[0]) {
+ tests[0].setup(function() {makeIframe(tests[0].event);});
+ } else {
+ ok(false, "There should have run 8 tests here");
+ SimpleTest.finish();
+ }
+}
+
+function should_have_blocked(popup) {
+ ok(!popup, "popup should have been blocked");
+}
+
+function should_not_have_blocked(popup) {
+ ok(popup, "popup should not have been blocked");
+}
+
+function setupPP(aAllowedEvents, aPopup1, aPopup2, aNext) {
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events", aAllowedEvents]]}, function() {
+ SpecialPowers.pushPermissions([{'type': 'popup', 'allow': aPopup1, 'context': document},
+ {'type': 'popup', 'allow': aPopup2, 'context': 'http://example.com'}], aNext);
+ });
+}
+
+/**
+ * The example_priv (DENY_ACTION) parameter controls whether or not the child frame has
+ * popup clearance. Neither the top window nor the grandchild frame have
+ * this clearance. The point of these tests is to make sure the child's
+ * clearance (or lack thereof) is properly considered when opening a popup
+ * from the grandchild.
+*/
+
+var tests = [
+ { event: "mouseup",
+ setup(aNext) {
+ setupPP("click mouseup", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "mouseup",
+ setup(aNext) {
+ setupPP("click mouseup", ALLOW_ACTION, ALLOW_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "mouseup",
+ setup(aNext) {
+ setupPP("click", ALLOW_ACTION, ALLOW_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "mouseup",
+ setup(aNext) {
+ setupPP("click", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_have_blocked
+ },
+ { event: "mouseover",
+ setup(aNext) {
+ setupPP("click mouseup", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_have_blocked
+ },
+ { event: "mouseover",
+ setup(aNext) {
+ setupPP("click mouseup", ALLOW_ACTION, ALLOW_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "click",
+ setup(aNext) {
+ setupPP("click mouseup", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "click",
+ setup(aNext) {
+ setupPP("click mouseup", ALLOW_ACTION, ALLOW_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ }
+];
+
+// Visible to child windows:
+function report(popup) {
+ tests[0].report(popup);
+ tests.shift();
+
+ if (tests[0]) {
+ tests[0].setup(function() {makeIframe(tests[0].event);});
+ } else {
+ SimpleTest.finish();
+ }
+}
+
+test_nested_frames();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug265203.html b/dom/tests/mochitest/bugs/test_bug265203.html
new file mode 100644
index 0000000000..94f56c0164
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug265203.html
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=265203
+-->
+<head>
+ <title>Test for Bug 265203</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=265203">Mozilla Bug 265203</a>
+<p id="display">
+<a id="a1" href="http://www.mozilla.org">Mozilla</a><a id="a2"
+ href="http://www.mozilla.org/products/firefox">Firefox</a><br>
+<br>
+<table cellpadding="2" cellspacing="2" border="1"
+ style="text-align: left; width: 100%;">
+ <tbody>
+
+ <tr>
+ <td style="vertical-align: top;"><a id="a3" href="http://www.mozilla.org">Mozilla</a></td>
+ <td style="vertical-align: top;"><a
+ href="http://www.mozilla.org/products/firefox">Firefox</a></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top;"><a href="http://www.mozilla.org">Mozilla</a></td>
+ <td style="vertical-align: top;"><a
+ href="http://www.mozilla.org/products/firefox">Firefox</a></td>
+
+ </tr>
+ </tbody>
+</table>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 265203 **/
+var gTestStarted = false;
+var expectedResult = [ null, 0, null ];
+var nextTest;
+var test = 0;
+
+function testFocus() {
+ var selection = window.getSelection()
+ is(selection.focusNode, expectedResult[0],"test" + test + ": " + "caret node");
+ is(selection.focusOffset, expectedResult[1],"test" + test + ": " + "caret offset");
+ is(document.activeElement, expectedResult[2],"test" + test + ": " + "focused node");
+ ++test;
+ if (nextTest)
+ nextTest();
+}
+
+function test0() {
+ $("a1").focus();
+ expectedResult = [ $("a1"), 0, $("a1") ]
+ nextTest = test1;
+ testFocus();
+}
+function test1() {
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ expectedResult = [ $("a1").firstChild, 7, $("a2") ]
+ nextTest = test2;
+ testFocus();
+}
+function test2() {
+ $("a3").focus();
+ expectedResult = [ $("a3"), 0, $("a3") ]
+ nextTest = test3;
+ testFocus();
+}
+function test3() {
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ expectedResult = [ $("a3").firstChild, 7, $("a3") ]
+ nextTest = SimpleTest.finish;
+ testFocus();
+}
+
+function startTest() {
+ if (gTestStarted)
+ return;
+ gTestStarted = true;
+ SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true]]}, test0);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(startTest);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug289714.html b/dom/tests/mochitest/bugs/test_bug289714.html
new file mode 100644
index 0000000000..11d28347ef
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug289714.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=289714
+-->
+<head>
+ <title>Test for Bug 289714</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=289714">Mozilla Bug 289714</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+let xhr = new XMLHttpRequest(),
+ expectedResponseText = "<?xml version='1.0' encoding='shift-jis'?><xml>" +
+ (new Array(1 << 13)).join("こんにちは") +
+ "</xml>";
+xhr.open("GET", "bug289714.sjs");
+xhr.onprogress = function() {
+ let text = xhr.responseText;
+ is(text, expectedResponseText.substring(0, text.length),
+ "Data before OnStopRequest is decoded properly");
+ xhr.onprogress = undefined;
+}
+xhr.onload = xhr.onerror = function() {
+ is(xhr.responseText, expectedResponseText,
+ "Final response is decoded properly");
+ SimpleTest.finish();
+}
+xhr.send();
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug291377.html b/dom/tests/mochitest/bugs/test_bug291377.html
new file mode 100644
index 0000000000..321fdf7571
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug291377.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=291377
+-->
+<head>
+ <title>Test for Bug 291377</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=291377">Mozilla Bug 291377</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/** Test for Bug 291377 **/
+/* Do something that causes an XPConnect exception */
+var threw = true;
+try {
+ window.location.port = -2;
+ threw = false;
+} catch (e) {
+ /* Check that we can touch various properties */
+ isnot(e.lineNumber, undefined, "Unexpected line number"); //This line number is dependent on the implementation of the SpecialPowers API
+ is(e.name, "NS_ERROR_MALFORMED_URI", "Unexpected exception name");
+ is(e.message, "", "Should not have a message for this case");
+ isnot(e.result, 0, "Should have a result");
+
+ is(e.result, SpecialPowers.Cr.NS_ERROR_MALFORMED_URI);
+}
+
+is(threw, true, "We need a different testcase for XPConnect exceptions?");
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug304459.html b/dom/tests/mochitest/bugs/test_bug304459.html
new file mode 100644
index 0000000000..766ae4a284
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug304459.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=304459
+-->
+<head>
+ <title>Test for Bug 304459</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=304459">Mozilla Bug 304459</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <iframe id="frame"></iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 304459 **/
+
+function iframeLoaded()
+{
+ var frame = document.getElementById("frame");
+ frame.onload = undefined;
+ frame.src = "http://example.org/tests/dom/tests/mochitest/bugs/iframe_bug304459-2.html";
+}
+
+function receiveMessage(evt)
+{
+ ok(evt.data, "Prototype leaks across navigation");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+window.addEventListener("message", receiveMessage);
+
+var frame = document.getElementById("frame");
+frame.onload = iframeLoaded;
+frame.src = "iframe_bug304459-1.html"
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug308856.html b/dom/tests/mochitest/bugs/test_bug308856.html
new file mode 100644
index 0000000000..b954a63a1c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug308856.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=308856
+-->
+<head>
+ <title>Test for Bug 308856</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=308856">Mozilla Bug 308856</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 308856 **/
+
+var monkey = 12;
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function() {
+ is(12,window.monkey,"Window global is correct value");
+ var found = false;
+ for (var p in window) {
+ if (p == "monkey") {
+ found = true;
+ }
+ }
+ ok(found, "Global js variables show up when enumerating [Window]");
+});
+addLoadEvent(SimpleTest.finish);
+
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug327891.html b/dom/tests/mochitest/bugs/test_bug327891.html
new file mode 100644
index 0000000000..4e2e95ea61
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug327891.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=327891
+-->
+<head>
+ <title>Test for Bug 327891</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=327891">Mozilla Bug 327891</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var pass = false;
+
+try {
+ new HTMLDocument();
+} catch(e) {
+ pass = true;
+}
+
+ok(pass, "new HTMLDocument() should have thrown");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug333983.html b/dom/tests/mochitest/bugs/test_bug333983.html
new file mode 100644
index 0000000000..c3ace11dbc
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug333983.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=333983
+-->
+<head>
+ <title>Test for Bug 333983</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333983">Mozilla Bug 333983</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 333983 **/
+HTMLElement.prototype.foopy = function () { return "foopy"; }
+
+var foopy = "";
+try {
+ foopy = document.body.foopy()
+} catch (ex) {
+ foopy = ex + "";
+}
+
+is(foopy, "foopy", "HTMLElement.prototype functions work");
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug335976.xhtml b/dom/tests/mochitest/bugs/test_bug335976.xhtml
new file mode 100644
index 0000000000..e5c1e3330c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug335976.xhtml
@@ -0,0 +1,68 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=335976
+-->
+<head>
+ <title>Test for Bug 335976</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=335976">Mozilla Bug 335976</a>
+<p id="display"></p>
+
+<iframe srcdoc="&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;body&gt; &lt;input&gt; &lt;/body&gt;&lt;/html&gt;" style="width: 95%; height: 150px;"></iframe>
+
+<div id="rootish" style="background: yellow">
+ <div>
+ <input/>
+ </div>
+</div>
+
+
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+<![CDATA[
+
+function lookAtTextboxesIn(root, numExpected)
+{
+ var textboxes = root.getElementsByTagName("input");
+ var threw;
+ var i;
+ var n;
+
+ for (i = 0; n = textboxes[i]; ++i) {
+ threw = true;
+ try { n.nodeType; threw = false; } catch(e) { }
+ ok(!threw, "n.nodeType threw");
+ }
+
+ ok(textboxes.length == numExpected, "Wrong number of textboxes");
+}
+
+function init()
+{
+ // Look at the textbox in the yellow div.
+ lookAtTextboxesIn(document.getElementById('rootish'), 1);
+
+ // Move the yellow div into the iframe.
+ var nd = window.frames[0].document;
+ nd.body.appendChild(nd.adoptNode(document.getElementById('rootish')));
+
+ // Look at the textboxes in the iframe.
+ lookAtTextboxesIn(window.frames[0].document.body, 2);
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(init);
+
+]]>
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug342448.html b/dom/tests/mochitest/bugs/test_bug342448.html
new file mode 100644
index 0000000000..5fd35c1f0f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug342448.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=342448
+-->
+<head>
+ <title>Test for Bug 342448</title>
+ <script type="text/javascript" src="/MochiKit/Base.js"></script>
+ <script type="text/javascript" src="/MochiKit/Async.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=342448">Mozilla Bug 342448</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 342448 **/
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+try {
+setTimeout(1, 0);
+} catch (ex) {}
+callLater(.1, function() { ok(true, "shouldn't crash when passing a number as the first arg to setTimeout"); SimpleTest.finish(); })
+
+
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug345521.html b/dom/tests/mochitest/bugs/test_bug345521.html
new file mode 100644
index 0000000000..8a396f0d1e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug345521.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=345521
+-->
+<head>
+ <title>Test for Bug 345521</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=345521">Mozilla Bug 345521</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <a id="testlink" onclick="return 0">test</a><br />
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 345521 **/
+function hitlink() {
+ var evt = document.createEvent("MouseEvents");
+ evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ var isOk = $("testlink").dispatchEvent(evt);
+ ok(isOk, "return 0 should not cancel an event");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(hitlink);
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug346659.html b/dom/tests/mochitest/bugs/test_bug346659.html
new file mode 100644
index 0000000000..20684fa32d
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug346659.html
@@ -0,0 +1,207 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=346659
+-->
+<head>
+ <title>Test for Bug 346659</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=346659">Mozilla Bug 346659</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 346659 **/
+var numTests = 10;
+SimpleTest.requestLongerTimeout(2); // test takes a long time on android and b2g emulators
+SimpleTest.waitForExplicitFinish();
+
+var wins = [];
+
+function r(base, tail) {
+ return base.replace(/\/[^\/]*$/, "/" + tail);
+}
+
+/**
+ * This function sets up the test according to the data it receives. If the data
+ * is a JSON string, it will use the object parsed from that to determine how to
+ * set up the test.
+ */
+async function handleCmd(evt) {
+ var cmd;
+ try {
+ cmd = JSON.parse(evt.data);
+ } catch (e) {
+ // Not json, so it should be a test result. We don't need to set up test.
+ return false;
+ }
+
+ if ("load" in cmd) {
+ var testNum = cmd.load;
+
+ // Set up the testing window property and get necessary information from it.
+ // We use SpecialPowers.spawn() here since the testing window could be cross
+ // origin.
+ var { isOpenerTest, location } =
+ await SpecialPowers.spawn(wins[testNum], [testNum], testNum => {
+ var win = content.wrappedJSObject;
+ win.childWin.x = testNum;
+
+ return {
+ isOpenerTest: win.childWin.opener == win,
+ location: content.location.href,
+ };
+ });
+
+ // Get the test location according to the test.
+ if (isOpenerTest) {
+ if ("xsite" in cmd) {
+ var loc = r(window.location.href, "bug346659-opener-echoer.html?" + testNum);
+ } else {
+ var loc = r(location, "bug346659-opener-echoer.html?" + testNum);
+ }
+ } else {
+ if ("xsite" in cmd) {
+ var loc = r(window.location.href, "bug346659-parent-echoer.html?" + testNum);
+ } else {
+ var loc = r(location, "bug346659-parent-echoer.html?" + testNum);
+ }
+ }
+
+ // Trigger the loading on the child window of the testing window.
+ await SpecialPowers.spawn(wins[testNum], [loc], loc => {
+ content.wrappedJSObject.childWin.location.href = loc;
+ });
+ wins[testNum] = null;
+ } else if ("write" in cmd) {
+ var testNum = cmd.write;
+
+ try {
+ // Set up the test on the testing window.
+ await SpecialPowers.spawn(wins[testNum], [testNum], testNum => {
+ var win = content.wrappedJSObject;
+ win.childWin.x = testNum;
+
+ // Test document.write().
+ if (win.childWin.opener == win) {
+ win.childWin.document.write(`
+ <script>
+ window.opener.opener.postMessage("${testNum} - " + window.x, "http://mochi.test:8888/");
+ window.opener.close();
+ window.close();
+ <` + '/script>');
+ } else {
+ win.childWin.document.write(`
+ <script>
+ window.parent.opener.postMessage("${testNum} - " + window.x, "http://mochi.test:8888/");
+ window.parent.close();
+ <` + '/script>');
+ }
+ });
+ } catch (e) {
+ if (e.name != "SecurityError" || e.code != 18) {
+ throw e;
+ }
+ // Security error on cross-site write() is fine
+ await SpecialPowers.spawn(wins[testNum], [], () => {
+ var win = content.wrappedJSObject;
+ if (win.childWin.opener == win) {
+ win.childWin.close();
+ }
+ });
+
+ handleTestEnd();
+ }
+ wins[testNum] = null;
+ }
+ return true;
+}
+
+async function messageReceiver(evt) {
+ // First try to detect a load/write command
+ if (await handleCmd(evt)) {
+ return;
+ }
+
+ var testNumber = parseInt(evt.data);
+ var testResult = evt.data.substring(3 + Math.floor(Math.log(testNumber) * Math.LOG10E + 1));
+
+ switch (testNumber) {
+ case 1:
+ is(testResult, "1", "Props on new window should be preserved when loading");
+ break;
+ case 2:
+ is(testResult, "2", "Props on new window should be preserved when writing");
+ break;
+ case 3:
+ is(testResult, "3", "Props on window opened from new window should be preserved when loading");
+ break;
+ case 4:
+ is(testResult, "4", "Props on window opened from new window should be preserved when writing");
+ break;
+ case 5:
+ is(testResult, "undefined", "Props on new window's child should go away when loading");
+ break;
+ case 6:
+ is(testResult, "6", "Props on new window's child should not go away when writing");
+ break;
+ case 7:
+ is(testResult, "7", "Props on different-domain window opened from different-domain new window can stay");
+ break;
+ case 9:
+ is(testResult, "undefined", "Props on different-domain new window's child should go away when loading");
+ break;
+ case 11:
+ is(testResult, "undefined", "Props on same-domain window opened from different-domain new window should go away when loading");
+ break;
+ case 12:
+ is(testResult, "undefined", "Props on different-domain new window's same-domain child should go away when loading");
+ break;
+ default:
+ ok(0, "unexpected test number (" + testNumber + ") when data is " + evt.data);
+ }
+
+ handleTestEnd();
+}
+
+function handleTestEnd() {
+ if (!--numTests) {
+ SimpleTest.finish();
+ }
+}
+window.addEventListener("message", messageReceiver);
+
+var win = window.open("");
+win.x = 1;
+win.location.href = "bug346659-echoer.html";
+
+win = window.open("");
+win.x = 2;
+win.document.write('<script> window.opener.postMessage("2 - " + window.x, window.location.href); window.close(); </' + 'script>');
+
+wins[3] = window.open('bug346659-opener.html?{"load":3}');
+wins[4] = window.open('bug346659-opener.html?{"write":4}');
+wins[5] = window.open('bug346659-parent.html?{"load":5}');
+wins[6] = window.open('bug346659-parent.html?{"write":6}');
+
+is(location.host, "mochi.test:8888", "Unexpected host");
+
+SpecialPowers.pushPrefEnv({"set": [["dom.security.https_first", false]]}, function() {
+ var baseurl = window.location.href.replace(/mochi\.test:8888/, "example.com");
+ wins[7] = window.open(r(baseurl, 'bug346659-opener.html?{"load":7}'));
+ wins[9] = window.open(r(baseurl, 'bug346659-parent.html?{"load":9}'));
+
+ wins[11] = window.open(r(baseurl, 'bug346659-opener.html?{"load":11,"xsite":true}'));
+ wins[12] = window.open(r(baseurl, 'bug346659-parent.html?{"load":12,"xsite":true}'));
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug369306.html b/dom/tests/mochitest/bugs/test_bug369306.html
new file mode 100644
index 0000000000..596a74f3bb
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug369306.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=369306
+-->
+<head>
+ <title>Test for Bug 369306</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=369306">Mozilla Bug 369306</a>
+<p id="display"></p>
+<div id='content'>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 369306 **/
+
+var originatingWindow = self;
+
+function focusShouldNotChange(aAction, nextTest)
+{
+ var w = window.open('about:blank', '', 'foo');
+ var fail = false;
+
+ SimpleTest.waitForFocus(function () {
+ function failHandler() { fail = true; }
+
+ originatingWindow.addEventListener("focus", failHandler);
+ w.addEventListener("blur", failHandler);
+
+ aAction(w);
+
+ SimpleTest.executeSoon(function () {
+ originatingWindow.removeEventListener("focus", failHandler);
+ w.removeEventListener("blur", failHandler);
+
+ ok(!fail, "The focus should not have been changed!");
+
+ // Cleaning and running next test.
+ w.close();
+ SimpleTest.waitForFocus(nextTest, originatingWindow);
+ });
+ }, w, true);
+}
+
+function focusShouldNotChange2(aURL, nextTest)
+{
+ var w = window.open(aURL, '', 'foo');
+ var fail = false;
+
+ SimpleTest.waitForFocus(function () {
+ function failHandler() { fail = true; }
+
+ originatingWindow.addEventListener("focus", failHandler);
+ w.addEventListener("blur", failHandler);
+
+ /**
+ * NOTE: This setTimeout can cause a random green.
+ * onload handler + executeSoon doesn't work too so we have to use setTimeout.
+ * The check may be call before w script being executed but that would make
+ * this check green even if it should be orange.
+ */
+ setTimeout(function () {
+ originatingWindow.removeEventListener("focus", failHandler);
+ w.removeEventListener("blur", failHandler);
+
+ ok(!fail, "The focus should not have been changed with URL=" + aURL);
+
+ // Cleaning and running next test.
+ w.close();
+ SimpleTest.waitForFocus(nextTest, originatingWindow);
+ }, 1000);
+ }, w);
+}
+
+function test1()
+{
+ focusShouldNotChange(function (aW) { aW.blur(); }, test2);
+}
+
+function test2()
+{
+ focusShouldNotChange(function () { originatingWindow.focus(); }, test3);
+}
+
+function test3()
+{
+ focusShouldNotChange2("test1_bug369306.html", test4);
+}
+
+function test4()
+{
+ focusShouldNotChange2("test2_bug369306.html", test5);
+}
+
+function test5()
+{
+ var w = window.open('about:blank', '', 'foo');
+
+ SimpleTest.waitForFocus(function () {
+ SimpleTest.waitForFocus(function () {
+ SimpleTest.waitForFocus(function () {
+ ok(true, "The last opened window should be able to get focus");
+ w.close();
+ SimpleTest.executeSoon(SimpleTest.finish);
+ }, w, true);
+
+ w.focus();
+ }, originatingWindow);
+
+ SimpleTest.executeSoon(function() {
+ // We have to focus back the originating window but we can't do that with
+ // .focus() or .blur() anymore.
+ SpecialPowers.focus(window);
+ });
+ }, w, true);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+function startTest() {
+ // dom.disable_window_flip has to be set to true for this test.
+ SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_flip", true]]}, test1);
+}
+
+// startTest is going to call the next tests.
+SimpleTest.waitForFocus(startTest);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug370098.html b/dom/tests/mochitest/bugs/test_bug370098.html
new file mode 100644
index 0000000000..29614a4372
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug370098.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=370098
+-->
+<head>
+ <title>Test for Bug 370098</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=370098">Mozilla Bug 370098</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/** Test for Bug 370098 **/
+function test_constructor(dom_proto, shouldthrow) {
+ var threw = false;
+ try {
+ window[dom_proto]();
+ } catch (e) {
+ threw = true;
+ }
+ // XSLTProcessor is still on the old bindings.
+ if (dom_proto != 'XSLTProcessor')
+ ok(threw, "Calling |" + dom_proto + "()| should always throw");
+
+ threw = false;
+ try {
+ new window[dom_proto]();
+ } catch (e) {
+ threw = true;
+ }
+ is(threw, shouldthrow, "Calling |new " + dom_proto + "()| should" + (shouldthrow ? " " : " not ") + "throw");
+}
+var dom_protos = [ "Element" ];
+var dom_constructors = [ "Document", "Image", "DOMParser", "XMLSerializer",
+ "XMLHttpRequest", "XPathEvaluator", "XSLTProcessor" ];
+dom_protos.forEach(
+ function(p) { test_constructor(p, true); });
+dom_constructors.forEach(
+ function(p) { test_constructor(p, false); });
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug377539.html b/dom/tests/mochitest/bugs/test_bug377539.html
new file mode 100644
index 0000000000..50148e77b5
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug377539.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=377539
+-->
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Testcase for bug 377539</title>
+
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=377539">Mozilla Bug 377539</a>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+
+<script type="text/javascript">
+var sw;
+var child_sw = -1;
+
+function test(){
+ var t = '<div style="display: none;"><iframe onload="doChecks()" srcdoc="<body><scr'+'ipt>try {parent.child_sw=screen.width}catch(e){}</scr'+'ipt>"></iframe></div>';
+ var div = document.createElement('div');
+ div.innerHTML = t;
+ document.getElementsByTagName('body')[0].appendChild(div);
+}
+
+try {
+ sw = screen.width;
+} catch (e) {
+ sw = -1;
+}
+
+</script>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+function doChecks() {
+ isnot(sw, -1, "screen.width threw an exception");
+ is(child_sw, sw, "iframe got wrong screen.width");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+test();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug384122.html b/dom/tests/mochitest/bugs/test_bug384122.html
new file mode 100644
index 0000000000..81dc3907e0
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug384122.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=384122
+-->
+<head>
+ <title>Test for Bug 384122</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=384122">Mozilla Bug 384122</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 384122 **/
+
+var foundQI = false;
+for (var property in Node)
+ if (property == "QueryInterface")
+ foundQI = true;
+is(foundQI, false,
+ "QueryInterface should not be enumerable on DOM interface objects");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug389366.html b/dom/tests/mochitest/bugs/test_bug389366.html
new file mode 100644
index 0000000000..82d493c5ea
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug389366.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=389366
+-->
+<head>
+ <title>Test for Bug 389366</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=389366">Mozilla Bug 389366</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <h4>Canvas testcase</h4>
+
+ Canvas, with pixel set to #ff0000 at 50% opacity:<br>
+ <canvas id="canvas1" width="10" height="10"></canvas>
+ <br>
+ <canvas id="canvas2" width="10" height="10"></canvas>
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function test()
+{
+ // Draw to canvas1
+ var canvas1 = document.getElementById("canvas1");
+ var ctx1 = canvas1.getContext("2d");
+
+ ctx1.globalAlpha = 0.502;
+ ctx1.fillStyle = "#FF0000";
+ ctx1.fillRect(0, 0, 10, 10);
+
+ var data1 = ctx1.getImageData(0,0,1,1).data;
+ isDeeply(data1, [255, 0, 0, 128], "expected half-transparent red canvas 1");
+
+ // half-transparent red 10x10 square
+ var imgData = ctx1.createImageData(10, 10);
+ var rgba = [ 255, 0, 0, 128 ];
+ for (i = 0; i < 50; ++i) {
+ for (j = 0; j < 4; ++j) {
+ imgData.data[(i * 4) + j] = rgba[j];
+ }
+ }
+
+ var canvas2 = document.getElementById("canvas2");
+ var ctx2 = canvas2.getContext("2d");
+ ctx2.putImageData(imgData, 0, 0);
+
+ var data2 = ctx2.getImageData(0,0,1,1).data;
+ isDeeply(data2, [255, 0, 0, 128], "expected half-transparent red canvas 2");
+
+ SimpleTest.finish();
+}
+
+addLoadEvent(test);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug393974.html b/dom/tests/mochitest/bugs/test_bug393974.html
new file mode 100644
index 0000000000..fe14355bf6
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug393974.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=393974
+-->
+<head>
+ <title>Test for Bug 393974</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=393974">Mozilla Bug 393974</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function test()
+{
+ // Create a tree walker with a filter which creates a cycle...
+ var tw = document.createTreeWalker(document, NodeFilter.SHOW_ALL,
+ function(n)
+ {
+ // force the closure to contain the
+ // global object, in case a future
+ // optimization might minimize the
+ // function's captured environment
+ if ("foo" + window == "fooPIRATES!")
+ return NodeFilter.FILTER_ACCEPT;
+ return NodeFilter.FILTER_REJECT;
+ });
+
+ // That should have been enough to create a leak, but we should do at least
+ // a couple tests while we're here so that this document doesn't show up as
+ // having no tests pass *or* fail.
+
+ ok(tw.firstChild() === null, "shouldn't be a first child");
+ ok(tw.currentNode === document, "should be unchanged");
+
+ ok(tw.lastChild() === null, "shouldn't be a last child");
+ ok(tw.currentNode === document, "should be unchanged");
+
+ ok(tw.nextNode() === null, "shouldn't be a next node");
+ ok(tw.currentNode === document, "should be unchanged");
+
+ ok(tw.nextSibling() === null, "shouldn't be a next sibling");
+ ok(tw.currentNode === document, "should be unchanged");
+
+ ok(tw.parentNode() === null, "shouldn't be a parent node");
+ ok(tw.currentNode === document, "should be unchanged");
+
+ ok(tw.previousNode() === null, "shouldn't be a previous node");
+ ok(tw.currentNode === document, "should be unchanged");
+
+ ok(tw.previousSibling() === null, "shouldn't be a previous sibling");
+ ok(tw.currentNode === document, "should be unchanged");
+}
+
+addLoadEvent(test);
+addLoadEvent(SimpleTest.finish);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug394769.html b/dom/tests/mochitest/bugs/test_bug394769.html
new file mode 100644
index 0000000000..73bff1b07b
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug394769.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=394769
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 394769</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=394769">Mozilla Bug 394769</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 394769 **/
+SimpleTest.waitForExplicitFinish();
+function h() {
+ is(arguments.length, 1, "Should only have one argument");
+ SimpleTest.finish();
+}
+
+function g() {
+ is(arguments.length, 0, "Should not have lateness argument for function with delay");
+ setTimeout(h, 0, "arg");
+}
+
+function f() {
+ is(arguments.length, 0, "Should not have lateness argument for function with no delay");
+ setTimeout(g, 0);
+}
+
+setTimeout(f);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug396843.html b/dom/tests/mochitest/bugs/test_bug396843.html
new file mode 100644
index 0000000000..bd9dede189
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug396843.html
@@ -0,0 +1,240 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=396843
+-->
+<head>
+ <title>Test for Bug 396843</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=396843">Mozilla Bug 396843</a>
+<p id="display">
+ <iframe src="http://example.org:80/" id="t"></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 396843 **/
+SimpleTest.waitForExplicitFinish();
+
+var allNodes = [];
+var XMLNodes = [];
+
+// HTML
+function HTML_TAG(name) {
+ allNodes.push(document.createElement(name));
+}
+
+/* List copy/pasted from nsHTMLTagList.h */
+HTML_TAG("a", "Anchor")
+HTML_TAG("abbr", "Span")
+HTML_TAG("acronym", "Span")
+HTML_TAG("address", "Span")
+HTML_TAG("applet", "Unknown")
+HTML_TAG("area", "Area")
+HTML_TAG("b", "Span")
+HTML_TAG("base", "Shared")
+HTML_TAG("basefont", "Span")
+HTML_TAG("bdi", "")
+HTML_TAG("bdo", "Span")
+HTML_TAG("bgsound", "Unknown")
+HTML_TAG("big", "Span")
+HTML_TAG("blockquote", "Shared")
+HTML_TAG("body", "Body")
+HTML_TAG("br", "BR")
+HTML_TAG("button", "Button")
+HTML_TAG("canvas", "Canvas")
+HTML_TAG("caption", "TableCaption")
+HTML_TAG("center", "Span")
+HTML_TAG("cite", "Span")
+HTML_TAG("code", "Span")
+HTML_TAG("col", "TableCol")
+HTML_TAG("colgroup", "TableCol")
+HTML_TAG("dd", "Span")
+HTML_TAG("del", "Mod")
+HTML_TAG("dfn", "Span")
+HTML_TAG("dir", "Shared")
+HTML_TAG("div", "Div")
+HTML_TAG("dl", "SharedList")
+HTML_TAG("dt", "Span")
+HTML_TAG("em", "Span")
+HTML_TAG("embed", "Embed")
+HTML_TAG("fieldset", "FieldSet")
+HTML_TAG("font", "Font")
+HTML_TAG("form", "Form")
+HTML_TAG("frame", "Frame")
+HTML_TAG("frameset", "FrameSet")
+HTML_TAG("h1", "Heading")
+HTML_TAG("h2", "Heading")
+HTML_TAG("h3", "Heading")
+HTML_TAG("h4", "Heading")
+HTML_TAG("h5", "Heading")
+HTML_TAG("h6", "Heading")
+HTML_TAG("head", "Head")
+HTML_TAG("hr", "HR")
+HTML_TAG("html", "Html")
+HTML_TAG("i", "Span")
+HTML_TAG("iframe", "IFrame")
+HTML_TAG("image", "")
+HTML_TAG("img", "Image")
+HTML_TAG("input", "Input")
+HTML_TAG("ins", "Mod")
+HTML_TAG("isindex", "Unknown")
+HTML_TAG("kbd", "Span")
+HTML_TAG("keygen", "Span")
+HTML_TAG("label", "Label")
+HTML_TAG("legend", "Legend")
+HTML_TAG("li", "LI")
+HTML_TAG("link", "Link")
+HTML_TAG("listing", "Span")
+HTML_TAG("map", "Map")
+HTML_TAG("marquee", "Div")
+HTML_TAG("menu", "Shared")
+HTML_TAG("meta", "Meta")
+HTML_TAG("multicol", "Unknown")
+HTML_TAG("nobr", "Span")
+HTML_TAG("noembed", "Div")
+HTML_TAG("noframes", "Div")
+HTML_TAG("noscript", "Div")
+HTML_TAG("object", "Object")
+HTML_TAG("ol", "SharedList")
+HTML_TAG("optgroup", "OptGroup")
+HTML_TAG("option", "Option")
+HTML_TAG("p", "Paragraph")
+HTML_TAG("param", "Shared")
+HTML_TAG("plaintext", "Span")
+HTML_TAG("pre", "Pre")
+HTML_TAG("q", "Shared")
+HTML_TAG("s", "Span")
+HTML_TAG("samp", "Span")
+HTML_TAG("script", "Script")
+HTML_TAG("select", "Select")
+HTML_TAG("small", "Span")
+HTML_TAG("spacer", "Unknown")
+HTML_TAG("span", "Span")
+HTML_TAG("strike", "Span")
+HTML_TAG("strong", "Span")
+HTML_TAG("style", "Style")
+HTML_TAG("sub", "Span")
+HTML_TAG("sup", "Span")
+HTML_TAG("table", "Table")
+HTML_TAG("tbody", "TableSection")
+HTML_TAG("td", "TableCell")
+HTML_TAG("textarea", "TextArea")
+HTML_TAG("tfoot", "TableSection")
+HTML_TAG("th", "TableCell")
+HTML_TAG("thead", "TableSection")
+HTML_TAG("template", "Template")
+HTML_TAG("title", "Title")
+HTML_TAG("tr", "TableRow")
+HTML_TAG("tt", "Span")
+HTML_TAG("u", "Span")
+HTML_TAG("ul", "SharedList")
+HTML_TAG("var", "Span")
+HTML_TAG("wbr", "Shared")
+HTML_TAG("xmp", "Span")
+
+function SVG_TAG(name) {
+ allNodes.push(document.createElementNS("http://www.w3.org/2000/svg", name));
+}
+
+// List sorta stolen from SVG element factory.
+SVG_TAG("a")
+SVG_TAG("polyline")
+SVG_TAG("polygon")
+SVG_TAG("circle")
+SVG_TAG("ellipse")
+SVG_TAG("line")
+SVG_TAG("rect")
+SVG_TAG("svg")
+SVG_TAG("g")
+SVG_TAG("foreignObject")
+SVG_TAG("path")
+SVG_TAG("text")
+SVG_TAG("tspan")
+SVG_TAG("image")
+SVG_TAG("style")
+SVG_TAG("linearGradient")
+SVG_TAG("metadata")
+SVG_TAG("radialGradient")
+SVG_TAG("stop")
+SVG_TAG("defs")
+SVG_TAG("desc")
+SVG_TAG("script")
+SVG_TAG("use")
+SVG_TAG("symbol")
+SVG_TAG("marker")
+SVG_TAG("title")
+SVG_TAG("clipPath")
+SVG_TAG("textPath")
+SVG_TAG("filter")
+SVG_TAG("feBlend")
+SVG_TAG("feColorMatrix")
+SVG_TAG("feComponentTransfer")
+SVG_TAG("feComposite")
+SVG_TAG("feFuncR")
+SVG_TAG("feFuncG")
+SVG_TAG("feFuncB")
+SVG_TAG("feFuncA")
+SVG_TAG("feGaussianBlur")
+SVG_TAG("feMerge")
+SVG_TAG("feMergeNode")
+SVG_TAG("feMorphology")
+SVG_TAG("feOffset")
+SVG_TAG("feFlood")
+SVG_TAG("feTile")
+SVG_TAG("feTurbulence")
+SVG_TAG("feConvolveMatrix")
+SVG_TAG("feDistantLight")
+SVG_TAG("fePointLight")
+SVG_TAG("feSpotLight")
+SVG_TAG("feDiffuseLighting")
+SVG_TAG("feSpecularLighting")
+SVG_TAG("feDisplacementMap")
+SVG_TAG("feImage")
+SVG_TAG("pattern")
+SVG_TAG("mask")
+SVG_TAG("svgSwitch")
+
+// Toss in some other namespaced stuff too, for good measure
+allNodes.push(document.createElementNS("http://www.w3.org/1998/Math/MathML",
+ "math"));
+allNodes.push(document.createElementNS("http://www.w3.org/2001/xml-events",
+ "testname"));
+allNodes.push(document.createElementNS("bogus.namespace", "testname"));
+
+var XMLDoc = document.implementation.createDocument("", "", null);
+
+// And non-elements
+allNodes.push(document.createTextNode("some text"));
+allNodes.push(document.createComment("some text"));
+allNodes.push(document.createDocumentFragment());
+XMLNodes.push(XMLDoc.createCDATASection("some text"));
+XMLNodes.push(XMLDoc.createProcessingInstruction("PI", "data"));
+
+function runTest() {
+ ok(document.nodePrincipal === undefined, "Must not have document principal");
+ ok(document.baseURIObject === undefined, "Must not have document base URI");
+ ok(document.documentURIObject === undefined, "Must have document URI");
+
+ for (var i = 0; i < allNodes.length; ++i) {
+ ok(allNodes[i].nodePrincipal === undefined,
+ "Unexpected principal appears for " + allNodes[i].nodeName);
+ ok(allNodes[i].baseURIObject === undefined,
+ "Unexpected base URI appears for " + allNodes[i].nodeName);
+ }
+}
+
+addLoadEvent(runTest);
+addLoadEvent(SimpleTest.finish);
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug400204.html b/dom/tests/mochitest/bugs/test_bug400204.html
new file mode 100644
index 0000000000..0364ec4008
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug400204.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=400204
+-->
+<head>
+ <title>Test for Bug 400204</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=400204">Mozilla Bug 400204</a>
+<p id="display"></p>
+<iframe id="content" src="about:blank" style="display: none"></iframe>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+ var c = document.getElementById("content");
+ var success = false;
+ // try to access innerWidth
+ try { success = (c.contentWindow.innerWidth == 0); } catch(ex) { success = false; }
+ ok(success, "can't access hidden iframe innerWidth, or it's not 0");
+
+ // try to access innerHeight
+ success = false;
+ try { success = (c.contentWindow.innerHeight == 0); } catch(ex) { success = false; }
+ ok(success, "can't access hidden iframe innerHeight, or it's not 0");
+
+ // Snag the canonical getter and setter
+ var innerWidthGetter = Object.getOwnPropertyDescriptor(c.contentWindow, "innerWidth").get;
+ var innerHeightGetter = Object.getOwnPropertyDescriptor(c.contentWindow, "innerHeight").get;
+
+ // try to set innerWidth
+ success = false;
+ try { c.contentWindow.innerWidth = 100; success = true; } catch(ex) { success = false; }
+ ok(success, "can't set hidden iframe innerWidth");
+
+ // try to set innerHeight
+ success = false;
+ try { c.contentWindow.innerHeight = 100; success = true; } catch(ex) { success = false; }
+ ok(success, "can't set hidden iframe innerHeight");
+
+ // now try these again for good measure, and to ensure the values
+ // haven't changed except via getting replaced
+ // try to access innerWidth
+ success = false;
+ try { success = (c.contentWindow.innerWidth == 100); } catch(ex) { success = false; }
+ ok(success, "can't access hidden iframe innerWidth, or it's not 100");
+
+ success = false;
+ try { success = (innerWidthGetter.call(c.contentWindow) == 0); } catch(ex) { success = false; }
+ ok(success, "can't access hidden iframe innerWidth, or it's not 0");
+
+ // try to access innerHeight
+ success = false;
+ try { success = (c.contentWindow.innerHeight == 100); } catch(ex) { success = false; }
+ ok(success, "can't access hidden iframe innerHeight, or it's not 100");
+
+ success = false;
+ try { success = (innerHeightGetter.call(c.contentWindow) == 0); } catch(ex) { success = false; }
+ ok(success, "can't access hidden iframe innerHeight, or it's not 0");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug404748.html b/dom/tests/mochitest/bugs/test_bug404748.html
new file mode 100644
index 0000000000..1e9b33427b
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug404748.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=404748
+-->
+<head>
+ <title>Test for Bug 404748</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=404748">Mozilla Bug 404748</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 404748 **/
+var setterCalled = false;
+HTMLDivElement.prototype.
+ __defineSetter__("onclick", function () { window.setterCalled = true });
+$("content").onclick = function () {};
+
+is(setterCalled, true, "Setter should have been called");
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug414291.html b/dom/tests/mochitest/bugs/test_bug414291.html
new file mode 100644
index 0000000000..f87b5e0dc5
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug414291.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=414291
+-->
+<head>
+ <title>Test for Bug 414291</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414291">Mozilla Bug 414291</a>
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 414291 **/
+var result1 = 0;
+var result2 = 0;
+
+window.open("file1_bug414291.html", "w1");
+is(result1, 0, "window should not be opened either as modal or loaded synchronously.");
+
+window.open("file2_bug414291.html", "w2", "modal=yes");
+is(result2, 0, "window should not be opened either as modal or data loaded synchronously.");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug42976.html b/dom/tests/mochitest/bugs/test_bug42976.html
new file mode 100644
index 0000000000..d5f66d456c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug42976.html
@@ -0,0 +1,81 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=42976
+-->
+<head>
+ <title>Test for Bug 42976</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="runTest()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=42976">Mozilla Bug 42976</a>
+<p id="display"></p>
+<div id="content">
+ <iframe id=specialtest srcdoc="<meta http-equiv='Content-Language' content='ja-JP'><base href='http://www.mozilla.org'><p>asdf"></iframe>;
+ <iframe id=htmlquirks srcdoc="<html><meta charset=ISO-8859-2><body><div></div></body></html>"></iframe>
+ <iframe id=htmlstd srcdoc="<!DOCTYPE html><html><meta charset=ISO-8859-3><body><div></div></body></html>"></iframe>
+ <iframe id=textplain srcdoc="<meta charset=ISO-8859-4>asdf%0Azxcv%0A"></iframe>
+ <iframe id=xhtmlstd srcdoc="<!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml'><meta charset=ISO-8859-5><body><div></div></body></html>"></iframe>
+ <iframe id=xmlstd srcdoc="<meta charset=ISO-8859-6><svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width='300' height='300'><text x='60' y='150' fill='blue'>Hello, World!</text><text x='60' y='250' fill='blue'>Hello, World!</text></svg>"></iframe>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+
+ var iframes = document.getElementsByTagName("iframe");
+ for (var i = 1; i < iframes.length; i++) {
+ var doc = iframes[i].contentDocument;
+ var clonefalse = doc.cloneNode(false);
+ // doc.compatMode
+ ok(doc.compatMode == clonefalse.compatMode, "compatMode not preserved correctly; " + iframes[i].id);
+
+ // doc.contentType
+ ok(doc.contentType == clonefalse.contentType, "contentType not preserved correctly; " + iframes[i].id);
+
+ // doc.characterSet
+ ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id);
+
+ // innerHTML+tag case test
+ var clonetrue = doc.cloneNode(true);
+ doc.documentElement.firstChild.innerHTML="<div><dD></dD></div>";
+ clonetrue.documentElement.firstChild.innerHTML="<div><dD></dD></div>";
+ ok(doc.documentElement.innerHTML == clonetrue.documentElement.innerHTML,
+ "innerHTML not preserved correctly; " + iframes[i].id);
+
+ }
+
+ // A couple of tests that don't quite fit in the framework.
+ var doc = iframes[0].contentDocument;
+
+ // Setting document.dir does nothing in a document without an <html> element
+ doc.dir="rtl";
+ var docclone = doc.cloneNode(false);
+
+ // doc.dir
+ ok(docclone.dir == "", "dir set on doc without html element");
+
+ // document.querySelectorAll(":lang(ja)")
+ docclone.appendChild(docclone.createElement("html"));
+ ok(docclone.querySelectorAll(":lang(ja)").length == 1, "lang not preserved correctly");
+
+ docclone.documentElement.innerHTML="<body><p><a href='a.html' id=a>asf</a></body>";
+ ok(docclone.getElementById('a').href == "http://www.mozilla.org/a.html",
+ "base not preserved correctly");
+
+ // Now that we have an <html> element, deep cloning preserves document.dir
+ docclone.dir="rtl";
+ var cloneclone = docclone.cloneNode(true);
+
+ // doc.dir
+ ok(cloneclone.dir == "rtl", "dir not preserved correctly");
+
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug430276.html b/dom/tests/mochitest/bugs/test_bug430276.html
new file mode 100644
index 0000000000..907ab0795e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug430276.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=430276
+-->
+<head>
+ <title>Test for Bug 430276</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430276">Mozilla Bug 430276</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 430276 **/
+
+function startTest() {
+ document.getElementById("testFrame")
+ .setAttribute("src", "iframe_bug430276.html");
+}
+
+function nextTest() {
+ document.getElementById("testFrame")
+ .setAttribute("src", "iframe_bug430276-2.html");
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(startTest);
+
+
+</script>
+</pre>
+<iframe id="testFrame">
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug440572.html b/dom/tests/mochitest/bugs/test_bug440572.html
new file mode 100644
index 0000000000..f89f78f2ba
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug440572.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=440572
+-->
+<head>
+ <title>Test for Bug 440572</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=440572">Mozilla Bug 440572</a>
+
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 440572 **/
+
+var messages = new Map();
+
+function receiveMessage(e)
+{
+ is(e.origin, "http://example.org", "wrong sender!");
+ messages.set(e.data.from, e.data.result);
+ // Runtests after receiving the right number of messages.
+ if (messages.size == 4) {
+ runtests();
+ }
+}
+
+window.addEventListener("message", receiveMessage);
+
+function runtests()
+{
+ is(messages.get("test"), "success", "test in frame failed.");
+ is(messages.get("dump"), "success", '"dump" in frame failed.');
+ is(messages.get("open"), "success", '"open" in frame failed.');
+ isnot(messages.get("close"), "success", "parent[\"close\"] should be the WebIDL property of Window.");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+</script>
+<br>
+<iframe name="test" src="http://example.org:80/tests/dom/tests/mochitest/bugs/iframe_bug440572.html"></iframe>
+<br>
+<iframe name="dump" src="http://example.org:80/tests/dom/tests/mochitest/bugs/iframe_bug440572.html"></iframe>
+<br>
+<iframe name="open" src="http://example.org:80/tests/dom/tests/mochitest/bugs/iframe_bug440572.html"></iframe>
+<br>
+<iframe name="close" src="http://example.org:80/tests/dom/tests/mochitest/bugs/iframe_bug440572.html"></iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug456151.html b/dom/tests/mochitest/bugs/test_bug456151.html
new file mode 100644
index 0000000000..7b0cb22776
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug456151.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=456151
+-->
+<head>
+ <title>Test for Bug 456151</title>
+ <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=456151">Mozilla Bug 456151</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 456151 **/
+var intercepted = false;
+
+// Set up our new addEventListener
+var proto = HTMLParagraphElement.prototype;
+proto.oldAdd = proto.addEventListener;
+proto.addEventListener = function(ev, list, capt) {
+ intercepted = true;
+ this.oldAdd(ev, list, capt);
+}
+proto.oldRemove = proto.removeEventListener;
+proto.removeEventListener = function(ev, list, capt) {
+ intercepted = true;
+ this.oldRemove(ev, list, capt);
+}
+
+var called = false;
+
+var func = function() { called = true; };
+$("display").addEventListener("click", func);
+is(intercepted, true, "Should have interecepted addEventListener call");
+
+sendMouseEvent({type: "click"}, "display");
+is(called, true, "Should have called event listener");
+
+interecepted = false;
+called = false;
+
+$("display").removeEventListener("click", func);
+is(intercepted, true, "Should have interecepted removeEventListener call");
+
+sendMouseEvent({type: "click"}, "display");
+is(called, false, "Should have removed event listener");
+
+// And now some simple sanity tests
+var recursion = false;
+var x = document.createElement("span");
+HTMLSpanElement.prototype.addEventListener =
+ function(a, b, c) {
+ return x.addEventListener(a,b,c);
+ }
+try {
+ x.addEventListener("click", function() { called = true; });
+} catch (e) {
+ recursion = e.message.match(/recursion/);
+}
+SimpleTest.isDeeply(recursion, ["recursion"], "Caught infinite recursion");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug458091.html b/dom/tests/mochitest/bugs/test_bug458091.html
new file mode 100644
index 0000000000..2bb6bc5404
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug458091.html
@@ -0,0 +1,100 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=458091
+-->
+<head>
+ <title>Test for Bug 458091</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=458091">Mozilla Bug 458091</a>
+
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<a id="testlink1" target="_blank" rel="opener" href="javascript:window.opener.finish(sessionStorage['testItem']);window.close();">Javascript Link</a>
+<a id="testlink2" target="_blank" rel="opener" href="bug458091_child.html">HTTP Link</a>
+<a id="testlink3" target="alreadyOpened" href="bug458091_child.html">Target Link</a>
+<script type="application/javascript">
+
+/** Test for Bug 458091 **/
+
+var gTestWin;
+var gRunningTests = 0;
+
+function runNextTest()
+{
+ if (gTests.length) {
+ var test = gTests.shift();
+ test();
+ } else {
+ SimpleTest.finish();
+ }
+}
+
+function finish(val)
+{
+ is(val, "correct value",
+ "New window should access the correct session storage");
+ if (--gRunningTests == 0) {
+ runNextTest();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function test1() {
+ sessionStorage.testItem = "correct value";
+
+ gRunningTests++;
+ window.open('javascript:window.opener.finish(sessionStorage["testItem"]);window.close();');
+
+ gRunningTests++;
+ window.open("bug458091_child.html");
+
+ gRunningTests++;
+ sendMouseEvent({type: "click"}, "testlink1");
+
+ gRunningTests++;
+ sendMouseEvent({type: "click"}, "testlink2");
+
+ // targetted load into an existing window
+ var testWin = window.open("about:blank", "alreadyOpened");
+ gRunningTests++;
+ sendMouseEvent({type: "click"}, "testlink3");
+
+ // window.location into an existing window. Leave the window open
+ // for further tests...
+ gRunningTests++;
+ gTestWin = window.open("about:blank", "testWindow");
+ gTestWin.location = 'javascript:window.opener.finish(sessionStorage["testItem"]);';
+}
+
+function test2() {
+ // Now change session storage and load a new item in gTestWin, to
+ // verify that they properly diverged after window.open().
+ gRunningTests++;
+ sessionStorage.testItem = "incorrect value";
+ gTestWin.location = 'javascript:window.opener.finish(sessionStorage["testItem"]);';
+}
+
+function test3()
+{
+ // Now, with session storage still changed, try the window.open()
+ // path, make sure it doesn't overwrite the session storage.
+ gRunningTests++;
+ window.open('javascript:window.opener.finish(sessionStorage["testItem"]);window.close();',
+ "testWindow");
+}
+
+var gTests = [test1, test2, test3];
+runNextTest();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug459848.html b/dom/tests/mochitest/bugs/test_bug459848.html
new file mode 100644
index 0000000000..495711fdb7
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug459848.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=459848
+-->
+<head>
+ <title>Test for Bug 459848</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=459848">Mozilla Bug 459848</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 459848 **/
+
+var ifr1, irf2;
+var doc1, doc2;
+
+function testDocument(d) {
+ d.documentElement.setAttribute("onload", "this.setAttribute('didRun', 'true');");
+ var e = d.createEvent("Events");
+ e.initEvent("load", true, true);
+ d.documentElement.dispatchEvent(e);
+}
+
+function testDoc2() {
+ testDocument(doc2);
+ isnot(doc2.documentElement.getAttribute("didRun"), "true",
+ "Shouldn't have run an event listener");
+ SimpleTest.finish();
+}
+
+function startTest() {
+ var ifr1 = document.getElementById('iframe1');
+ var ifr2 = document.getElementById('iframe2');
+ doc1 = ifr1.contentDocument;
+ doc2 = ifr2.contentDocument;
+
+ testDocument(doc1);
+ is(doc1.documentElement.getAttribute("didRun"), "true",
+ "Should have run an event listener");
+
+ ifr2.remove();
+ setTimeout(testDoc2, 0);
+}
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(startTest);
+
+</script>
+</pre>
+<iframe id="iframe1"></iframe>
+<iframe id="iframe2"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug465263.html b/dom/tests/mochitest/bugs/test_bug465263.html
new file mode 100644
index 0000000000..a7c95b5177
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug465263.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=465263
+-->
+<head>
+ <title>Test for Bug 465263</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=465263">Mozilla Bug 465263</a>
+<p id="display">
+ <iframe src="http://mochi.test:8888"></iframe>
+ <iframe src="http://mochi.test:8888"></iframe>
+ <iframe src="http://mochi.test:8888"></iframe>
+ <iframe src="http://mochi.test:8888"></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 465263 **/
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function() {
+ window.frames[0].location.hash = '';
+ is(window.frames[0].location.href, "http://mochi.test:8888/#",
+ "Should have '#' in href now");
+ window.frames[1].location.hash = '#';
+ is(window.frames[1].location.href, "http://mochi.test:8888/#",
+ "Should have only one '#' in href");
+ window.frames[2].location.hash = 'foo';
+ is(window.frames[2].location.href, "http://mochi.test:8888/#foo",
+ "Should have '#foo' in href");
+ window.frames[3].location.hash = '#foo';
+ is(window.frames[3].location.href, "http://mochi.test:8888/#foo",
+ "Should have only one '#' in href here too");
+ SimpleTest.finish();
+});
+
+
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug484775.html b/dom/tests/mochitest/bugs/test_bug484775.html
new file mode 100644
index 0000000000..31edf0447e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug484775.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=484775
+-->
+<head>
+ <title>Test for Bug 484775</title>
+ <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=484775">Mozilla Bug 484775</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 484775 **/
+
+var expectedTarget = null;
+var expectedType = null;
+var eventCount = 0;
+
+function listener(evt) {
+ ++eventCount;
+ is(evt.type, expectedType, "Wrong event type!");
+ is(evt.target, expectedTarget, "Wrong event target!");
+}
+
+expectedType = "TestEvent";
+var event = document.createEvent("Event");
+event.initEvent(expectedType, true, true);
+is(event.type, expectedType, "Wrong event type after initEvent!");
+
+var attr = document.createAttribute("attribute");
+expectedTarget = attr;
+attr.addEventListener(expectedType, listener);
+attr.dispatchEvent(event);
+is(eventCount, 1, "Should have fired an event!");
+attr.removeEventListener(expectedType, listener);
+
+var df = document.createDocumentFragment();
+expectedTarget = df;
+df.addEventListener(expectedType, listener);
+df.dispatchEvent(event);
+is(eventCount, 2, "Should have fired an event!");
+df.removeEventListener(expectedType, listener);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug492925.html b/dom/tests/mochitest/bugs/test_bug492925.html
new file mode 100644
index 0000000000..d7a067611f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug492925.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=492925
+-->
+<head>
+ <title>Test for Bug 492925</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ @media tv, print {
+ #div2 {
+ overflow: hidden;
+ }
+ }
+ </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492925">Mozilla Bug 492925</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 492925 **/
+
+var sheet = document.styleSheets[1];
+var rule = sheet.cssRules[0];
+var media = rule.media;
+
+is(media.mediaText, "tv, print", "Unexpected media string");
+is(media[0], "tv", "[0] should be 'tv'");
+is(media[1], "print", "[1] should be 'print'");
+is(media.item(0), "tv", ".item(0) should be 'tv'");
+is(media.item(1), "print", ".item(1) should be 'print'");
+
+
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug49312.html b/dom/tests/mochitest/bugs/test_bug49312.html
new file mode 100644
index 0000000000..14e6d56287
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug49312.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=49312
+-->
+<head>
+ <title>Test for Bug 49312</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script>
+ // Hack to set things up so that parent.fakeOpener works the same way for
+ // both test subframes.
+ var framesToLoad = 2;
+ function subframeLoaded(win) {
+ is(win.location.href
+ .replace(/iframe_bug49312\.html$/, "test_bug49312.html"),
+ window.location.href,
+ "Unexpected subframe href");
+ if (win == opened) {
+ opened.close();
+ }
+ if (--framesToLoad == 0) {
+ SimpleTest.finish();
+ }
+ }
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=49312">Mozilla Bug 49312</a>
+<p id="display">
+ <iframe src="javascript:'<script>location=\'iframe_bug49312.html\'</script>'"></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 49312 **/
+SimpleTest.waitForExplicitFinish();
+var opened = window.open("javascript:'<script>location=\\\'iframe_bug49312.html\\\'</" + "script>'", "", "width=100,height=100")
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug495219.html b/dom/tests/mochitest/bugs/test_bug495219.html
new file mode 100644
index 0000000000..8fd04862e9
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug495219.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=495219
+-->
+<head>
+ <title>Test for Bug 495219</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=495219">Mozilla
+ Bug 495219</a>
+<iframe onload="this.style.display='none'"></iframe>
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+window.onload = function () {
+ is(window.frames[0].innerWidth, 0, "width should be zero");
+ is(window.frames[0].innerHeight, 0, "height should be zero");
+ SimpleTest.finish();
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug529328.html b/dom/tests/mochitest/bugs/test_bug529328.html
new file mode 100644
index 0000000000..231234f4db
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug529328.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=529328
+-->
+<head>
+ <title>Test for Bug 529328</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529328">Mozilla Bug 529328</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 529328 **/
+function testDOMTokenList() {
+ is(document.body.classList[-1], undefined, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList[0], undefined, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList[1], undefined, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList[2], undefined, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList.item(-1), null, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList.item(0), null, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList.item(1), null, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList.item(2), null, "Wrong value for out of bounds access (DOMTokenList)");
+
+ document.body.className = "a b";
+ is(document.body.classList[-1], undefined, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList[0], "a", "Wrong value for in bounds access (DOMTokenList)");
+ is(document.body.classList[1], "b", "Wrong value for in bounds access (DOMTokenList)");
+ is(document.body.classList[2], undefined, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList.item(-1), null, "Wrong value for out of bounds access (DOMTokenList)");
+ is(document.body.classList.item(0), "a", "Wrong value for in bounds access (DOMTokenList)");
+ is(document.body.classList.item(1), "b", "Wrong value for in bounds access (DOMTokenList)");
+ is(document.body.classList.item(2), null, "Wrong value for out of bounds access (DOMTokenList)");
+}
+
+function testDOMStringList() {
+ is(document.styleSheetSets[-1], undefined, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets[0], undefined, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets[1], undefined, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets[2], undefined, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(-1), null, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(0), null, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(1), null, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(2), null, "Wrong value for out of bounds access (DOMStringList)");
+
+ var s = document.createElement("style");
+ s.title = "a";
+ document.head.appendChild(s);
+ s = document.createElement("style");
+ s.title = "b";
+ document.head.appendChild(s);
+
+ is(document.styleSheetSets[-1], undefined, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets[0], "a", "Wrong value for in bounds access (DOMStringList)");
+ is(document.styleSheetSets[1], "b", "Wrong value for in bounds access (DOMStringList)");
+ is(document.styleSheetSets[2], undefined, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(-1), null, "Wrong value for out of bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(0), "a", "Wrong value for in bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(1), "b", "Wrong value for in bounds access (DOMStringList)");
+ is(document.styleSheetSets.item(2), null, "Wrong value for out of bounds access (DOMStringList)");
+}
+
+function testMediaList() {
+ var s = document.createElement("style");
+ document.head.appendChild(s);
+ is(s.sheet.media[-1], undefined, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media[0], undefined, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media[1], undefined, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media[2], undefined, "Wrong value for out of bounds access (MediaList) (MediaList)");
+ is(s.sheet.media.item(-1), null, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media.item(0), null, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media.item(1), null, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media.item(2), null, "Wrong value for out of bounds access (MediaList) (MediaList)");
+
+ s.setAttribute("media", "a, b");
+
+ is(s.sheet.media[-1], undefined, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media[0], "a", "Wrong value for in bounds access (MediaList)");
+ is(s.sheet.media[1], "b", "Wrong value for in bounds access (MediaList)");
+ is(s.sheet.media[2], undefined, "Wrong value for out of bounds access (MediaList) (MediaList)");
+ is(s.sheet.media.item(-1), null, "Wrong value for out of bounds access (MediaList)");
+ is(s.sheet.media.item(0), "a", "Wrong value for in bounds access (MediaList)");
+ is(s.sheet.media.item(1), "b", "Wrong value for in bounds access (MediaList)");
+ is(s.sheet.media.item(2), null, "Wrong value for out of bounds access (MediaList) (MediaList)");
+}
+
+function testCSSStyleDeclaration() {
+ var s = document.createElement("span");
+
+ is(s.style[-1], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style[0], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style[1], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style[2], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style.item(-1), "", "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style.item(0), "", "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style.item(1), "", "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style.item(2), "", "Wrong value for out of bounds access (CSSStyleDeclaration)");
+
+ s.setAttribute("style", "color: blue; z-index: 42;");
+
+ is(s.style[-1], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style[0], "color", "Wrong value for in bounds access (CSSStyleDeclaration)");
+ is(s.style[1], "z-index", "Wrong value for in bounds access (CSSStyleDeclaration)");
+ is(s.style[2], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style.item(-1), "", "Wrong value for out of bounds access (CSSStyleDeclaration)");
+ is(s.style.item(0), "color", "Wrong value for in bounds access (CSSStyleDeclaration)");
+ is(s.style.item(1), "z-index", "Wrong value for in bounds access (CSSStyleDeclaration)");
+ is(s.style.item(2), "", "Wrong value for out of bounds access (CSSStyleDeclaration)");
+}
+
+testDOMTokenList();
+testDOMStringList();
+testMediaList();
+testCSSStyleDeclaration();
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug531176.html b/dom/tests/mochitest/bugs/test_bug531176.html
new file mode 100644
index 0000000000..f091c0d475
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug531176.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=531176
+-->
+<head>
+ <title>Test for Bug 531176</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=531176">Mozilla Bug 531176</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 531176 **/
+
+var errorCount = 0;
+function errorHandler(msg, filename, linenr) {
+ is(msg, "SyntaxError: expected expression, got ';'", "Wrong error!");
+ is(filename, String(window.location), "Wrong filename!");
+ is(linenr, 1, "Wrong linenr!");
+ ++errorCount;
+}
+
+window.onerror = errorHandler;
+document.body.setAttribute("onclick", "var x=;");
+// Force eager compilation
+document.body.onclick;
+is(errorCount, 1, "Error handler should have been called! (1)");
+
+function recursiveHandler(msg, filename, linenr) {
+ is(msg, "SyntaxError: expected expression, got ';'", "Wrong error!");
+ is(filename, String(window.location), "Wrong filename!");
+ is(linenr, 1, "Wrong linenr!");
+ ++errorCount;
+ document.body.setAttribute("onclick", "var z=;");
+}
+
+window.onerror = recursiveHandler;
+document.body.setAttribute("onclick", "var y=;");
+// Force eager compilation
+document.body.onclick;
+is(errorCount, 2, "Error handler should have been called! (2)");
+
+// Check that error handler works even after recursion error.
+document.body.setAttribute("onclick", "var foo=;");
+// Force eager compilation
+document.body.onclick;
+is(errorCount, 3, "Error handler should have been called! (3)");
+
+window.onerror = function() { ++errorCount; };
+</script>
+<script>
+var foo =;
+</script>
+<script>
+is(errorCount, 4, "Error handler should have been called! (4)");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug531542.html b/dom/tests/mochitest/bugs/test_bug531542.html
new file mode 100644
index 0000000000..89dcd702a4
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug531542.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=531542
+-->
+<head>
+ <title>Test for Bug 531542</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=531542">Mozilla Bug 531542</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 531542 **/
+
+var negativeTimeoutFired = false;
+function negativeTimeout()
+{
+ negativeTimeoutFired = true;
+}
+function testFinished()
+{
+ ok(negativeTimeoutFired, "Timeout with negative delay should fire.");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+setTimeout(negativeTimeout, -1);
+setTimeout(testFinished, 0);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug534149.html b/dom/tests/mochitest/bugs/test_bug534149.html
new file mode 100644
index 0000000000..8c1a8b7e4d
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug534149.html
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=534149
+-->
+<head>
+ <title>Test for Bug 534149</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=534149">Mozilla Bug 534149</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 534149 **/
+function getIDs(iframe) {
+ var win = iframe.contentWindow;
+ // Force inner creation
+ win.document;
+
+ let wgc = SpecialPowers.wrap(win).windowGlobalChild;
+ return [wgc.outerWindowId, wgc.innerWindowId];
+}
+
+var i1 = document.createElement("iframe");
+var i2 = document.createElement("iframe");
+
+document.body.appendChild(i1);
+var [i1outer, i1inner] = getIDs(i1);
+
+document.body.appendChild(i2);
+var [i2outer, i2inner] = getIDs(i2);
+
+is(i1inner, i1outer + 1, "For frame 1, inner should come right after outer");
+is(i2inner, i2outer + 1, "For frame 2, inner should come right after outer");
+is(i2outer, i1inner + 1, "Frame 2 comes right after frame 1");
+
+var innerWindowDestroyID = null;
+var outerWindowDestroyID = null;
+
+var outerObserver = {
+ observe(id) {
+ outerWindowDestroyID =
+ SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
+ SpecialPowers.removeObserver(outerObserver, "outer-window-destroyed");
+ maybeContinueTest();
+ }
+};
+var innerObserver = {
+ observe(id) {
+ innerWindowDestroyID =
+ SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
+ SpecialPowers.removeObserver(innerObserver, "inner-window-destroyed");
+ maybeContinueTest();
+ }
+};
+
+function removeFrame(iframe) {
+ SpecialPowers.addObserver(outerObserver, "outer-window-destroyed");
+ SpecialPowers.addObserver(innerObserver, "inner-window-destroyed");
+
+ iframe.remove();
+}
+
+function maybeContinueTest() {
+ if (innerWindowDestroyID != null &&
+ outerWindowDestroyID != null) {
+ is(innerWindowDestroyID, i1inner, "inner window of frame 1 should be destroyed");
+ is(outerWindowDestroyID, i1outer, "outer window of frame 1 should be destroyed");
+ SimpleTest.finish();
+ }
+}
+
+removeFrame(i1);
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug541530.html b/dom/tests/mochitest/bugs/test_bug541530.html
new file mode 100644
index 0000000000..8db8180850
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug541530.html
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=541530
+-->
+<head>
+ <title>Test for Bug 411103</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=541530">Mozilla Bug 541530</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var orig = window;
+window = {};
+
+var origLocation = location;
+
+ok(window === orig, "can't override window");
+ok(window.location === location, "properties are properly aliased");
+ok(document.location === location, "properties are properly aliased");
+
+var canDefine = false;
+try {
+ this.__defineGetter__.call(this, 'bar', function() {});
+ this.__defineSetter__.call(this, 'bar', function() {});
+ canDefine = true;
+} catch (e) {}
+ok(canDefine, "Should have access to __defineGetter__ and __defineSetter__");
+
+try {
+ this.__defineGetter__('window', function() {});
+ ok(false, "should not be able to defineGetter(window)");
+} catch (e) {
+}
+
+try {
+ this.__defineGetter__.call(window, 'location', function(){});
+ ok(false, "should not be able to defineGetter(window.location)");
+} catch (e) {
+}
+
+try {
+ this.__defineGetter__.call(window.location, 'href', function(){});
+ ok(false, "shouldn't be able to override location.href");
+} catch (e) {
+ ok(/shadow/.exec(e.message) ||
+ /can't redefine non-configurable/.exec(e.message),
+ "Should be caught by the anti-shadow mechanism.");
+}
+
+// Try deleting the property.
+delete window.location.href;
+ok(typeof window.location.href !== 'undefined',
+ "shouldn't be able to delete the inherited property");
+delete Object.getPrototypeOf(window.location).href;
+ok(typeof window.location.href !== 'undefined',
+ "shouldn't be able to delete the property off of the prototype");
+
+this.__defineGetter__.call(Object.getPrototypeOf(window.location), 'href', function(){});
+ok(true, "should be able to define things on the prototype");
+
+try {
+ this.__defineSetter__.call(window.location, 'href', function(){});
+ ok(false, "overrode a setter for location.href?");
+} catch (e) {
+ ok(/shadow/.exec(e.message) ||
+ /can't redefine non-configurable/.exec(e.message),
+ "Should be caught by the anti-shadow mechanism.");
+}
+
+try {
+ this.__defineGetter__.call(document, 'location', function(){});
+ ok(false, "shouldn't be able to override document.location");
+} catch (e) {
+}
+
+ok(window === orig, "can't override window");
+ok(window.location === origLocation, "properties are properly aliased");
+ok(document.location === origLocation, "properties are properly aliased");
+
+location.href = 'javascript:ok(true, "was able to set location.href through a watchpoint")';
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug545314.html b/dom/tests/mochitest/bugs/test_bug545314.html
new file mode 100644
index 0000000000..09bf74fb4e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug545314.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=545314
+-->
+<head>
+ <title>Test for Bug 545314</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=545314">Mozilla Bug 545314</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<iframe id="ifr"></iframe>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 545314 **/
+var frame = window.frames[0];
+frame.location.assign("http://localhost:8888/");
+ok(true, "location.assign didn't throw");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug548828.html b/dom/tests/mochitest/bugs/test_bug548828.html
new file mode 100644
index 0000000000..83602e6637
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug548828.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=548828
+-->
+<head>
+ <title>Test for Bug 548828</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=548828">Mozilla Bug 548828</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 548828 **/
+ var head = document.getElementsByTagName("head")[0];
+ is(document.head, head, "document.head and document.getElementsByTagName(\"head\")[0] should match");
+ document.head = "";
+ is(document.head, head, "document.head reassigned");
+ document.head = document.createElement("head");
+ is(document.head, head, "new element created with the name \"head\"");
+ document.documentElement.appendChild(document.createElement("head"));
+ is(document.head, head, "new child named head appended to document");
+ var head2 = document.createElement("head");
+ document.documentElement.insertBefore(head2, head);
+ is(document.head, head2, "new head inserted before existing head");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug558973.html b/dom/tests/mochitest/bugs/test_bug558973.html
new file mode 100644
index 0000000000..9208e3c587
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug558973.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=558973
+-->
+<head>
+ <title>Test for Bug 558973</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=558973">Mozilla Bug 558973</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 558973 **/
+
+var child = document.createTextNode("a");
+
+var text = document.createTextNode("a");
+var exception = "";
+var exceptionCode = 0;
+try {
+ text.appendChild(child);
+}
+catch (e) {
+ exception = e.name;
+ exceptionCode = e.code;
+}
+is(exception, "HierarchyRequestError",
+ "Expected HierarchyRequestError");
+is(exceptionCode, DOMException.HIERARCHY_REQUEST_ERR,
+ "Expected DOMException.HIERARCHY_REQUEST_ERR");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug562433.html b/dom/tests/mochitest/bugs/test_bug562433.html
new file mode 100644
index 0000000000..e7fa9da4e7
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug562433.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=562433
+-->
+<head>
+ <title>Test for Bug 562433</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=562433">Mozilla Bug 562433</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 562433 **/
+
+var w = window.open("");
+
+// The new window's location.host and location.hostname must be the empty
+// string (instead of throwing an exception)
+
+is(w.location.host, "", 'w.location.host should be ""');
+is(w.location.hostname, "", 'w.location.hostname should be ""');
+
+w.close();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug563487.html b/dom/tests/mochitest/bugs/test_bug563487.html
new file mode 100644
index 0000000000..eeb90bc961
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug563487.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=563487
+-->
+<head>
+ <!-- Put this before the mochi* stuff, since that adds various listeners -->
+ <script>
+ var exception = null;
+ try {
+ window.removeEventListener("foo", function() {});
+ } catch (e) {
+ exception = e;
+ }
+ </script>
+ <title>Test for Bug 563487</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=563487">Mozilla Bug 563487</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 563487 **/
+is(exception, null, "removeEventListener threw");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug581072.html b/dom/tests/mochitest/bugs/test_bug581072.html
new file mode 100644
index 0000000000..3878bed0a7
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug581072.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=581072
+-->
+<head>
+ <title>Test for Bug 581072</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=581072">Mozilla Bug 581072</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+/** Test for Bug 581072 **/
+var longTimerFired = false;
+
+// Set up a one-hour timeout
+setTimeout(function() { longTimerFired = true; }, 3600000);
+
+// Trigger suspend and resume timeouts
+(function() {
+ var utils = SpecialPowers.getDOMWindowUtils(window);
+ utils.suspendTimeouts();
+ utils.resumeTimeouts();
+})()
+
+// Now set up another timeout which should fire before the one-hour one
+setTimeout(function() {
+ is(longTimerFired, false, "One-hour timer should not fire before our 0ms one");
+ SimpleTest.finish();
+}, 0);
+
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug583225.html b/dom/tests/mochitest/bugs/test_bug583225.html
new file mode 100644
index 0000000000..2923bc52bd
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug583225.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=583225
+-->
+<head>
+ <title>Test for Bug 583225</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=583225">Mozilla Bug 583225</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 583225 **/
+
+function clicked()
+{
+ ok(true, "Event fired on DocumentFragment.");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+var docFragment = document.createDocumentFragment();
+docFragment.foo = "foo";
+docFragment.addEventListener("click", clicked);
+var event = document.createEvent('MouseEvent');
+event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false,
+ false, false, 0, docFragment);
+docFragment.dispatchEvent(event);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug585240.html b/dom/tests/mochitest/bugs/test_bug585240.html
new file mode 100644
index 0000000000..829f4684ae
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug585240.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=585240
+-->
+<head>
+ <title>Test for Bug 585240</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=585240">Mozilla Bug 585240</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 585240 **/
+
+ SimpleTest.waitForExplicitFinish();
+
+ window.onmessage = function(event) {
+ ok(true, "message event should fire!");
+ SimpleTest.finish();
+ }
+ window.postMessage("hello", "*");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug585819.html b/dom/tests/mochitest/bugs/test_bug585819.html
new file mode 100644
index 0000000000..7efe8fc800
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug585819.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=585819
+-->
+<head>
+ <title>Test for Bug 585819</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=585819">Mozilla Bug 585819</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <iframe></iframe>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 585819 **/
+
+var range = document.createRange();
+range.setStartBefore(document.body);
+var fragment = range.createContextualFragment("<span></span>");
+is(fragment.firstChild.localName, "span", "We don't want tag inference here!");
+
+var iframeDoc = document.getElementsByTagName("iframe")[0].contentDocument;
+var root = iframeDoc.documentElement;
+is(root.localName, "html", "Wrong root.");
+root.innerHTML = "<span></span>";
+is(root.firstChild.localName, "head", "We want inference here!");
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug593174.html b/dom/tests/mochitest/bugs/test_bug593174.html
new file mode 100644
index 0000000000..8c24aaf06a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug593174.html
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=593174
+-->
+<head>
+ <title>Test for Bug 593174</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=593174">Mozilla Bug 593174</a>
+
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var loadCount = 0;
+var popup = null;
+
+const kOriginalLocation = location.href;
+
+function iframeLoaded(identifier) {
+ loadCount++;
+ dump("iframeLoaded. loadCount=" + loadCount +
+ " identifier='" + identifier + "'\n");
+
+ var iframe = document.getElementById('iframe');
+ var iframeCw = iframe.contentWindow;
+
+ if (loadCount == 1) {
+ // Test 1: Navigate iframe1. This page should be the referer.
+ // We'll get a callback from the inner page when its iframe finishes
+ // loading, so get rid of the onload listener on our iframe.
+
+ // Change this page's URI using replaceState; the referrer should be this
+ // new value, not our original location.
+ history.replaceState('', '', Math.random());
+
+ iframe.onload = null;
+ iframeCw.location = 'file_bug593174_2.html';
+ }
+ else if (loadCount == 2) {
+ // Test 1: Check that this page is the referer.
+ is(iframeCw.document.referrer, String(document.location), 'outer iframe referrer');
+
+ // Test 2: file_bug593174_2.html itself contains an iframe, whose src is a
+ // data: uri. Call into that inner iframe and have it set its
+ // document.location. The new document's referrer should be
+ // file_bug593174_2.html.
+
+ // We'll get a call to iframeLoaded when this finishes.
+ iframeCw.navigateInnerIframe();
+ }
+ else if (loadCount == 3) {
+ is(iframeCw.getInnerIframeReferrer(), String(iframeCw.location), 'inner iframe referrer');
+
+ // Now do the test again, this time with a popup.
+ popup = window.open('file_bug593174_1.html');
+ popup.onload = iframeLoaded('popup/outer');
+ }
+ else if (loadCount == 4) {
+ history.replaceState('', '', Math.random());
+
+ popup.onload = null;
+ popup.location = 'file_bug593174_2.html';
+ }
+ else if (loadCount == 5) {
+ is(popup.document.referrer, String(document.location), 'popup referrer after replaceState');
+ popup.navigateInnerIframe();
+ }
+ else if (loadCount == 6) {
+ is(popup.getInnerIframeReferrer(), String(popup.location), 'popup/inner iframe referrer');
+ popup.close();
+ history.replaceState('', '', kOriginalLocation);
+ SimpleTest.finish();
+ }
+}
+
+</script>
+
+<iframe onload='iframeLoaded("outer")' id='iframe' src='file_bug593174_1.html'></iframe>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug61098.html b/dom/tests/mochitest/bugs/test_bug61098.html
new file mode 100644
index 0000000000..9502a28749
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug61098.html
@@ -0,0 +1,370 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=61098
+-->
+<head>
+ <title>Test for Bug 61098</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script src="/tests/SimpleTest/MockObjects.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="runtests();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=61098">Mozilla Bug 61098</a>
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+<script class="testbody" type="text/javascript">
+/** Test for Bug 61098 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var mockPromptServiceRegisterer;
+
+var promptState;
+
+function registerMockPromptService()
+{
+ var { XPCOMUtils } = SpecialPowers.ChromeUtils.importESModule(
+ "resource://gre/modules/XPCOMUtils.sys.mjs"
+ );
+ var Ci = SpecialPowers.Ci;
+
+ function MockPrompt(aDOMWindow) {
+ this.domWindow = SpecialPowers.unwrap(aDOMWindow);
+ }
+
+ MockPrompt.prototype = {
+ QueryInterface(iid) {
+ if (iid.equals(Ci.nsIPrompt)) {
+ return this;
+ }
+ throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
+ },
+
+ domWindow : null,
+
+ _toggleModalState()
+ {
+ // The real prompt service puts the window into a modal state
+ // immediately before showing a modal prompt, and leaves the modal state
+ // when the prompt is dismissed by the user. This mock prompt doesn't
+ // show anything to the user, so we only need to enter and immediately
+ // leave the modal state -- this is done to trigger the necessary
+ // accounting for triggering the "stop showing more prompts" code for
+ // abusive pages.
+ var winUtils = SpecialPowers.getDOMWindowUtils(this.domWindow);
+ winUtils.enterModalState();
+ winUtils.leaveModalState();
+ },
+
+ alert(aDialogTitle, aText)
+ {
+ this._toggleModalState();
+ promptState = {method: "alert",
+ parent: SpecialPowers.unwrap(this.domWindow),
+ title: aDialogTitle,
+ msg: aText
+ };
+ },
+
+ alertCheck(aDialogTitle, aText, aCheckMsg, aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "alertCheck",
+ parent: SpecialPowers.unwrap(this.domWindow),
+ title: aDialogTitle,
+ msg: aText,
+ checkMsg: aCheckMsg,
+ checkState: aCheckState
+ };
+
+ SpecialPowers.wrap(aCheckState).value = true;
+ },
+
+ confirm(aDialogTitle, aText)
+ {
+ this._toggleModalState();
+ promptState = {method: "confirm",
+ parent: SpecialPowers.unwrap(this.domWindow),
+ title: aDialogTitle,
+ msg: aText
+ };
+
+ return true;
+ },
+
+ confirmCheck(aDialogTitle, aText, aCheckMsg, aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "confirmCheck",
+ parent: SpecialPowers.unwrap(this.domWindow),
+ title: aDialogTitle,
+ msg: aText,
+ checkMsg: aCheckMsg,
+ checkState: aCheckState
+ };
+
+ SpecialPowers.wrap(aCheckState).value = true;
+
+ return true;
+ },
+
+ confirmEx(aDialogTitle, aText, aButtonFlags,
+ aButton0Title, aButton1Title, aButton2Title,
+ aCheckMsg, aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "confirmCheck",
+ parent: SpecialPowers.unwrap(this.domWindow),
+ title: aDialogTitle,
+ msg: aText,
+ checkMsg: aCheckMsg,
+ checkState: aCheckState
+ };
+
+ if (aCheckMsg != null)
+ SpecialPowers.wrap(aCheckState).value = true;
+
+ return 0;
+ },
+
+ prompt(aDialogTitle, aText, aValue, aCheckMsg,
+ aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "prompt",
+ parent: SpecialPowers.unwrap(this.domWindow),
+ title: aDialogTitle,
+ msg: aText,
+ checkMsg: aCheckMsg,
+ checkState: aCheckState
+ };
+
+ if (aCheckMsg != null)
+ SpecialPowers.wrap(aCheckState).value = true;
+
+ return true;
+ },
+ };
+
+
+ // Override the prompt service with our own so that we can test
+ // modal dialogs
+
+ function MockPromptService()
+ {
+ }
+
+ MockPromptService.prototype = {
+ QueryInterface(iid) {
+ if (iid.equals(Ci.nsIPromptFactory) || iid.equals(Ci.nsIPromptService)) {
+ return this;
+ }
+ throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
+ },
+
+ getPrompt(aDOMWindow, aIID)
+ {
+ return SpecialPowers.wrapCallbackObject(new MockPrompt(aDOMWindow));
+ },
+
+ alert(aParent, aDialogTitle, aText)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.alert(aDialogTitle, aText);
+ },
+
+ alertCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.alertCheck(aDialogTitle, aText, aCheckMsg, aCheckState);
+ },
+
+ confirm(aParent, aDialogTitle, aText)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.confirm(aDialogTitle, aText);
+ },
+
+ confirmCheck(aParent, aDialogTitle, aText, aCheckMsg,
+ aCheckState)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.confirmCheck(aDialogTitle, aText, aCheckMsg, aCheckState);
+ },
+
+ confirmEx(aParent, aDialogTitle, aText, aButtonFlags,
+ aButton0Title, aButton1Title, aButton2Title,
+ aCheckMsg, aCheckState)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.confirmEx(aDialogTitle, aText, aButtonFlags,
+ aButton0Title, aButton1Title, aButton2Title,
+ aCheckMsg, aCheckState);
+ },
+
+ prompt(aParent, aDialogTitle, aText, aValue, aCheckMsg,
+ aCheckState)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.prompt(aDialogTitle, aText, aValue, aCheckMsg, aCheckState);
+ },
+
+ };
+
+ mockPromptServiceRegisterer =
+ new MockObjectRegisterer("@mozilla.org/prompter;1",
+ MockPromptService);
+ mockPromptServiceRegisterer.register();
+};
+
+var expectedState;
+
+function runtests()
+{
+ SpecialPowers.pushPrefEnv({'set': [["dom.successive_dialog_time_limit", 3]]},
+ runtestsInner);
+}
+
+async function runtestsInner()
+{
+ registerMockPromptService();
+
+ // Test that alert() works normally and then gets blocked on the
+ // second call.
+ w = window.open();
+ w.alert("alert message 1");
+ is (promptState.method, "alert", "Wrong prompt method called");
+ is (promptState.parent, w, "Wrong alert parent");
+ is (promptState.msg, "alert message 1", "Wrong alert message");
+ promptState = void(0);
+
+ w.alert("alert message 2");
+ is (promptState.method, "alertCheck", "Wrong prompt method called");
+ is (promptState.parent, w, "Wrong alert parent");
+ is (promptState.msg, "alert message 2", "Wrong alert message");
+ promptState = void(0);
+
+ try {
+ w.alert("alert message 3");
+ } catch(e) {
+ is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception");
+ }
+
+ is (promptState, void(0), "Wrong prompt state after blocked alert()");
+
+ w.close();
+
+ // Then check that alert() gets blocked with a new window, because
+ // dialogs are disabled/enabled on basis of browsing context groups.
+ w = window.open();
+
+ try {
+ w.alert("alert message 4");
+ } catch(e) {
+ is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception");
+ }
+
+ is (promptState, void(0), "Wrong prompt state after blocked alert()");
+
+ // Reset the state and enable the dialogs again.
+ SpecialPowers.DOMWindowUtils.enableDialogs();
+ SpecialPowers.DOMWindowUtils.resetDialogAbuseState();
+
+ // Test that confirm() works normally and then gets blocked on the
+ // second call.
+ w.confirm("confirm message 1");
+ is (promptState.method, "confirm", "Wrong prompt method called");
+ is (promptState.parent, w, "Wrong confirm parent");
+ is (promptState.msg, "confirm message 1", "Wrong confirm message");
+ promptState = void(0);
+
+ w.confirm("confirm message 2");
+ is (promptState.method, "confirmCheck", "Wrong prompt method called");
+ is (promptState.parent, w, "Wrong confirm parent");
+ is (promptState.msg, "confirm message 2", "Wrong confirm message");
+ promptState = void(0);
+
+ try {
+ w.confirm("confirm message 3");
+ } catch(e) {
+ is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception");
+ }
+
+ is (promptState, void(0), "Wrong prompt state after blocked confirm()");
+
+ w.close();
+
+ // Then check that confirm() gets blocked with a new window, because
+ // dialogs are disabled/enabled on basis of browsing context groups.
+ w = window.open();
+
+ try {
+ w.confirm("confirm message 4");
+ } catch(e) {
+ is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception");
+ }
+
+ is (promptState, void(0), "Wrong prompt state after blocked prompt()");
+
+ // Reset the state and enable the dialogs again.
+ SpecialPowers.DOMWindowUtils.enableDialogs();
+ SpecialPowers.DOMWindowUtils.resetDialogAbuseState();
+
+ // Test that prompt() works normally and then gets blocked on the
+ // second call.
+ w.prompt("prompt message 1");
+ is (promptState.method, "prompt", "Wrong prompt method called");
+ is (promptState.parent, w, "Wrong prompt parent");
+ is (promptState.msg, "prompt message 1", "Wrong prompt message");
+ is (promptState.checkMsg, null, "Wrong dialog value");
+ promptState = void(0);
+
+ w.prompt("prompt message 2");
+ is (promptState.method, "prompt", "Wrong prompt method called");
+ is (promptState.parent, w, "Wrong prompt parent");
+ is (promptState.msg, "prompt message 2", "Wrong prompt message");
+ is (promptState.checkMsg, "Prevent this page from creating additional dialogs", "Wrong dialog value");
+ promptState = void(0);
+
+ try {
+ w.prompt("prompt message 3");
+ } catch(e) {
+ is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception");
+ }
+
+ is (promptState, void(0), "Wrong prompt state after blocked prompt()");
+
+ w.close();
+
+ // Then check that prompt() gets blocked with a new window, because
+ // dialogs are disabled/enabled on basis of browsing context groups.
+ w = window.open();
+
+ try {
+ w.prompt("prompt message 4");
+ } catch(e) {
+ is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception");
+ }
+
+ is (promptState, void(0), "Wrong prompt state after blocked prompt()");
+
+ w.close();
+
+ // Reset the state and enable the dialogs again.
+ SpecialPowers.DOMWindowUtils.enableDialogs();
+ SpecialPowers.DOMWindowUtils.resetDialogAbuseState();
+
+ mockPromptServiceRegisterer.unregister();
+
+ SimpleTest.finish();
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug612267.html b/dom/tests/mochitest/bugs/test_bug612267.html
new file mode 100644
index 0000000000..65e3660be1
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug612267.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=612267
+-->
+<head>
+ <title>Test for Bug 393974</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=612267">Mozilla Bug 612267</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+Window.prototype.test = 'PASS';
+is(window.test, 'PASS', "setting Window.prototype affects window.__proto__");
+is(test, 'PASS', "setting Window.prototype affects the inner window lookup for sure");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug617296.html b/dom/tests/mochitest/bugs/test_bug617296.html
new file mode 100644
index 0000000000..23f0ebf14b
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug617296.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=617296
+-->
+<head>
+ <title>Test for Bug 617296</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=617296">Mozilla Bug 617296</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 617296 **/
+var URL = 5;
+is(URL, 5, "window.URL should be replaceable");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug620947.html b/dom/tests/mochitest/bugs/test_bug620947.html
new file mode 100644
index 0000000000..fdca09af24
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug620947.html
@@ -0,0 +1,31 @@
+<!-- This test must be in quirks mode so it has a document.all -->
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=620947
+-->
+<head>
+ <title>Test for Bug 620947</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=620947">Mozilla Bug 620947</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 620947 **/
+is(-1 in document.all, false, "shouldn't be there");
+is(document.all[-1], undefined, "shouldn't be able to get it");
+
+
+
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug622361.html b/dom/tests/mochitest/bugs/test_bug622361.html
new file mode 100644
index 0000000000..a8855fc853
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug622361.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script>
+var w;
+var counter = 0;
+
+function doNext()
+{
+ counter++;
+ postMessage("ohai", "*");
+}
+
+function boom(event)
+{
+ switch (counter)
+ {
+ case 1:
+ w = window.open("test1_bug622361.html");
+ doNext();
+ return;
+ case 2:
+ w.location = "test2_bug622361.html";
+ function next()
+ {
+ w.history.back();
+ doNext();
+ }
+ setTimeout(next, 5000);
+ return;
+ case 3:
+ localStorage.setItem("key", "value");
+ w.history.forward();
+ doNext();
+ return;
+ case 4:
+ w.close();
+ ok(true, "Test complete");
+ SimpleTest.finish();
+ }
+}
+
+window.addEventListener("message", boom);
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+</script>
+</head>
+<body onload="doNext();"></body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug633133.html b/dom/tests/mochitest/bugs/test_bug633133.html
new file mode 100644
index 0000000000..19c61dbfee
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug633133.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633133
+-->
+<head>
+ <title>Test for Bug 633133</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633133">Mozilla Bug 633133</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <div id='foo'></div>
+ <div name='bar'></div>
+ <select id="select" onchange="var foo = 'bar';">
+ <option>option1</option>
+ <option>option2</option>
+ </select>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 633133 **/
+
+var divCollection = document.getElementsByTagName('div');
+
+ok("foo" in divCollection, "'foo' should be in the div collection");
+ok("bar" in divCollection, "'bar' should be in the div collection");
+ok(!("" in divCollection), "empty string shouldn't be in the div collection");
+ok(!("foobar" in divCollection), "'foobar' shouldn't be in the div collection");
+
+var select = $('select');
+is(select[0].text, "option1", "select elements work");
+Math.sin();
+ok(1 in select, "in works");
+is(select[1].text, "option2", "can get it too");
+ok(!(2 in select), "in works for elements out of range");
+is(select[2], undefined, "can get them too and they're undefined");
+isnot(select.onchange, undefined, "select.onchange shouldn't be undefined");
+is(typeof(select.onchange), 'function', "select.onchange should be a function");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug642026.html b/dom/tests/mochitest/bugs/test_bug642026.html
new file mode 100644
index 0000000000..6f24b2120c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug642026.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=642026
+
+/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-->
+<head>
+ <title>Test for Bug 642026</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=642026">Mozilla Bug 642026</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 642026 **/
+
+var expResult = ["NaN", "Infinity", "undefined", "eval", "parseInt", "parseFloat", "isNaN", "isFinite", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "Object", "Function", "Array", "String", "Boolean", "Number", "Date", "Date", "RegExp", "Error", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "Math", "JSON"];
+
+var result = Object.getOwnPropertyNames(window);
+var result1 = {};
+for (var p in result) {
+ result1[result[p]] = true;
+}
+
+ok(expResult.every(c => result1[c]), "all of the standard classes have been enumerated");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug648465.html b/dom/tests/mochitest/bugs/test_bug648465.html
new file mode 100644
index 0000000000..4ea76555ae
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug648465.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=648465
+-->
+<head>
+ <title>Test for Bug 648465</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=648465">
+ Mozilla Bug 648465</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 648465 **/
+var w = window.open('about:blank');
+try {
+ is(w.fullScreen, false, "can access non-allAccess properties of w");
+} finally {
+ w.close();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug654137.html b/dom/tests/mochitest/bugs/test_bug654137.html
new file mode 100644
index 0000000000..1a1c739764
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug654137.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=654137
+-->
+<head>
+ <title>Test for Bug 654137</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=654137">Mozilla Bug 654137</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 654137 **/
+var prev = window.top;
+top = "Fail";
+is(top, prev, "top should not have been replaced");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug664737.html b/dom/tests/mochitest/bugs/test_bug664737.html
new file mode 100644
index 0000000000..423004b2fc
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug664737.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=664737
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 664737</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=664737">Mozilla Bug 664737</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 664737 **/
+function isUndefined(name) {
+ try {
+ var rv = history[name];
+ is(rv, undefined, "No value found for history." + name);
+ } catch (e) {
+ ok(false, "Accessing history." + name + " threw: " + e);
+ }
+}
+
+isUndefined("current");
+isUndefined("previous");
+isUndefined("next");
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug665548.html b/dom/tests/mochitest/bugs/test_bug665548.html
new file mode 100644
index 0000000000..9d31b32c0a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug665548.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=665548
+-->
+<head>
+ <title>Test for Bug 665548</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=665548">Mozilla Bug 665548</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <iframe name='location'></iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 665548 **/
+
+isnot(window.location, window.frames[0],
+ "window.location shouldn't be the frame named location");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug684544.html b/dom/tests/mochitest/bugs/test_bug684544.html
new file mode 100644
index 0000000000..d069db1969
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug684544.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=
+-->
+<head>
+ <title>Test for Bug </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug **/
+
+var f = document.createElement("iframe");
+document.body.appendChild(f);
+var win = f.contentWindow;
+
+// Set location once to make sure it's resolved
+win.location = "data:text/html,1";
+
+// Now try to make the location object go away.
+f.remove();
+
+// Check that location is now null. If it's not, the test needs changing
+// (e.g. to use window.close() so that it's null).
+is("location" in win, true, "Should still have a location property");
+ok(!!win.location, "Location should not be null");
+
+// Just set the location. This should not crash but throw an exception.
+var noException;
+try {
+ win.location = "data:text/html,2";
+ noException = true;
+} catch(e) {
+ noException = false;
+}
+ok(noException, "Shouldn't throw when setting location.");
+
+// And check that we didn't override the slot in the process.
+is(typeof(win.location), "object", "Location should not have become a string");
+ok(!!win.location, "Location should not be null");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug691707.html b/dom/tests/mochitest/bugs/test_bug691707.html
new file mode 100644
index 0000000000..c567cbefad
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug691707.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=691707
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 691707</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=691707">Mozilla Bug 691707</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 691707 **/
+
+var nodeList = document.body.childNodes;
+var properties = [];
+for (let i in nodeList) {
+ properties.push(i);
+}
+for (var j = 1; j < nodeList.length; ++j)
+ ok(properties.includes("" + j), "Enumerating hit all numeric properties");
+ok(properties.includes("item"), "Enumerating hit 'item' from the prototype");
+ok(properties.includes("length"), "Enumerating hit 'length' from the prototype");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug698061.html b/dom/tests/mochitest/bugs/test_bug698061.html
new file mode 100644
index 0000000000..f023ca0ad8
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug698061.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=698061
+-->
+<head>
+ <title>Test for Bug 698061</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=698061">Mozilla Bug 698061</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 698061 **/
+
+var d = document.createElement("div");
+d.innerHTML = "<span>hello </span><span>world</span>";
+
+var imported = document.importNode(d);
+is(imported.childNodes.length, 0, "Should not have cloned child nodes with no deep arg!");
+is(imported.textContent, "", "Should not have cloned text with no deep arg!");
+
+imported = document.importNode(d, true);
+is(imported.childNodes.length, 2, "Should have cloned child nodes!");
+is(imported.textContent, "hello world", "Should have cloned text!");
+
+imported = document.importNode(d, false);
+is(imported.childNodes.length, 0, "Shouldn't have cloned child nodes!");
+is(imported.textContent, "", "Shouldn't have cloned text!");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug698551.html b/dom/tests/mochitest/bugs/test_bug698551.html
new file mode 100644
index 0000000000..a6b73b4efd
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug698551.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=698551
+-->
+<head>
+ <title>Test for Bug 698551</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=698551">Mozilla Bug 698551</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 698551 **/
+var l = document.getElementsByTagName("body");
+var it = Object.getPrototypeOf(l).item;
+Object.defineProperty(Object.getPrototypeOf(l), "item",
+{
+ get() { return it; },
+});
+Object.defineProperty(Object.getPrototypeOf(l), "foopy",
+{
+ get() { return this[0]; },
+});
+is(l.foopy, document.body,
+ "Should end up with the body correctly when getting via [0]");
+is(l.item(0), document.body,
+ "Should end up with the body correctly when getting via .item(0)");
+is(l.length, 1, "Should have one body");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug707749.html b/dom/tests/mochitest/bugs/test_bug707749.html
new file mode 100644
index 0000000000..b3243ce83f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug707749.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=707749
+-->
+<head>
+ <title>Test for Bug 707749</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=707749 ">Mozilla Bug 707749 </a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 707749 **/
+SimpleTest.waitForExplicitFinish();
+function loaded() {
+ $('ifr').contentDocument.open();
+ $('ifr').contentDocument.close();
+ ok(true, "Don't throw an exception from contentDocument.open()");
+ SimpleTest.finish();
+}
+
+</script>
+<iframe id="ifr" onload="loaded()" srcdoc="<script>navigator</script>"></iframe>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug739038.html b/dom/tests/mochitest/bugs/test_bug739038.html
new file mode 100644
index 0000000000..1f964f3750
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug739038.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=739038
+-->
+<head>
+ <title>Test for Bug 739038</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=739038">Mozilla Bug 739038</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 739038 **/
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv({"set": [["dom.enable_window_print", false]]}, function() {
+ var ifr = document.createElement("iframe");
+ ifr.onload = function() {
+ var win = ifr.contentWindow;
+ var caughtException = false;
+ try {
+ win.print();
+ } catch (e) {
+ caughtException = true;
+ }
+ ok(caughtException, "window.print() should throw an exception");
+ is(win.print, undefined, "window.print shouldn't even exist");
+ SimpleTest.finish();
+ }
+ document.body.appendChild(ifr);
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug740811.html b/dom/tests/mochitest/bugs/test_bug740811.html
new file mode 100644
index 0000000000..cf614de0c8
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug740811.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=740811
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 740811</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=740811">Mozilla Bug 740811</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 740811 **/
+is(Object.getPrototypeOf(SVGElement.prototype), Element.prototype,
+ "Bogus proto for SVGElement");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug743615.html b/dom/tests/mochitest/bugs/test_bug743615.html
new file mode 100644
index 0000000000..19dbb233dd
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug743615.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=743615
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 743615</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="utils_bug743615.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=743615">Mozilla Bug 743615</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<canvas id="c" width="200" height="200"><canvas>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for structured cloning ImageData. **/
+
+SimpleTest.waitForExplicitFinish();
+window.addEventListener('message', windowMessage);
+startTest();
+
+function startTest() {
+ // Make an ImageData.
+ var ctx = document.getElementById('c').getContext('2d');
+ ctx.fillStyle = 'rgb(';
+ ctx.fillRect(30, 30, 50, 50);
+
+ // Make a blank ImageData.
+ var imageData = ctx.createImageData(200, 200);
+ is(imageData.data.length, imageData.width * imageData.height * 4,
+ 'right size for data');
+
+ // Write some things into it.
+ var pattern = makePattern(imageData.data.length, 42, 7);
+ setPattern(imageData, pattern);
+ ok(checkPattern(imageData, pattern), 'Can read it back before sending');
+
+ // PostMessage it to ourselves.
+ window.postMessage({ imageData,
+ pattern,
+ dataRef: imageData.data }, '*');
+}
+
+function windowMessage(evt) {
+ // Check the pattern we received.
+ var imageData = evt.data.imageData;
+ var pattern = evt.data.pattern;
+ ok(checkPattern(imageData, pattern),
+ 'postMessage from self worked correctly');
+
+ is(imageData.data, evt.data.dataRef,
+ 'Should have backrefs for imagedata buffer');
+
+ // Make a new pattern, and send it to a worker.
+ pattern = makePattern(imageData.data.length, 4, 3);
+ setPattern(imageData, pattern);
+ var worker = new Worker('worker_bug743615.js');
+ worker.onmessage = workerMessage;
+ worker.postMessage( {imageData, pattern });
+}
+
+function workerMessage(evt) {
+ // Relay the results of the worker-side tests.
+ is(evt.data.statusMessage, 'PASS', evt.data.statusMessage);
+
+ // Test what the worker sent us.
+ ok(checkPattern(evt.data.imageData, evt.data.pattern),
+ 'postMessage from worker worked correctly');
+
+ // All done.
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug755320.html b/dom/tests/mochitest/bugs/test_bug755320.html
new file mode 100644
index 0000000000..4dcfe8e840
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug755320.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=755320
+-->
+<head>
+ <title>Test for Bug 755320</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=755320">Mozilla Bug 755320</a>
+
+<script type="text/javascript">
+
+/** Test for Bug 755320 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function finish() {
+ ok(true, "Got onload for iframe.");
+ SimpleTest.finish();
+}
+</script>
+
+<!-- remote="true" should be ignored on vanilla iframes. -->
+<iframe remote="true" onload='finish()' src="data:text/html,It worked."></iframe>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug777628.html b/dom/tests/mochitest/bugs/test_bug777628.html
new file mode 100644
index 0000000000..8a00cbd1df
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug777628.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=777628
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 743615</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="utils_bug743615.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777628">Mozilla Bug 777628</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<iframe id="ifr"></iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for structured cloning ImageData from another scope. **/
+
+// Set up an ImageData in another scope.
+var doc = document.getElementById('ifr').contentDocument;
+var canvas = doc.createElement('canvas');
+canvas.width = 200;
+canvas.height = 200;
+doc.body.appendChild(canvas);
+var ctx = canvas.getContext('2d');
+ctx.fillStyle = 'rgb(';
+ctx.fillRect(30, 30, 50, 50);
+var imageData = ctx.createImageData(200, 200);
+
+// Clone it.
+window.postMessage({ imageData }, '*');
+ok(true, "Handled cross-compartment imagedata without throwing/crashing!");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug809290.html b/dom/tests/mochitest/bugs/test_bug809290.html
new file mode 100644
index 0000000000..f6ac91dff6
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug809290.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=809290
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 809290</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=809290">Mozilla Bug 809290</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/*
+ * Test for Bug 809290.
+ *
+ * This test used to check that the referrer was the entry settings object.
+ * Due to spec changes, we now need to check that the referrer is the incumbent
+ * settings object.
+ */
+SimpleTest.waitForExplicitFinish();
+
+var gNotifyCount = 0;
+var base = window.location.href.replace(/test_bug.*/, '');
+function notifyReferrer(referrer) {
+ ++gNotifyCount;
+ if (gNotifyCount == 1) {
+ is(referrer, base + 'file_bug809290_b1.html', "Referrer should come from the incumbent script settings object (1)");
+ document.getElementById('ifr').setAttribute('src', 'file_bug809290_b2.html');
+ } else {
+ is(gNotifyCount, 2, "notify count");
+ is(referrer, base + 'file_bug809290_b2.html', "Referrer should come from the the incumbent script settings object (2)");
+ SimpleTest.finish();
+ }
+}
+
+function go() {
+ var ifr = document.getElementById('ifr');
+ ifr.onload = null;
+ ifr.contentWindow.innerLoad();
+}
+
+</script>
+</pre>
+<iframe id="ifr" src="file_bug809290_b1.html" onload="go();"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug817476.html b/dom/tests/mochitest/bugs/test_bug817476.html
new file mode 100644
index 0000000000..1be29166a3
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug817476.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=817476
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 817476</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=817476">Mozilla Bug 817476</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 817476 **/
+function getNewWindow() {
+ var ifr = document.createElement("iframe");
+ $("content").appendChild(ifr);
+ return ifr.contentWindow;
+}
+
+// Test getting .screen before .Screen
+var win = getNewWindow();
+is(Object.getPrototypeOf(win.screen), win.Screen.prototype,
+ "protos must match (1)");
+is(win.Screen.prototype.toString(), "[object Screen]",
+ "proto must be WebIDL (1)");
+
+// Test getting Screen before .screen
+var win = getNewWindow();
+is(win.Screen.prototype, Object.getPrototypeOf(win.screen),
+ "protos must match (2)");
+is(win.Screen.prototype.toString(), "[object Screen]",
+ "proto must be WebIDL (2)");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug823173.html b/dom/tests/mochitest/bugs/test_bug823173.html
new file mode 100644
index 0000000000..bd2c2fa96e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug823173.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=823173
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 823173</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=823173">Mozilla Bug 823173</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 823173 **/
+try {
+ ok(!(navigator instanceof Window), "navigator is not an instance of Window");
+} catch (e) {
+ ok(false, "instanceof tests should not throw");
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug848088.html b/dom/tests/mochitest/bugs/test_bug848088.html
new file mode 100644
index 0000000000..24c43c421a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug848088.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=848088
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 848088</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 848088 **/
+
+function test(loopFor, setExpandoAt)
+{
+ var list = document.getElementsByTagName("audio");
+ delete list.length;
+ var shouldHaveExpando = false;
+ var realLength = list.length;
+ for (var i = 0; i < loopFor; ++i) {
+ if (i == setExpandoAt) {
+ // Add an expando that shadows.
+ Object.defineProperty(list, "length", { value: "a" });
+ shouldHaveExpando = true;
+ }
+ var hasExpando = (list.length != realLength);
+ if (shouldHaveExpando != hasExpando) {
+ return false;
+ }
+ }
+ return true;
+}
+
+ok(test(200000, 100000), "Correctly detected expando on DOM list object");
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=848088">Mozilla Bug 848088</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug850517.html b/dom/tests/mochitest/bugs/test_bug850517.html
new file mode 100644
index 0000000000..82b209966f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug850517.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=850517
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 850517</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for live updating of named child resolution. **/
+ SimpleTest.waitForExplicitFinish();
+
+ function go() {
+ var ifrA = $('a');
+ var ifrB = $('b');
+ var sb = new SpecialPowers.Cu.Sandbox('http://www.example.com');
+ sb.win = window;
+ sb.childA = ifrA.contentWindow;
+ sb.childB = ifrB.contentWindow;
+ SpecialPowers.setWrapped(sb, 'is', SpecialPowers.wrapFor(is, sb));
+ SpecialPowers.setWrapped(sb, 'ok', SpecialPowers.wrapFor(ok, sb));
+ is(window.theoneandonly.frameElement, ifrA, "Named child resolution works");
+ SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childA, "Named child resolution works via Xray");', sb);
+ ifrA.removeAttribute('name');
+ is(typeof window.theoneandonly, 'undefined', "Revocation works");
+ SpecialPowers.Cu.evalInSandbox('try { win.theoneandonly; ok(false, "Should have thrown"); } ' +
+ 'catch (e) {ok(!!/denied/.exec(e) && !!/theoneandonly/.exec(e), "Revocation works via Xray");};', sb);
+ ifrB.setAttribute('name', 'theoneandonly');
+ is(window.theoneandonly.frameElement, ifrB, "Another mule kicking in the same old stall");
+ SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childB, "Another mule via Xray");', sb);
+ SimpleTest.finish();
+ }
+
+ </script>
+</head>
+<body onload="go();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850517">Mozilla Bug 850517</a>
+<p id="display"></p>
+<iframe id="a" name="theoneandonly"></iframe>
+<iframe id="b"></iframe>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug857555.html b/dom/tests/mochitest/bugs/test_bug857555.html
new file mode 100644
index 0000000000..b72d1573e4
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug857555.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=857555
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 857555</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 857555 **/
+ SimpleTest.waitForExplicitFinish();
+
+ addLoadEvent(function() {
+ is(content, $("t").contentWindow, "'content' as iframe name should work");
+ is(sidebar, $("u").contentWindow, "'sidebar' as iframe name should work");
+ SimpleTest.finish();
+ });
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=857555">Mozilla Bug 857555</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <iframe name="content" id="t"></iframe>
+ <iframe name="sidebar" id="u"></iframe>
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug862540.html b/dom/tests/mochitest/bugs/test_bug862540.html
new file mode 100644
index 0000000000..27e77dc0ef
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug862540.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=862540
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 862540</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 862540 **/
+ window.status = 5;
+ is(window.status, "5", "Should be able to get 5");
+
+ window.status = { toString() { return "foo"; } };
+ ok(window.status === "foo", "Should be coercing window.status to string");
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=862540">Mozilla Bug 862540</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug873229.html b/dom/tests/mochitest/bugs/test_bug873229.html
new file mode 100644
index 0000000000..c245275159
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug873229.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=873229
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 873229</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 873229 **/
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(function() {
+ // We're going to need to be tricky: we want to trigger onerror without
+ // getting an exception thrown in our face. Use event dispatch!
+ var f = $("f").contentWindow;
+ is(typeof(bar), "function", "bar should be a function");
+ is(typeof(f.bar), "function", "bar should be a function in the subframe");
+ var string;
+ var url;
+ var line;
+
+ var oldOnerror = window.onerror;
+
+ // Now we have to be very careful to not trigger any errors we don't
+ // expect!
+ var errorCount = 0;
+
+ window.onerror = function(exceptionString, exceptionURL, exceptionLine) {
+ string = exceptionString;
+ url = exceptionURL;
+ line = exceptionLine;
+ ++errorCount;
+ }
+
+ document.documentElement.onclick = function() {
+ bar();
+ };
+ string = "FAIL";
+ url = "FAIL";
+ line = "FAIL";
+ document.documentElement.dispatchEvent(new Event("click"));
+ is(string, "Script error.", "Did not sanitize string");
+ is(url,
+ "http://example.com/tests/dom/tests/mochitest/bugs/file_bug873229.js",
+ "Should not sanitize URL");
+ is(line, 0, "Did not sanitize line");
+
+ document.documentElement.onclick = function() {
+ f.bar();
+ };
+ string = "FAIL";
+ url = "FAIL";
+ line = "FAIL";
+ document.documentElement.dispatchEvent(new Event("click"));
+ is(string, "Script error.", "Did not sanitize string in iframe");
+ is(url,
+ "http://example.com/tests/dom/tests/mochitest/bugs/file_bug873229.js",
+ "Should not sanitize URL in iframe");
+ is(line, 0, "Did not sanitize line in iframe");
+
+ document.documentElement.onclick = null;
+
+ is(errorCount, 2, "Should have had two exceptions");
+ window.onerror = oldOnerror;
+ SimpleTest.finish();
+ });
+
+ </script>
+ <script src="http://example.com/tests/dom/tests/mochitest/bugs/file_bug873229.js"></script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=873229">Mozilla Bug 873229</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<iframe id="f" srcdoc="<script src='http://example.com/tests/dom/tests/mochitest/bugs/file_bug873229.js'></script>"></iframe>
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug876098.html b/dom/tests/mochitest/bugs/test_bug876098.html
new file mode 100644
index 0000000000..4c4fa41a57
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug876098.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=876098
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 876098</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 876098 **/
+ var div = document.createElement("div");
+ // count has to be large enough to trigger ion-compilation
+ var count = 2000;
+ // Separate function to make sure nothing weird we do block the ion-compile
+ (function() {
+ for (var i = 0; i < count; ++i) {
+ var span = document.createElement("span");
+ span.x = "foo";
+ div.appendChild(span);
+ }
+ })();
+
+ SpecialPowers.gc();
+
+ function allHaveProp() {
+ var kids = div.childNodes;
+ for (var i = 0; i < count; ++i) {
+ if (kids[i].x != "foo") {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ ok(allHaveProp(), "All spans should have the property we added");
+
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=876098">Mozilla Bug 876098</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug927901.html b/dom/tests/mochitest/bugs/test_bug927901.html
new file mode 100644
index 0000000000..c012a062db
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug927901.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=927901
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 927901</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 927901 **/
+ SimpleTest.waitForExplicitFinish();
+
+ var counter = 0;
+ window.onmessage = function(e) {
+ ++counter;
+ is(e.data, "pass", "Accessing window.crypto.getRandomValues in the iframe should have succeeded!");
+ if (counter == 1) {
+ document.getElementById("testiframe").src =
+ "http://mochi.test:8888/tests/dom/tests/mochitest/bugs/file_bug927901.html "
+ } else if (counter == 2) {
+ SimpleTest.finish();
+ }
+ }
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=927901">Mozilla Bug 927901</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+<iframe id="testiframe" src="http://test1.example.org:8000/tests/dom/tests/mochitest/bugs/file_bug927901.html"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html b/dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html
new file mode 100644
index 0000000000..7b0b8ff731
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=673472
+-->
+<head>
+ <title>Test for Bug 673472</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <base href="http://mochi.test:8888/tests/dom/tests/mochitest/bugs/">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=673472">Mozilla Bug 673472</a>
+<pre id="test">
+<script type="application/javascript">
+
+function f() {
+try {
+ var ifr = document.getElementById('i');
+ if (ifr.contentWindow.document.location == 'about:blank') {
+ ifr.remove();
+ ok(true, "no crash received");
+ SimpleTest.executeSoon(SimpleTest.finish);
+ }
+} catch(e) {
+ok(false, e);
+}
+}
+
+SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+<iframe src="devicemotion_outer.html" onload="f()" id=i></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_domparser_after_blank.html b/dom/tests/mochitest/bugs/test_domparser_after_blank.html
new file mode 100644
index 0000000000..d8ea6e09f9
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_domparser_after_blank.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head><meta charset=utf-8>
+ <title>Test for creating DOMParser() after docoment.write() blanks the page</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=820841">Mozilla Bug 820841</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 820841 **/
+
+function startTest() {
+ document.getElementById("testFrame")
+ .setAttribute("src", "iframe_domparser_after_blank.html");
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(startTest);
+
+
+</script>
+</pre>
+<iframe id="testFrame">
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_errorReporting.html b/dom/tests/mochitest/bugs/test_errorReporting.html
new file mode 100644
index 0000000000..aa299c98cc
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_errorReporting.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1070842
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1070842</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for error reporting behavior. **/
+ SimpleTest.waitForExplicitFinish();
+
+ function testErrorReportingHelper(f, rgxp, preventDefault) {
+ return new Promise(function(resolve, reject) {
+ window.addEventListener('error', function(e) {
+ ok(rgxp.test(e.message), "Should get message matching " + rgxp + ". Got: " + e.message);
+ var expectedMessages;
+ if (preventDefault) {
+ e.preventDefault();
+ expectedMessages = [];
+ } else {
+ expectedMessages = [{message: rgxp}];
+ }
+ SimpleTest.monitorConsole(resolve, expectedMessages, /* forbidUnexpectedMsgs = */ true);
+ setTimeout(SimpleTest.endMonitorConsole.bind(SimpleTest), 0);
+ }, {once: true});
+
+ // Notify the test harness to avoid treating the next exception as a test failure.
+ SimpleTest.expectUncaughtException();
+
+ // Invoke the function async so that the exception doesn't get eaten by
+ // the Promise machinery.
+ setTimeout(f, 0);
+ });
+ }
+ function testErrorReporting(f, rgxp) {
+ return new Promise(function(resolve, reject) {
+ testErrorReportingHelper.bind(null, f, rgxp, false)().then(
+ testErrorReportingHelper.bind(null, f, rgxp, true)).then(
+ resolve);
+ });
+ }
+
+ function go() {
+ var otherWin = $('emptyFrame').contentWindow;
+ var clickMe = $('clickMe');
+ testErrorReporting.bind(null, () => { throw Error("Simple Error") }, /Simple Error/)().then(
+ testErrorReporting.bind(null, () => otherWin.eval('throw Error("Cross Global Error")'), /Cross Global Error/)).then(
+ testErrorReporting.bind(null, () => clickMe.dispatchEvent(new MouseEvent('click')), /thrwan/)).then(
+ testErrorReporting.bind(null, () => { clickMe.setAttribute('onclick', ' '); /* Make sure we recompile. */
+ clickMe.setAttribute('onclick', '?');
+ clickMe.onclick; }, /SyntaxError/)).then(
+ SimpleTest.finish.bind(SimpleTest));
+ }
+
+ </script>
+</head>
+<body onload="go();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1070842">Mozilla Bug 1070842</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<button id="clickMe" onclick="thrwan.error;">Click Me</button>
+<iframe id="emptyFrame"></iframe>
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_instanceof_error_message.html b/dom/tests/mochitest/bugs/test_instanceof_error_message.html
new file mode 100644
index 0000000000..05dfa602f7
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_instanceof_error_message.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1530413
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1530413</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+ add_task(() => {
+ var Cu = SpecialPowers.Cu;
+ try {
+ // Test case 1
+ ({} instanceof {});
+ ok(false, "Should throw a type error");
+ } catch (e) {
+ is(e.message, "({}) is not a function", "We should get a correct error message when calling instanceof");
+ }
+ // Test case 2
+ try {
+ ({} instanceof document);
+ ok(false, "Should throw a type error");
+ } catch (e) {
+ is(e.message, "document is not a function", "We should get a correct error message when calling instanceof");
+ }
+ // Test case 3
+ try {
+ ({} instanceof new Proxy(document, {}));
+ ok(false, "Should throw a type error");
+ } catch (e) {
+ is(e.message, "(new Proxy(...)) is not a function", "We should get a correct error message when calling instanceof");
+ }
+ // Test case 4 - Verify invoking instanceof on an object from a different compartment yields the same error
+ var sandbox = SpecialPowers.unwrap(Cu.Sandbox(this, { sameZoneAs: this, freshCompartment: true, wantXrays: false }));
+ sandbox.window = window;
+ sandbox.crossCompartmentObject = {}; // object created in the test compartment
+ try {
+ Cu.evalInSandbox("({} instanceof window);", sandbox);
+ ok(false, "Should throw a type error");
+ } catch (e) {
+ is(e.message, "window is not a function", "We should get a correct error message when calling instanceof");
+ }
+
+ // Test case 5 - Verify we get the same error when the LHS is an object created in a different compartment
+ try {
+ Cu.evalInSandbox("(crossCompartmentObject instanceof window);", sandbox);
+ ok(false, "Should throw a type error");
+ } catch (e) {
+ is(e.message, "window is not a function", "We should get a correct error message when calling instanceof");
+ }
+
+ // Test case 6 - Test that we are correctly wrapping the window into sandbox's compartment
+ window[Symbol.hasInstance] = function(instance) {
+ instance.window = this;
+ return true;
+ }
+ var x = Cu.evalInSandbox("(crossCompartmentObject instanceof window);", sandbox);
+ ok(x, "Symbol.hasInstance for window should return true");
+ is(sandbox.crossCompartmentObject.window, window, "We shouldn't leak the window");
+ delete window[Symbol.hasInstance];
+ Cu.nukeSandbox(sandbox);
+
+ // Test case 7 - Test instanceof with RHS being a same-origin Xray to a Window
+ sandbox = SpecialPowers.unwrap(Cu.Sandbox(this, { sameZoneAs: this, freshCompartment: true}));
+ sandbox.window = window;
+ sandbox.crossCompartmentObject = {};
+
+ window[Symbol.hasInstance] = function(instance) {
+ instance.window = this;
+ return true;
+ }
+ try {
+ Cu.evalInSandbox("(crossCompartmentObject instanceof window);", sandbox);
+ ok(false, "Should throw a type error");
+ } catch (e) {
+ is(e.message, "window is not a function",
+ "We should get a correct error thrown when the RHS of instanceof is an Xray to a Window.");
+ }
+ delete window[Symbol.hasInstance];
+ Cu.nukeSandbox(sandbox);
+
+ // Test case 8 - Test instanceof with RHS being a same-origin Xray waiver
+ sandbox = SpecialPowers.unwrap(Cu.Sandbox(this, { sameZoneAs: this, freshCompartment: true}));
+ sandbox.window = window;
+ sandbox.crossCompartmentObject = {};
+ sandbox.waiveXrays = SpecialPowers.wrapFor(Cu.waiveXrays, sandbox);
+
+ window[Symbol.hasInstance] = function(instance) {
+ instance.window = this;
+ return true;
+ }
+ Cu.evalInSandbox("(crossCompartmentObject instanceof waiveXrays(window));", sandbox);
+ ok(x, "Symbol.hasInstance for window should return true");
+ is(sandbox.crossCompartmentObject.window, window,
+ "The window pointed to by the crossCompartmentObject should be the same as the window in our compartment");
+ delete window[Symbol.hasInstance];
+ Cu.nukeSandbox(sandbox);
+ });
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1530413">Mozilla Bug 1530413</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/bugs/test_navigator_buildID.html b/dom/tests/mochitest/bugs/test_navigator_buildID.html
new file mode 100644
index 0000000000..231bd99c23
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_navigator_buildID.html
@@ -0,0 +1,93 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=583181
+-->
+<head>
+ <title>Test for Bug 583181</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/ChromeTask.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="onLoad()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=583181">Mozilla Bug 583181</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+const LEGACY_BUILD_ID = 20181001000000;
+
+//
+// Access navigator.buildID from unprivileged web content.
+//
+var isOK = false;
+try {
+ var contentBuildID = navigator.buildID;
+ isOK = true;
+} catch (ex) {
+}
+ok(isOK, "navigator.buildID should never throw");
+is(typeof(contentBuildID), "string", "navigator.buildID should be a string");
+is(+contentBuildID, LEGACY_BUILD_ID,
+ "navigator.buildID should be spoofed in content");
+
+async function onLoad() {
+ //
+ // Access navigator.buildID from chrome.
+ //
+ let chromeBuildID = await ChromeTask.spawn(null, () => {
+ const browser = Services.wm.getMostRecentBrowserWindow();
+ return browser.navigator.buildID;
+ });
+
+ ok(+chromeBuildID > LEGACY_BUILD_ID,
+ `navigator.buildID should be exposed in chrome - got "${chromeBuildID}"`);
+
+ //
+ // Access navigator.buildID from mozilla.org.
+ //
+ let mozillaBuildID = await getMozillaBuildID();
+
+ ok(+mozillaBuildID > LEGACY_BUILD_ID,
+ `navigator.buildID should be exposed on mozilla.org ` +
+ `- got "${mozillaBuildID}"`);
+ is(chromeBuildID, mozillaBuildID,
+ "navigator.buildID should be the same in chrome and on mozilla.org");
+
+ //
+ // Access navigator.buildID from mozilla.org when resisting fingerprinting.
+ //
+ await SpecialPowers.pushPrefEnv(
+ {"set": [["privacy.resistFingerprinting", true]]});
+
+ let resistBuildID = await getMozillaBuildID();
+
+ is(+resistBuildID, LEGACY_BUILD_ID,
+ "navigator.buildID should be spoofed on mozilla.org when " +
+ "resisting fingerprinting");
+
+ SimpleTest.finish();
+}
+
+async function getMozillaBuildID() {
+ let iframe = document.getElementById("mozillaIFrame");
+
+ await new Promise(resolve => {
+ iframe.addEventListener("load", resolve, { once: true });
+ SpecialPowers.spawn(iframe, [], () => this.content.location.reload());
+ });
+
+ return SpecialPowers.spawn(
+ iframe, [], () => this.content.wrappedJSObject.navigator.buildID);
+}
+</script>
+</pre>
+<iframe id="mozillaIFrame" src="https://www.mozilla.org/" />
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_no_find_showDialog.html b/dom/tests/mochitest/bugs/test_no_find_showDialog.html
new file mode 100644
index 0000000000..5cfa36ebc0
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_no_find_showDialog.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1348409</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <iframe src="about:blank"></iframe>
+ <script type="text/javascript">
+
+ async function checkForFindDialog() {
+ let chromeScript = SpecialPowers.loadChromeScript(_ => {
+ /* eslint-env mozilla/chrome-script */
+ addMessageListener("test:check", () => {
+ let sawFind = false;
+ let findDialog = Services.wm.getMostRecentWindow("findInPage");
+ if (findDialog) {
+ findDialog.close();
+ sawFind = true;
+ }
+
+ return sawFind;
+ });
+
+ });
+
+ let sawFind = await chromeScript.sendQuery("test:check");
+ chromeScript.destroy();
+ return sawFind;
+ }
+
+ function ensureFinished(chromeScript) {
+ return new Promise(resolve => {
+ chromeScript.addMessageListener("test:disarm:done", (sawWindow) => {
+ resolve(sawWindow);
+ });
+ chromeScript.sendAsyncMessage("test:disarm");
+ });
+ }
+
+ function doWraparoundFind(findString, showDialog) {
+ let result = window.find(findString,
+ false /* aCaseSensitive */,
+ false /* aBackwards*/,
+ true /* aWrapAround */,
+ false /* aWholeWord */,
+ false /* aSearchInFrames */,
+ showDialog /* aShowInDialog */)
+ // Collapse selection so that we can do another find outside
+ // of the selection result.
+ document.getSelection().collapseToStart();
+ return result;
+ }
+
+ function startTest() {
+ add_task(async function() {
+ ok(doWraparoundFind("text to search for", false),
+ "Found the text in the document body.");
+
+ // We're asking for the dialog now. We should just ignore that request.
+ ok(doWraparoundFind("fhqwhgads", true),
+ "Should return true and not show a dialog if the string exists in the page.");
+ ok(!doWraparoundFind(null, true),
+ "Should return false and not show a dialog if we pass a null string.");
+ ok(!doWraparoundFind("", true),
+ "Should return false and not show a dialog if we pass an empty string.");
+
+ // Double check to ensure that the parent didn't open a find dialog
+ let sawWindow = await checkForFindDialog();
+ ok(!sawWindow, "Should never have seen the dialog.");
+ });
+ }
+ </script>
+</head>
+<body onload="startTest()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1348409">Mozilla Bug 1348409</a>
+
+<p>
+ Here's some text to search for: fhqwhgads! A hovercraft full of eels!
+</p>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_onerror_message.html b/dom/tests/mochitest/bugs/test_onerror_message.html
new file mode 100644
index 0000000000..476c02d978
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_onerror_message.html
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=743049
+-->
+<head>
+ <meta charset="UTF-8">
+ <title>Test for Bug 743049</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=743049">Mozilla Bug 743049</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <iframe id="frame"></iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+"use strict";
+
+/** Test for Bug 743049 **/
+
+var expected = [
+{ name: "Error", message: "foo", filename: String(location), lineNumber: 45 },
+{ name: "Error", message: "foo", filename: "bar", lineNumber: 123 },
+{ name: "", message: "uncaught exception: [object Object]", filename: location.href, lineNumber: 80 },
+{ name: "DuckError", message: "foo", filename: "bar", lineNumber: 123 },
+{ name: "", message: "uncaught exception: [object Object]", filename: location.href, lineNumber: 80 },
+{ name: "", message: "foo", filename: "baz", lineNumber: 123 },
+{ name: "", message: "uncaught exception: [object Object]", filename: location.href, lineNumber: 80 },
+{ name: "InvalidStateError", message: "XMLHttpRequest.responseType setter: Cannot set 'responseType' property on XMLHttpRequest after 'send()' (when its state is LOADING or DONE).", filename: String(location), lineNumber: 62 },
+{ name: "ReferenceError", message: "xxx is not defined", filename: String(location), lineNumber: 64 },
+{ name: "ReferenceError", message: "xxx is not defined", filename: String(location), lineNumber: 66 }
+];
+
+var counter = 0;
+var origin = location.protocol + "//" + location.host;
+postMessage(counter, origin);
+window.onmessage = function(e) {
+ if (e.origin !== origin)
+ return;
+ try {
+ if (e.data == 0) {
+ throw new Error("foo");
+ } else if (e.data == 1) {
+ throw new Error("foo","bar",123);
+ } else if (e.data == 2) {
+ throw {};
+ } else if (e.data == 3) {
+ throw {name:"DuckError",message:"foo",filename:"bar",lineNumber:123};
+ } else if (e.data == 4) {
+ throw {name:"DuckError",filename:"bar",lineNumber:123};
+ } else if (e.data == 5) {
+ throw {message:"foo",fileName:"baz",lineNumber:123};
+ } else if (e.data == 6) {
+ throw {name:3,message:4,lineNumber:123};
+ } else if (e.data == 7) {
+ var x = new XMLHttpRequest();
+ x.open("GET", location, false);
+ var a = x.send();
+ x.responseType = "arraybuffer";
+ } else if (e.data == 8) {
+ throw new ReferenceError("xxx is not defined");
+ } else if (e.data == 9) {
+ new xxx;
+ } else {
+ SimpleTest.finish();
+ return;
+ }
+ } catch (e) {
+ if (e instanceof Error || typeof e.message=="string" &&
+ ("filename" in e || "fileName" in e) && "lineNumber" in e) {
+ is(e.message, expected[counter].message, counter + " catch message");
+ is(e.filename || e.fileName, expected[counter].filename, counter + " catch filename");
+ is(e.lineNumber, expected[counter].lineNumber, counter + " catch lineno");
+ } else {
+ is("uncaught exception: " + e, expected[counter].message, counter + " catch message");
+ }
+ throw e;
+ }
+ ok(false, counter + " Error should be thrown or test should finish");
+};
+window.onerror = function(message, filename, lineno) {
+ is(message, Error.prototype.toString.call(expected[counter]), counter + " onerror message");
+ is(filename, expected[counter].filename, counter + " onerror filename");
+ is(lineno, expected[counter].lineNumber, counter + " onerror lineno");
+ postMessage(++counter, origin);
+ return true;
+};
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_postmessage.html b/dom/tests/mochitest/bugs/test_postmessage.html
new file mode 100644
index 0000000000..8dee4ec4a5
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_postmessage.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1574017</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/ChromeTask.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+ async function waitForErrorMessage(err) {
+ return ChromeTask.spawn(err, async err => {
+ await new Promise(resolve => {
+ let console = Services.console;
+ console.reset();
+ console.registerListener(function listener(aMessage) {
+ var sourceName = `http://mochi.test:8888/tests/dom/tests/mochitest/bugs/test_postmessage.html`;
+ if (
+ aMessage.message.includes(err) &&
+ aMessage instanceof Ci.nsIScriptError &&
+ aMessage.sourceName == sourceName
+ ) {
+ console.unregisterListener(listener);
+ resolve();
+ }
+ });
+ });
+ });
+ }
+ add_task(async function testNoCallerURI() {
+ var Cu = SpecialPowers.Cu;
+ var princ = SpecialPowers.wrap(window.document).nodePrincipal;
+ var sandbox = Cu.Sandbox(princ, { sameZoneAs: this });
+ SpecialPowers.unwrap(sandbox).win = window.frames.diffDomain;
+ var err = `Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://example.com’) does not match the recipient window’s origin (‘https://example.org’).`;
+ let consolePromise = waitForErrorMessage(err);
+ Cu.evalInSandbox(
+ 'win.postMessage("We should not be able to post this message", "https://example.com");',
+ sandbox
+ );
+ await consolePromise;
+ ok(true, "Error message was logged correctly to the console");
+ Cu.nukeSandbox(sandbox);
+ });
+ add_task(async function testWithWindowID() {
+ var err = `Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://example.ru’) does not match the recipient window’s origin (‘https://example.org’).`;
+ let consolePromise = waitForErrorMessage(err);
+ window.frames.diffDomain.postMessage(
+ "The window should not receive this",
+ "https://example.ru"
+ );
+ await consolePromise;
+ ok(true, "Error message was logged correctly to the console");
+ });
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1574017">Mozilla Bug 1574017</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+<iframe id="diffDomain" name="diffDomain" src="https://example.org/tests/dom/tests/mochitest/bugs/file_empty.html"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_protochains.html b/dom/tests/mochitest/bugs/test_protochains.html
new file mode 100644
index 0000000000..62be36d118
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_protochains.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=817420
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 817420</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=817420">Mozilla Bug 817420</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 817420 **/
+is(Object.getPrototypeOf(HTMLElement.prototype), Element.prototype,
+ "Must have correct proto chain for HTMLElement.prototype");
+is(Object.getPrototypeOf(document.createElementNS(null, "x")),
+ Element.prototype,
+ "Must have correct proto chain for random element");
+is(Object.getPrototypeOf(document.createElement("noSuchElementName")),
+ HTMLUnknownElement.prototype,
+ "Must have correct proto chain for random HTML element");
+
+// And check that it's really working as it should
+function checkPropPresent(propName, objList, expected)
+{
+ for (obj of objList) {
+ is(propName in obj,
+ expected,
+ obj + " should " + (expected ? "" : "not ") + "have the property");
+ }
+}
+var objList = [ Element.prototype,
+ HTMLElement.prototype,
+ document.createElementNS(null, "x"),
+ document.createElement("noSuchElementName"),
+ document.body ]
+checkPropPresent("somePropertyThatBetterNeverExist", objList, false);
+Element.prototype.somePropertyThatBetterNeverExist = 1;
+checkPropPresent("somePropertyThatBetterNeverExist", objList, true);
+
+objList = [ HTMLElement.prototype,
+ document.createElement("noSuchElementName"),
+ document.body ]
+checkPropPresent("someOtherPropertyThatBetterNeverExist", objList, false);
+HTMLElement.prototype.someOtherPropertyThatBetterNeverExist = 1;
+checkPropPresent("someOtherPropertyThatBetterNeverExist", objList, true);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_resize_move_windows.html b/dom/tests/mochitest/bugs/test_resize_move_windows.html
new file mode 100644
index 0000000000..11b2d90f21
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_resize_move_windows.html
@@ -0,0 +1,349 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=565541
+-->
+<head>
+ <title>Test for Bug 565541</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565541">Mozilla Bug 565541</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script>
+
+/** Test for Bug 565541 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var previousX, previousY, previousWidth, previousHeight;
+
+["innerWidth", "innerHeight", "screenX", "screenY", "outerWidth",
+ "outerHeight"].map(function(name) {
+ window[name+"Getter"] = Object.getOwnPropertyDescriptor(window, name).get;
+});
+
+function backValues()
+{
+ previousX = window.screenX;
+ previousY = window.screenY;
+ previousWidth = window.outerWidth;
+ previousHeight = window.outerHeight;
+}
+
+function restoreValues()
+{
+ window.moveTo(previousX, previousY);
+ window.resizeTo(previousWidth, previousHeight);
+}
+
+function getNewWidth(aWindow)
+{
+ return (aWindow.innerWidth > (screen.width / 2)) ? 100 : screen.width;
+}
+
+function getNewHeight(aWindow)
+{
+ return (aWindow.innerHeight > (screen.height / 2)) ? 100 : screen.height;
+}
+
+function getNewX(aWindow)
+{
+ return (aWindow.screenX > ((screen.width - aWindow.outerWidth) / 2))
+ ? 0 : screen.width - aWindow.outerWidth;
+}
+
+function getNewY(aWindow)
+{
+ return (aWindow.screenY > ((screen.height - aWindow.outerHeight) / 2))
+ ? 0 : screen.height - aWindow.outerHeight;
+}
+
+/**
+ * hitEventLoop is called when we want to check something but we can't rely on
+ * an event or a specific number of event loop hiting.
+ * This method can be called by specifying a condition, a test (using SimpleTest
+ * API), how many times the event loop has to be hit and what to call next.
+ * If times < 0, the event loop will be hit as long as the condition isn't
+ * true or the test doesn't time out.
+ */
+function hitEventLoop(condition, test, times) {
+ return new Promise(function(resolve, reject) {
+ function doMagic() {
+ if (condition() || times == 0) {
+ test();
+ resolve();
+ return;
+ }
+
+ times--;
+ setTimeout(doMagic, 0);
+ }
+
+ doMagic();
+ });
+}
+
+function checkChangeIsDisabled(aWindow) {
+ // We want to check that nothing has changed. Having a high value would take
+ // too much time. Worse thing that could happen is random green.
+ var hits = 5;
+
+ function getProp(propName) {
+ return window[propName + "Getter"].call(aWindow);
+ }
+
+ var originalWidth = getProp("innerWidth");
+ var originalHeight = getProp("innerHeight");
+
+ var originalX = getProp("screenX");
+ var originalY = getProp("screenY");
+
+ var oWidth = getProp("outerWidth");
+ var oHeight = getProp("outerHeight");
+
+ function changeCondition() {
+ return aWindow.innerWidth != originalWidth ||
+ aWindow.innerHeight != originalHeight ||
+ aWindow.screenX != originalX || aWindow.screenY != originalY ||
+ aWindow.outerWidth != oWidth || aWindow.outerHeight != oHeight;
+ }
+
+ function changeTest() {
+ is(getProp("innerWidth"), originalWidth,
+ "Window width shouldn't have changed");
+ is(getProp("innerHeight"), originalHeight,
+ "Window height shouldn't have changed");
+ is(getProp("screenX"), originalX,
+ "Window x position shouldn't have changed");
+ is(getProp("screenY"), originalY,
+ "Window y position shouldn't have changed");
+ is(getProp("outerWidth"), oWidth,
+ "Window outerWidth shouldn't have changed");
+ is(getProp("outerHeight"), oHeight,
+ "Window outerHeight shouldn't have changed");
+ }
+
+ /**
+ * Size changes.
+ */
+ var newWidth = getNewWidth(aWindow);
+ var newHeight = getNewHeight(aWindow);
+
+ aWindow.resizeTo(newWidth, newHeight);
+
+ aWindow.resizeBy(newWidth - aWindow.innerWidth,
+ newHeight - aWindow.innerHeight);
+
+ aWindow.sizeToContent();
+
+ /**
+ * Position checks.
+ */
+ var newX = getNewX(aWindow);
+ var newY = getNewY(aWindow);
+
+ aWindow.moveTo(newX, newY);
+
+ aWindow.moveBy(newX - aWindow.screenX,
+ newY - aWindow.screenY);
+
+ /**
+ * Outer width/height checks.
+ */
+ aWindow.resizeTo(aWindow.outerWidth * 2, aWindow.outerHeight * 2);
+
+ // We did a lot of changes. Now, we are going to wait and see if something
+ // happens.
+ // NOTE: if this happens to fail, you will have to check manually which
+ // operation has been accepted.
+ return hitEventLoop(changeCondition, changeTest, hits);
+}
+
+function checkChangeIsEnabled(aWindow, aNext)
+{
+ info(`checkChangeIsEnabled start`);
+ // Something should happen. We are not going to go to the next test until
+ // it does.
+ var hits = -1;
+
+ var prevWidth;
+ var prevHeight;
+
+ var prevX;
+ var prevY;
+
+ var oWidth;
+ var oHeight;
+
+ function sizeChangeCondition() {
+ return aWindow.outerWidth != prevWidth && aWindow.outerHeight != prevHeight;
+ }
+
+ function sizeChangeTest() {
+ isnot(aWindow.outerWidth, prevWidth, "Window width should have changed");
+ isnot(aWindow.outerHeight, prevHeight, "Window height should have changed");
+
+ prevWidth = aWindow.outerWidth;
+ prevHeight = aWindow.outerHeight;
+ }
+
+ function posChangeCondition() {
+ // With GTK, sometimes, only one dimension changes.
+ if (navigator.platform.includes('Linux')) {
+ return aWindow.screenX != prevX || aWindow.screenY != prevY;
+ }
+ return aWindow.screenX != prevX && aWindow.screenY != prevY;
+ }
+
+ function posChangeTest() {
+ // With GTK, sometimes, only one dimension changes.
+ if (navigator.platform.includes('Linux')) {
+ // With GTK, sometimes, aWindow.screenX changes during two calls.
+ // So we call it once and save the returned value.
+ var x = aWindow.screenX;
+ var y = aWindow.screenY;
+ if (x != prevX) {
+ isnot(x, prevX, "Window x position should have changed");
+ }
+ if (y != prevY) {
+ isnot(y, prevY, "Window y position should have changed");
+ }
+ } else {
+ isnot(aWindow.screenX, prevX, "Window x position should have changed");
+ isnot(aWindow.screenY, prevY, "Window y position should have changed");
+ }
+
+ prevX = aWindow.screenX;
+ prevY = aWindow.screenY;
+ }
+
+ function outerChangeCondition() {
+ return aWindow.outerWidth != oWidth && aWindow.outerHeight != oHeight;
+ }
+
+ function outerChangeTest() {
+ isnot(aWindow.outerWidth, oWidth, "Window outerWidth should have changed");
+ isnot(aWindow.outerHeight, oHeight, "Window outerHeight should have changed");
+ }
+
+ /**
+ * Size checks.
+ */
+ prevWidth = aWindow.outerWidth;
+ prevHeight = aWindow.outerHeight;
+
+ aWindow.resizeTo(getNewWidth(aWindow), getNewHeight(aWindow));
+ hitEventLoop(sizeChangeCondition, sizeChangeTest, hits)
+ .then(function() {
+ aWindow.resizeTo(getNewWidth(aWindow), getNewHeight(aWindow));
+ return hitEventLoop(sizeChangeCondition, sizeChangeTest, hits);
+ })
+ .then(function () {
+ aWindow.resizeBy(getNewWidth(aWindow) - aWindow.innerWidth,
+ getNewHeight(aWindow) - aWindow.innerHeight);
+ return hitEventLoop(sizeChangeCondition, sizeChangeTest, hits);
+ })
+ .then(function() {
+ aWindow.sizeToContent();
+ return hitEventLoop(sizeChangeCondition, sizeChangeTest, hits);
+ })
+ .then(function() {
+ /**
+ * Position checks.
+ */
+ prevX = aWindow.screenX;
+ prevY = aWindow.screenY;
+
+ aWindow.moveTo(getNewX(aWindow), getNewY(aWindow));
+ return hitEventLoop(posChangeCondition, posChangeTest, hits);
+ })
+ .then(function() {
+ prevX = aWindow.screenX;
+ prevY = aWindow.screenY;
+
+ aWindow.moveBy(getNewX(aWindow) - aWindow.screenX,
+ getNewY(aWindow) - aWindow.screenY);
+ return hitEventLoop(posChangeCondition, posChangeTest, hits);
+ })
+ .then(function() {
+ /**
+ * Outer width/height checks.
+ */
+ oWidth = aWindow.outerWidth;
+ oHeight = aWindow.outerHeight;
+
+ aWindow.resizeTo(oWidth * 2, oHeight * 2);
+ return hitEventLoop(outerChangeCondition, outerChangeTest, hits);
+ })
+ .then(function() {
+ let origWidth = oWidth;
+ let origHeight = oHeight;
+
+ oWidth = aWindow.outerWidth;
+ oHeight = aWindow.outerHeight;
+
+ aWindow.resizeTo(origWidth, origHeight);
+ return hitEventLoop(outerChangeCondition, outerChangeTest, hits);
+ })
+ .then(aNext);
+}
+
+SpecialPowers.pushPrefEnv({
+ "set": [["dom.disable_window_move_resize", false]]},
+ function() {
+SimpleTest.waitForFocus(function() {
+ if (screen.width <= 200 || screen.height <= 200) {
+ todo(false, "The screen needs to be bigger than 200px*200px to run this test.");
+ SimpleTest.finish();
+ return;
+ }
+
+ backValues();
+
+ // The current window can't change it's own size and position.
+ checkChangeIsDisabled(window).then(function() {
+ info(`Change was disabled`);
+ // We create a window and check that it can change its own size and position.
+ // However, passing size/position parameters to window.open should work.
+ var w = window.open("file_resize_move_windows_1.html", '',
+ 'width=170,height=170,screenX=65,screenY=65');
+
+ SimpleTest.waitForFocus(function() {
+ w.check(function() {
+ // The current window can change the size and position of the created one.
+ checkChangeIsEnabled(w, function() {
+ w.close();
+
+ // If we call window.open with an empty string as a third parameter,
+ // by default, it will create a new tab instead of a new window.
+ // In that case, we shouldn't allow the caller to change the size/position.
+ w = window.open("file_resize_move_windows_2.html", '', '');
+ SimpleTest.waitForFocus(function() {
+ w.check(function() {
+
+ // The current window can't change the size and position of the new tab.
+ checkChangeIsDisabled(w).then(function() {
+ w.close();
+
+ restoreValues();
+ SimpleTest.finish();
+ });
+ });
+ }, w, false);
+ });
+ })
+ }, w, false);
+ });
+});
+}); // SpecialPowers.pushPrefEnv()
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_sizetocontent_clamp.html b/dom/tests/mochitest/bugs/test_sizetocontent_clamp.html
new file mode 100644
index 0000000000..745c96e6cc
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_sizetocontent_clamp.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=764240
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 764240</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=764240">Mozilla Bug 764240</a>
+<p id="display"></p>
+<div id="content">
+ <button onclick="test();">run test</button>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 764240 **/
+
+SimpleTest.waitForExplicitFinish();
+
+// Error margin allowed for the window's size. Windows has varying minimum
+// sizes depending on the os due to outer window chrome. Unix is given 5
+// pixels to protect against minor variances.
+var epsilon = !navigator.platform.includes("Win") ? 5 : 20;
+
+// Windows 8 has a minimum 122 pixel inner window width due to
+// outer window chrome.
+var isWin8 = (navigator.userAgent.includes("Windows NT 6.2"));
+
+var innerWidthMin = (isWin8 ? 120 : 100);
+var innerWidthMax = (isWin8 ? 125 : 100);
+
+var isExecuted = false;
+
+function test() {
+ var w = window.open('file_empty.html', null, 'width=300,height=300');
+
+ SimpleTest.waitForFocus(function() {
+ w.onresize = function() {
+ info(`got resize: ${w.innerWidth} ${w.innerHeight}`);
+
+ if (w.innerWidth > 300 - epsilon || isExecuted) {
+ return;
+ }
+
+ isExecuted = true;
+
+ ok(w.innerWidth + epsilon >= innerWidthMin && w.innerWidth - epsilon <= innerWidthMax,
+ "innerWidth should be between " + innerWidthMin + " and " + innerWidthMax + " but it was: " + w.innerWidth);
+ ok(w.innerHeight + epsilon >= 100 && w.innerHeight - epsilon <= 100,
+ "innerHeight should be around 100" + " but it was: " + w.innerHeight);
+
+ w.close();
+
+ SimpleTest.waitForFocus(function() {
+ SimpleTest.finish();
+ });
+ };
+ w.sizeToContent();
+ }, w);
+}
+
+SimpleTest.waitForFocus(function() {
+ synthesizeMouseAtCenter(document.getElementsByTagName('button')[0], {});
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_toJSON.html b/dom/tests/mochitest/bugs/test_toJSON.html
new file mode 100644
index 0000000000..77eaccb1d1
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_toJSON.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=760851
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 760851</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 760851 **/
+ SimpleTest.waitForExplicitFinish();
+
+ // We need to skip all the interface constants.
+ var keysToSkip = ["TYPE_NAVIGATE", "TYPE_RELOAD", "TYPE_RESERVED",
+ "TYPE_BACK_FORWARD"];
+
+ // Testing window.performance is sufficient, because checkAttributesMatch is
+ // recursive, so window.performance.navigation and window.performance.timing
+ // get tested as well.
+ var toTest = [window.performance];
+
+ // The event handler has to be initialized or else jsonObj will be undefined
+ window.performance.onresourcetimingbufferfull = function() {};
+
+ function checkAttributesMatch(obj, jsonObj) {
+ // EventCounts isn't going to converted to a JSON string
+ if ('EventCounts' in window && obj instanceof EventCounts) {
+ return;
+ }
+ if (typeof(obj) !== "object") {
+ throw "Expected obj to be of type \"object\". Test failed.";
+ }
+ if (typeof(jsonObj) !== "object") {
+ is(false, "Expected object " + jsonObj + " to be of type object, but gotten otherwise");
+ }
+ for (key in obj) {
+ if (typeof(obj[key]) === "function" || keysToSkip.indexOf(key) > -1)
+ continue;
+ if (typeof(obj[key]) === "object") {
+ checkAttributesMatch(obj[key], jsonObj[key]);
+ continue;
+ }
+ is(jsonObj[key], obj[key], "values for " + obj + " key " + key + " should match");
+ }
+ }
+
+ function runTest() {
+ toTest.forEach(function(testObj) {
+ var jsonCopy = JSON.parse(JSON.stringify(testObj));
+ checkAttributesMatch(testObj, jsonCopy);
+ });
+ SimpleTest.finish();
+ }
+
+ </script>
+</head>
+<body onload="runTest();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=760851">Mozilla Bug 760851</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ <p></p>
+ <p></p>
+ <p></p>
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_window_bar.html b/dom/tests/mochitest/bugs/test_window_bar.html
new file mode 100644
index 0000000000..7c5a1f38a6
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_window_bar.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=642338
+-->
+<head>
+ <title>Test for Bug 642338</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=642338">Mozilla Bug 642338</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/* Test that the following window properties work:
+
+ menubar
+ toolbar
+ locationbar
+ personalbar
+ statusbar
+ scrollbars
+
+*/
+
+// Popup is opened if one of the following condtitions is met:
+// * both location and toolbar are false
+// * menubar is false
+// * resizable is false
+// * scrollbars is false
+// * status is false
+var featuresList = [
+ {
+ type: 'non-popup',
+ target: 'all-bars-toolbar',
+ features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes',
+ },
+ {
+ type: 'non-popup',
+ target: 'all-bars-location',
+ features: 'location=yes,menubar=yes,status=yes,scrollbars=yes',
+ },
+ {
+ type: 'popup',
+ target: 'no-menubar',
+ features: 'toolbar=yes,menubar=no,status=yes,scrollbars=yes',
+ },
+ {
+ type: 'popup',
+ target: 'no-toolbar',
+ features: 'toolbar=no,menubar=yes,status=yes,scrollbars=yes',
+ },
+ {
+ type: 'popup',
+ target: 'no-status',
+ features: 'toolbar=yes,menubar=yes,status=no,scrollbars=yes',
+ },
+ {
+ type: 'popup',
+ target: 'no-scrollbars',
+ features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=no',
+ },
+ {
+ type: 'popup',
+ target: 'no-bars',
+ features: 'toolbar=no,menubar=no,status=no,scrollbars=no',
+ },
+ {
+ type: 'popup',
+ target: 'no-resizable',
+ features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
+ + ',resizable=no',
+ },
+ {
+ type: 'non-popup',
+ target: 'width-sized',
+ features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
+ + ',width=500',
+ },
+ {
+ // if features isnt empty, toolbar and location defaults to false,
+ // and that results in popup.
+ type: 'popup',
+ target: 'only-width-sized',
+ features: 'width=500',
+ },
+ {
+ type: 'non-popup',
+ target: 'height-sized',
+ features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
+ + ',height=500',
+ },
+ {
+ type: 'non-popup',
+ target: 'sized',
+ features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
+ + ',width=500,height=500',
+ },
+ {
+ type: 'popup',
+ target: 'only-sized',
+ features: 'width=500,height=500',
+ },
+];
+
+var numWindows = 0;
+
+/* Called when our popup loads. */
+function testWindow(w)
+{
+ function checkFeature(feature) {
+ if (w.location.search.startsWith('?popup')) {
+ is(w[feature].visible, false, `${feature} should be hidden for popup (${w.name}).`);
+ } else {
+ is(w[feature].visible, true, `${feature} should be visible for non-popup (${w.name}).`);
+ }
+ }
+
+ // If popup is opened, all BarProp.visible become false.
+ checkFeature('menubar');
+ checkFeature('toolbar');
+ checkFeature('personalbar');
+ checkFeature('scrollbars');
+ checkFeature('statusbar');
+ checkFeature('locationbar');
+
+ w.close();
+
+ numWindows++;
+ if (numWindows == featuresList.length) {
+ // We're done!
+ SimpleTest.finish();
+ }
+
+}
+
+SimpleTest.waitForExplicitFinish();
+for (var item of featuresList) {
+ // This will call back into testWindow when they open.
+ window.open(`file_window_bar.html?${item.type}`, item.target, item.features);
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/utils_bug260264.js b/dom/tests/mochitest/bugs/utils_bug260264.js
new file mode 100644
index 0000000000..dfb0eb45a0
--- /dev/null
+++ b/dom/tests/mochitest/bugs/utils_bug260264.js
@@ -0,0 +1,69 @@
+const ALLOW_ACTION = SpecialPowers.Ci.nsIPermissionManager.ALLOW_ACTION;
+const DENY_ACTION = SpecialPowers.Ci.nsIPermissionManager.DENY_ACTION;
+const UNKNOWN_ACTION = SpecialPowers.Ci.nsIPermissionManager.UNKNOWN_ACTION;
+const PROMPT_ACTION = SpecialPowers.Ci.nsIPermissionManager.PROMPT_ACTION;
+
+/**
+ * Dispatches |handler| to |element|, as if fired in response to |event|.
+ */
+function send(element, event, handler) {
+ function unique_handler() {
+ return handler.apply(this, arguments);
+ }
+ element.addEventListener(event, unique_handler);
+ try {
+ sendMouseEvent({ type: event }, element.id);
+ } finally {
+ element.removeEventListener(event, unique_handler);
+ }
+}
+
+/**
+ * Because it's not nice to leave popup windows open after the tests are
+ * finished, we need a foolproof way to close some/all window.opened windows.
+ */
+(function (originalOpen) {
+ var wins = [];
+ (window.open = function () {
+ var win = originalOpen.apply(window, arguments);
+ if (win) {
+ wins[wins.length] = win;
+ }
+ return win;
+ }).close = function (n) {
+ var promises = [];
+ if (arguments.length < 1) {
+ n = wins.length;
+ }
+ while (n-- > 0) {
+ var win = wins.pop();
+ if (win) {
+ let openedBrowsingContextID = SpecialPowers.getBrowsingContextID(win);
+ promises.push(
+ (function (openedWindow) {
+ return new Promise(function (resolve) {
+ let observer = {
+ observe(subject) {
+ if (subject.id == openedBrowsingContextID) {
+ SpecialPowers.removeObserver(
+ observer,
+ "browsing-context-discarded"
+ );
+ SimpleTest.executeSoon(resolve);
+ }
+ },
+ };
+
+ SpecialPowers.addObserver(observer, "browsing-context-discarded");
+ });
+ })(win)
+ );
+ win.close();
+ } else {
+ promises.push(Promise.resolve());
+ break;
+ }
+ }
+ return Promise.all(promises);
+ };
+})(window.open);
diff --git a/dom/tests/mochitest/bugs/utils_bug743615.js b/dom/tests/mochitest/bugs/utils_bug743615.js
new file mode 100644
index 0000000000..24b3a77a4c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/utils_bug743615.js
@@ -0,0 +1,30 @@
+function makePattern(len, start, inc) {
+ var pattern = [];
+ while (len) {
+ pattern.push(start);
+ start = (start + inc) % 256;
+ --len;
+ }
+ return pattern;
+}
+
+function setPattern(imageData, pattern) {
+ if (pattern.length != imageData.data.length) {
+ throw Error("Invalid pattern");
+ }
+ for (var i = 0; i < pattern.length; ++i) {
+ imageData.data[i] = pattern[i];
+ }
+}
+
+function checkPattern(imageData, pattern) {
+ if (pattern.length != imageData.data.length) {
+ throw Error("Invalid pattern");
+ }
+ for (var i = 0; i < pattern.length; ++i) {
+ if (imageData.data[i] != pattern[i]) {
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/dom/tests/mochitest/bugs/window_bug1171215.html b/dom/tests/mochitest/bugs/window_bug1171215.html
new file mode 100644
index 0000000000..f196457b18
--- /dev/null
+++ b/dom/tests/mochitest/bugs/window_bug1171215.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1022869
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1022869</title>
+ <iframe src="about:blank"></iframe>
+ <script type="text/javascript">
+
+ function finish() {
+ opener.postMessage({type: "finish" });
+ }
+
+ function info(msg) {
+ opener.postMessage({type: "info", msg });
+ }
+
+ function ok(a, msg) {
+ opener.postMessage({type: "test", test: !!a, msg });
+ }
+
+ function is(a, b, msg) {
+ ok(a === b, msg);
+ }
+
+ var f = document.getElementsByTagName("iframe")[0];
+
+ /** Test for Bug 1022869 **/
+ function startTest() {
+ // Set a cookie in example.org so we can test that we can't read it in
+ // third-party cases.
+ f.contentWindow.location =
+ "http://example.org/tests/dom/tests/mochitest/bugs/file_prime_cookie.html";
+ waitForLoad().then(continueTest).catch((e) => { ok(false, `Got exception: ${e}`) });
+ }
+
+ function waitForLoad() {
+ return new Promise((resolve) => {
+ window.addEventListener("message", function(msg) {
+ info(`got message ${msg.data}`);
+ resolve(msg.data);
+ }, {once: true});
+ });
+ }
+
+ async function continueTest() {
+ var sameOrigin = "http://mochi.test:8888";
+ var thirdParty = "http://example.org";
+ var page = "tests/dom/tests/mochitest/bugs/file_cookieOutputter.html"
+ var redirect = "tests/dom/tests/mochitest/bugs/file_redirector.sjs";
+
+ function createRedirect(firstOrigin, secondOrigin) {
+ return `${firstOrigin}/${redirect}?${secondOrigin}/${page}`;
+ }
+
+ info("starting test");
+
+ // Same origin to same origin.
+ f.contentWindow.location = createRedirect(sameOrigin, sameOrigin);
+ let cookie = await waitForLoad();
+ is(cookie, "a=b", "got the cookie");
+
+ // Cross origin to cross origin.
+ f.contentWindow.location = createRedirect(thirdParty, thirdParty);
+ cookie = await waitForLoad();
+ is(cookie, "", "no third-party cookies");
+
+ // Same origin to cross origin.
+ f.contentWindow.location = createRedirect(sameOrigin, thirdParty);
+ cookie = await waitForLoad();
+ is(cookie, "", "no third-party cookies");
+
+ // Cross origin to same origin
+ f.contentWindow.location = createRedirect(thirdParty, sameOrigin);
+ cookie = await waitForLoad();
+ is(cookie, "a=b", "got the cookie");
+
+ finish();
+ }
+ </script>
+</head>
+<body onload="startTest()">
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/worker_bug743615.js b/dom/tests/mochitest/bugs/worker_bug743615.js
new file mode 100644
index 0000000000..16c5617bd2
--- /dev/null
+++ b/dom/tests/mochitest/bugs/worker_bug743615.js
@@ -0,0 +1,44 @@
+importScripts("utils_bug743615.js");
+
+self.onmessage = function onMessage(evt) {
+ // Check the pattern that was sent.
+ var imageData = evt.data.imageData;
+ var pattern = evt.data.pattern;
+ var statusMessage = checkPattern(imageData, pattern)
+ ? "PASS"
+ : "Got corrupt typed array in worker";
+
+ // Check against the interface object.
+ if (!(imageData instanceof ImageData)) {
+ statusMessage += ", Bad interface object in worker";
+ }
+
+ // Check the getters.
+ if (imageData.width * imageData.height != imageData.data.length / 4) {
+ statusMessage += ", Bad ImageData getters in worker: ";
+ statusMessage += [imageData.width, imageData.height].join(", ");
+ }
+
+ // Make sure that writing to .data is a no-op when not in strict mode.
+ var origData = imageData.data;
+ var threw = false;
+ try {
+ imageData.data = [];
+ imageData.width = 2;
+ imageData.height = 2;
+ } catch (e) {
+ threw = true;
+ }
+ if (threw || imageData.data !== origData) {
+ statusMessage = statusMessage + ", Should silently ignore sets";
+ }
+
+ // Send back a new pattern.
+ pattern = makePattern(imageData.data.length, 99, 2);
+ setPattern(imageData, pattern);
+ self.postMessage({
+ statusMessage,
+ imageData,
+ pattern,
+ });
+};
diff --git a/dom/tests/mochitest/chrome/489127.html b/dom/tests/mochitest/chrome/489127.html
new file mode 100644
index 0000000000..0e2fd4efd4
--- /dev/null
+++ b/dom/tests/mochitest/chrome/489127.html
@@ -0,0 +1,268 @@
+<!DOCTYPE HTML>
+<title>nsIDOMWindowUtils::nodesFromRect test - bug 489127</title>
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script>
+ var SimpleTest = window.opener.SimpleTest;
+ function ok() { window.opener.ok.apply(window.opener, arguments); }
+ function done() { window.opener.done.apply(window.opener, arguments); }
+ function info() { window.opener.info.apply(window.opener, arguments); }
+
+ let e = {};
+
+ let dwu = window.windowUtils;
+
+ function check(x, y, top, right, bottom, left, onlyVisible, list, aListIsComplete = false, aOpacityThreshold = 1.0) {
+ let nodes = dwu.nodesFromRect(x, y, top, right, bottom, left, /* aIgnoreRootScrollFrame = */ true, /* aFlushLayout = */ true, onlyVisible, aOpacityThreshold);
+
+ if (!aListIsComplete) {
+ list.push(e.body);
+ list.push(e.html);
+ }
+
+ if (nodes.length != list.length) {
+ ok(false, "Different number of nodes (" + nodes.length + " vs. " + list.length +
+ ") for rect [" + x + "," + y + "], " +
+ "[" + top + "," + right + "," + bottom + "," + left + "]");
+ return;
+ }
+
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i] != list[i]) {
+ ok(false, `Unexpected node #${i} (${nodes[i].id} vs. ${list[i].id}) ` +
+ `[${x}, ${y}] [${top}, ${right}, ${bottom}, ${left}]`);
+ return;
+ }
+ }
+ ok(true, "All correct nodes found for rect " +
+ "[" + x + "," + y + "], " +
+ "[" + top + "," + right + "," + bottom + "," + left + "]");
+ }
+
+ function doTest() {
+ // Set up shortcut access to elements
+ e.html = document.documentElement;
+ ['h1', 'd1', 'd2', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'span',
+ 'a1', 'a2', 'a3', 'transf', 'iframe1', 'body', 'opacity', 'host'].forEach(function(a) {
+ e[a] = document.getElementById(a);
+ });
+
+ let shadow = e.host.attachShadow({ mode: "open" });
+ shadow.innerHTML = `
+ <style>
+ #host-inner { height: 100px; width: 100px; background-color: blue }
+ </style>
+ <div id="host-inner"></div>
+ `;
+
+ window.scrollTo(0, 0);
+
+ // Top, Right, Bottom, Left directions:
+ check(53, 71, 0, 0, 0, 0, false, []);
+ check(53, 71, 10, 0, 0, 0, false, [e.h1]);
+ check(53, 71, 0, 10, 0, 0, false, [e.p3]);
+ check(53, 71, 0, 0, 10, 0, false, [e.d1]);
+ check(152, 105, 0, 0, 0, 10, false, [e.d1]);
+ check(152, 105, 10, 10, 10, 10, false, [e.p4, e.p3, e.d1]);
+
+ // e.p1 is invisible and shouldn't appear:
+ check(153,193,0,0,0,0,false,[e.p5]);
+ check(153,193,0,20,0,20, false, [e.p5, e.d2]);
+
+ // Precise pixel checks:
+ check(144, 183, 0, 0, 0, 0, false, []);
+ check(144, 183, 0, 0, 1, 0, false, [e.p5]);
+ check(144, 183, 0, 0, 0, 1, false, [e.d2]);
+ check(144, 183, 0, 0, 1, 1, false, [e.p5, e.d2]);
+ check(77, 240, 0, 0, 0, 0, false, [e.p2]);
+ check(77, 240, 1, 0, 0, 0, false, [e.p5, e.p2]);
+ check(77, 240, 0, 0, 1, 0, false, [e.span, e.p2]);
+ check(77, 240, 1, 0, 1, 0, false, [e.p5, e.span, e.p2]);
+
+ // Expanding area checks:
+ check(39, 212, 0, 0, 0, 0, false, []);
+ check(39, 212, 10, 0, 0, 0, false, [e.d2]);
+ check(39, 212, 0, 0, 10, 0, false, [e.p2]);
+ check(39, 212, 10, 1, 30, 0, false, [e.d2, e.p2]);
+ check(39, 212, 10, 5, 30, 0, false, [e.span, e.d2, e.p2]);
+ check(39, 212, 10, 15, 30, 0, false, [e.p5, e.span, e.d2, e.p2]);
+
+ // Elements inside iframe shouldn't be returned:
+ check(15, 410, 0, 30, 50, 0, false, [e.iframe1]);
+
+ // Area with links and text nodes:
+ let [x1, y1] = getCenterFor(e.a1);
+ let [x2, y2] = getCenterFor(e.a2);
+ let [x3, y3] = getCenterFor(e.a3);
+ let [xt, yt] = [(x2 + x1) / 2, y1]; //text node between a1 and a2
+
+ check(x1, y1, 0, 0, 0, 0, false, [e.a1.firstChild, e.a1, e.p6]);
+ check(x1, y1, 0, 0, y3 - y1, 0, false, [e.a3.firstChild, e.a3, e.a1.firstChild, e.a1, e.p6]);
+ check(x1, y1, 0, xt - x1, 0, 0, false, [e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
+ check(x1, y1, 0, x2 - x1, 0, 0, false, [e.a2.firstChild, e.a2, e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
+ check(x1, y1, 0, x2 - x1, y3 - y1, 0, false, [e.a3.firstChild, e.a3, e.a2.firstChild, e.a2, e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
+
+ // 2d transform:
+ check(61, 671, 0, 0, 0, 0, false, []);
+ check(61, 671, 0, 30, 0, 10, false, [e.transf]);
+ check(61, 671, 0, 30, 90, 10, false, [e.transf.firstChild, e.transf]);
+
+ {
+ info("opacity: with and without aVisibleOnly = true");
+ let [x, y] = getCenterFor(e.opacity);
+ check(x, y, 1, 1, 1, 1, false, [e.opacity]);
+ check(x, y, 1, 1, 1, 1, true, []);
+ }
+
+ // Check elements behind opaque backgrounds of other elements don't show up
+ // in the list when aVisibleOnly = true.
+ {
+ info("elements behind opaque backgrounds of other elements with aVisibleOnly=true");
+ let container = document.getElementById('obscured-test');
+ let fg = document.getElementById('obscured-test-foreground');
+ let bg = document.getElementById('obscured-test-background');
+
+ let [x, y] = getCenterFor(container);
+ check(x, y, 1, 1, 1, 1, false, [fg, bg, container]);
+
+ const kListIsComplete = true;
+
+ check(x, y, 1, 1, 1, 1, true, [fg], kListIsComplete);
+ check(x, y, 1, 1, 1, 1, true, [fg], kListIsComplete, 0.5);
+
+ info("Occluded with different opacity thresholds, with background colors and opacity");
+ fg.style.backgroundColor = "rgba(0, 255, 0, 0.5)";
+ check(x, y, 1, 1, 1, 1, true, [fg], kListIsComplete, 0.4);
+ check(x, y, 1, 1, 1, 1, true, [fg, bg], kListIsComplete, 0.6);
+
+ fg.style.backgroundColor = "";
+ fg.style.opacity = "0.5";
+
+ check(x, y, 1, 1, 1, 1, true, [fg], kListIsComplete, 0.4);
+ check(x, y, 1, 1, 1, 1, true, [fg, bg], kListIsComplete, 0.6);
+ }
+
+ {
+ info("Shadow DOM retargeting");
+
+ let [x, y] = getCenterFor(e.host);
+ let inner = shadow.getElementById("host-inner");
+ check(x, y, 1, 1, 1, 1, false, [inner, e.host]);
+ }
+
+ done();
+ }
+
+ function getCenterFor(element) {
+ let rect = element.getBoundingClientRect();
+ return [(rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2];
+ }
+
+ addLoadEvent(doTest);
+</script>
+<style>
+body {
+ margin: 8px;
+ padding: 0;
+}
+
+h1, div, p, span, iframe {
+ display: block;
+ width: 100px;
+ height: 30px;
+ border: 3px solid black;
+ padding: 10px;
+ margin: 10px;
+}
+
+span {
+ display: inline-block;
+}
+
+#iframe1 {
+ height: 100px;
+ margin-top: 60px;
+}
+
+#p6 {
+ height: 50px;
+ margin-top: 30px;
+}
+
+#transf {
+ margin-top: 60px;
+ -moz-transform: rotate(-45deg);
+}
+
+#opacity {
+ opacity: 0;
+ margin-top: 60px;
+}
+
+#decimal {
+ position: relative;
+ left: 0.5px;
+ top: 50.5px;
+}
+
+#obscured-test {
+ position: relative;
+ width: 500px;
+ height: 500px;
+}
+
+#obscured-test-background {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ z-index: 0;
+ background: red;
+}
+
+#obscured-test-foreground {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ z-index: 1;
+ background: green;
+}
+</style>
+<body id="body">
+ <h1 id="h1"></h1>
+ <div id="d1"></div>
+
+ <!-- floated element -->
+ <div id="d2" style="float: left"></div>
+
+ <!-- hidden element -->
+ <p id="p1" style="float: left; visibility: hidden"></p>
+
+ <p id="p2" style="clear: left"><span id="span"></span></p>
+
+ <!-- absolute position -->
+ <p id="p3" style="position:absolute; top: 10px; left:50px; height:50px;"></p>
+
+ <!-- fixed position -->
+ <p id="p4" style="position: fixed; top: 30px; left: 150px; height: 50px; background-color: blue;"></p>
+
+ <!-- relative position -->
+ <p id="p5" style="position:relative; top: -100px; left: 30px; margin-bottom: -70px; background-color: green"></p>
+
+ <!-- decimal CSS pixels -->
+ <div id="decimal"></div>
+
+ <iframe id="iframe1" src="data:text/html,<div>div</div><p>p</p>"></iframe>
+
+ <p id="p6"><a href="#" id="a1">A</a> / <a href="#" id="a2">A</a><br/><a href="#" id="a3">A</a></p>
+
+ <div id="transf">text</div>
+
+ <div id="opacity">text</div>
+
+ <div id="host"></div>
+
+ <div id="obscured-test">
+ <div id="obscured-test-background"></div>
+ <div id="obscured-test-foreground"></div>
+ </div>
+</body>
diff --git a/dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xhtml b/dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xhtml
new file mode 100644
index 0000000000..3ce8724fa0
--- /dev/null
+++ b/dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ Test for Persistent Storage in chrome
+ -->
+<window id="sample-window" width="400" height="400"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/chrome-harness.js"></script>
+
+<script type="application/javascript">
+var SimpleTest = window.arguments[0].SimpleTest;
+
+document.addEventListener("DOMWindowCreated", function(e) {
+ var otherWindow = e.target.defaultView.wrappedJSObject;
+ SimpleTest.is(e.type, "DOMWindowCreated", "DOMWindowCreated: " + otherWindow);
+ otherWindow.doneFunction = function() {
+ SimpleTest.ok(true, "doneFunction was called");
+ SimpleTest.finish();
+ window.close();
+ };
+}, false);
+
+var root = getRootDirectory(window.location.href);
+var el = document.createXULElement("iframe");
+el.setAttribute('type', 'content');
+el.setAttribute('src', root + 'DOMWindowCreated_content.html');
+document.documentElement.appendChild(el);
+</script>
+</window>
diff --git a/dom/tests/mochitest/chrome/DOMWindowCreated_content.html b/dom/tests/mochitest/chrome/DOMWindowCreated_content.html
new file mode 100644
index 0000000000..acb6b0582e
--- /dev/null
+++ b/dom/tests/mochitest/chrome/DOMWindowCreated_content.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+ <title>DOMWindowCreated helper</title>
+
+ <script type="application/javascript">
+ window.doneFunction();
+ </script>
+<body>
+ <h1>DOMWindowCreated Helper</h1>
diff --git a/dom/tests/mochitest/chrome/child_focus_frame.html b/dom/tests/mochitest/chrome/child_focus_frame.html
new file mode 100644
index 0000000000..d7f0ff63cd
--- /dev/null
+++ b/dom/tests/mochitest/chrome/child_focus_frame.html
@@ -0,0 +1,57 @@
+<html id="t13">
+<body id="inner-document">
+
+<input id="t19" value="Input" accesskey="b">
+<input id="t14" tabindex="2" type="password" value="test">
+<button id="t20">Button</button>
+<div style="float: left; margin-top: 30px;">
+ <button id="t21">Button 2</button>
+</div>
+<div id="abs" style="position: absolute; top: 40px; left: 250px;">
+ <button id="t22" accesskey="c">Button 3</button>
+ <p><span>
+ <select id="t15" tabindex="2" accesskey="e">
+ <option>One
+ </select>
+ </span></p>
+</div>
+<div id="t16" tabindex="2" style="overflow: scroll; max-height: 20px;">
+ This is a scrollable area with some sufficiently long text contained within it.
+</div>
+<img id="n5" src="happy.png"/>
+<img id="t23" tabindex="0" src="happy.png"/>
+<a id="t17" tabindex="2" accesskey="f">1</a>
+<a id="t24" tabindex="0" href="#">2</a>
+<a id="t25" href="#">Link 3</a>
+<br>
+<span id="hiddenspan" style="display: none;"></span>
+<input id="t26" tabindex="0" type="checkbox" accesskey="a">
+<input id="o11" tabindex="-1" type="checkbox">
+<div style="display: none;"><input/></div>
+<div id="t27" style="overflow: scroll; max-height: 20px;">
+ This is a scrollable area with some sufficiently long text contained within it.
+ This is a scrollable area with some sufficiently long text contained within it.
+ <button id="inscroll" tabindex="-1">Button 4</button>
+</div>
+<map name="map1">
+ <area id="t31" href="#" shape="rect" coords="0,0,5,5">
+ <area id="t32" href="#" shape="rect" coords="10,10,15,15">
+ <area id="t18" href="#" shape="circle" coords="0,8,4" tabindex="2">Button 5</area>
+ <area id="t33" href="#" shape="poly" coords="10,1,16,3,14,10,7,10,10,1">
+</map>
+<input type="hidden"/>
+<fieldset style="float: right;">
+<legend id="legend">Options</legend>
+ <input id="t28" type="radio" name="options" value="optionone">One
+ <label id="ad" accesskey="d">Label:<input id="t29" type="radio" name="options" value="optiontwo">Two</label>
+</fieldset>
+<div id="t30" tabindex="0">abc</div>
+<input id="o18" accesskey="u" disabled size="3"/>
+<label id="ag" accesskey="g" for="n6">L</label>
+<input id="n6" tabindex="-1" type="button"/>
+<span id="n7" accesskey="t">s</span>
+<img id="image" src="data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%18%00%00%00%18%02%03%00%00%00%9D%19%D5k%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%0CPLTE%FF%FF%FF%FF%FF%FF%F7%DC%13%00%00%00%03%80%01X%00%00%00%01tRNS%08N%3DPT%00%00%00%01bKGD%00%88%05%1DH%00%00%00%09pHYs%00%00%0B%11%00%00%0B%11%01%7Fd_%91%00%00%00%07tIME%07%D2%05%0C%14%0C%0D%D8%3F%1FQ%00%00%00%5CIDATx%9C%7D%8E%CB%09%C0%20%10D%07r%B7%20%2F%E9wV0%15h%EA%D9%12D4%BB%C1x%CC%5C%1E%0C%CC%07%C0%9C0%9Dd7()%C0A%D3%8D%E0%B8%10%1DiCHM%D0%AC%D2d%C3M%F1%B4%E7%FF%10%0BY%AC%25%93%CD%CBF%B5%B2%C0%3Alh%CD%AE%13%DF%A5%F7%E0%03byW%09A%B4%F3%E2%00%00%00%00IEND%AEB%60%82"
+ usemap="#map1" ismap>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/chrome.ini b/dom/tests/mochitest/chrome/chrome.ini
new file mode 100644
index 0000000000..098d49a49b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/chrome.ini
@@ -0,0 +1,91 @@
+[DEFAULT]
+skip-if = os == 'android'
+support-files =
+ 489127.html
+ DOMWindowCreated_chrome.xhtml
+ DOMWindowCreated_content.html
+ child_focus_frame.html
+ file_clipboard_events_chrome.html
+ file_DOM_element_instanceof.xhtml
+ file_bug800817.xhtml
+ file_bug830858.xhtml
+ file_bug1224790-1_modal.xhtml
+ file_bug1224790-1_nonmodal.xhtml
+ file_bug1224790-2_modal.xhtml
+ file_bug1224790-2_nonmodal.xhtml
+ file_popup_blocker_chrome.html
+ file_subscript_bindings.js
+ focus_frameset.html
+ focus_window2.xhtml
+ focus_dialog.xhtml
+ queryCaretRectUnix.html
+ queryCaretRectWin.html
+ selectAtPoint.html
+ selectAtPoint-innerframe.html
+ sizemode_attribute.xhtml
+ window_activation.xhtml
+ window_callback_wrapping.xhtml
+ window_docshell_swap.xhtml
+ window_focus.xhtml
+ window_focus_inner.xhtml
+ window_focus_docnav.xhtml
+ !/dom/tests/mochitest/general/file_clonewrapper.html
+ !/dom/tests/mochitest/general/file_moving_nodeList.html
+ !/dom/tests/mochitest/general/file_moving_xhr.html
+ !/dom/tests/mochitest/geolocation/network_geolocation.sjs
+
+[test_DOMWindowCreated.xhtml]
+[test_DOM_element_instanceof.xhtml]
+[test_activation.xhtml]
+tags = fullscreen
+[test_bug800817.xhtml]
+[test_bug830858.xhtml]
+[test_bug1224790-1.xhtml]
+tags = openwindow
+skip-if = os != 'mac'
+[test_bug1224790-2.xhtml]
+tags = openwindow
+skip-if = os != 'mac'
+[test_callback_wrapping.xhtml]
+[test_clonewrapper.xhtml]
+[test_cyclecollector.xhtml]
+[test_docshell_swap.xhtml]
+[test_elements_proto.xhtml]
+[test_focus.xhtml]
+skip-if =
+ os == 'linux' # bug 1296622, Bug 1605253
+ os == "mac" && !debug # Bug 1828622
+ os == "win" && !debug # Bug 1828622
+[test_focus_dialog.xhtml]
+[test_focus_docnav.xhtml]
+[test_focused_link_scroll.xhtml]
+[test_geolocation.xhtml]
+[test_getTransformTo.html]
+[test_indexedSetter.html]
+[test_intlUtils_getDisplayNames.html]
+[test_intlUtils_isAppLocaleRTL.html]
+[test_moving_nodeList.xhtml]
+[test_moving_xhr.xhtml]
+[test_nodesFromPoint.html]
+[test_nodesFromRect.html]
+[test_parsingMode.html]
+[test_popup_blocker_chrome.xhtml]
+[test_queryCaretRect.html]
+[test_resize_move_windows.xhtml]
+support-files =
+ file_resize_move_windows_1.html
+ file_resize_move_windows_2.html
+# disabled on linux for timeouts--bug-834716
+skip-if = os == 'linux'
+[test_sandbox_bindings.xhtml]
+[test_sandbox_eventhandler.xhtml]
+[test_sandbox_image.xhtml]
+[test_sandbox_postMessage.html]
+[test_selectAtPoint.html]
+[test_sizemode_attribute.xhtml]
+tags = fullscreen
+skip-if = os != 'win'
+[test_subscript_bindings.xhtml]
+[test_xray_event_constructor.xhtml]
+[test_clipboard_events_chrome.html]
+[test_window_getRegionalPrefsLocales.html]
diff --git a/dom/tests/mochitest/chrome/file_DOM_element_instanceof.xhtml b/dom/tests/mochitest/chrome/file_DOM_element_instanceof.xhtml
new file mode 100644
index 0000000000..92290016f0
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_DOM_element_instanceof.xhtml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<window title="Mozilla Bug 824917"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <iframe type="content"></iframe>
+
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 799299 **/
+ var SimpleTest = window.arguments[0].SimpleTest;
+ var ok = window.arguments[0].ok;
+
+ // Note: We can't use frames[0] here because the type="content" attribute
+ // isolates it into a separate browsing context hierarchy.
+ var doc = document.querySelector("iframe").contentDocument;
+ ok(HTMLBodyElement.isInstance(doc.createElement("body")),
+ "Should be instance of HTMLBodyElement");
+ ok(HTMLDivElement.isInstance(doc.createElement("div")),
+ "Should be instance of HTMLDivElement");
+ ok(HTMLFrameSetElement.isInstance(doc.createElement("frameset")),
+ "Should be instance of HTMLFrameSetElement");
+ ok(HTMLHeadingElement.isInstance(doc.createElement("h1")),
+ "Should be instance of HTMLHeadingElement");
+ ok(HTMLLabelElement.isInstance(doc.createElement("label")),
+ "Should be instance of HTMLLabelElement");
+
+ window.close();
+ window.arguments[0].SimpleTest.finish();
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_bug1224790-1_modal.xhtml b/dom/tests/mochitest/chrome/file_bug1224790-1_modal.xhtml
new file mode 100644
index 0000000000..2093ba9c67
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-1_modal.xhtml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
+-->
+<window title="Mozilla Bug 1224790"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<dialog buttons="accept">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 1224790 **/
+
+ function runTests() {
+ window.openDialog('file_bug1224790-1_nonmodal.xhtml', '', 'dialog=no');
+ }
+
+ function nonModalClosed() {
+ window.close();
+ window.arguments[0].modalClosed();
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+</dialog>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xhtml b/dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xhtml
new file mode 100644
index 0000000000..01995a916c
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xhtml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
+-->
+<window title="Mozilla Bug 1224790"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 1224790 **/
+
+ function runTests() {
+ window.close();
+ opener.wrappedJSObject.nonModalClosed();
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_bug1224790-2_modal.xhtml b/dom/tests/mochitest/chrome/file_bug1224790-2_modal.xhtml
new file mode 100644
index 0000000000..74906a05f8
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-2_modal.xhtml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
+-->
+<window title="Mozilla Bug 1224790"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<dialog buttons="accept">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 1224790 **/
+
+ var nonModal = null;
+
+ function runTests() {
+ nonModal = window.openDialog('file_bug1224790-2_nonmodal.xhtml', '', 'dialog=no');
+ }
+
+ function nonModalOpened() {
+ window.close();
+ nonModal.modalClosed(window.arguments[0]);
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+</dialog>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xhtml b/dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xhtml
new file mode 100644
index 0000000000..5e3c737676
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xhtml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
+-->
+<window title="Mozilla Bug 1224790"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 1224790 **/
+
+ function runTests() {
+ opener.wrappedJSObject.nonModalOpened()
+ }
+
+ function modalClosed(grandparent) {
+ // Request cycle collection to trigger destructor for parent modal window,
+ // that mutates mAncestorLink of this window.
+ var windowUtils = window.windowUtils;
+
+ Services.obs.notifyObservers(null, "child-cc-request");
+ windowUtils.cycleCollect();
+
+ // Wait for a while.
+ setTimeout(function() {
+ window.close();
+ grandparent.wrappedJSObject.nonModalClosed();
+ }, 3000);
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_bug800817.xhtml b/dom/tests/mochitest/chrome/file_bug800817.xhtml
new file mode 100644
index 0000000000..bcd64b3ca7
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug800817.xhtml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=800817
+-->
+<window title="Mozilla Bug 800817"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=800817"
+ target="_blank">Mozilla Bug 800817</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 800817 **/
+
+ function sendClick(win) {
+ var wu = win.windowUtils;
+ wu.sendMouseEventToWindow("mousedown", 10, 10, 0, 0, 0);
+ wu.sendMouseEventToWindow("mouseup", 10, 10, 0, 0, 0);
+ }
+
+ function runTests() {
+ var b1 = document.getElementById("b1");
+ var b2 = document.getElementById("b2");
+
+ var testMozBrowser = window.arguments[0].testMozBrowser;
+ if (testMozBrowser) {
+ b1.setAttribute("mozbrowser", "true");
+ b2.setAttribute("mozbrowser", "true");
+ }
+
+ if (testMozBrowser)
+ window.arguments[0].info("Testing with mozbrowser=true");
+ else
+ window.arguments[0].info("Testing without mozbrowser");
+
+ b1.contentWindow.focus();
+ window.arguments[0].is(document.activeElement, b1,
+ "Focused first iframe");
+
+ var didCallDummy = false;
+ b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
+ sendClick(b2.contentWindow);
+ window.arguments[0].ok(didCallDummy, "dummy mousedown handler should fire");
+ window.arguments[0].is(document.activeElement, b2,
+ "Focus shifted to second iframe");
+
+ b1.contentWindow.focus();
+ window.arguments[0].is(document.activeElement, b1,
+ "Re-focused first iframe for the first time");
+
+ var didCallListener = false;
+ b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
+ sendClick(b2.contentWindow);
+ window.arguments[0].ok(didCallListener, "mousedown handler should fire");
+ window.arguments[0].is(document.activeElement, b1,
+ "Did not move focus to the second iframe");
+
+ window.close();
+ window.arguments[0].finishedTests();
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+ <iframe xmlns="http://www.w3.org/1999/xhtml"
+ id="b1" type="content" src="about:blank"
+ style="width: 300px; height: 550px; border: 1px solid black;"/>
+ <iframe xmlns="http://www.w3.org/1999/xhtml"
+ id="b2" type="content" src="about:blank"
+ style="width: 300px; height: 550px; border: 1px solid black;"/>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_bug830858.xhtml b/dom/tests/mochitest/chrome/file_bug830858.xhtml
new file mode 100644
index 0000000000..1865f52ac3
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug830858.xhtml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=830858
+-->
+<window title="Mozilla Bug 830858"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=830858"
+ target="_blank">Mozilla Bug 830858</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 830858 **/
+
+ function runTests() {
+ var b = document.getElementById("b");
+ var win = b.contentWindow;
+ var doc = win.document;
+ var wu = win.windowUtils;
+
+ var docListenerCalled = 0;
+ doc.addEventListener("foo", function() { ++docListenerCalled; }, true);
+ var winListenerCalled = 0;
+ win.addEventListener("foo", function() { ++winListenerCalled; }, true);
+ var iframeListenerCalled = 0;
+ b.addEventListener("foo", function() { ++iframeListenerCalled; }, true);
+
+ doc.dispatchEvent(new Event("foo"));
+ window.arguments[0].is(docListenerCalled, 1, "Normal dispatch to Document");
+ window.arguments[0].is(winListenerCalled, 1, "Normal dispatch to Document");
+ window.arguments[0].is(iframeListenerCalled, 1, "Normal dispatch to Document");
+
+ win.dispatchEvent(new Event("foo"));
+ window.arguments[0].is(docListenerCalled, 1, "Normal dispatch to Window");
+ window.arguments[0].is(winListenerCalled, 2, "Normal dispatch to Window");
+ window.arguments[0].is(iframeListenerCalled, 2, "Normal dispatch to Window");
+
+ wu.dispatchEventToChromeOnly(doc, new Event("foo"));
+ window.arguments[0].is(docListenerCalled, 1, "Chrome-only dispatch to Document");
+ window.arguments[0].is(winListenerCalled, 2, "Chrome-only dispatch to Document");
+ window.arguments[0].is(iframeListenerCalled, 3, "Chrome-only dispatch to Document");
+
+ wu.dispatchEventToChromeOnly(win, new Event("foo"));
+ window.arguments[0].is(docListenerCalled, 1, "Chrome-only dispatch to Window");
+ window.arguments[0].is(winListenerCalled, 2, "Chrome-only dispatch to Window");
+ window.arguments[0].is(iframeListenerCalled, 4, "Chrome-only dispatch to Window");
+
+ window.close();
+ window.arguments[0].finishedTests();
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+ <iframe xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="b" type="content" src="about:blank"
+ style="width: 300px; height: 550px; border: 1px solid black;"/>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_clipboard_events_chrome.html b/dom/tests/mochitest/chrome/file_clipboard_events_chrome.html
new file mode 100644
index 0000000000..652d1e981f
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_clipboard_events_chrome.html
@@ -0,0 +1 @@
+<body onload='window.arguments[0].doChecks(this)'><input id='i' value='Sample Text'></body>
diff --git a/dom/tests/mochitest/chrome/file_popup_blocker_chrome.html b/dom/tests/mochitest/chrome/file_popup_blocker_chrome.html
new file mode 100644
index 0000000000..28463b14a6
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_popup_blocker_chrome.html
@@ -0,0 +1,6 @@
+<html>
+<body onload="window.opener.next()">
+foobar
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/file_resize_move_windows_1.html b/dom/tests/mochitest/chrome/file_resize_move_windows_1.html
new file mode 100644
index 0000000000..2c3b1b9c8f
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_resize_move_windows_1.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Helper file for test_resize_move_windows.html</title>
+<script>
+function check(next) {
+ var is_range = function(aTest, aValue, aRange, aMsg) {
+ ok(aTest < aValue + aRange && aTest > aValue - aRange, aMsg);
+ };
+ is_range(window.innerWidth, 170, 5, 'parameter width should be taken into account');
+ is_range(window.innerHeight, 170, 5, 'parameter height should be taken into account');
+ is_range(window.screenX, 25, 5, 'parameter screenX should be taken into account');
+ is_range(window.screenY, 25, 5, 'parameter screenY should be taken into account');
+}
+</script>
+</head>
+<body onload="console.log('load')">
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/file_resize_move_windows_2.html b/dom/tests/mochitest/chrome/file_resize_move_windows_2.html
new file mode 100644
index 0000000000..81b67587a7
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_resize_move_windows_2.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Helper file for test_resize_move_windows.xhtml</title>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/file_subscript_bindings.js b/dom/tests/mochitest/chrome/file_subscript_bindings.js
new file mode 100644
index 0000000000..cfc9128d31
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_subscript_bindings.js
@@ -0,0 +1 @@
+new window.XMLHttpRequest();
diff --git a/dom/tests/mochitest/chrome/focus_dialog.xhtml b/dom/tests/mochitest/chrome/focus_dialog.xhtml
new file mode 100644
index 0000000000..24eda7ad1b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/focus_dialog.xhtml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+<window id="other-document"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<dialog buttons="accept">
+
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<button id="button-1" label="Something"/>
+<button id="button-2" label="Something else"/>
+
+<script>
+<![CDATA[
+
+window.is = window.arguments[0].is;
+window.isnot = window.arguments[0].isnot;
+window.ok = window.arguments[0].ok;
+window.SimpleTest = window.arguments[0].SimpleTest;
+
+(async function() {
+ await new Promise(resolve => {
+ window.onload = resolve;
+ });
+
+ await new Promise(resolve => SimpleTest.waitForFocus(resolve, window));
+
+ let dialog = document.querySelector("dialog");
+ let shadow = dialog.shadowRoot;
+
+ let button = document.getElementById("button-1");
+ let button2 = document.getElementById("button-2");
+ let forwardSequence = [];
+
+ button.focus();
+
+ is(document.activeElement, button, "Should've focused the button");
+ forwardSequence.push(button);
+
+ synthesizeKey("KEY_Tab");
+
+ is(document.activeElement, button2, "Should've moved to the second button");
+ forwardSequence.push(button2);
+
+ synthesizeKey("KEY_Tab");
+
+ isnot(shadow.activeElement, null, "Should've focused the shadow root button");
+ is(document.activeElement, dialog, "document.focusedElement should be the dialog because retargeting");
+ forwardSequence.push(shadow.activeElement);
+
+ synthesizeKey("KEY_Tab");
+
+ is(document.activeElement, button, "Should properly wrap around going forward");
+
+ while (forwardSequence.length) {
+ synthesizeKey("KEY_Tab", { shiftKey: true });
+ is(
+ shadow.activeElement || document.activeElement,
+ forwardSequence.pop(),
+ "Should travel backwards correctly: " + forwardSequence.length
+ );
+ }
+
+ window.close();
+ SimpleTest.finish();
+}());
+
+]]>
+</script>
+</dialog>
+</window>
diff --git a/dom/tests/mochitest/chrome/focus_frameset.html b/dom/tests/mochitest/chrome/focus_frameset.html
new file mode 100644
index 0000000000..4032575552
--- /dev/null
+++ b/dom/tests/mochitest/chrome/focus_frameset.html
@@ -0,0 +1,25 @@
+<html id="outer">
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<script>
+if (opener)
+ SimpleTest.waitForFocus(() => opener.framesetWindowLoaded(window));
+// Don't try to call finish() in this frame, since it will get upset that we
+// ran no tests.
+SimpleTest.waitForExplicitFinish();
+</script>
+
+<frameset rows="30%, 70%">
+ <frame src="data:text/html,&lt;html id='f1' &gt;&lt;body id='framebody1'&gt;&lt;input id='f2'&gt;&lt;body&gt;&lt;/html&gt;">
+ <frameset cols="30%, 33%, 34%">
+ <frame src="data:text/html,&lt;html id='f3'&gt;&lt;body id='framebody2'&gt;&lt;input id='f4'&gt;&lt;body&gt;&lt;/html&gt;">
+ <frame src="data:text/html,&lt;html id='f5'&gt;&lt;body id='framebody3'&gt;&lt;input id='f6' tabindex='2'&gt;&lt;body&gt;&lt;/html&gt;">
+ <frame src="data:text/html,&lt;html id='f7'&gt;&lt;body id='framebody4'&gt;&lt;input id='f8'&gt;&lt;body&gt;&lt;/html&gt;">
+ </frameset>
+ <noframes>
+ <input id="unused1"/>
+ <input id="unused2" tabindex="1"/>
+ </noframes>
+</frameset>
+
+</html>
diff --git a/dom/tests/mochitest/chrome/focus_window2.xhtml b/dom/tests/mochitest/chrome/focus_window2.xhtml
new file mode 100644
index 0000000000..63f973b1dc
--- /dev/null
+++ b/dom/tests/mochitest/chrome/focus_window2.xhtml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+<window id="other-document"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script>
+<![CDATA[
+
+function focused()
+{
+ if (window.arguments)
+ setTimeout(() => window.arguments[0](window, window.arguments[1]), 0);
+}
+
+SimpleTest.waitForFocus(focused);
+
+]]>
+</script>
+
+<button id="other" label="OK"/>
+<input xmlns="http://www.w3.org/1999/xhtml" id="other-input" value="test"/>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/queryCaretRectUnix.html b/dom/tests/mochitest/chrome/queryCaretRectUnix.html
new file mode 100644
index 0000000000..0f06f838de
--- /dev/null
+++ b/dom/tests/mochitest/chrome/queryCaretRectUnix.html
@@ -0,0 +1,209 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>nsIDOMWindowUtils::sendQueryContentEvent w/QUERY_CARET_RECT test</title>
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+
+<style>
+ #text {
+ position: absolute;
+ left: 0em;
+ top: 0em;
+ font-size: 10pt;
+ font-family: monospace;
+ line-height: 20px;
+ letter-spacing: 0px;
+ margin-top:-1px; /* nix the text area border */
+ overflow: hidden;
+ width:800px;
+ height:400px;
+ }
+ #div-hor {
+ position: absolute;
+ left: 0em;
+ border-top:1px solid lightgray;
+ width: 1000px;
+ pointer-events:none;
+ }
+ #div-ver {
+ position: absolute;
+ top: 0em;
+ border-left:1px solid lightgray;
+ height: 500px;
+ pointer-events:none;
+ }
+</style>
+
+<script type="application/javascript">
+ var SimpleTest = window.opener.SimpleTest;
+
+ function ok() { window.opener.ok.apply(window.opener, arguments); }
+ function done() { window.opener.done.apply(window.opener, arguments); }
+
+ function dumpLn() {
+ for (let idx = 0; idx < arguments.length; idx++)
+ dump(arguments[idx] + " ");
+ dump("\n");
+ }
+
+ // drawn grid is 20x20
+ function drawGrid() {
+ for (var idx = 0; idx < 20; idx++) {
+ var e = document.createElement("div");
+ e.setAttribute("id", "div-hor");
+ e.style.top = (idx*20) + "px";
+ document.getElementById("container").appendChild(e);
+ }
+ for (var idx = 0; idx < 40; idx++) {
+ var e = document.createElement("div");
+ e.setAttribute("id", "div-ver");
+ e.style.left = (idx*20) + "px";
+ document.getElementById("container").appendChild(e);
+ }
+ }
+
+ function getSelection(aElement) {
+ // aElement is known to be a textarea here.
+ return aElement.editor.selection;
+ }
+
+ function testCaretPosition(aDomWinUtils, aOffset, aRectDims) {
+ let rect = aDomWinUtils.sendQueryContentEvent(
+ aDomWinUtils.QUERY_CARET_RECT,
+ aOffset, 0, 0, 0,
+ aDomWinUtils.QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
+ ok(rect, "rect returned");
+ ok(rect.succeeded, "call succeeded");
+
+ info("left:" + rect.left + " top:" + rect.top);
+
+ ok(rect.left > aRectDims.min.left, "rect.left > " + aRectDims.min.left);
+ ok(rect.left < aRectDims.max.left, "rect.left < " + aRectDims.max.left);
+ ok(rect.top > aRectDims.min.top, "rect.top > " + aRectDims.min.top);
+ ok(rect.top < aRectDims.max.top, "rect.top < " + aRectDims.max.top);
+ }
+
+ function doTest() {
+ let domWinUtils = window.windowUtils;
+
+ let text = document.getElementById("text");
+
+ text.focus();
+
+ let textrect = text.getBoundingClientRect();
+
+ let cp = document.caretPositionFromPoint(10, 395);
+ let input = cp.offsetNode;
+ let offset = cp.offset;
+ input.selectionStart = input.selectionEnd = offset;
+
+ let selection = getSelection(text);
+
+ testCaretPosition(domWinUtils, input.selectionStart, {
+ min: { left: 5, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, input.selectionEnd, {
+ min: { left: 5, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionStart, {
+ min: { left: 5, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionEnd, {
+ min: { left: 5, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.anchorOffset, {
+ min: { left: 5, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.focusOffset, {
+ min: { left: 5, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ cp = document.caretPositionFromPoint(395, 395);
+ input = cp.offsetNode;
+ offset = cp.offset;
+ input.selectionStart = input.selectionEnd = offset;
+
+ selection = getSelection(text);
+
+ testCaretPosition(domWinUtils, input.selectionStart, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, input.selectionEnd, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionStart, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionEnd, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.anchorOffset, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.focusOffset, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ done();
+ }
+
+</script>
+
+<body onload="doTest()">
+<textarea id="text" wrap="on">
+Alice was beginning to get very tired of sitting by her sister on the bank,
+and of having nothing to do: once or twice she had peeped into the book
+her sister was reading, but it had no pictures or conversations in it,
+`and what is the use of a book,' thought Alice `without pictures or
+conversation?'
+
+So she was considering in her own mind (as well as she could, for the
+hot day made her feel very sleepy and stupid), whether the pleasure of
+making a daisy-chain would be worth the trouble of getting up and
+picking the daisies, when suddenly a White Rabbit with pink In another
+moment down went Alice after it, never once considering how in the world
+she was to get out again.
+
+The rabbit-hole went straight on like a tunnel for some way, and then
+dipped suddenly down, so suddenly that Alice had not a moment to think
+about stopping herself before she found herself falling down a very deep
+well.
+
+Either the well was very deep, or she fell very slowly, for she had
+plenty of time as she went down to look about her and to wonder what was
+ going to happen next. First, she tried to look down and make out what
+she was coming to, but it was too dark to see anything; then she looked
+at the sides of the well, and noticed that they were filled with
+cupboards and book-shelves; here and there she saw maps and pictures
+hung upon pegs. She took down a jar from one of the shelves as she
+passed; it was labelled `ORANGE MARMALADE', but to her great
+disappointment it was empty: she did not like to drop the jar for fear
+of killing somebody, so managed to put it into one of the cupboards as
+she fell past it.
+</textarea>
+<div id="container"></div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/queryCaretRectWin.html b/dom/tests/mochitest/chrome/queryCaretRectWin.html
new file mode 100644
index 0000000000..27708aad58
--- /dev/null
+++ b/dom/tests/mochitest/chrome/queryCaretRectWin.html
@@ -0,0 +1,218 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>nsIDOMWindowUtils::sendQueryContentEvent w/QUERY_CARET_RECT test</title>
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+
+<!--
+ #########################################################
+ # WARNING: this file has Windows line endings. If you
+ # update this file please maintain them. Line endings are
+ # taken into account when calculating query caret rect
+ # values.
+ #########################################################
+-->
+
+<style>
+ #text {
+ position: absolute;
+ left: 0em;
+ top: 0em;
+ font-size: 10pt;
+ font-family: monospace;
+ line-height: 20px;
+ letter-spacing: 0px;
+ margin-top:-1px; /* nix the text area border */
+ overflow: hidden;
+ width:800px;
+ height:400px;
+ }
+ #div-hor {
+ position: absolute;
+ left: 0em;
+ border-top:1px solid lightgray;
+ width: 1000px;
+ pointer-events:none;
+ }
+ #div-ver {
+ position: absolute;
+ top: 0em;
+ border-left:1px solid lightgray;
+ height: 500px;
+ pointer-events:none;
+ }
+</style>
+
+<script type="application/javascript">
+ var SimpleTest = window.opener.SimpleTest;
+
+ function ok() { window.opener.ok.apply(window.opener, arguments); }
+ function done() { window.opener.done.apply(window.opener, arguments); }
+
+ function dumpLn() {
+ for (let idx = 0; idx < arguments.length; idx++)
+ dump(arguments[idx] + " ");
+ dump("\n");
+ }
+
+ // drawn grid is 20x20
+ function drawGrid() {
+ for (var idx = 0; idx < 20; idx++) {
+ var e = document.createElement("div");
+ e.setAttribute("id", "div-hor");
+ e.style.top = (idx*20) + "px";
+ document.getElementById("container").appendChild(e);
+ }
+ for (var idx = 0; idx < 40; idx++) {
+ var e = document.createElement("div");
+ e.setAttribute("id", "div-ver");
+ e.style.left = (idx*20) + "px";
+ document.getElementById("container").appendChild(e);
+ }
+ }
+
+ function getSelection(aElement) {
+ // aElement is know to be a textarea.
+ return aElement.editor.selection;
+ }
+
+ function testCaretPosition(aDomWinUtils, aOffset, aRectDims) {
+ let rect = aDomWinUtils.sendQueryContentEvent(
+ aDomWinUtils.QUERY_CARET_RECT,
+ aOffset, 0, 0, 0,
+ aDomWinUtils.QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
+ ok(rect, "rect returned");
+ ok(rect.succeeded, "call succeeded");
+
+ info("left:" + rect.left + " top:" + rect.top);
+
+ ok(rect.left > aRectDims.min.left, "rect.left > " + aRectDims.min.left);
+ ok(rect.left < aRectDims.max.left, "rect.left < " + aRectDims.max.left);
+ ok(rect.top > aRectDims.min.top, "rect.top > " + aRectDims.min.top);
+ ok(rect.top < aRectDims.max.top, "rect.top < " + aRectDims.max.top);
+ }
+
+ function doTest() {
+ let domWinUtils = window.windowUtils;
+
+ let text = document.getElementById("text");
+
+ text.focus();
+
+ let textrect = text.getBoundingClientRect();
+
+ let cp = document.caretPositionFromPoint(10, 395);
+ let input = cp.offsetNode;
+ let offset = cp.offset;
+ input.selectionStart = input.selectionEnd = offset;
+
+ let selection = getSelection(text);
+
+ testCaretPosition(domWinUtils, input.selectionStart, {
+ min: { left: 10, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, input.selectionEnd, {
+ min: { left: 10, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionStart, {
+ min: { left: 10, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionEnd, {
+ min: { left: 10, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.anchorOffset, {
+ min: { left: 10, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.focusOffset, {
+ min: { left: 10, top: 380 },
+ max: { left: 25, top: 390 },
+ });
+
+ cp = document.caretPositionFromPoint(395, 395);
+ input = cp.offsetNode;
+ offset = cp.offset;
+ input.selectionStart = input.selectionEnd = offset;
+
+ selection = getSelection(text);
+
+ testCaretPosition(domWinUtils, input.selectionStart, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, input.selectionEnd, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionStart, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, text.selectionEnd, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.anchorOffset, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ testCaretPosition(domWinUtils, selection.focusOffset, {
+ min: { left: 390, top: 380 },
+ max: { left: 400, top: 390 },
+ });
+
+ done();
+ }
+
+</script>
+
+<body onload="doTest()">
+<textarea id="text" wrap="on">
+Alice was beginning to get very tired of sitting by her sister on the bank,
+and of having nothing to do: once or twice she had peeped into the book
+her sister was reading, but it had no pictures or conversations in it,
+`and what is the use of a book,' thought Alice `without pictures or
+conversation?'
+
+So she was considering in her own mind (as well as she could, for the
+hot day made her feel very sleepy and stupid), whether the pleasure of
+making a daisy-chain would be worth the trouble of getting up and
+picking the daisies, when suddenly a White Rabbit with pink In another
+moment down went Alice after it, never once considering how in the world
+she was to get out again.
+
+The rabbit-hole went straight on like a tunnel for some way, and then
+dipped suddenly down, so suddenly that Alice had not a moment to think
+about stopping herself before she found herself falling down a very deep
+well.
+
+Either the well was very deep, or she fell very slowly, for she had
+plenty of time as she went down to look about her and to wonder what was
+ going to happen next. First, she tried to look down and make out what
+she was coming to, but it was too dark to see anything; then she looked
+at the sides of the well, and noticed that they were filled with
+cupboards and book-shelves; here and there she saw maps and pictures
+hung upon pegs. She took down a jar from one of the shelves as she
+passed; it was labelled `ORANGE MARMALADE', but to her great
+disappointment it was empty: she did not like to drop the jar for fear
+of killing somebody, so managed to put it into one of the cupboards as
+she fell past it.
+</textarea>
+<div id="container"></div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/selectAtPoint-innerframe.html b/dom/tests/mochitest/chrome/selectAtPoint-innerframe.html
new file mode 100644
index 0000000000..34a8055cce
--- /dev/null
+++ b/dom/tests/mochitest/chrome/selectAtPoint-innerframe.html
@@ -0,0 +1,6 @@
+<html>
+<body style='margin: 0; padding: 0; font-family: monospace;' onload='window.parent.onFrameLoad();'>
+<div id='sel2'>ttestselection2 Lorem ipsum dolor sit amet, at duo debet graeci, vivendum vulputate per ut.</div>
+<br/><br/>
+</body>
+</html>">
diff --git a/dom/tests/mochitest/chrome/selectAtPoint.html b/dom/tests/mochitest/chrome/selectAtPoint.html
new file mode 100644
index 0000000000..6f5f08801b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/selectAtPoint.html
@@ -0,0 +1,278 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>nsIDOMWindowUtils::selectAtPoint test</title>
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+
+<script type="application/javascript">
+ var SimpleTest = window.opener.SimpleTest;
+
+ function ok() { window.opener.ok.apply(window.opener, arguments); }
+ function done() { window.opener.done.apply(window.opener, arguments); }
+
+ function dumpLn() {
+ for (let idx = 0; idx < arguments.length; idx++)
+ dump(arguments[idx] + " ");
+ dump("\n");
+ }
+
+ function getCharacterDims() {
+ let span = document.getElementById("measure");
+ let rect = span.getBoundingClientRect();
+ // Subtract 2 from each dimension because of 1px border on all sides
+ // of the frame.
+ return { width: rect.width - 2, height: rect.height - 2 };
+ }
+
+ function setStart(aDWU, aX, aY, aSelectType)
+ {
+ // Clear any existing selection
+ let selection = document.getSelection();
+ selection.removeAllRanges();
+
+ // Select text
+ let result = aDWU.selectAtPoint(aX, aY, aSelectType);
+ ok(result == true, "selectAtPoint succeeded?");
+ }
+
+ function setEnd(aDWU, aX, aY, aSelectType)
+ {
+ // Select text
+ let result = aDWU.selectAtPoint(aX, aY, aSelectType);
+ ok(result == true, "selectAtPoint succeeded?");
+ }
+
+ function setSingle(aDWU, aX, aY, aSelectType, aSelectTypeStr, aExpectedSelectionText) {
+ // Clear any existing selection
+ let selection = document.getSelection();
+ selection.removeAllRanges();
+
+ // Select text
+ let result = aDWU.selectAtPoint(aX, aY, aSelectType);
+ ok(result == true, "selectAtPoint succeeded?");
+ }
+
+ function checkSelection(aDoc, aSelectTypeStr, aExpectedSelectionText) {
+ // Retrieve text selected
+ let selection = aDoc.getSelection();
+ let text = selection.toString();
+
+ // Test
+ let result = (text == aExpectedSelectionText);
+ ok(result, aSelectTypeStr + " selection text matches?");
+ if (!result) {
+ dumpLn(aSelectTypeStr + " selection text:", "[" + text + "] expected:[" + aExpectedSelectionText + "]" );
+ }
+ }
+
+ function doTest() {
+ let dwu = window.windowUtils;
+
+ let os = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULRuntime).OS;
+ let isLinux = (os == "Linux");
+ let isMac = (os == "Darwin");
+ let isWindows = (os == "WINNT");
+
+ if (!isLinux && !isMac && !isWindows) {
+ done();
+ return;
+ }
+
+ window.scrollTo(0, 0);
+
+ // Trick to get character spacing - get the bounds around a
+ // single character trapped in a div.
+ let charDims = getCharacterDims();
+ // dumpLn("character dims:", charDims.width, charDims.height);
+
+ //
+ // Root frame selection
+ //
+
+ // First div in the main page
+
+ let div = document.getElementById("div1");
+ let rect = div.getBoundingClientRect();
+ rect.x += 1; rect.y += 1; rect.width -= 2; rect.height -= 2; // remove border
+
+ // Centered on the first character in the sentence div
+ let targetPoint = { xPos: rect.left + (charDims.width / 2),
+ yPos: rect.top + (charDims.height / 2) };
+
+ setSingle(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_WORDNOSPACE);
+ checkSelection(document, "SELECT_WORDNOSPACE", "ttestselection1");
+ setSingle(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_WORD);
+ if (isLinux || isMac) {
+ checkSelection(document, "SELECT_WORD", "ttestselection1");
+ } else if (isWindows) {
+ checkSelection(document, "SELECT_WORD", "ttestselection1 ");
+ }
+ setSingle(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_PARAGRAPH);
+ checkSelection(document, "SELECT_PARAGRAPH", "ttestselection1 Lorem ipsum dolor sit amet, at duo debet graeci, vivendum vulputate per ut. Ne labore incorrupte vix. Cu copiosae postulant tincidunt ius, in illud appetere contentiones eos. Ei munere officiis assentior pro, nibh decore ius at.");
+
+ // Within the 10th character "c" in the sentence div
+ targetPoint = { xPos: rect.left + 9.6 * charDims.width,
+ yPos: rect.top + (charDims.height / 2) };
+ // The expectations here are incorrect, because selectAtPoint selects two characters
+ // when it should only get one. https://bugzilla.mozilla.org/show_bug.cgi?id=1696176
+ setSingle(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
+ checkSelection(document, "SELECT_CHARACTER", "c");
+ setSingle(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CLUSTER);
+ checkSelection(document, "SELECT_CLUSTER", "c");
+
+ // Separate character blocks in a word 'ttestse(l)ection(1)'
+ targetPoint = { xPos: rect.left + 7.6 * charDims.width,
+ yPos: rect.top + (charDims.height / 2) };
+ setStart(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
+ targetPoint = { xPos: rect.left + 14.6 * charDims.width,
+ yPos: rect.top + (charDims.height / 2) };
+ setEnd(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
+ checkSelection(document, "split selection", "l1");
+
+ // Trying to select where there's no text, should fail but not throw
+ let result = dwu.selectAtPoint(rect.left - 20, rect.top - 20, Ci.nsIDOMWindowUtils.SELECT_CHARACTER, false);
+ ok(result == false, "couldn't select?");
+
+ // Second div in the main page
+
+ div = document.getElementById("div2");
+ rect = div.getBoundingClientRect();
+ rect.x += 1; rect.y += 1; rect.width -= 2; rect.height -= 2; // remove border
+
+ // Centered on the first line, first character in the paragraph div
+ targetPoint = { xPos: rect.left + (charDims.width / 2),
+ yPos: rect.top + (charDims.height / 2) };
+ setSingle(dwu, targetPoint.xPos + 50, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_PARAGRAPH);
+ checkSelection(document, "SELECT_PARAGRAPH", "Lorem ipsum dolor sit amet, at duo debet graeci, vivendum vulputate per ut. Ne labore incorrupte vix. Cu copiosae postulant tincidunt ius, in illud appetere contentiones eos.");
+
+ //
+ // Inner IFRAME selection tests
+ //
+
+ let frame = document.getElementById("frame1");
+ let dwuFrame = frame.contentDocument
+ .defaultView
+ .windowUtils;
+
+ frame.contentWindow.scrollTo(0, 0);
+
+ rect = frame.getBoundingClientRect();
+ rect.x += 1; rect.y += 1; rect.width -= 2; rect.height -= 2; // remove border
+
+ targetPoint = { xPos: charDims.width / 2,
+ yPos: charDims.height / 2 };
+ setSingle(dwuFrame, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_WORDNOSPACE);
+ checkSelection(frame.contentWindow.document, "SELECT_WORDNOSPACE", "ttestselection2");
+ setSingle(dwuFrame, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_WORD);
+ if (isLinux || isMac) {
+ checkSelection(frame.contentWindow.document, "SELECT_WORD", "ttestselection2");
+ } else if (isWindows) {
+ checkSelection(frame.contentWindow.document, "SELECT_WORD", "ttestselection2 ");
+ }
+ setSingle(dwuFrame, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_PARAGRAPH);
+ checkSelection(frame.contentWindow.document, "SELECT_PARAGRAPH", "ttestselection2 Lorem ipsum dolor sit amet, at duo debet graeci, vivendum vulputate per ut.");
+
+ // Outside the frame should throw. This is a failure in coordinate setup of
+ // nsDOMWindowUtils::SelectAtPoint.
+ let thr = false;
+ try {
+ dwuFrame.selectAtPoint(rect.right + 50, rect.top, Ci.nsIDOMWindowUtils.SELECT_WORD, false);
+ } catch (ex) { thr = true; }
+ ok(thr == true, "selectAtPoint expected throw?");
+
+ done();
+ }
+
+ let frameLoad = false;
+ let pageLoad = false;
+ let painted = false;
+ function testReady() {
+ if (frameLoad && pageLoad && painted)
+ doTest();
+ }
+
+ function onFrameLoad() {
+ // Exit the onload handler before trying the test, because we need
+ // to ensure that paint unsupression has happened.
+ setTimeout(function() {
+ frameLoad = true;
+ testReady();
+ }, 0);
+ }
+
+ function onPageLoad() {
+ // Exit the onload handler before trying the test, because we need
+ // to ensure that paint unsupression has happened
+ // XXXroc why do we need to separately test for the loading of the frame
+ // and a paint? That should not be necessary for this test.
+ setTimeout(function() {
+ pageLoad = true;
+ testReady();
+ }, 0);
+ }
+
+ function onPaint() {
+ window.removeEventListener("MozAfterPaint", onPaint);
+ painted = true;
+ testReady();
+ }
+
+ window.addEventListener("MozAfterPaint", onPaint);
+</script>
+
+<style type="text/css">
+
+body {
+ font-family: monospace;
+ margin-left: 40px;
+ margin-top: 40px;
+ padding: 0;
+}
+
+#div1 {
+ border: 1px solid red;
+ width: 400px;
+ height: 100px;
+}
+
+#frame1 {
+ display: block;
+ height: 100px;
+ width: 300px;
+ border: 1px solid blue;
+ padding: 0;
+ margin: 0;
+}
+
+#div2 {
+ border: 1px solid green;
+}
+
+#measure {
+ padding: 0px;
+ margin: 0px;
+ border: 1px solid red;
+}
+
+</style>
+</head>
+<body id="body" onload="onPageLoad();">
+
+<div id="div1">ttestselection1 Lorem ipsum dolor sit amet, at duo debet graeci, vivendum vulputate per ut. Ne labore incorrupte vix. Cu copiosae postulant tincidunt ius, in illud appetere contentiones eos. Ei munere officiis assentior pro, nibh decore ius at.</div>
+
+<br />
+
+<iframe id="frame1" src="selectAtPoint-innerframe.html"></iframe>
+
+<br/>
+
+<div id="div2">Lorem ipsum dolor sit amet, at duo debet graeci, vivendum vulputate per ut. Ne labore incorrupte vix. Cu copiosae postulant tincidunt ius, in illud appetere contentiones eos.</div>
+
+<br />
+
+<span id="measure">t</span>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/sizemode_attribute.xhtml b/dom/tests/mochitest/chrome/sizemode_attribute.xhtml
new file mode 100644
index 0000000000..3dbde68064
--- /dev/null
+++ b/dom/tests/mochitest/chrome/sizemode_attribute.xhtml
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ Test for fullscreen sizemode in chrome
+ -->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ persist="sizemode"
+ sizemode="normal"
+ onload="nextStep()">
+
+<script type="text/javascript">
+let tests = [
+ function test1() {
+ checkAndContinue("normal");
+ },
+
+ function test2() {
+ listen("fullscreen", () => checkAndContinue("fullscreen"));
+ window.fullScreen = true;
+ },
+
+ function test3() {
+ listen("fullscreen", () => checkAndContinue("normal"));
+ window.fullScreen = false;
+ },
+
+ function test4() {
+ listen("resize", () => checkAndContinue("maximized"));
+ window.maximize();
+ },
+
+ function test5() {
+ listen("fullscreen", () => checkAndContinue("fullscreen"));
+ window.fullScreen = true;
+ },
+
+ function test6() {
+ listen("fullscreen", () => checkAndContinue("maximized"));
+ window.fullScreen = false;
+ },
+
+ function test7() {
+ listen("resize", () => checkAndContinue("normal"));
+ window.restore();
+ },
+
+ function test8() {
+ window.arguments[0].done();
+ }
+];
+
+function nextStep() {
+ tests.shift()();
+}
+
+function listen(event, fn) {
+ window.addEventListener(event, function listener() {
+ window.removeEventListener(event, listener, false);
+ fn();
+ }, false);
+}
+
+function checkAndContinue(sizemode) {
+
+ let windowStates = {
+ "fullscreen": window.STATE_FULLSCREEN,
+ "normal": window.STATE_NORMAL,
+ "maximized": window.STATE_MAXIMIZED
+ };
+
+ setTimeout(function() {
+ is(window.document.documentElement.getAttribute("sizemode"), sizemode, "sizemode attribute should match actual window state");
+ is(window.fullScreen, sizemode == "fullscreen", "window.fullScreen should match actual window state");
+ is(window.windowState, windowStates[sizemode], "window.sizeMode should match actual window state");
+ nextStep();
+ }, 0);
+}
+
+let is = window.arguments[0].is;
+
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+
+</body>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_DOMWindowCreated.xhtml b/dom/tests/mochitest/chrome/test_DOMWindowCreated.xhtml
new file mode 100644
index 0000000000..4ad119b7f5
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_DOMWindowCreated.xhtml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ Test for Persistent Storage in chrome
+ -->
+<window id="sample-window" width="400" height="400"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/chrome-harness.js"></script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+var root = getRootDirectory(window.location.href);
+window.openDialog(root + "DOMWindowCreated_chrome.xhtml", "_blank", "chrome,width=600,height=550,noopener", window);
+</script>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_DOM_element_instanceof.xhtml b/dom/tests/mochitest/chrome/test_DOM_element_instanceof.xhtml
new file mode 100644
index 0000000000..9efdaab158
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_DOM_element_instanceof.xhtml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=824917
+-->
+<window title="Mozilla Bug 824917"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=824917"
+ target="_blank">Mozilla Bug 824917</a>
+ </body>
+
+ <iframe type="content"></iframe>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 824917 **/
+
+ function runTests() {
+ window.openDialog("file_DOM_element_instanceof.xhtml", "_blank", "chrome,width=600,height=550,noopener", window);
+ }
+
+ addLoadEvent(runTests);
+
+ SimpleTest.waitForExplicitFinish();
+
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_activation.xhtml b/dom/tests/mochitest/chrome/test_activation.xhtml
new file mode 100644
index 0000000000..2bc5a7d98d
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_activation.xhtml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="data:text/css,
+
+%23box {
+ background: blue;
+}
+
+%23box:-moz-window-inactive {
+ background: cyan;
+}
+
+" type="text/css"?>
+<!--
+ Test for the :-moz-window-inactive pseudoclass
+ -->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ sizemode="fullscreen">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<box id="box" height="100"/>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+
+newwindow = window.browsingContext.topChromeWindow.openDialog("window_activation.xhtml", "_blank","chrome,width=300,height=200", window);
+
+function complete()
+{
+ newwindow.close();
+ SimpleTest.finish();
+}
+
+</script>
+
+
+<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_bug1224790-1.xhtml b/dom/tests/mochitest/chrome/test_bug1224790-1.xhtml
new file mode 100644
index 0000000000..9f2c345f5c
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug1224790-1.xhtml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
+-->
+<window title="Mozilla Bug 1224790"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 1224790 **/
+ /*
+ * 1. Opens modal dialog
+ * 2. Open non-modal window from modal dialog
+ * 3. Close non-modal window
+ * 4. Close modal dialog
+ * 5. Click button to ensure mouse event is working
+ */
+
+ function startTest() {
+ window.openDialog('file_bug1224790-1_modal.xhtml', '', 'modal,noopener', window);
+ }
+
+ function modalClosed() {
+ SimpleTest.waitForFocus(gotFocus);
+ }
+
+ var timer = null;
+ function gotFocus() {
+ var button = document.getElementById('button');
+ synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
+ function click() {
+ // The bug is not reproducible with synthesizeMouseAtCenter.
+ synthesizeNativeMouseEvent({ type: "click", target: button, atCenter: true });
+ }
+ click();
+ // On debug build, it's possible that the click event handler is not
+ // triggered by the first click in case the click is dispatched too early
+ // before Firefox gets ready for input.
+ // Click the button again after 1 sec when we don't get click event.
+ timer = setTimeout(click, 1000);
+ }
+
+ function onClick() {
+ if (timer) {
+ // Avoid clicking unrelated thing.
+ clearTimeout(timer);
+ }
+ ok(true, "Click event should be fired");
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.waitForFocus(startTest);
+ ]]>
+ </script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1224790"
+ target="_blank">Mozilla Bug 1224790</a>
+ </body>
+ <button id="button" label="button" oncommand="onClick()" />
+</window>
diff --git a/dom/tests/mochitest/chrome/test_bug1224790-2.xhtml b/dom/tests/mochitest/chrome/test_bug1224790-2.xhtml
new file mode 100644
index 0000000000..7b4983fd37
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug1224790-2.xhtml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
+-->
+<window title="Mozilla Bug 1224790"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 1224790 **/
+ /*
+ * 1. Opens modal dialog
+ * 2. Open non-modal window from modal dialog
+ * 3. Close modal dialog
+ * 4. Wait for a while for destructor for modal dialog
+ * 5. Close non-modal window
+ * 6. Click button to ensure mouse event is working
+ */
+
+ function startTest() {
+ window.openDialog('file_bug1224790-2_modal.xhtml', '', 'modal,noopener', window);
+ }
+
+ function nonModalClosed() {
+ SimpleTest.waitForFocus(gotFocus);
+ }
+
+ var timer = null;
+ function gotFocus() {
+ var button = document.getElementById('button');
+ synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
+ function click() {
+ // The bug is not reproducible with synthesizeMouseAtCenter.
+ synthesizeNativeMouseEvent({ type: "click", target: button, atCenter: true });
+ }
+ click();
+ // On debug build, it's possible that the click event handler is not
+ // triggered by the first click in case the click is dispatched too early
+ // before Firefox gets ready for input.
+ // Click the button again after 1 sec when we don't get click event.
+ timer = setTimeout(click, 1000);
+ }
+
+ function onClick() {
+ if (timer) {
+ // Avoid clicking unrelated thing.
+ clearTimeout(timer);
+ }
+ ok(true, "Click event should be fired");
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.waitForFocus(startTest);
+ ]]>
+ </script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1224790"
+ target="_blank">Mozilla Bug 1224790</a>
+ </body>
+ <button id="button" label="button" oncommand="onClick()" />
+</window>
diff --git a/dom/tests/mochitest/chrome/test_bug800817.xhtml b/dom/tests/mochitest/chrome/test_bug800817.xhtml
new file mode 100644
index 0000000000..fefaf2c155
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug800817.xhtml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=800817
+-->
+<window title="Mozilla Bug 800817" onload="runTests()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=800817"
+ target="_blank">Mozilla Bug 800817</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 800817 **/
+
+ var testMozBrowser = false;
+ function runTests() {
+ // Run a first round of tests for non-mozbrowser iframes.
+ window.openDialog("file_bug800817.xhtml", "_blank", "chrome,width=600,height=550,noopener", window);
+ }
+
+ function finishedTests() {
+ if (!testMozBrowser) {
+ testMozBrowser = true;
+ // Run a second round of tests for mozbrowser iframes.
+ window.openDialog("file_bug800817.xhtml", "_blank", "chrome,width=600,height=550,noopener", window);
+ } else {
+ SimpleTest.finish();
+ }
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_bug830858.xhtml b/dom/tests/mochitest/chrome/test_bug830858.xhtml
new file mode 100644
index 0000000000..9afc51bdef
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug830858.xhtml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=830858
+-->
+<window title="Mozilla Bug 830858"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="runTests()">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 830858 **/
+
+ function runTests() {
+ window.openDialog("file_bug830858.xhtml", "_blank", "chrome,width=600,height=550,noopener", window);
+ }
+
+ function finishedTests() {
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ ]]>
+ </script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=830858"
+ target="_blank">Mozilla Bug 830858</a>
+ </body>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_callback_wrapping.xhtml b/dom/tests/mochitest/chrome/test_callback_wrapping.xhtml
new file mode 100644
index 0000000000..28b7b89b43
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_callback_wrapping.xhtml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=742222
+-->
+<window title="Mozilla Bug 742222"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=742222"
+ target="_blank">Mozilla Bug 742222</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ window.open("window_callback_wrapping.xhtml");
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_clipboard_events_chrome.html b/dom/tests/mochitest/chrome/test_clipboard_events_chrome.html
new file mode 100644
index 0000000000..0c67d5e280
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_clipboard_events_chrome.html
@@ -0,0 +1,60 @@
+<html>
+<body onload="runTest()">
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<script>
+// This test checks that the dom.event.clipboardevents.enabled does not apply to chrome shells.
+
+SimpleTest.waitForExplicitFinish();
+function runTest()
+{
+ SpecialPowers.pushPrefEnv({"set": [['dom.event.clipboardevents.enabled', false]]}, function() {
+ window.openDialog("file_clipboard_events_chrome.html", "_blank", "chrome,width=200,height=200,noopener", window);
+ });
+}
+
+var event_fired = false;
+
+function doChecks(win)
+{
+ var windowFocused = function() {
+ var textbox = win.document.getElementById("i");
+ textbox.value = "Sample Text";
+
+ textbox.oncut = function() { event_fired = true; };
+ textbox.oncopy = function() { event_fired = true; };
+ textbox.onpaste = function() { event_fired = true; };
+
+ textbox.select();
+ textbox.focus();
+
+ textbox.setSelectionRange(1, 4);
+ synthesizeKey("x", {accelKey: 1}, win);
+ is(textbox.value, "Sle Text", "cut changed text when preference is disabled");
+ ok(event_fired, "cut event fired when preference is disabled")
+
+ event_fired = false;
+ textbox.setSelectionRange(4, 6);
+ synthesizeKey("c", {accelKey: 1}, win);
+ is(textbox.value, "Sle Text", "cut changed text when preference is disabled");
+ ok(event_fired, "copy event fired when preference is disabled")
+
+ event_fired = false;
+ textbox.setSelectionRange(1, 4);
+ synthesizeKey("v", {accelKey: 1}, win);
+ is(textbox.value, "STeText", "paste changed text when preference is disabled");
+ ok(event_fired, "paste event fired when preference is disabled")
+
+ win.close();
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForFocus(windowFocused, win);
+}
+
+</script>
+
+<p id="display"></p>
+</body></html>
diff --git a/dom/tests/mochitest/chrome/test_clonewrapper.xhtml b/dom/tests/mochitest/chrome/test_clonewrapper.xhtml
new file mode 100644
index 0000000000..41d7661fb1
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_clonewrapper.xhtml
@@ -0,0 +1,117 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=667388
+-->
+<window title="Mozilla Bug 667388"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ // Setup.
+ SimpleTest.waitForExplicitFinish();
+ window.testObject = { myNumber: 42,
+ myDomain: window.location.domain };
+
+
+ // Wait for both frames to load before proceeding.
+ var framesLoaded = [null, false, false, false];
+ function onFrameLoaded(id) {
+
+ // Mark this frame as loaded.
+ framesLoaded[id] = true;
+
+ // Allow it to call various helpers.
+ window.frames[id].wrappedJSObject.is = is;
+ window.frames[id].wrappedJSObject.ok = ok;
+ window.frames[id].wrappedJSObject.info = info;
+
+ // If all the frames are loaded, start the test.
+ if (framesLoaded[1] && framesLoaded[2] && framesLoaded[3])
+ startTest();
+ }
+
+ function reject(e) {
+ ok(false, "Rejected Promise: " + e);
+ SimpleTest.finish();
+ }
+
+ function startTest() {
+
+ runChromeContentTest(window.frames[1]).then(
+ runContentContentTest.bind(null, window.frames[1], window.frames[2],
+ true, "Should be able to clone same-origin"), reject).then(
+ runContentContentTest.bind(null, window.frames[2], window.frames[3],
+ false, "Should not be able to clone cross-origin"), reject).then(function() {
+ // Colaborate with document.domain, then try again.
+ frames[2].document.domain = 'example.org';
+ frames[3].document.domain = 'example.org';
+ return runContentContentTest(window.frames[2], window.frames[3],
+ false, "Should be able to clone cross-origin with document.domain, but can't because of cached CCWs")
+ }, reject).then(SimpleTest.finish.bind(SimpleTest), reject);
+ }
+
+ // Tests cloning between chrome and content.
+ function runChromeContentTest(contentWin) {
+
+ // We should be able to clone a content object.
+ tryToClone(contentWin.wrappedJSObject.testObject,
+ true,
+ "Chrome should be able to clone content object");
+
+ return Promise.resolve();
+ }
+
+ // Test cloning between content and content.
+ //
+ // Note - the way we do this is kind of sketchy. Because we're grabbing the
+ // test object from win1 by waiving Xray (via .wrappedJSObject), the object
+ // we're passing from win1 to win2 is actually the waived object (which has
+ // a distinct identity in the compartment of win2). So this means that we're
+ // actually giving win2 Xray waivers to win1! This doesn't affect things as
+ // long as the security wrappers check documentDomainMakesSameOrigin directly
+ // for the puncture case rather than checking IsTransparent(), but it still
+ // gives rise to a situation that wouldn't really happen in practice.
+ function runContentContentTest(win1, win2, shouldSucceed, msg) {
+
+ var p = win1.wrappedJSObject.tryToClone(win2.wrappedJSObject.testObject,
+ shouldSucceed, msg);
+ if (!shouldSucceed)
+ return;
+ return new Promise(function(resolve) {
+ p.then(function(cloneResult) {
+ is(JSON.stringify(Cu.waiveXrays(cloneResult)),
+ JSON.stringify(win2.wrappedJSObject.testObject),
+ "Clone should create an identical object");
+ resolve();
+ });
+ });
+ }
+
+ function tryToClone(obj, shouldSucceed, message) {
+ var success = false;
+ var sink = window.frames[0];
+ try { sink.postMessage(obj, '*'); success = true; }
+ catch (e) { message = message + ' (threw: ' + e.message + ')'; }
+ is(success, shouldSucceed, message);
+ }
+
+ ]]>
+ </script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=667388"
+ target="_blank">Mozilla Bug 667388</a>
+ <iframe id="sink" />
+ <!-- The first two are same-origin, the third is not. -->
+ <iframe id="frame1" onload="onFrameLoaded(1);" src="http://test1.example.org/tests/dom/tests/mochitest/general/file_clonewrapper.html" />
+ <iframe id="frame2" onload="onFrameLoaded(2);" src="http://test1.example.org/tests/dom/tests/mochitest/general/file_clonewrapper.html" />
+ <iframe id="frame3" onload="onFrameLoaded(3);" src="http://test2.example.org/tests/dom/tests/mochitest/general/file_clonewrapper.html" />
+ </body>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_cyclecollector.xhtml b/dom/tests/mochitest/chrome/test_cyclecollector.xhtml
new file mode 100644
index 0000000000..89302f37cc
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_cyclecollector.xhtml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=
+-->
+<window title="Mozilla Bug "
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id="
+ target="_blank">Mozilla Bug </a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug **/
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
+ var didCall = false;
+ var observer = {
+ QueryInterface: function QueryInterface(aIID) {
+ if (aIID.equals(Ci.nsIObserver) ||
+ aIID.equals(Ci.nsISupports))
+ return this;
+ throw Components.Exception("", Cr.NS_NOINTERFACE);
+ },
+ observe: function(subject, topic, data) {
+ obs.removeObserver(observer, "cycle-collector-begin");
+ observer = null;
+ didCall = true;
+ }
+ };
+
+ // Start an incremental GC, to make sure that calling ccSlice
+ // when an IGC is running finishes the GC.
+ SpecialPowers.Cu.getJSTestingFunctions().gcslice(1);
+
+ // Make sure that we call the observer even if we're in the middle
+ // of an ICC when we add the observer. See bug 981033.
+ SpecialPowers.finishCC();
+ SpecialPowers.ccSlice(1);
+
+ obs.addObserver(observer, "cycle-collector-begin");
+
+ SpecialPowers.DOMWindowUtils.cycleCollect();
+
+ ok(didCall, "Observer should have been called!");
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_docshell_swap.xhtml b/dom/tests/mochitest/chrome/test_docshell_swap.xhtml
new file mode 100644
index 0000000000..120f179cd2
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_docshell_swap.xhtml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<window title="Docshell swap test"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ SimpleTest.waitForExplicitFinish();
+
+ // Create two identical windows, each with a <browser> element.
+ let win1 = window.browsingContext.topChromeWindow.openDialog("window_docshell_swap.xhtml", "_blank","chrome,width=300,height=200");
+ let win2 = window.browsingContext.topChromeWindow.openDialog("window_docshell_swap.xhtml", "_blank","chrome,width=300,height=200");
+
+ let loadCount = 0;
+ function loadHandler() {
+ loadCount++;
+ if (loadCount < 2)
+ return;
+
+ let browser1 = win1.document.getElementById("browser");
+ let browser2 = win2.document.getElementById("browser");
+
+ let pongCount = 0;
+
+ function gotPong(target_ok) {
+ pongCount++;
+ ok(target_ok, "message went to correct target");
+ if (pongCount == 1) {
+ win1.close();
+ win2.close();
+ SimpleTest.finish();
+ }
+ }
+
+ let mm1 = browser1.frameLoader.messageManager;
+ let mm2 = browser2.frameLoader.messageManager;
+
+ // Swap docshells. Everything should be identical to before, since there was nothing to
+ // distinguish these docshells.
+ browser1.swapFrameLoaders(browser2);
+
+ // mm1 shouldn't change here, but we update it in case it does due to a bug.
+ mm1 = browser1.frameLoader.messageManager;
+
+ // Load ping-pong code into first window.
+ mm1.loadFrameScript("data:,addMessageListener('ping', () => sendAsyncMessage('pong'));", false);
+
+ // A pong message received in win1 means success.
+ win1.messageManager.addMessageListener("pong", () => { gotPong(true); });
+
+ // A pong message received in win2 means failure!
+ win2.messageManager.addMessageListener("pong", () => { gotPong(false); });
+
+ // Send the ping to win1.
+ mm1.sendAsyncMessage("ping");
+ }
+
+ win1.addEventListener("load", loadHandler, false);
+ win2.addEventListener("load", loadHandler, false);
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_elements_proto.xhtml b/dom/tests/mochitest/chrome/test_elements_proto.xhtml
new file mode 100644
index 0000000000..c95bda7beb
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_elements_proto.xhtml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+
+<window title="Mozilla Bug 861493"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <script type="application/javascript">
+ <![CDATA[
+ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ SimpleTest.waitForExplicitFinish();
+
+ addLoadEvent(() => {
+ ok(XULTextElement.isInstance(document.createElementNS(XUL_NS, "label")),
+ `<label> should be of XULTextElement type`);
+
+ ok(XULTextElement.isInstance(document.createElementNS(XUL_NS, "description")),
+ `<description> should be of XULTextElement type`);
+
+ SimpleTest.finish();
+ });
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_focus.xhtml b/dom/tests/mochitest/chrome/test_focus.xhtml
new file mode 100644
index 0000000000..3e30104af4
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focus.xhtml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Focus Tests"
+ onload="setTimeout(runTest, 0);"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+<script>
+if (navigator.platform.startsWith("Win")) {
+ SimpleTest.expectAssertions(0, 1);
+}
+
+SimpleTest.waitForExplicitFinish();
+async function runTest()
+{
+ window.openDialog("window_focus.xhtml", "_blank", "chrome,width=600,height=550,noopener", window);
+}
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_focus_dialog.xhtml b/dom/tests/mochitest/chrome/test_focus_dialog.xhtml
new file mode 100644
index 0000000000..0d9d886e26
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focus_dialog.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Focus Tests"
+ onload="setTimeout(runTest, 0);"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+<script>
+if (navigator.platform.startsWith("Win")) {
+ SimpleTest.expectAssertions(0, 1);
+}
+
+SimpleTest.waitForExplicitFinish();
+async function runTest() {
+ // Enable full tab focus model on mac.
+ await SpecialPowers.pushPrefEnv({ set: [["accessibility.tabfocus", 7]] });
+ window.openDialog("focus_dialog.xhtml", "_blank", "chrome,modal,noopener", window);
+}
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_focus_docnav.xhtml b/dom/tests/mochitest/chrome/test_focus_docnav.xhtml
new file mode 100644
index 0000000000..7067da3d1d
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focus_docnav.xhtml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window onload="runTest();"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+function runTest()
+{
+ window.openDialog("window_focus_docnav.xhtml", "_blank", "chrome,width=600,height=550,noopener", window);
+}
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_focused_link_scroll.xhtml b/dom/tests/mochitest/chrome/test_focused_link_scroll.xhtml
new file mode 100644
index 0000000000..717da1b51b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focused_link_scroll.xhtml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Focus Scroll Tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+<div id="div" style="width:500px;height:48px;overflow:auto;font-size:16px;line-height:16px;">
+aaaaaaaaa<br/>bbbbbbbb<br/>
+<a href="about:blank;" id="a">ccccccccc<br/>ddddddddd</a>
+</div>
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest()
+{
+ var fm = Components.classes["@mozilla.org/focus-manager;1"].
+ getService(Components.interfaces.nsIFocusManager);
+ var div = document.getElementById('div');
+ var a = document.getElementById('a');
+ synthesizeMouse(a, 4, 4, { type: "mousedown" }, window);
+ is(fm.focusedElement, a,
+ "The anchor element isn't set focus by the mouse down event");
+ is(div.scrollTop, 0,
+ "The div element was scrolled by the mouse down event");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForFocus(runTest);
+
+</script>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_geolocation.xhtml b/dom/tests/mochitest/chrome/test_geolocation.xhtml
new file mode 100644
index 0000000000..482b36ea20
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_geolocation.xhtml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ Test for Geolocation in chrome
+ -->
+<window
+ id="sample-window"
+ width="400"
+ height="400"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+>
+ <script
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"
+ ></script>
+
+ <script>
+ SimpleTest.waitForExplicitFinish();
+ async function test() {
+ /** @type {Geolocation} */
+ const geolocation = Cc["@mozilla.org/geolocation;1"].getService(
+ Ci.nsISupports
+ );
+ try {
+ // Watch position
+ let watchId;
+ let position = await new Promise((resolve, reject) => {
+ watchId = geolocation.watchPosition(resolve, reject, { timeout: 0 });
+ });
+ ok(position, "watchPosition() callable from chrome");
+ geolocation.clearWatch(watchId);
+
+ // Get position
+ position = await new Promise((resolve, reject) =>
+ geolocation.getCurrentPosition(resolve, reject)
+ );
+ ok(position, "getCurrentPosition() callable from chrome");
+ } catch (err) {
+ ok(
+ false,
+ "error occurred trying to get geolocation from chrome: " + err.message
+ );
+ } finally {
+ SimpleTest.finish();
+ }
+ }
+ </script>
+
+ <body
+ xmlns="http://www.w3.org/1999/xhtml"
+ style="height: 300px; overflow: auto;"
+ onload="test()"
+ />
+</window>
diff --git a/dom/tests/mochitest/chrome/test_getTransformTo.html b/dom/tests/mochitest/chrome/test_getTransformTo.html
new file mode 100644
index 0000000000..1fc4e4749b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_getTransformTo.html
@@ -0,0 +1,117 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test Element::getTransformToViewport</title>
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+<style>
+body {
+ margin: 0px;
+}
+.box {
+ background-color: red;
+ height: 20px;
+ width: 80px;
+}
+.a {
+ margin: 10px;
+}
+.b {
+ margin: 20px;
+}
+.c {
+ transform: translate(11px, -11px);
+}
+.d {
+ transform: skewx(-45deg);
+}
+
+</style>
+<script>
+'use strict';
+
+SimpleTest.waitForExplicitFinish();
+
+function testTransformToParent() {
+ let expectedData = [
+ ["boxA", "1,0,0,0,0,1,0,0,0,0,1,0,10,0,0,1"],
+ ["boxB", "1,0,0,0,0,1,0,0,0,0,1,0,20,0,0,1"],
+ ["boxC", "1,0,0,0,0,1,0,0,0,0,1,0,11,-11,0,1"],
+ ["boxD", "1,0,0,0,-1,1,0,0,0,0,1,0,10,0,0,1"],
+ ];
+
+ // Test transform to parent.
+ for (let i = 0; i < expectedData.length; ++i) {
+ let expected = expectedData[i];
+ let element = document.getElementById(expected[0]);
+
+ let transform = element.getTransformToParent();
+ let transformFloats = transform.toFloat32Array();
+ let transformString = transformFloats.toString();
+ is(transformString, expected[1], "Element " + expected[0] + " has expected transform to parent.");
+ }
+}
+
+function testTransformToAncestorAndViewport() {
+ let expectedData = [
+ ["boxA", "1,0,0,0,0,1,0,0,0,0,1,0,10,10,0,1"],
+ ["boxB", "1,0,0,0,0,1,0,0,0,0,1,0,20,50,0,1"],
+ ["boxC", "1,0,0,0,0,1,0,0,0,0,1,0,11,79,0,1"],
+ ];
+
+ // Test transform to document (an actual ancestor unchanged by embedding within the mochitest framework).
+ for (let i = 0; i < expectedData.length; ++i) {
+ let expected = expectedData[i];
+ let element = document.getElementById(expected[0]);
+
+ let transform = element.getTransformToAncestor(document.documentElement);
+ let transformFloats = transform.toFloat32Array();
+ let transformString = transformFloats.toString();
+ is(transformString, expected[1], "Element " + expected[0] + " has expected transform to ancestor.");
+ }
+
+ // Test transform to a non-ancestor is equivalent to transform to viewport.
+ let nonAncestorElement = document.getElementById("nonAncestor");
+ for (let i = 0; i < expectedData.length; ++i) {
+ let expected = expectedData[i];
+ let element = document.getElementById(expected[0]);
+
+ let transform = element.getTransformToAncestor(nonAncestorElement);
+ let transformFloats = transform.toFloat32Array();
+ let transformString = transformFloats.toString();
+
+ let transformToViewport = element.getTransformToViewport();
+ let transformToViewportFloats = transformToViewport.toFloat32Array();
+ let transformToViewportString = transformToViewportFloats.toString();
+ is(transformString, transformToViewportString, "Element " + expected[0] + " transform to non-ancestor is equivalent to transform to viewport.");
+ }
+}
+
+function runTests() {
+ testTransformToParent();
+ testTransformToAncestorAndViewport();
+
+ SimpleTest.finish();
+}
+</script>
+</head>
+<body onLoad="runTests();">
+
+<div id="boxAParent">
+ <div id="boxA" class="box a">boxA</div>
+</div>
+<div id="boxBParent">
+ <div id="boxB" class="box b">boxB</div>
+</div>
+<div id="boxCParent">
+ <div id="boxC" class="box c">boxC</div>
+</div>
+<div id="boxDParent">
+ <div id="boxD" class="box d">boxD</div>
+</div>
+
+<div id="nonAncestor">This div is not an ancestor of any of the boxes.</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/chrome/test_indexedSetter.html b/dom/tests/mochitest/chrome/test_indexedSetter.html
new file mode 100644
index 0000000000..16bff02030
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_indexedSetter.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=715156
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 715156</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+ <script type="application/javascript">
+
+ /** Test for Bug 715156 **/
+
+ function runTests() {
+ var doc = document.getElementById("testFrame").contentDocument;
+ var options = doc.createElement("select").options;
+ ok(Cu.isXrayWrapper(options), "should be an Xray wrapper");
+ var option = doc.createElement("option");
+ options[4] = option;
+ is(options.length, 5, "setting an indexed property through an Xray wrapper should work")
+ is(options[4], option, "setting an indexed property through an Xray wrapper should work")
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(runTests);
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=715156">Mozilla Bug 715156</a>
+<p id="display"></p>
+<iframe id="testFrame"></iframe>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/test_intlUtils_getDisplayNames.html b/dom/tests/mochitest/chrome/test_intlUtils_getDisplayNames.html
new file mode 100644
index 0000000000..2f4c6e41d1
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_intlUtils_getDisplayNames.html
@@ -0,0 +1,351 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1341994
+-->
+<head>
+ <title>Test for Bug 1341994 </title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1341994 ">Mozilla Bug 1341994</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<script>
+
+var testData = [
+ {
+ locales: ["en-US"],
+ options: {
+ type: "language",
+ },
+ expected: {
+ locale: "en-US",
+ type: "language",
+ style: "long",
+ calendar: "gregory",
+ values: [],
+ }
+ },
+ {
+ locales: ["en-US"],
+ options: {
+ type: "weekday",
+ style: "narrow",
+ calendar: "gregory",
+ keys: [3],
+ },
+ expected: {
+ locale: "en-US",
+ type: "weekday",
+ style: "narrow",
+ calendar: "gregory",
+ values: ["W"]
+ }
+ },
+
+ {
+ locales: ["fr"],
+ options: {
+ type: "dateTimeField",
+ keys: ["year", "day"],
+ },
+ expected: {
+ locale: "fr",
+ type: "dateTimeField",
+ style: "long",
+ calendar: "gregory",
+ values: ["année", "jour"],
+ }
+ },
+ {
+ locales: ["fr"],
+ options: {
+ type: "month",
+ keys: [10],
+ },
+ expected: {
+ locale: "fr",
+ type: "month",
+ style: "long",
+ calendar: "gregory",
+ values: ["octobre"],
+ }
+ },
+ {
+ locales: ["fr"],
+ options: {
+ type: "weekday",
+ keys: [6],
+ },
+ expected: {
+ locale: "fr",
+ type: "weekday",
+ style: "long",
+ calendar: "gregory",
+ values: ["samedi"],
+ }
+ },
+ {
+ locales: ["fr"],
+ options: {
+ type: "dayPeriod",
+ keys: ["pm"],
+ },
+ expected: {
+ locale: "fr",
+ type: "dayPeriod",
+ style: "long",
+ calendar: "gregory",
+ values: ["PM"],
+ }
+ },
+
+ {
+ locales: ["it"],
+ options: {
+ type: "weekday",
+ style: "short",
+ keys: [4],
+ },
+ expected: {
+ locale: "it",
+ type: "weekday",
+ style: "short",
+ calendar: "gregory",
+ values: ["gio"],
+ }
+ },
+ {
+ locales: ["it"],
+ options: {
+ type: "month",
+ style: "short",
+ keys: [8],
+ },
+ expected: {
+ locale: "it",
+ type: "month",
+ style: "short",
+ calendar: "gregory",
+ values: ["ago"],
+ }
+ },
+ {
+ locales: ["it"],
+ options: {
+ type: "dayPeriod",
+ style: "short",
+ keys: ["am"],
+ },
+ expected: {
+ locale: "it",
+ type: "dayPeriod",
+ style: "short",
+ calendar: "gregory",
+ values: ["AM"],
+ }
+ },
+ {
+ locales: ["it"],
+ options: {
+ type: "dateTimeField",
+ style: "short",
+ keys: ["month"],
+ },
+ expected: {
+ locale: "it",
+ type: "dateTimeField",
+ style: "short",
+ calendar: "gregory",
+ values: ["mese"],
+ }
+ },
+
+ {
+ locales: ["ar"],
+ options: {
+ type: "weekday",
+ style: "long",
+ keys: [4],
+ },
+ expected: {
+ locale: "ar",
+ type: "weekday",
+ style: "long",
+ calendar: "gregory",
+ values: ["الخميس"],
+ }
+ },
+ {
+ locales: ["ar"],
+ options: {
+ type: "month",
+ style: "long",
+ keys: [8],
+ },
+ expected: {
+ locale: "ar",
+ type: "month",
+ style: "long",
+ calendar: "gregory",
+ values: ["أغسطس"],
+ }
+ },
+ {
+ locales: ["ar"],
+ options: {
+ type: "dayPeriod",
+ style: "long",
+ keys: ["am"],
+ },
+ expected: {
+ locale: "ar",
+ type: "dayPeriod",
+ style: "long",
+ calendar: "gregory",
+ values: ["ص"],
+ }
+ },
+ {
+ locales: ["ar"],
+ options: {
+ type: "dateTimeField",
+ style: "long",
+ keys: ["month"],
+ },
+ expected: {
+ locale: "ar",
+ type: "dateTimeField",
+ style: "long",
+ calendar: "gregory",
+ values: ["الشهر"],
+ }
+ },
+
+ {
+ locales: ["zh-TW"],
+ options: {
+ type: "weekday",
+ style: "abbreviated",
+ keys: [4],
+ },
+ expected: {
+ locale: "zh-TW",
+ type: "weekday",
+ style: "abbreviated",
+ calendar: "gregory",
+ values: ["週四"],
+ }
+ },
+ {
+ locales: ["zh-TW"],
+ options: {
+ type: "month",
+ style: "short",
+ keys: [8],
+ },
+ expected: {
+ locale: "zh-TW",
+ type: "month",
+ style: "short",
+ calendar: "gregory",
+ values: ["8月"],
+ }
+ },
+ {
+ locales: ["zh-TW"],
+ options: {
+ type: "dayPeriod",
+ style: "short",
+ keys: ["am"],
+ },
+ expected: {
+ locale: "zh-TW",
+ type: "dayPeriod",
+ style: "short",
+ calendar: "gregory",
+ values: ["上午"],
+ }
+ },
+ {
+ locales: ["zh-TW"],
+ options: {
+ type: "dateTimeField",
+ style: "short",
+ keys: ["month"],
+ },
+ expected: {
+ locale: "zh-TW",
+ type: "dateTimeField",
+ style: "short",
+ calendar: "gregory",
+ values: ["月"],
+ }
+ },
+
+ /* Invalid input */
+
+ {
+ locales: ["en-US"],
+ options: {
+ type: "weekday",
+ style: "",
+ keys: [4]
+ },
+ expected: {
+ exception: true
+ }
+ },
+ {
+ locales: ["foo-X"],
+ options: {
+ type: "weekday",
+ keys: [4]
+ },
+ expected: {
+ exception: true
+ }
+ },
+ {
+ locales: ["en-US"],
+ options: {
+ keys: [
+ ""
+ ],
+ },
+ expected: {
+ exception: true
+ }
+ },
+]
+
+let intlUtils = window.intlUtils;
+ok(intlUtils, "window.intlUtils should exist");
+
+for (let { locales, options, expected } of testData) {
+ try {
+ let result = intlUtils.getDisplayNames(locales, options);
+
+ is(result.locale, expected.locale, "locale is " + expected.locale);
+ is(result.type, expected.type, "type is " + expected.type);
+ is(result.style, expected.style, "style is " + expected.style);
+ is(result.calendar, expected.calendar, "calendar is " + expected.calendar);
+
+ let values = result.values;
+ let expectedValues = expected.values;
+
+ is(values.length, expectedValues.length, "values' length is " + expectedValues.length);
+
+ for (let i = 0; i < expectedValues.length; ++i) {
+ is(values[i], expectedValues[i], "value is " + expectedValues[i]);
+ }
+ } catch (e) {
+ ok(expected.exception, "Exception expected : " + e);
+ }
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/test_intlUtils_isAppLocaleRTL.html b/dom/tests/mochitest/chrome/test_intlUtils_isAppLocaleRTL.html
new file mode 100644
index 0000000000..fc6e8e2fb4
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_intlUtils_isAppLocaleRTL.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1673054
+-->
+<head>
+ <title>Test for Bug 1673054 </title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+</head>
+<body onload="test()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1673054 ">Mozilla Bug 1673054</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<script>
+async function test() {
+ SimpleTest.waitForExplicitFinish();
+
+ let intlUtils = window.intlUtils;
+ ok(intlUtils, "window.intlUtils should exist");
+
+ let originalValue = intlUtils.isAppLocaleRTL();
+ ok(originalValue == false, "window.intlUtils.isAppLocaleRTL should exist");
+
+ await SpecialPowers.pushPrefEnv({ set: [["intl.l10n.pseudo", "bidi"]] });
+ let currentValue = intlUtils.isAppLocaleRTL();
+ ok(currentValue == true, "If pseudolocale is bidi, isAppLocaleRTL should be true");
+
+ await SpecialPowers.clearUserPref("intl.l10n.pseudo");
+ currentValue = intlUtils.isAppLocaleRTL();
+ ok(originalValue == currentValue, "Without override, isAppLocaleRTL should be default");
+
+ SimpleTest.finish();
+}
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/test_moving_nodeList.xhtml b/dom/tests/mochitest/chrome/test_moving_nodeList.xhtml
new file mode 100644
index 0000000000..0a3f20eeac
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_moving_nodeList.xhtml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=684115
+-->
+<window title="Mozilla Bug 684115"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=654370"
+ target="_blank">Mozilla Bug 684115</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ var firstWindow, secondWindow;
+ function iframe_loaded() {
+ if (!firstWindow || !secondWindow)
+ return;
+ var nodeList = firstWindow.document.childNodes;
+ ok(!("expando" in nodeList), "shouldn't be able to see expandos on the NodeList");
+ nodeList = firstWindow.wrappedJSObject.getNodeList();
+ ok(("expando" in nodeList), "should be able to see expandos on the NodeList");
+ options = firstWindow.wrappedJSObject.getOptions();
+ is(options.selectedIndex, -1, "can access selectedIndex in chrome");
+ secondWindow.wrappedJSObject.tryToUseNodeList(nodeList, ok);
+ nodeList = document.childNodes;
+ secondWindow.wrappedJSObject.tryToUseNodeList(nodeList, ok);
+ SimpleTest.finish();
+ }
+
+ ]]></script>
+
+ <iframe id="one" src="http://mochi.test:8888/tests/dom/tests/mochitest/general/file_moving_nodeList.html"
+ onload="firstWindow = this.contentWindow; iframe_loaded()" />
+ <iframe id="two" src="http://example.org/tests/dom/tests/mochitest/general/file_moving_nodeList.html"
+ onload="secondWindow = this.contentWindow; iframe_loaded()" />
+</window>
diff --git a/dom/tests/mochitest/chrome/test_moving_xhr.xhtml b/dom/tests/mochitest/chrome/test_moving_xhr.xhtml
new file mode 100644
index 0000000000..717a0715cc
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_moving_xhr.xhtml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=684115
+-->
+<window title="Mozilla Bug 684115"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=654370"
+ target="_blank">Mozilla Bug 684115</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ var firstWindow, secondWindow;
+ function iframe_loaded() {
+ if (!firstWindow || !secondWindow)
+ return;
+ var xhr = firstWindow.wrappedJSObject.createXHR();
+ ok(("expando" in xhr), "should be able to see expandos on the XHR");
+ is(xhr.readyState, XMLHttpRequest.UNSENT, "can access readyState in chrome");
+ secondWindow.wrappedJSObject.tryToUseXHR(xhr, ok);
+ secondWindow.wrappedJSObject.tryToUseXHR(new XMLHttpRequest(), ok);
+ SimpleTest.finish();
+ }
+
+ ]]></script>
+
+ <iframe id="one" src="http://mochi.test:8888/tests/dom/tests/mochitest/general/file_moving_xhr.html"
+ onload="firstWindow = this.contentWindow; iframe_loaded()" />
+ <iframe id="two" src="http://example.org/tests/dom/tests/mochitest/general/file_moving_xhr.html"
+ onload="secondWindow = this.contentWindow; iframe_loaded()" />
+</window>
diff --git a/dom/tests/mochitest/chrome/test_nodesFromPoint.html b/dom/tests/mochitest/chrome/test_nodesFromPoint.html
new file mode 100644
index 0000000000..30675a41dd
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_nodesFromPoint.html
@@ -0,0 +1,119 @@
+<!doctype html>
+<meta charset="utf-8">
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<style>
+ div { text-align: justify; max-height: 100vh; }
+</style>
+<div id="testElement"></div>
+<script>
+
+// TODO(emilio): Upstream to WPT once there's a spec for this and our
+// implementation is not [ChromeOnly].
+
+const testElement = document.getElementById("testElement");
+
+testElement.innerHTML = "X ".repeat(5000);
+
+{
+ const rect = testElement.getBoundingClientRect();
+
+ const node =
+ document.nodeFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+ is(node, testElement.firstChild, "Should return the text node");
+
+ const nodes =
+ document.nodesFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+
+ const expected = [testElement.firstChild, testElement, document.body, document.documentElement];
+ is(nodes.length, expected.length, "Not the amount of expected nodes");
+
+ for (let i = 0; i < nodes.length; ++i)
+ is(nodes[i], expected[i]);
+}
+
+// Make the test slotted, and add some fallback that we'll test later as well.
+{
+ // Work around the sanitizer by building the DOM manually....
+ const slot = document.createElement("slot");
+ slot.innerHTML = "Y ".repeat(5000);
+
+ const wrapper = document.createElement("div");
+ wrapper.appendChild(slot);
+
+ testElement.attachShadow({ mode: "open" }).appendChild(wrapper);
+}
+
+{
+ const rect = testElement.getBoundingClientRect();
+
+ const node =
+ document.nodeFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+ is(node, testElement.firstChild, "Should return the text node");
+
+ const nodes =
+ document.nodesFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+
+ const expected = [testElement.firstChild, testElement, document.body, document.documentElement];
+ is(nodes.length, expected.length, "Not the amount of expected nodes (returned nodes in the shadow?)");
+
+ for (let i = 0; i < nodes.length; ++i)
+ is(nodes[i], expected[i]);
+}
+
+{
+ const rect = testElement.getBoundingClientRect();
+
+ const node =
+ testElement.shadowRoot.nodeFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+ is(node, testElement.shadowRoot.firstChild, "Should return the div wrapping the text node");
+
+ const nodes =
+ testElement.shadowRoot.nodesFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+
+ const expected = [testElement.shadowRoot.firstChild];
+ is(nodes.length, expected.length, "Not the amount of expected nodes (returned nodes outside of the shadow?)");
+
+ for (let i = 0; i < nodes.length; ++i)
+ is(nodes[i], expected[i]);
+}
+
+// Show the fallback.
+testElement.firstChild.remove();
+
+{
+ const rect = testElement.getBoundingClientRect();
+
+ const fallbackText = testElement.shadowRoot.querySelector("slot").firstChild;
+
+ const node =
+ testElement.shadowRoot.nodeFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+ is(node, fallbackText, "Should return the fallback text");
+
+ const nodes =
+ testElement.shadowRoot.nodesFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+
+ const expected = [fallbackText, testElement.shadowRoot.firstChild];
+ is(nodes.length, expected.length, "Not the amount of expected nodes (returned nodes outside of the shadow?)");
+
+ for (let i = 0; i < nodes.length; ++i)
+ is(nodes[i], expected[i]);
+}
+
+// Test the fallback from the document.
+{
+ const rect = testElement.getBoundingClientRect();
+
+ const node =
+ document.nodeFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+ is(node, testElement, "Should return the element, since the fallback text is in the shadow");
+
+ const nodes =
+ document.nodesFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
+
+ const expected = [testElement, document.body, document.documentElement];
+ is(nodes.length, expected.length, "Not the amount of expected nodes (returned nodes inside of the shadow?)");
+
+ for (let i = 0; i < nodes.length; ++i)
+ is(nodes[i], expected[i]);
+}
+</script>
diff --git a/dom/tests/mochitest/chrome/test_nodesFromRect.html b/dom/tests/mochitest/chrome/test_nodesFromRect.html
new file mode 100644
index 0000000000..5f5566c89b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_nodesFromRect.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIDOMWindowUtils::nodesFromRect test - bug 489127</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ function done() {
+ testwindow.close();
+ SimpleTest.finish();
+ }
+ var testwindow = window.open("489127.html", '_new', 'width=600,height=400');
+</script>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/chrome/test_parsingMode.html b/dom/tests/mochitest/chrome/test_parsingMode.html
new file mode 100644
index 0000000000..2966b8f79b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_parsingMode.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>CSSStyleSheet parsingMode test - bug 1230491</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ function sheetText(sheet) {
+ return [...sheet.cssRules].map(r => r.cssText).join();
+ }
+ function run() {
+ const sss = Cc["@mozilla.org/content/style-sheet-service;1"]
+ .getService(Ci.nsIStyleSheetService);
+ const utils = window.windowUtils;
+
+ const userUrl = encodeURI("data:text/css,body { color: seagreen; -moz-window-transform: none }");
+ utils.loadSheetUsingURIString(userUrl, sss.USER_SHEET);
+
+ const agentUrl = encodeURI("data:text/css,body { color: tomato; }");
+ utils.loadSheetUsingURIString(agentUrl, sss.AGENT_SHEET);
+
+ const authorUrl = "chrome://mochikit/content/tests/SimpleTest/test.css";
+
+ let results = [];
+ for (let sheet of InspectorUtils.getAllStyleSheets(document)) {
+ if (sheet.href === agentUrl) {
+ is(sheet.parsingMode, "agent", "agent sheet has expected mode");
+ results[sss.AGENT_SHEET] = 1;
+ } else if (sheet.href === userUrl) {
+ is(sheet.parsingMode, "user", "user sheet has expected mode");
+ is(sheet.cssRules[0].style.length, 2, "Chrome-only properties are parsed in user sheet")
+ results[sss.USER_SHEET] = 1;
+ } else if (sheet.href === authorUrl) {
+ is(sheet.parsingMode, "author", "author sheet has expected mode");
+ results[sss.AUTHOR_SHEET] = 1;
+ } else if (sheet.href === "about:PreferenceStyleSheet") {
+ is(sheet.parsingMode, "agent",
+ "about:PreferenceStyleSheet has agent mode");
+ continue;
+ } else {
+ // Ignore sheets we don't care about.
+ continue;
+ }
+
+ // Check that re-parsing preserves the mode.
+ let mode = sheet.parsingMode;
+ let text = sheetText(sheet);
+ InspectorUtils.parseStyleSheet(sheet, "body { color: chartreuse; }");
+ if (mode == "agent") {
+ is(sheetText(sheet), text,
+ "Reparsing should not have changed a UA sheet");
+ } else {
+ isnot(sheetText(sheet), text,
+ "Reparsing should have changed a non-UA sheet");
+ }
+ is(sheet.parsingMode, mode,
+ "check that re-parsing preserved mode " + mode);
+ }
+
+ ok(results[sss.AGENT_SHEET] && results[sss.USER_SHEET] &&
+ results[sss.AUTHOR_SHEET],
+ "all sheets seen");
+
+ SimpleTest.finish();
+ }
+</script>
+</head>
+<body onload="run()">
+ <div> What? </div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/test_popup_blocker_chrome.xhtml b/dom/tests/mochitest/chrome/test_popup_blocker_chrome.xhtml
new file mode 100644
index 0000000000..1c00815aa6
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_popup_blocker_chrome.xhtml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=662519
+-->
+<window title="Mozilla Bug 662519"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=662519"
+ target="_blank">Mozilla Bug 662519</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 662519 **/
+
+ let w = null;
+
+ let steps = [
+ function() {
+ w = window.open("file_popup_blocker_chrome.html", "", "width=200,height=200");
+ ok(w, "The window object shouldn't be null");
+ // next() is called within file_popup_blocker_chrome.html
+ },
+ function() {
+ w.close();
+ ok(true, "The popup appeared");
+ next();
+ },
+ function() {
+ w = window.open("file_popup_blocker_chrome.html", "_blank", "width=200,height=200");
+ ok(w, "The window object shouldn't be null");
+ // next() is called within file_popup_blocker_chrome.html
+ },
+ function() {
+ w.close();
+ ok(true, "The popup appeared");
+ next();
+ },
+ ];
+
+ function next() {
+ if (!steps.length) {
+ SimpleTest.finish();
+ return;
+ }
+ let step = steps.shift();
+ step();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ // We have to enable dom.disable_open_during_load which is disabled
+ // by the test harness.
+ SpecialPowers.pushPrefEnv({'set': [["dom.disable_open_during_load", true]] }, function() {
+ next();
+ });
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_queryCaretRect.html b/dom/tests/mochitest/chrome/test_queryCaretRect.html
new file mode 100644
index 0000000000..fa1b643d23
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_queryCaretRect.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIDOMWindowUtils::sendQueryContentEvent w/QUERY_CARET_RECT test</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ function done() {
+ testwindow.close();
+ SimpleTest.finish();
+ }
+ var isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
+ var testwindow = window.open("queryCaretRect" + (isWindows ? "Win" : "Unix") + ".html",
+ "_new", "width=800,height=800");
+</script>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/test_resize_move_windows.xhtml b/dom/tests/mochitest/chrome/test_resize_move_windows.xhtml
new file mode 100644
index 0000000000..bf44523815
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_resize_move_windows.xhtml
@@ -0,0 +1,249 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=565541
+-->
+<window title="Mozilla Bug 565541"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=565541"
+ target="_blank">Mozilla Bug 565541</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 565541 **/
+ var previousX, previousY, previousWidth, previousHeight;
+
+ function backValues()
+ {
+ previousX = window.top.screenX;
+ previousY = window.top.screenY;
+ previousWidth = window.top.outerWidth;
+ previousHeight = window.top.outerHeight;
+ }
+
+ function restoreValues()
+ {
+ window.top.moveTo(previousX, previousY);
+ window.top.resizeTo(previousWidth, previousHeight);
+ }
+
+ function getNewWidth(aWindow)
+ {
+ return (aWindow.innerWidth > (screen.width / 2)) ? 100 : screen.width;
+ }
+
+ function getNewHeight(aWindow)
+ {
+ return (aWindow.innerHeight > (screen.height / 2)) ? 100 : screen.height;
+ }
+
+ function getNewX(aWindow)
+ {
+ return (aWindow.screenX > ((screen.width - aWindow.outerWidth) / 2))
+ ? 0 : screen.width - aWindow.outerWidth;
+ }
+
+ function getNewY(aWindow)
+ {
+ return (aWindow.screenY > ((screen.height - aWindow.outerHeight) / 2))
+ ? 0 : screen.height - aWindow.outerHeight;
+ }
+
+ /**
+ * hitEventLoop is called when we want to check something but we can't rely on
+ * an event or a specific number of event loop hiting.
+ * This method can be called by specifying a condition, a test (using SimpleTest
+ * API), how many times the event loop has to be hitten and what to call next.
+ * If times < 0, the event loop will be hitten as long as the condition isn't
+ * true or the test doesn't time out.
+ */
+ function hitEventLoop(condition, test, times, next) {
+ if (condition() || times == 0) {
+ test();
+ next();
+ return;
+ }
+
+ setTimeout(hitEventLoop, 0, condition, test, times - 1, next);
+ }
+
+ function checkChangeIsEnabled(aWindow, aNext)
+ {
+ // Something should happen. We are not going to go to the next test until
+ // it does.
+ var hits = -1;
+
+ var prevWidth;
+ var prevHeight;
+
+ var prevX;
+ var prevY;
+
+ var oWidth;
+ var oHeight;
+
+ function sizeChangeCondition() {
+ return aWindow.innerWidth != prevWidth && aWindow.innerHeight != prevHeight;
+ }
+
+ function sizeChangeTest() {
+ isnot(aWindow.innerWidth, prevWidth, "Window width should have changed");
+ isnot(aWindow.innerHeight, prevHeight, "Window height should have changed");
+
+ prevWidth = aWindow.innerWidth;
+ prevHeight = aWindow.innerHeight;
+ }
+
+ function posChangeCondition() {
+ // With GTK, sometimes, only one dimension changes.
+ if (navigator.platform.includes('Linux')) {
+ return aWindow.screenX != prevX || aWindow.screenY != prevY;
+ }
+ return aWindow.screenX != prevX && aWindow.screenY != prevY;
+ }
+
+ function posChangeConditionIgnoreLinux() {
+ if (posChangeCondition()) {
+ return true;
+ }
+
+ if (navigator.platform.includes('Linux')) {
+ return true;
+ }
+ }
+
+ function posChangeTest() {
+ // With GTK, sometimes, only one dimension changes.
+ if (navigator.platform.includes('Linux')) {
+ // With GTK, sometimes, aWindow.screenX changes during two calls.
+ // So we call it once and save the returned value.
+ var x = aWindow.screenX;
+ var y = aWindow.screenY;
+ if (x != prevX) {
+ isnot(x, prevX, "Window x position should have changed");
+ }
+ if (y != prevY) {
+ isnot(y, prevY, "Window y position should have changed");
+ }
+ } else {
+ isnot(aWindow.screenX, prevX, "Window x position should have changed");
+ isnot(aWindow.screenY, prevY, "Window y position should have changed");
+ }
+
+ prevX = aWindow.screenX;
+ prevY = aWindow.screenY;
+ }
+
+ function outerChangeCondition() {
+ return aWindow.outerWidth != oWidth && aWindow.outerHeight != oHeight;
+ }
+
+ function outerChangeTest() {
+ isnot(aWindow.outerWidth, oWidth, "Window outerWidth should have changed");
+ isnot(aWindow.outerHeight, oHeight, "Window outerHeight should have changed");
+
+ aWindow.resizeTo(oWidth, oHeight);
+ }
+
+ /**
+ * Size checks.
+ */
+ prevWidth = aWindow.innerWidth;
+ prevHeight = aWindow.innerHeight;
+
+ aWindow.resizeTo(getNewWidth(aWindow), getNewHeight(aWindow));
+ hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
+ aWindow.resizeBy(getNewWidth(aWindow) - aWindow.innerWidth,
+ getNewHeight(aWindow) - aWindow.innerHeight);
+
+ hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
+ prevWidth = aWindow.innerWidth;
+ prevHeight = aWindow.innerHeight;
+ aWindow.sizeToContent();
+
+ hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
+ /**
+ * Position checks.
+ */
+ prevX = aWindow.screenX;
+ prevY = aWindow.screenY;
+
+ aWindow.moveBy(getNewX(aWindow) - aWindow.screenX,
+ getNewY(aWindow) - aWindow.screenY);
+
+ hitEventLoop(posChangeConditionIgnoreLinux, posChangeTest, hits, function () {
+ /**
+ * Outer width/height checks.
+ */
+ oWidth = aWindow.outerWidth;
+ oHeight = aWindow.outerHeight;
+
+ aWindow.resizeTo(oWidth * 2, oHeight* 2);
+
+ hitEventLoop(outerChangeCondition, outerChangeTest, hits, aNext);
+ });
+ });
+ });
+ });
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ function test() {
+ SimpleTest.waitForFocus(function() {
+ if (screen.width <= 200 || screen.height <= 200) {
+ todo(false, "The screen is too small to run this test.");
+ SimpleTest.finish();
+ return;
+ }
+
+ backValues();
+
+ // We are in a chrome context, we can change the size and position.
+ checkChangeIsEnabled(window.top, async function() {
+ // We create a window and check that the size and position can be set with
+ // window.open parameters and can be changed by the created window.
+ var w = window.open("file_resize_move_windows_1.html", '',
+ 'width=170,height=170,screenX=25,screenY=25');
+
+ await SimpleTest.promiseWaitForCondition(() => w.document.readyState == "complete");
+ SimpleTest.waitForFocus(function() {
+ w.wrappedJSObject.ok = SimpleTest.ok;
+ w.wrappedJSObject.check();
+ // The current window can change the size and position of the created one.
+ checkChangeIsEnabled(w, async function() {
+ w.close();
+ // If we call window.open with an empty string as a third parameter,
+ // by default, it will create a new tab instead of a new window.
+ // In a chrome context, the size and position can change.
+ w = window.open("file_resize_move_windows_2.html", '', '');
+ await SimpleTest.promiseWaitForCondition(() => w.document.readyState == "complete");
+ SimpleTest.waitForFocus(function() {
+ // The current window can change the size and position of the new tab.
+ // Because we are in a chrome context.
+ checkChangeIsEnabled(w, function() {
+ w.close();
+ restoreValues();
+ SimpleTest.finish();
+ });
+ }, w, false);
+ });
+ }, w, false);
+ });
+ });
+ }
+
+ addLoadEvent(function onLoad() {
+ test();
+ });
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_sandbox_bindings.xhtml b/dom/tests/mochitest/chrome/test_sandbox_bindings.xhtml
new file mode 100644
index 0000000000..e7d80f75af
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sandbox_bindings.xhtml
@@ -0,0 +1,317 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=741267
+-->
+<window title="Mozilla Bug 741267"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript">
+
+
+</script>
+ <iframe id="t"></iframe>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741267"
+ target="_blank">Mozilla Bug 741267</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 741267 **/
+ function isXrayWrapper(x) {
+ return Cu.isXrayWrapper(x);
+ }
+
+ function doTest() {
+ var win = $("t").contentWindow;
+ ok(isXrayWrapper(win),
+ "We want to be testing things with an Xray as sandboxPrototype here");
+
+ var sandbox = Cu.Sandbox(win, { sandboxPrototype: win });
+
+ is(sandbox._content, undefined, "_content does nothing over Xray");
+
+ try {
+ var css = Cu.evalInSandbox("CSSStyleDeclaration", sandbox);
+ is(String(css.prototype), "[object CSSStyleDeclaration]",
+ "'CSSStyleDeclaration.prototype' in a sandbox should return the CSSStyleDeclaration interface prototype object");
+ } catch (e) {
+ ok(false, "'CSSStyleDeclaration' shouldn't throw in a sandbox");
+ }
+ try {
+ var et = Cu.evalInSandbox("EventTarget", sandbox);
+ ok(et, "'EventTarget' in a sandbox should return the EventTarget interface object");
+ ok(isXrayWrapper(et), "Getting an interface object on an Xray wrapper should return an Xray wrapper");
+ } catch (e) {
+ ok(false, "'EventTarget' shouldn't throw in a sandbox");
+ }
+ try {
+ var xhr = Cu.evalInSandbox("XMLHttpRequest.prototype", sandbox);
+ ok(xhr, "'XMLHttpRequest.prototype' in a sandbox should return the XMLHttpRequest interface prototype object");
+ ok(isXrayWrapper(xhr), "Getting an interface prototype object on an Xray wrapper should return an Xray wrapper");
+ ok(isXrayWrapper(xhr.constructor), "Getting the constructor property on an Xray wrapper of an interface prototype object should return an Xray wrapper");
+ isnot(Object.getOwnPropertyDescriptor(xhr, "send"), undefined,
+ "We should claim to have a send() method");
+ isnot(Object.keys(xhr).indexOf("responseType"), -1,
+ "We should claim to have a responseType property");
+ isnot(Object.getOwnPropertyNames(xhr).indexOf("open"), -1,
+ "We should claim to have an open() method");
+ isnot(Object.getOwnPropertyDescriptor(xhr, "constructor"), undefined,
+ "We should claim to have a 'constructor' property");
+ } catch (e) {
+ ok(false, "'XMLHttpRequest.prototype' shouldn't throw in a sandbox");
+ }
+ try {
+ var img = Cu.evalInSandbox("Image.prototype", sandbox);
+ ok(img, "'Image.prototype' in a sandbox should return the interface prototype object");
+ ok(isXrayWrapper(img), "Getting an interface prototype object on an Xray wrapper should return an Xray wrapper");
+ } catch (e) {
+ ok(false, "'Image.prototype' shouldn't throw in a sandbox");
+ }
+ try {
+ var xhr = Cu.evalInSandbox("XMLHttpRequest", sandbox);
+ xhr.prototype = "notok";
+ } finally {
+ isnot(xhr.prototype, "notok", "'XMLHttpRequest.prototype' should be readonly");
+ }
+ var constructorWritable = false;
+ try {
+ var xhr = Cu.evalInSandbox("XMLHttpRequest.prototype", sandbox);
+ xhr.constructor = "ok";
+ is(xhr.constructor, "ok", "'XMLHttpRequest.prototype.constructor' should be writeable");
+ } catch (e) {
+ ok(false, "'XMLHttpRequest.prototype.constructor' should be writeable");
+ }
+ try {
+ var xhr = Cu.evalInSandbox("XMLHttpRequest", sandbox);
+ is(String(xhr), String(XMLHttpRequest), "'XMLHttpRequest' in a sandbox should return the XMLHttpRequest interface object");
+ ok(isXrayWrapper(xhr.prototype), "Getting the prototype property on an Xray wrapper of an interface object should return an Xray wrapper");
+ isnot(Object.getOwnPropertyDescriptor(xhr, "UNSENT"), undefined,
+ "We should claim to have an UNSENT constant");
+ isnot(Object.keys(xhr).indexOf("OPENED"), -1,
+ "We should claim to have an OPENED constant");
+ isnot(Object.getOwnPropertyNames(xhr).indexOf("DONE"), -1,
+ "We should claim to have a DONE constant");
+ isnot(Object.getOwnPropertyDescriptor(xhr, "prototype"), undefined,
+ "We should claim to have 'prototype' property");
+ } catch (e) {
+ ok(false, "'XMLHttpRequest' shouldn't throw in a sandbox");
+ }
+ try {
+ var xhr = Cu.evalInSandbox("new XMLHttpRequest()", sandbox);
+ is("" + xhr, new XMLHttpRequest() + "", "'new XMLHttpRequest()' in a sandbox should create an XMLHttpRequest object");
+ } catch (e) {
+ ok(false, "'new XMLHttpRequest()' shouldn't throw in a sandbox (1)");
+ }
+ try {
+ var xhr = Cu.evalInSandbox("XMLHttpRequest.toString = function () { return 'Failed'; }; XMLHttpRequest;", sandbox);
+ is(xhr.toString(), XMLHttpRequest + "", "XMLHttpRequest.toString in the sandbox should not override the native toString behaviour");
+ } catch (e) {
+ ok(false, "'XMLHttpRequest' shouldn't throw in a sandbox");
+ }
+ try {
+ var xhr = Cu.evalInSandbox("XMLHttpRequest.prototype.toString = function () { return 'Failed'; }; new XMLHttpRequest();", sandbox);
+ is(xhr.toString(), new XMLHttpRequest() + "", "XMLHttpRequest.prototype.toString in the sandbox should not override the native toString behaviour");
+ } catch (e) {
+ ok(false, "'new XMLHttpRequest()' shouldn't throw in a sandbox (2)");
+ }
+
+ try {
+ // have to run this test before document.defaultView.XMLHttpRequest
+ // gets munged in the sandbox.
+ var proto = Cu.evalInSandbox("XMLHttpRequest.prototype", sandbox);
+ props = [];
+ for (var i in proto) {
+ props.push(i);
+ }
+ isnot(props.indexOf("dispatchEvent"), -1,
+ "'dispatchEvent' property should be enumerable on XMLHttpRequest.prototype");
+ props = Object.getOwnPropertyNames(proto);
+ is(props.indexOf("dispatchEvent"), -1,
+ "'dispatchEvent' is not an own property on XMLHttpRequest.prototype; it's on EventTarget.prototype")
+ } catch (e) {
+ ok(false, "XMLHttpRequest.prototype manipulation via an Xray shouldn't throw" + e);
+ }
+ try {
+ Cu.evalInSandbox("XMLHttpRequest.prototype.a = 'expando a'", sandbox);
+ Cu.evalInSandbox("XMLHttpRequest.prototype.b = 'expando b'", sandbox);
+ Cu.evalInSandbox("XMLHttpRequest.prototype", sandbox).b = 'xrayexpando';
+ var xhr = Cu.evalInSandbox("new XMLHttpRequest()", sandbox);
+ is(xhr.a, undefined, "'XMLHttpRequest()' in a sandbox should not have expandos from inside the sandbox");
+ is(xhr.b, "xrayexpando", "'new XMLHttpRequest()' in a sandbox should have Xray expandos");
+ } catch (e) {
+ ok(false, "'new XMLHttpRequest()' shouldn't throw in a sandbox");
+ }
+ try {
+ Cu.evalInSandbox("document.defaultView.XMLHttpRequest = function() {};", sandbox);
+ var win = Cu.evalInSandbox("document.defaultView", sandbox);
+ var xhr = new win.XMLHttpRequest();
+ is("" + xhr, new XMLHttpRequest() + "", "'new XMLHttpRequest()' in a sandbox should create an XMLHttpRequest object");
+ } catch (e) {
+ ok(false, "'new XMLHttpRequest()' shouldn't throw in a sandbox");
+ }
+ try {
+ var canvas = Cu.evalInSandbox("document.createElement('canvas').getContext('2d')", sandbox);
+ is(canvas.DRAWWINDOW_DRAW_CARET, CanvasRenderingContext2D.DRAWWINDOW_DRAW_CARET, "Constants should be defined on DOM objects in a sandbox");
+ } catch (e) {
+ ok(false, "'document.createElement('canvas').getContext('2D')' shouldn't throw in a sandbox");
+ }
+ try {
+ var classList = Cu.evalInSandbox("document.body.className = 'a b'; document.body.classList", sandbox);
+ is(classList.toString(), "a b", "Stringifier should be called");
+ } catch (e) {
+ ok(false, "Stringifying shouldn't throw in a sandbox");
+ }
+ try {
+ var ctx = Cu.evalInSandbox("var ctx = document.createElement('canvas').getContext('2d'); ctx.foopy = 5; ctx", sandbox);
+ ok(!("foopy" in ctx), "We should have an Xray here");
+ var data = ctx.createImageData(1, 1);
+ for (var i = 0; i < data.data.length; ++i) {
+ // Watch out for premultiplied bits... just set all the alphas to 255
+ if (i % 4 == 3) {
+ // Note - We need to waive Xrays here because indexed access on Typed
+ // Arrays is forbidden over Xrays for performance reasons.
+ Cu.waiveXrays(data.data)[i] = 255;
+ } else {
+ Cu.waiveXrays(data.data)[i] = i;
+ }
+ }
+ ctx.putImageData(data, 0, 0);
+ var data2 = ctx.getImageData(0, 0, 1, 1);
+ is(data2.data.length, data.data.length, "Lengths must match");
+ for (i = 0; i < data.data.length; ++i)
+ is(Cu.waiveXrays(data.data)[i], Cu.waiveXrays(data2.data)[i], "Data at " + i + " should match");
+ } catch (e) {
+ ok(false, "Imagedata manipulation via an Xray shouldn't throw " + e);
+ }
+
+ try {
+ var list = Cu.evalInSandbox("document.getElementsByTagName('*')", sandbox);
+ props = [];
+ for (var i in list) {
+ props.push(i);
+ }
+ is(props.indexOf("constructor"), -1,
+ "'constructor' property should not be enumerable on list object");
+ props = Object.getOwnPropertyNames(list);
+ is(props.indexOf("constructor"), -1,
+ "'constructor' property should not be an own property name on list object");
+ } catch (e) {
+ ok(false, "NodeList.prototype manipulation via an Xray shouldn't throw" + e);
+ }
+
+ try {
+ var proto = Cu.evalInSandbox("NodeList.prototype", sandbox);
+ props = [];
+ for (var i in proto) {
+ props.push(i);
+ }
+ is(props.indexOf("constructor"), -1,
+ "'constructor' property should not be enumerable on proto directly");
+ props = Object.getOwnPropertyNames(proto);
+ isnot(props.indexOf("constructor"), -1,
+ "'constructor' property should be an own property name on proto");
+ } catch (e) {
+ ok(false, "NodeList.prototype manipulation via an Xray shouldn't throw" + e);
+ }
+
+ try {
+ var url = Cu.evalInSandbox("URL", sandbox);
+ for (var i in url) {
+ url[i];
+ }
+ isnot(url.createObjectURL, undefined, "Should have a createObjectURL");
+ ok(true, "We didn't crash!");
+ } catch (e) {
+ ok(false, "URL interface object manipulation via an Xray shouldn't throw" + e);
+ }
+
+ try {
+ url.revokeObjectURL("");
+ } catch (e) {
+ // Just testing whether revokeObjectURL crashes us
+ }
+ ok(true, "We didn't crash!");
+
+ // And now tests that don't use a window-associated sandbox
+ sandbox = Cu.Sandbox(win.document.nodePrincipal,
+ { sandboxPrototype: win });
+ try {
+ var ws = Cu.evalInSandbox('var ws = new WebSocket("ws://example.org"); ws', sandbox);
+ // Test that we actually got a WebSocket object, probably
+ ok("bufferedAmount" in ws, "What is this object?");
+ } catch (e) {
+ ok(false, "Should be able to create a WebSocket in a sandbox " + e);
+ }
+ try {
+ var es = Cu.evalInSandbox('var es = new EventSource("about:blank"); es', sandbox);
+ // Test that we actually got a EventSource object, probably
+ is(es.url, "about:blank", "What is this object?");
+ } catch (e) {
+ ok(false, "Should be able to create an EventSource in a sandbox " + e);
+ }
+
+ try {
+ var nodeFilterIface = Cu.evalInSandbox(
+ 'NodeFilter.myExpando = "FAIL"; NodeFilter', sandbox);
+ is(nodeFilterIface.myExpando, undefined,
+ "Should have Xrays for callback interface objects");
+ } catch (e) {
+ ok(false, "Should be able to return NodeFilter from a sandbox " + e);
+ }
+
+ try {
+ var eventCtor = Cu.evalInSandbox("Event", sandbox);
+ var e = new eventCtor("test", { bubbles: true });
+ is(e.bubbles, true, "Dictionary argument should work");
+ } catch (e) {
+ ok(false, "Should be able to construct my event " + e);
+ }
+
+ try {
+ var elem = Cu.evalInSandbox('document.createElement("p")', sandbox);
+ elem.expando = 5;
+ elem.expando = 7;
+ is(elem.expando, 7, "Should be able to set expandos on Xrays for DOM bindings");
+ var doc = Cu.evalInSandbox('document', sandbox);
+ doc.expando = 5;
+ doc.expando = 7;
+ is(doc.expando, 7, "Should be able to set expandos on Xrays for DOM bindings with named properties");
+ } catch (e) {
+ ok(false, "Setting expandos on Xrays shouldn't throw " + e);
+ }
+
+ // Test that binding a bareword window method produces something
+ // which has a .call
+ try {
+ var binary = Cu.evalInSandbox(
+ 'btoa.bind(window).call(null, "foo")', sandbox);
+ is(binary, "Zm9v", "Should get the right result from .call on bound btoa");
+ } catch (e) {
+ ok(false, ".call on bound btoa shouldn't throw " + e);
+ }
+
+ // Test that binding a bareword window method produces something
+ // which has a .apply
+ try {
+ var binary = Cu.evalInSandbox(
+ 'btoa.bind(window).apply(null, ["foo"])', sandbox);
+ is(binary, "Zm9v", "Should get the right result from .apply on bound btoa");
+ } catch (e) {
+ ok(false, ".apply on bound btoa shouldn't throw " + e);
+ }
+
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(doTest);
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_sandbox_eventhandler.xhtml b/dom/tests/mochitest/chrome/test_sandbox_eventhandler.xhtml
new file mode 100644
index 0000000000..3c870a6f18
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sandbox_eventhandler.xhtml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=817284
+-->
+<window title="Mozilla Bug 817284"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=817284"
+ target="_blank">Mozilla Bug 817284</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 817284 **/
+ var sb = Cu.Sandbox("http://example.com", { wantGlobalProperties: ["XMLHttpRequest"] });
+
+ // Test event handler calls
+ var xhr = Cu.evalInSandbox(
+ 'var xhr = new XMLHttpRequest();\
+ var called = false;\
+ xhr.onload = function() { called = true; };\
+ xhr', sb);
+
+ var e = document.createEvent("Events");
+ e.initEvent("load", false, false);
+ xhr.dispatchEvent(e);
+ is(Cu.evalInSandbox('called', sb), true, "Event handler should have been called");
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_sandbox_image.xhtml b/dom/tests/mochitest/chrome/test_sandbox_image.xhtml
new file mode 100644
index 0000000000..a922a7472d
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sandbox_image.xhtml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=616397
+-->
+<window title="Mozilla Bug 616397"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <iframe id="t"></iframe>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=616397"
+ target="_blank">Mozilla Bug 616397</a>
+ </body>
+
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 616397 **/
+ function doTest() {
+ var win = $("t").contentWindow;
+ var sandbox = Cu.Sandbox(win, { sandboxPrototype: win });
+ var result = Cu.evalInSandbox("new Image()", sandbox);
+ isnot(result, null, "Should have an image");
+ is(result.tagName, "IMG", "Should have the right tag name");
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(doTest);
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_sandbox_postMessage.html b/dom/tests/mochitest/chrome/test_sandbox_postMessage.html
new file mode 100644
index 0000000000..1e2dc4fa5c
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sandbox_postMessage.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Testing postMessage from sandbox</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ function doTest() {
+ var sandbox = Cu.Sandbox("http://mochi.test:8888/", { wantXrays: true });
+ var win = window.frames.sameDomain;
+ sandbox.win = win;
+ sandbox.is = is;
+ sandbox.done = SimpleTest.finish;
+
+ result = Cu.evalInSandbox('var data = {some:"data"};'
+ +'win.addEventListener("message", receiveMessage, false);'
+ +'function receiveMessage(event)'
+ +'{'
+ +' is(JSON.stringify(event.data), JSON.stringify(data), "Received the expected message data");'
+ +' done();'
+ +'}'
+ +'win.postMessage(data, "*")'
+ , sandbox);
+ }
+
+ addLoadEvent(doTest);
+</script>
+</head>
+<body>
+<iframe src="http://mochi.test:8888/"
+ id="sameDomain" name="sameDomain">
+</iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/chrome/test_selectAtPoint.html b/dom/tests/mochitest/chrome/test_selectAtPoint.html
new file mode 100644
index 0000000000..a4865b5125
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_selectAtPoint.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIDOMWindowUtils::selectAtPoint test</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ function done() {
+ testwindow.close();
+ SimpleTest.finish();
+ }
+ var testwindow = window.open("selectAtPoint.html", '_new', 'width=800,height=800');
+</script>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/chrome/test_sizemode_attribute.xhtml b/dom/tests/mochitest/chrome/test_sizemode_attribute.xhtml
new file mode 100644
index 0000000000..58685531c5
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sizemode_attribute.xhtml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ Test for the sizemode attribute
+ -->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ sizemode="fullscreen">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+
+newwindow = window.browsingContext.topChromeWindow.openDialog("sizemode_attribute.xhtml", "_blank","chrome,resizable=yes", window);
+
+function done() {
+ newwindow.close();
+ SimpleTest.finish();
+}
+
+</script>
+<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px;"/>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_subscript_bindings.xhtml b/dom/tests/mochitest/chrome/test_subscript_bindings.xhtml
new file mode 100644
index 0000000000..2bb09c1167
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_subscript_bindings.xhtml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=741267
+-->
+<window title="Mozilla Bug 741267"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <iframe id="t"></iframe>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741267"
+ target="_blank">Mozilla Bug 741267</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 741267 **/
+ function doTest() {
+ // Resolve XMLHttpRequest on the chrome global
+ new XMLHttpRequest();
+
+ var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
+ var context = { window: $("t").contentWindow };
+ var thrown = false;
+ try {
+ loader.loadSubScript(/.*\//.exec(window.location.href)[0] + "file_subscript_bindings.js", context);
+ } catch (e) {
+ thrown = true;
+ }
+ ok(!thrown, "'new window.XMLHttpRequest()' in a subscript shouldn't throw");
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(doTest);
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_window_getRegionalPrefsLocales.html b/dom/tests/mochitest/chrome/test_window_getRegionalPrefsLocales.html
new file mode 100644
index 0000000000..581169e67b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_window_getRegionalPrefsLocales.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1337234
+-->
+<head>
+ <title>Test for Bug 1337234</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1337234">Mozilla Bug 1337234</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<script>
+
+const localeService =
+ Cc["@mozilla.org/intl/localeservice;1"].getService(Ci.mozILocaleService);
+
+let rpLocales = localeService.negotiateLanguages(window.getRegionalPrefsLocales(),
+ localeService.availableLocales);
+
+ok(rpLocales.length, "getRegionalPrefsLocales returns at least one locale.");
+is(rpLocales[0], "en-US", "The first regional prefs locale should resolve to en-US.");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/test_xray_event_constructor.xhtml b/dom/tests/mochitest/chrome/test_xray_event_constructor.xhtml
new file mode 100644
index 0000000000..c26bfa56a6
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_xray_event_constructor.xhtml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=861493
+-->
+<window title="Mozilla Bug 861493"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <iframe id="t" type="content"></iframe>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=861493"
+ target="_blank">Mozilla Bug 861493</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 861493 **/
+ SimpleTest.waitForExplicitFinish();
+
+ addLoadEvent(function() {
+ ok(Cu.isXrayWrapper($("t").contentWindow),
+ "Should have xray");
+ var e = new ($("t").contentWindow).Event("test", { bubbles: true });
+ is(e.bubbles, true, "Dictionary should have worked");
+ SimpleTest.finish();
+ })
+
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/window_activation.xhtml b/dom/tests/mochitest/chrome/window_activation.xhtml
new file mode 100644
index 0000000000..c1cbd4791e
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_activation.xhtml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="data:text/css,
+
+%23box {
+ background: blue;
+}
+
+%23box:-moz-window-inactive {
+ background: cyan;
+}
+
+" type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<box id="box" height="100"/>
+
+<script type="application/javascript"><![CDATA[
+
+var ok = window.arguments[0].ok;
+var complete = window.arguments[0].complete;
+var openerDoc = window.arguments[0].document;
+var SimpleTest = window.arguments[0].SimpleTest;
+
+SimpleTest.waitForFocus(function () {
+ ok(getComputedStyle(document.getElementById("box"), "").backgroundColor, "rgb(0, 0, 255)");
+ ok(getComputedStyle(openerDoc.getElementById("box"), "").backgroundColor, "rgb(0, 255, 255)");
+ window.arguments[0].focus();
+ ok(getComputedStyle(document.getElementById("box"), "").backgroundColor, "rgb(0, 255, 255)");
+ ok(getComputedStyle(openerDoc.getElementById("box"), "").backgroundColor, "rgb(0, 0, 255)");
+ complete();
+}, window);
+
+]]></script>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/window_callback_wrapping.xhtml b/dom/tests/mochitest/chrome/window_callback_wrapping.xhtml
new file mode 100644
index 0000000000..6bb8176570
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_callback_wrapping.xhtml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <browser type="content"
+ src="data:text/html,&lt;script&gt;var x = new XMLHttpRequest(); x.onreadystatechange = function() {}&lt;/script&gt;"/>
+
+ <script type="application/javascript"><![CDATA[
+ window.onload = function() {
+ var z = new XPCNativeWrapper(window.frames[0].wrappedJSObject.x).onreadystatechange;
+ var t = window.opener.SimpleTest;
+ t.ok(true, "Hey, we didn't crash");
+ window.close();
+ t.finish();
+ }
+ ]]>
+</script>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/window_docshell_swap.xhtml b/dom/tests/mochitest/chrome/window_docshell_swap.xhtml
new file mode 100644
index 0000000000..3b849b64c8
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_docshell_swap.xhtml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<browser type="content" src="about:blank" id="browser"/>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/window_focus.xhtml b/dom/tests/mochitest/chrome/window_focus.xhtml
new file mode 100644
index 0000000000..a2a1b5a2c3
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_focus.xhtml
@@ -0,0 +1,1699 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+<!--
+ This test checks focus in various ways
+-->
+<window id="outer-document" title="Focus Test" width="600" height="550"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<body xmlns="http://www.w3.org/1999/xhtml"/>
+
+ <script type="application/javascript"><![CDATA[
+
+const { BrowserTestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/BrowserTestUtils.sys.mjs"
+);
+const { ContentTask } = ChromeUtils.import(
+ "resource://testing-common/ContentTask.jsm"
+);
+
+var fm = Cc["@mozilla.org/focus-manager;1"].
+ getService(Ci.nsIFocusManager);
+
+const kChildDocumentRootIndex = 13;
+const kBeforeTabboxIndex = 34;
+const kTabbableSteps = 38;
+const kFocusSteps = 26;
+const kNoFocusSteps = 7;
+const kOverflowElementIndex = 27;
+
+var gTestStarted = false;
+var gPartialTabbing = false;
+var gMoveToFocusFrame = false;
+var gLastFocus = null;
+var gLastFocusWindow = window;
+var gLastFocusMethod = -1;
+var gEvents = "";
+var gExpectedEvents = "";
+var gEventMatched = true;
+var gShowOutput = false;
+var gChildWindow = null;
+
+var gOldExpectedWindow = null;
+var gNewExpectedWindow = null;
+
+function is(l, r, n) { window.arguments[0].SimpleTest.is(l,r,n); }
+function ok(v, n) { window.arguments[0].SimpleTest.ok(v,n); }
+
+function initEvents(target)
+{
+ target.addEventListener("focus", eventOccured, true);
+ target.addEventListener("blur", eventOccured, true);
+ getTopWindow(target).addEventListener("activate", eventOccured, true);
+ getTopWindow(target).addEventListener("deactivate", eventOccured, true);
+}
+
+function eventOccured(event)
+{
+ // iframes should never receive focus or blur events directly
+ if (Element.isInstance(event.target) && event.target.localName == "iframe")
+ ok(false, "iframe " + event.type + "occured");
+
+ var id;
+ if (gOldExpectedWindow && event.type == "blur") {
+ if (Window.isInstance(event.target))
+ id = "frame-" + gOldExpectedWindow.document.documentElement.id + "-window";
+ else if (Document.isInstance(event.target))
+ id = "frame-" + gOldExpectedWindow.document.documentElement.id + "-document";
+ else
+ id = event.originalTarget.id;
+ }
+ else if (gNewExpectedWindow && event.type == "focus") {
+ if (Window.isInstance(event.target))
+ id = "frame-" + gNewExpectedWindow.document.documentElement.id + "-window";
+ else if (Document.isInstance(event.target))
+ id = "frame-" + gNewExpectedWindow.document.documentElement.id + "-document";
+ else
+ id = event.originalTarget.id;
+ }
+ else if (event.type == "activate" || event.type == "deactivate")
+ id = event.target.document.documentElement.id + "-window";
+ else if (Window.isInstance(event.target))
+ id = (event.target == window) ? "outer-window" : "child-window";
+ else if (Document.isInstance(event.target))
+ id = (event.target == document) ? "outer-document" : "child-document";
+ else
+ id = event.originalTarget.id;
+
+ if (gEvents)
+ gEvents += " ";
+ gEvents += event.type + ": " + id;
+}
+
+function expectFocusShift(callback, expectedWindow, expectedElement, focusChanged, testid)
+{
+ if (expectedWindow == null)
+ expectedWindow = expectedElement ?
+ expectedElement.ownerGlobal :
+ gLastFocusWindow;
+
+ var expectedEvents = "";
+ if (focusChanged) {
+ var id;
+ if (getTopWindow(gLastFocusWindow) != getTopWindow(expectedWindow)) {
+ id = getTopWindow(gLastFocusWindow).document.documentElement.id;
+ expectedEvents += "deactivate: " + id + "-window";
+ }
+
+ if (gLastFocus && gLastFocus.id != "t" + kChildDocumentRootIndex &&
+ (!gOldExpectedWindow || gOldExpectedWindow.document.documentElement != gLastFocus)) {
+ if (expectedEvents)
+ expectedEvents += " ";
+ if (!gOldExpectedWindow)
+ expectedEvents += "commandupdate: cu ";
+ expectedEvents += "blur: " + gLastFocus.id;
+ }
+
+ if (gLastFocusWindow && gLastFocusWindow != expectedWindow) {
+ if (!gMoveToFocusFrame) {
+ if (gOldExpectedWindow)
+ id = "frame-" + gOldExpectedWindow.document.documentElement.id;
+ else
+ id = (gLastFocusWindow == window) ? "outer" : "child";
+ if (expectedEvents)
+ expectedEvents += " ";
+ expectedEvents += "blur: " + id + "-document " +
+ "blur: " + id + "-window";
+ }
+ }
+
+ if (getTopWindow(gLastFocusWindow) != getTopWindow(expectedWindow)) {
+ id = getTopWindow(expectedWindow).document.documentElement.id;
+ if (expectedEvents)
+ expectedEvents += " ";
+ expectedEvents += "activate: " + id + "-window";
+ }
+
+ if (expectedWindow && gLastFocusWindow != expectedWindow) {
+ if (gNewExpectedWindow)
+ id = "frame-" + gNewExpectedWindow.document.documentElement.id;
+ else
+ id = (expectedWindow == window) ? "outer" : "child";
+ if (expectedEvents)
+ expectedEvents += " ";
+ expectedEvents += "focus: " + id + "-document " +
+ "focus: " + id + "-window";
+ }
+
+ // for this test which fires a mouse event on a label, the document will
+ // be focused first and then the label code will focus the related
+ // control. This doesn't result in different focus events, but a command
+ // update will occur for the document and then a second command update will
+ // occur when the control is focused. However, this will only happen on
+ // platforms or controls where mouse clicks cause trigger focus.
+ if (testid == "mouse on html label with content inside" &&
+ mouseWillTriggerFocus(expectedElement)) {
+ expectedEvents += " commandupdate: cu";
+ }
+
+ if (expectedElement &&
+ (!gNewExpectedWindow || gNewExpectedWindow.document.documentElement != expectedElement)) {
+ if (!gNewExpectedWindow) {
+ if (expectedEvents)
+ expectedEvents += " ";
+ expectedEvents += "commandupdate: cu";
+ }
+ if (expectedElement.id != "t" + kChildDocumentRootIndex) {
+ if (expectedEvents)
+ expectedEvents += " ";
+ expectedEvents += "focus: " + expectedElement.id;
+ }
+ }
+ else if (expectedWindow && gLastFocusWindow != expectedWindow &&
+ !expectedElement) {
+ if (expectedEvents)
+ expectedEvents += " ";
+ expectedEvents += "commandupdate: cu";
+ }
+ }
+
+ gLastFocus = expectedElement;
+ gLastFocusWindow = expectedWindow;
+
+ callback();
+
+ compareEvents(expectedEvents, expectedWindow, expectedElement, testid);
+}
+
+function compareEvents(expectedEvents, expectedWindow, expectedElement, testid)
+{
+ if (!gShowOutput) {
+ gEvents = "";
+ return;
+ }
+
+ is(gEvents, expectedEvents, testid + " events");
+ gEvents = "";
+
+ var doc;
+ if (expectedWindow == window)
+ doc = "outer-document";
+ else if (expectedWindow == gChildWindow)
+ doc = "inner-document";
+ else if (gNewExpectedWindow)
+ doc = gNewExpectedWindow.document.body ? gNewExpectedWindow.document.body.id :
+ gNewExpectedWindow.document.documentElement.id;
+ else
+ doc = "other-document";
+
+ var focusedElement = fm.focusedElement;
+ is(focusedElement ? focusedElement.id : "none",
+ expectedElement ? expectedElement.id : "none", testid + " focusedElement");
+ is(fm.focusedWindow, expectedWindow, testid + " focusedWindow");
+ var focusedWindow = {};
+ is(fm.getFocusedElementForWindow(expectedWindow, false, focusedWindow),
+ expectedElement, testid + " getFocusedElementForWindow");
+ is(focusedWindow.value, expectedWindow, testid + " getFocusedElementForWindow frame");
+ is(expectedWindow.document.hasFocus(), true, testid + " hasFocus");
+ is(expectedWindow.document.activeElement ? expectedWindow.document.activeElement.id : "none",
+ expectedElement ? expectedElement.id : doc, testid + " activeElement");
+ var cdwindow = getTopWindow(expectedWindow);
+ if (cdwindow.document.commandDispatcher) {
+ is(cdwindow.document.commandDispatcher.focusedWindow, expectedWindow, testid + " commandDispatcher focusedWindow");
+ is(cdwindow.document.commandDispatcher.focusedElement, focusedElement, testid + " commandDispatcher focusedElement");
+ }
+
+ if (gLastFocusMethod != -1) {
+ is(fm.getLastFocusMethod(null), gLastFocusMethod, testid + " lastFocusMethod null");
+ is(fm.getLastFocusMethod(expectedWindow), gLastFocusMethod, testid + " lastFocusMethod window");
+ }
+
+ // the parent should have the iframe focused
+ if (doc == "inner-document") {
+ is(document.hasFocus(), true, testid + " hasFocus");
+ is(fm.getFocusedElementForWindow(window, false, focusedWindow),
+ $("childframe"), testid + " getFocusedElementForWindow for parent");
+ is(focusedWindow.value, window, testid + " getFocusedElementForWindow for parent frame");
+ is(fm.getFocusedElementForWindow(window, true, focusedWindow),
+ expectedElement, testid + " getFocusedElementForWindow deep for parent");
+ is(focusedWindow.value, gChildWindow, testid + " getFocusedElementForWindow deep for parent frame");
+ is(document.activeElement.id, "childframe", testid + " activeElement for parent");
+ }
+
+ // compare the selection for the child window. Skip mouse tests as the caret
+ // is adjusted by the selection code for mouse clicks, and not the focus code.
+ if (expectedWindow == window) {
+ var selection = window.getSelection();
+ ok(selection.focusNode == null && selection.focusOffset == 0 &&
+ selection.anchorNode == null && selection.anchorOffset == 0, testid + " selection");
+ }
+ else if ((expectedWindow == gChildWindow) && !testid.indexOf("mouse") == -1) {
+ checkSelection(expectedElement, testid);
+ }
+}
+
+function checkSelection(node, testid)
+{
+ var selection = gChildWindow.getSelection();
+
+ var range = gChildWindow.document.createRange();
+ range.selectNodeContents(node);
+ if (!node.firstChild || node.localName == "input" ||
+ node.localName == "select" || node.localName == "button") {
+ range.setStartBefore(node);
+ range.setEndBefore(node);
+ }
+
+ if (node.firstChild)
+ range.setEnd(range.startContainer, range.startOffset);
+
+ is(selection.focusNode, range.startContainer, testid + " selection focusNode");
+ is(selection.focusOffset, range.startOffset, testid + " selection focusOffset");
+ is(selection.anchorNode, range.endContainer, testid + " selection anchorNode");
+ is(selection.anchorOffset, range.endOffset, testid + " selection anchorOffset");
+}
+
+function getTopWindow(win)
+{
+ return win.browsingContext.topChromeWindow;
+}
+
+function mouseWillTriggerFocus(element)
+{
+ if (!element) {
+ return false;
+ }
+
+ if (SpecialPowers.getIntPref("accessibility.mouse_focuses_formcontrol") == 1) {
+ // This is a chrome document, so we'll only trigger focus with the mouse if the value of the pref is 1.
+ return true;
+ }
+
+ if (element.namespaceURI == "http://www.w3.org/1999/xhtml") {
+ // links are special. They can be focused but show no focus ring
+ if (element.localName == "a" || element.localName == "div" ||
+ element.localName == "select" ||
+ element.localName == "input" && (element.type == "text" ||
+ element.type == "password")) {
+ return true;
+ }
+ } else if (element.localName == "richlistbox") {
+ return true;
+ }
+
+ return false;
+}
+
+function mouseOnElement(element, expectedElement, focusChanged, testid)
+{
+ var expectedWindow = (element.ownerGlobal == gChildWindow) ? gChildWindow : window;
+ // on Mac, form elements are not focused when clicking, except for lists and inputs.
+ var noFocusOnMouse = !mouseWillTriggerFocus(element)
+
+ if (noFocusOnMouse) {
+ // no focus so the last focus method will be 0
+ gLastFocusMethod = 0;
+ expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal),
+ expectedWindow, null, true, testid);
+ gLastFocusMethod = fm.FLAG_BYMOUSE;
+ }
+ else {
+ expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal),
+ element.ownerGlobal,
+ expectedElement, focusChanged, testid);
+ }
+}
+
+function done()
+{
+ var opener = window.arguments[0];
+ window.close();
+ window.arguments[0].SimpleTest.finish();
+}
+
+var pressTab = () => synthesizeKey("KEY_Tab");
+
+function setFocusTo(id, fwindow)
+{
+ gLastFocus = getById(id);
+ gLastFocusWindow = fwindow;
+ if (gLastFocus)
+ gLastFocus.focus();
+ else
+ fm.clearFocus(fwindow);
+ gEvents = "";
+}
+
+function getById(id)
+{
+ if (gNewExpectedWindow)
+ return gNewExpectedWindow.document.getElementById(id);
+ var element = $(id);
+ if (!element)
+ element = $("childframe").contentDocument.getElementById(id);
+ return element;
+}
+
+function startTest()
+{
+ if (gTestStarted)
+ return;
+ gTestStarted = true;
+
+ gChildWindow = $("childframe").contentWindow;
+ gShowOutput = true;
+
+ // synthesize a mousemove over the image to ensure that the imagemap data is
+ // created. Otherwise, the special imagemap frames might not exist, and
+ // won't be focusable.
+ synthesizeMouse(getById("image"), 4, 4, { type: "mousemove" }, gChildWindow);
+
+ initEvents(window);
+
+ is(fm.activeWindow, window, "activeWindow");
+ is(gChildWindow.document.hasFocus(), false, " child document hasFocus");
+
+ // test to see if the Mac Full Keyboard Access setting is set. If t3 is
+ // focused after tab is pressed, then it is set to inputs and lists only.
+ // Otherwise, all elements are in the tab order.
+ pressTab();
+
+ if (fm.focusedElement.id == "t3")
+ gPartialTabbing = true;
+ else
+ is(fm.focusedElement.id, "t1", "initial tab key");
+
+ is(fm.getLastFocusMethod(null), fm.FLAG_BYKEY, "last focus method null start");
+ is(fm.getLastFocusMethod(window), fm.FLAG_BYKEY, "last focus method window start");
+
+ fm.clearFocus(window);
+ gEvents = "";
+
+ gLastFocusMethod = fm.FLAG_BYKEY;
+ if (gPartialTabbing) {
+ var partialTabList = ["t3", "t5", "t9", "t10", "t11", "t12", "t13", "t14", "t15",
+ "t16", "t19", "t20", "t21", "t22", "t26", "t27", "t28", "t29", "t30"];
+ for (var idx = 0; idx < partialTabList.length; idx++) {
+ expectFocusShift(pressTab, null, getById(partialTabList[idx]), true, "partial tab key " + partialTabList[idx]);
+ }
+ setFocusTo("last", window);
+ expectFocusShift(pressTab, null, getById(partialTabList[0]), true, "partial tab key wrap to start");
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}),
+ null, getById("last"), true, "partial shift tab key wrap to end");
+ for (var idx = partialTabList.length - 1; idx >= 0; idx--) {
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}),
+ null, getById(partialTabList[idx]), true, "partial tab key " + partialTabList[idx]);
+ }
+ }
+ else {
+ // TAB key
+ for (var idx = 1; idx <= kTabbableSteps; idx++) {
+ expectFocusShift(pressTab, null, getById("t" + idx), true, "tab key t" + idx);
+ }
+
+ // wrapping around at end with TAB key
+ setFocusTo("last", window);
+ expectFocusShift(pressTab, null, getById("t1"), true, "tab key wrap to start");
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}),
+ null, getById("last"), true, "shift tab key wrap to end");
+
+ // Shift+TAB key
+ setFocusTo("o5", window);
+ for (idx = kTabbableSteps; idx > 0; idx--) {
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}),
+ null, getById("t" + idx), true, "shift tab key t" + idx);
+ }
+ }
+
+ var t19 = getById("t19");
+ is(t19.selectionStart, 0, "input focused from tab key selectionStart");
+ is(t19.selectionEnd, 5, "input focused from tab key selectionEnd");
+ t19.setSelectionRange(0, 0);
+
+ gLastFocusMethod = 0;
+ var selectFired = false;
+ function selectListener() { selectFired = true; }
+ t19.addEventListener("select", selectListener, false);
+ expectFocusShift(() => t19.select(),
+ null, getById("t" + 19), true, "input.select()");
+ t19.removeEventListener("select", selectListener, false);
+ ok(!selectFired, "select event does not fire asynchronously for input");
+
+ // mouse clicking
+ gLastFocusMethod = fm.FLAG_BYMOUSE;
+ for (idx = kTabbableSteps; idx >= 1; idx--) {
+ // skip the document root and the overflow element
+ if (idx == kChildDocumentRootIndex || idx == kOverflowElementIndex)
+ continue;
+ if ((navigator.platform.indexOf("Mac") == 0) && (idx == kBeforeTabboxIndex + 1))
+ continue;
+
+ var element = getById("t" + idx);
+ // skip area elements, as getBoundingClientRect doesn't return their actual coordinates
+ if (element.localName == "area")
+ continue;
+
+ mouseOnElement(element, element, true, "mouse on element t" + idx);
+ var expectedWindow = (element.ownerGlobal == gChildWindow) ? gChildWindow : window;
+ if (element.localName == "richlistbox" && expectedWindow == window &&
+ navigator.platform.indexOf("Mac") == 0) {
+ // after focusing a listbox on Mac, clear the focus before continuing.
+ setFocusTo(null, window);
+ }
+ }
+
+ ok(t19.selectionStart == t19.selectionEnd, "input focused from mouse selection");
+
+ // mouse clicking on elements that are not tabbable
+ for (idx = 1; idx <= kFocusSteps; idx++) {
+ var element = getById("o" + (idx % 2 ? idx : idx - 1));
+
+ mouseOnElement(element, element, idx % 2,
+ "mouse on non-tabbable element o" + idx);
+ }
+
+ // mouse clicking on elements that are not tabbable and have user-focus: none
+ // or are not focusable for other reasons (for instance, being disabled)
+ // These elements will clear the focus when clicked.
+ for (idx = 1; idx <= kNoFocusSteps; idx++) {
+ var element = getById("n" + idx);
+ gLastFocusMethod = idx % 2 ? 0 : fm.FLAG_BYMOUSE;
+
+ mouseOnElement(element, idx % 2 ? null: element, true, "mouse on unfocusable element n" + idx);
+ }
+
+ if (idx == kOverflowElementIndex) {
+ gLastFocusMethod = fm.FLAG_BYMOUSE;
+ var element = getById("t" + idx);
+ expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal),
+ window, null, true, "mouse on scrollable element");
+ }
+
+ // focus() method
+ gLastFocusMethod = fm.FLAG_BYJS;
+ for (idx = kTabbableSteps; idx >= 1; idx--) {
+ if ((navigator.platform.indexOf("Mac") == 0) && (idx == kBeforeTabboxIndex + 1))
+ continue;
+ expectFocusShift(() => getById("t" + idx).focus(),
+ null, getById("t" + idx), true, "focus method on element t" + idx);
+ }
+
+ $("t1").focus();
+ ok(gEvents === "", "focusing element that is already focused");
+
+ $("t2").blur();
+ $("t7").blur();
+ ok(gEvents === "", "blurring element that is not focused");
+ is(document.activeElement, $("t1"), "old element still focused after blur() on another element");
+
+ // focus() method on elements that are not tabbable
+ for (idx = 1; idx <= kFocusSteps; idx++) {
+ var expected = getById("o" + (idx % 2 ? idx : idx - 1));
+ expectFocusShift(() => getById("o" + idx).focus(),
+ expected.ownerGlobal,
+ expected, idx % 2, "focus method on non-tabbable element o" + idx);
+ }
+
+ // focus() method on elements that are not tabbable and have user-focus: none
+ // or are not focusable for other reasons (for instance, being disabled)
+ for (idx = 1; idx <= kNoFocusSteps; idx++) {
+ var expected = getById("o" + (idx % 2 ? idx : idx - 1));
+ expectFocusShift(() => getById("o" + idx).focus(),
+ expected.ownerGlobal,
+ expected, idx % 2, "focus method on unfocusable element n" + idx);
+ }
+
+ // the focus() method on the legend element should focus the legend if it is
+ // focusable, or the first element after the legend if it is not focusable.
+ if (!gPartialTabbing) {
+ gLastFocusMethod = fm.FLAG_BYJS;
+ var legend = getById("legend");
+ expectFocusShift(() => legend.focus(),
+ null, getById("t28"), true, "focus method on unfocusable legend");
+ legend.tabIndex = "0";
+ expectFocusShift(() => legend.focus(),
+ null, getById("legend"), true, "focus method on focusable legend");
+ legend.tabIndex = "-1";
+ }
+
+ var accessKeyDetails = (navigator.platform.includes("Mac")) ?
+ { ctrlKey : true } : { altKey : true };
+
+ // test accesskeys
+ var keys = ["t26", "t19", "t22", "t29", "t15", "t17", "n6",
+ "t4", "o1", "o9", "n4"];
+ for (var k = 0; k < keys.length; k++) {
+ var key = String.fromCharCode(65 + k);
+
+ // accesskeys D and G are for labels so get redirected
+ gLastFocusMethod = (key == "D" || key == "G") ? fm.FLAG_BYMOVEFOCUS : fm.FLAG_BYKEY;
+
+ // on Windows and Linux, the shift key must be pressed for content area access keys
+ // and on Mac, the alt key must be pressed for content area access keys
+ var isContent = (getById(keys[k]).ownerGlobal == gChildWindow);
+ if (!navigator.platform.includes("Mac")) {
+ accessKeyDetails.shiftKey = isContent;
+ } else {
+ accessKeyDetails.altKey = isContent;
+ }
+
+ expectFocusShift(() => synthesizeKey(key, accessKeyDetails),
+ null, getById(keys[k]), true, "accesskey " + key);
+ }
+
+ // clicking on the labels
+ gLastFocusMethod = fm.FLAG_BYMOVEFOCUS | fm.FLAG_BYMOUSE;
+ mouseOnElement(getById("ad"), getById("t29"), true, "mouse on html label with content inside");
+ mouseOnElement(getById("ag"), getById("n6"), true, "mouse on html label with for attribute");
+ gLastFocusMethod = fm.FLAG_BYJS;
+ expectFocusShift(() => synthesizeMouse(getById("aj"), 2, 2, { }),
+ null, getById("o9"), true, "mouse on xul label with content inside");
+ expectFocusShift(() => synthesizeMouse(getById("ak"), 2, 2, { }),
+ null, getById("n4"), true, "mouse on xul label with control attribute");
+
+ // test accesskeys that shouldn't work
+ k = "o".charCodeAt(0);
+ gLastFocusMethod = fm.FLAG_BYJS;
+ while (k++ < "v".charCodeAt(0)) {
+ var key = String.fromCharCode(k);
+ expectFocusShift(() => synthesizeKey(key, accessKeyDetails),
+ window, getById("n4"), false, "non accesskey " + key);
+ }
+ gLastFocusMethod = -1;
+
+ // should focus the for element when using the focus method on a label as well
+ expectFocusShift(() => getById("ad").focus(),
+ null, getById("t29"), true, "mouse on html label using focus method");
+
+ // make sure that the text is selected when clicking a label associated with an input
+ getById("ag").htmlFor = "t19";
+ expectFocusShift(() => synthesizeMouse(getById("ag"), 2, 2, { }, gChildWindow),
+ null, getById("t19"), true, "mouse on html label with for attribute changed");
+ is(t19.selectionStart, 0, "input focused from label, selectionStart");
+ is(t19.selectionEnd, 5, "input focused from label, selectionEnd");
+
+ // switch to another panel in a tabbox and ensure that tabbing moves between
+ // elements on the new panel.
+ $("tabbox").selectedIndex = 1;
+ expectFocusShift(() => getById("t" + kBeforeTabboxIndex).focus(),
+ null, getById("t" + kBeforeTabboxIndex), true, "focus method on element before tabbox");
+
+ if (!gPartialTabbing) {
+ expectFocusShift(pressTab, null, getById("tab2"), true, "focus method on tab");
+ expectFocusShift(pressTab, null, getById("htab1"), true, "tab key switch tabpanel 1");
+ expectFocusShift(pressTab, null, getById("htab2"), true, "tab key switch tabpanel 2");
+ expectFocusShift(pressTab, null, getById("t" + (kBeforeTabboxIndex + 4)), true, "tab key switch tabpanel 3");
+ }
+ $("tabbox").selectedIndex = 0;
+
+ // ---- the following checks when the focus changes during a blur or focus event ----
+
+ var o5 = $("o5");
+ var o9 = $("o9");
+ var t3 = $("t3");
+ var t17 = getById("t17");
+ var t19 = getById("t19");
+ var shiftFocusParentDocument = () => o9.focus();
+ var shiftFocusChildDocument = () => t17.focus();
+
+ var trapBlur = function (element, eventListener, blurFunction)
+ {
+ element.focus();
+ gEvents = "";
+ element.addEventListener("blur", eventListener, false);
+ blurFunction();
+ element.removeEventListener("blur", eventListener, false);
+ }
+
+ var functions = [
+ element => element.focus(),
+ element => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal)
+ ];
+
+ // first, check cases where the focus is adjusted during the blur event. Iterate twice,
+ // once with the focus method and then focusing by mouse clicking
+ for (var l = 0; l < 2; l++) {
+ var adjustFocus = functions[l];
+ var mod = (l == 1) ? " with mouse" : "";
+
+ // an attempt is made to switch the focus from one element (o5) to another
+ // element (t3) within the same document, yet the focus is shifted to a
+ // third element (o9) in the same document during the blur event for the
+ // first element.
+ trapBlur(o5, shiftFocusParentDocument, () => adjustFocus(t3));
+ compareEvents("commandupdate: cu blur: o5 commandupdate: cu focus: o9",
+ window, o9, "change focus to sibling during element blur, attempted sibling" + mod);
+
+ // similar, but the third element (t17) is in a child document
+ trapBlur(o9, shiftFocusChildDocument, () => adjustFocus(t3));
+ compareEvents("commandupdate: cu blur: o9 blur: outer-document blur: outer-window " +
+ "focus: child-document focus: child-window commandupdate: cu focus: t17",
+ gChildWindow, t17, "change focus to child document during element blur, attempted sibling" + mod);
+
+ // similar, but an attempt to switch focus within the same document, but the
+ // third element (t17) is in a parent document
+ trapBlur(t17, shiftFocusParentDocument, () => adjustFocus(t19));
+ compareEvents("commandupdate: cu blur: t17 blur: child-document blur: child-window " +
+ "focus: outer-document focus: outer-window commandupdate: cu focus: o9",
+ window, o9, "change focus to parent document during element blur, attempted sibling" + mod);
+
+ // similar, but blur is called instead of switching focus
+ trapBlur(t3, shiftFocusParentDocument, () => t3.blur());
+ compareEvents("commandupdate: cu blur: t3 commandupdate: cu focus: o9",
+ window, o9, "change focus to same document during clear focus" + mod);
+
+ // check when an element in the same document is focused during the
+ // element's blur event, but an attempt was made to focus an element in the
+ // child document. In this case, the focus in the parent document should be
+ // what was set during the blur event, but the actual focus should still
+ // move to the child document.
+ trapBlur(t3, shiftFocusParentDocument, () => adjustFocus(t17));
+ compareEvents("commandupdate: cu blur: t3 commandupdate: cu focus: o9 " +
+ "blur: outer-document blur: outer-window " +
+ "focus: child-document focus: child-window commandupdate: cu focus: t17",
+ gChildWindow, t17, "change focus to sibling during element blur, attempted child" + mod);
+ is(fm.getFocusedElementForWindow(window, false, {}), $("childframe"),
+ "change focus to sibling during element blur, attempted child, focused in parent" + mod);
+
+ // similar, but with a parent
+ trapBlur(t19, shiftFocusChildDocument, () => adjustFocus(t3));
+ compareEvents("commandupdate: cu blur: t19 commandupdate: cu focus: t17 " +
+ "blur: child-document blur: child-window " +
+ "focus: outer-document focus: outer-window commandupdate: cu focus: t3",
+ window, t3, "change focus to sibling during element blur, attempted parent" + mod);
+ is(fm.getFocusedElementForWindow(gChildWindow, false, {}), t17,
+ "change focus to sibling during element blur, attempted child, focused in child" + mod);
+
+ // similar, with a child, but the blur event focuses a child element also
+ trapBlur(t3, shiftFocusChildDocument, () => adjustFocus(t19));
+ compareEvents("commandupdate: cu blur: t3 blur: outer-document blur: outer-window " +
+ "focus: child-document focus: child-window commandupdate: cu focus: t17",
+ gChildWindow, t17, "change focus to child during element blur, attempted child" + mod);
+
+ // similar, with a parent, where the blur event focuses a parent element also
+ trapBlur(t17, shiftFocusParentDocument, () => adjustFocus(t3));
+ compareEvents("commandupdate: cu blur: t17 blur: child-document blur: child-window " +
+ "focus: outer-document focus: outer-window commandupdate: cu focus: o9",
+ window, o9, "change focus to parent during element blur, attempted parent" + mod);
+ }
+
+ var trapFocus = function (element, eventListener)
+ {
+ element.addEventListener("focus", eventListener, false);
+ element.focus();
+ element.removeEventListener("focus", eventListener, false);
+ }
+
+ fm.clearFocus(window);
+ gEvents = "";
+
+ // next, check cases where the focus is adjusted during the focus event
+
+ // switch focus to an element in the same document
+ trapFocus(o5, shiftFocusParentDocument);
+ compareEvents("commandupdate: cu focus: o5 commandupdate: cu blur: o5 commandupdate: cu focus: o9",
+ window, o9, "change focus to sibling during element focus");
+
+ // similar, but the new element (t17) is in a child document
+ trapFocus(o5, shiftFocusChildDocument);
+ compareEvents("commandupdate: cu blur: o9 " +
+ "commandupdate: cu focus: o5 commandupdate: cu blur: o5 " +
+ "blur: outer-document blur: outer-window " +
+ "focus: child-document focus: child-window commandupdate: cu focus: t17",
+ gChildWindow, t17, "change focus to child document during element focus");
+
+ // similar, but the new element (o9) is in a parent document.
+ trapFocus(t19, shiftFocusParentDocument);
+ compareEvents("commandupdate: cu blur: t17 " +
+ "commandupdate: cu focus: t19 commandupdate: cu blur: t19 " +
+ "blur: child-document blur: child-window " +
+ "focus: outer-document focus: outer-window commandupdate: cu focus: o9",
+ window, o9, "change focus to parent document during element focus");
+
+ // clear the focus during the focus event
+ trapFocus(t3, () => fm.clearFocus(window));
+ compareEvents("commandupdate: cu blur: o9 commandupdate: cu focus: t3 commandupdate: cu blur: t3",
+ window, null, "clear focus during focus event");
+
+ if (!gPartialTabbing)
+ doCommandDispatcherTests();
+
+ testMoveFocus();
+
+ doRemoveTests();
+
+ // tests various focus manager apis for null checks
+ var exh = false;
+ try {
+ fm.clearFocus(null);
+ }
+ catch (ex) { exh = true; }
+ is(exh, true, "clearFocus with null window causes exception");
+
+ var exh = false;
+ try {
+ fm.getFocusedElementForWindow(null, false, focusedWindow);
+ }
+ catch (ex) { exh = true; }
+ is(exh, true, "getFocusedElementForWindow with null window causes exception");
+
+ // just make sure that this doesn't crash
+ fm.moveCaretToFocus(null);
+
+ // ---- tests for the FLAG_NOSWITCHFRAME flag
+ getById("o5").focus();
+ gLastFocusMethod = fm.FLAG_BYJS;
+ gEvents = "";
+ // focus is being shifted in a child, so the focus should not change
+ expectFocusShift(() => fm.setFocus(getById("t20"), fm.FLAG_NOSWITCHFRAME),
+ window, getById("o5"), false, "no switch frame focus to child");
+ setFocusTo("t20", gChildWindow);
+
+ gLastFocusMethod = 0;
+
+ // here, however, focus is being shifted in a parent, which will have to blur
+ // the child, so the focus will always change
+ expectFocusShift(() => fm.setFocus(getById("o5"), fm.FLAG_NOSWITCHFRAME),
+ window, getById("o5"), true, "no switch frame focus to parent");
+
+ expectFocusShift(() => fm.setFocus(getById("t1"), fm.FLAG_NOSWITCHFRAME),
+ window, getById("t1"), true, "no switch frame focus to same window");
+
+ // ---- tests for focus and scrolling into view ----
+ var inscroll = getById("inscroll");
+ inscroll.tabIndex = 0;
+ is(inscroll.parentNode.scrollTop, 0, "scroll position before focus");
+ inscroll.focus();
+ ok(inscroll.parentNode.scrollTop > 5, "scroll position after focus");
+ inscroll.parentNode.scrollTop = 0;
+ fm.setFocus(inscroll, fm.FLAG_NOSCROLL);
+ is(inscroll.parentNode.scrollTop, 0, "scroll position after noscroll focus");
+
+ getById("t9").focus();
+ getById("inpopup1").focus();
+ is(fm.focusedElement, getById("t9"), "focus in closed popup");
+
+ // ---- tests to check if tabbing out of a input works
+
+ setFocusTo("t1", window);
+
+ var input1 = document.createElement("input");
+ $("innerbox").appendChild(input1);
+
+ var input2 = document.createElement("input");
+ $("innerbox").appendChild(input2);
+
+ gLastFocusMethod = fm.FLAG_BYJS;
+ expectFocusShift(() => input2.focus(),
+ null, input2, true, "focus on input");
+ gLastFocusMethod = fm.FLAG_BYKEY;
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}),
+ null, input1, true, "shift+tab on input");
+
+ input1.tabIndex = 2;
+ input2.tabIndex = 2;
+ gLastFocusMethod = fm.FLAG_BYJS;
+ expectFocusShift(() => input2.focus(),
+ null, input2, true, "focus on input with tabindex set");
+ gLastFocusMethod = fm.FLAG_BYKEY;
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}),
+ null, input1, true, "shift+tab on input with tabindex set");
+
+ // ---- test to check that refocusing an element during a blur event doesn't succeed
+
+ var t1 = getById("t1");
+ t1.addEventListener("blur", () => t1.focus(), true);
+ t1.focus();
+ var t3 = getById("t3");
+ synthesizeMouse(t3, 2, 2, { });
+ is(fm.focusedElement, t3, "focus during blur");
+
+ setFocusTo("t9", window);
+ gLastFocusMethod = -1;
+ window.openDialog("focus_window2.xhtml", "_blank", "chrome", otherWindowFocused);
+}
+
+function doCommandDispatcherTests()
+{
+ var t19 = getById("t19");
+ t19.focus();
+ gLastFocusWindow = gChildWindow;
+ gLastFocus = t19;
+ gEvents = "";
+
+ expectFocusShift(() => document.commandDispatcher.focusedElement = getById("o9"),
+ null, getById("o9"), true, "command dispatcher set focusedElement");
+ expectFocusShift(() => document.commandDispatcher.advanceFocus(),
+ null, getById("o13"), true, "command dispatcher advanceFocus");
+ expectFocusShift(() => document.commandDispatcher.rewindFocus(),
+ null, getById("o9"), true, "command dispatcher rewindFocus");
+ expectFocusShift(() => document.commandDispatcher.focusedElement = null,
+ null, null, true, "command dispatcher set focusedElement to null");
+ expectFocusShift(() => document.commandDispatcher.focusedWindow = gChildWindow,
+ null, getById("t19"), true, "command dispatcher set focusedElement to null");
+ expectFocusShift(() => document.commandDispatcher.focusedElement = null,
+ gChildWindow, null, true, "command dispatcher set focusedElement to null in child");
+ expectFocusShift(() => document.commandDispatcher.advanceFocusIntoSubtree(getById("t19")),
+ null, getById("t20"), true, "command dispatcher advanceFocusIntoSubtree child");
+ expectFocusShift(() => document.commandDispatcher.advanceFocusIntoSubtree(null),
+ null, getById("t21"), true, "command dispatcher advanceFocusIntoSubtree null child");
+ expectFocusShift(() => document.commandDispatcher.advanceFocusIntoSubtree(getById("o9").parentNode),
+ null, getById("o9"), true, "command dispatcher advanceFocusIntoSubtree parent");
+}
+
+function doRemoveTests()
+{
+ // next, some tests which remove elements
+ var t19 = getById("t19");
+ t19.focus();
+ t19.remove();
+
+ is(fm.focusedElement, null, "removed element focusedElement");
+ is(fm.focusedWindow, gChildWindow, "removed element focusedWindow");
+ is(gChildWindow.document.hasFocus(), true, "removed element hasFocus");
+ is(gChildWindow.document.activeElement, getById("inner-document"), "removed element activeElement");
+
+ getById("t15").focus();
+ var abs = getById("abs");
+ abs.remove();
+
+ is(fm.focusedElement, null, "removed ancestor focusedElement");
+ is(fm.focusedWindow, gChildWindow, "removed ancestor focusedWindow");
+ is(gChildWindow.document.hasFocus(), true, "removed ancestor hasFocus");
+ is(gChildWindow.document.activeElement, getById("inner-document"), "removed ancestor activeElement");
+}
+
+// tests for the FocusManager moveFocus method
+function testMoveFocus()
+{
+ setFocusTo("t6", window);
+
+ // moving focus while an element is already focused
+ var newFocus;
+ gLastFocusMethod = fm.FLAG_BYMOVEFOCUS;
+ var expectedFirst = getById(gPartialTabbing ? "t3" : "t1");
+ expectFocusShift(() => newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_FIRST, 0),
+ window, expectedFirst, true, "moveFocus to first null window null content");
+ is(newFocus, fm.focusedElement, "moveFocus to first null window null content return value");
+
+ expectFocusShift(() => newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_LAST, 0),
+ window, getById("last"), true, "moveFocus to last null window null content");
+ is(newFocus, fm.focusedElement, "moveFocus to last null window null content return value");
+
+ gLastFocusMethod = 0;
+ newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_ROOT, 0);
+ is(newFocus, null, "moveFocus to root null window null content return value");
+ is(fm.focusedWindow, window, "moveFocus to root null window null content focusedWindow");
+ is(fm.focusedElement, null, "moveFocus to root null window null content focusedElement");
+
+ // moving focus while no element is focused
+ fm.clearFocus(window);
+ gEvents = "";
+ gLastFocus = null;
+ gLastFocusMethod = fm.FLAG_BYMOVEFOCUS;
+ expectFocusShift(() => newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_FIRST, 0),
+ window, expectedFirst, true, "moveFocus to first null window null content no focus");
+ is(newFocus, fm.focusedElement, "moveFocus to first null window null content no focus return value");
+ fm.clearFocus(window);
+ gEvents = "";
+ gLastFocus = null;
+ expectFocusShift(() => newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_LAST, 0),
+ window, getById("last"), true, "moveFocus to last null window null content no focus");
+ is(newFocus, fm.focusedElement, "moveFocus to last null window null content no focus return value");
+ fm.clearFocus(window);
+ gEvents = "";
+ gLastFocusMethod = 0;
+ newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_ROOT, 0);
+ is(newFocus, null, "moveFocus to root null window null content no focus return value");
+ is(fm.focusedWindow, window, "moveFocus to root null window null content no focus focusedWindow");
+ is(fm.focusedElement, null, "moveFocus to root null window null content no focus focusedElement");
+
+ // moving focus from a specified element
+ setFocusTo("t6", window);
+ gLastFocusMethod = fm.FLAG_BYMOVEFOCUS;
+ expectFocusShift(() => newFocus = fm.moveFocus(null, getById("specialroot"), fm.MOVEFOCUS_FIRST, 0),
+ window, getById("t3"), true, "moveFocus to first null window with content");
+// XXXndeakin P3 this doesn't work
+// expectFocusShift(() => newFocus = fm.moveFocus(null, getById("specialroot"), fm.MOVEFOCUS_LAST, 0),
+// window, getById("o3"), true, "moveFocus to last null window with content");
+
+ // move focus to first in child window
+ expectFocusShift(() => newFocus = fm.moveFocus(gChildWindow, null, fm.MOVEFOCUS_FIRST, 0),
+ gChildWindow, getById("t" + (kChildDocumentRootIndex + 1)), true,
+ "moveFocus to first child window null content");
+ is(newFocus, getById("t" + (kChildDocumentRootIndex + 1)),
+ "moveFocus to first child window null content return value");
+
+ // move focus to last in child window
+ setFocusTo("t6", window);
+ var expectedLast = getById(gPartialTabbing ? "t30" : "t" + (kBeforeTabboxIndex - 1));
+ expectFocusShift(() => newFocus = fm.moveFocus(gChildWindow, null, fm.MOVEFOCUS_LAST, 0),
+ gChildWindow, expectedLast, true,
+ "moveFocus to last child window null content");
+ is(newFocus, getById(expectedLast),
+ "moveFocus to last child window null content return value");
+
+ // move focus to root in child window
+ setFocusTo("t6", window);
+ var childroot = getById("t" + kChildDocumentRootIndex);
+ gLastFocusMethod = 0;
+ newFocus = fm.moveFocus(gChildWindow, null, fm.MOVEFOCUS_ROOT, 0),
+ is(newFocus, childroot, "moveFocus to root child window null content return value");
+ is(fm.focusedWindow, gChildWindow, "moveFocus to root child window null content focusedWindow");
+ is(fm.focusedElement, childroot, "moveFocus to root child window null content focusedElement");
+
+ // MOVEFOCUS_CARET tests
+ getById("t20").focus();
+ gEvents = "";
+
+ var selection = gChildWindow.getSelection();
+ selection.removeAllRanges();
+
+ newFocus = fm.moveFocus(gChildWindow, null, fm.MOVEFOCUS_CARET, 0);
+ is(newFocus, null, "move caret when at document root");
+ is(fm.focusedElement, null, "move caret when at document root");
+
+ var node = getById("t16").firstChild;
+ var range = gChildWindow.document.createRange();
+ range.setStart(node, 3);
+ range.setEnd(node, 3);
+ selection.addRange(range);
+
+ newFocus = fm.moveFocus(gChildWindow, null, fm.MOVEFOCUS_CARET, 0);
+ is(newFocus, null, "move caret to non-link return value");
+ is(fm.focusedElement, null, "move caret to non-link");
+
+ var t25 = getById("t25");
+ var node = t25.firstChild;
+ range.setStart(node, 1);
+ range.setEnd(node, 1);
+ newFocus = fm.moveFocus(gChildWindow, null, fm.MOVEFOCUS_CARET, 0);
+
+ is(newFocus, t25, "move caret to link return value");
+ is(fm.focusedElement, t25, "move caret to link focusedElement");
+
+ // enable caret browsing temporarily to test caret movement
+ var prefs = Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefBranch);
+ prefs.setBoolPref("accessibility.browsewithcaret", true);
+
+ synthesizeKey("KEY_ArrowLeft", {}, gChildWindow);
+ synthesizeKey("KEY_ArrowLeft", {}, gChildWindow);
+ is(fm.focusedElement, null, "move caret away from link");
+
+ synthesizeKey("KEY_ArrowLeft", {}, gChildWindow);
+ is(fm.focusedElement, getById("t24"), "move caret away onto link");
+
+ prefs.setBoolPref("accessibility.browsewithcaret", false);
+
+ // cases where focus in on a content node with no frame
+
+ if (!gPartialTabbing) {
+ getById("t24").blur();
+ gEvents = "";
+ gLastFocus = null;
+ gLastFocusWindow = gChildWindow;
+ gLastFocusMethod = fm.FLAG_BYKEY;
+
+ selection.selectAllChildren(getById("hiddenspan"));
+ expectFocusShift(() => synthesizeKey("KEY_Tab"),
+ gChildWindow, getById("t26"), true, "tab with selection on hidden content");
+
+ setFocusTo($("o15"), window);
+ $("o15").hidden = true;
+ document.documentElement.getBoundingClientRect(); // flush after hiding
+ expectFocusShift(() => synthesizeKey("KEY_Tab"),
+ window, $("o17"), true, "tab with focus on hidden content");
+
+ $("o17").hidden = true;
+ document.documentElement.getBoundingClientRect();
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}),
+ window, $("o13"), true, "shift+tab with focus on hidden content");
+ }
+
+ // cases with selection in an <input>
+
+ var t19 = getById("t19");
+ t19.setSelectionRange(0, 0);
+ setFocusTo("t18", gChildWindow);
+
+ gLastFocusMethod = fm.FLAG_BYMOVEFOCUS;
+ expectFocusShift(() => newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_FORWARD, 0),
+ gChildWindow, t19, true, "moveFocus to next input");
+ is(t19.selectionStart, 0, "input focused after moveFocus selectionStart");
+ is(t19.selectionEnd, 5, "input focused after moveFocus selectionEnd");
+
+ t19.setSelectionRange(0, 0);
+ setFocusTo("t18", gChildWindow);
+ gLastFocusMethod = fm.FLAG_BYKEY;
+ expectFocusShift(() => newFocus = fm.moveFocus(null, null, fm.MOVEFOCUS_FORWARD, fm.FLAG_BYKEY),
+ gChildWindow, t19, true, "moveFocus to next input by key");
+ is(t19.selectionStart, 0, "input focused after moveFocus by key selectionStart");
+ is(t19.selectionEnd, 5, "input focused after moveFocus by key selectionEnd");
+}
+
+function otherWindowFocused(otherWindow)
+{
+ var expectedElement = getById("t9");
+
+ is(fm.activeWindow, otherWindow, "other activeWindow");
+ is(fm.focusedWindow, otherWindow, "other focusedWindow");
+ is(window.document.hasFocus(), false, "when lowered document hasFocus");
+ var focusedWindow = {};
+ is(fm.getFocusedElementForWindow(window, false, focusedWindow),
+ expectedElement, "when lowered getFocusedElementForWindow");
+ is(focusedWindow.value, window, "when lowered getFocusedElementForWindow frame");
+ is(document.activeElement.id, expectedElement.id, "when lowered activeElement");
+ is(window.document.commandDispatcher.focusedWindow, window, " commandDispatcher in other window focusedWindow");
+ is(window.document.commandDispatcher.focusedElement, expectedElement, " commandDispatcher in other window focusedElement");
+
+ compareEvents("deactivate: outer-document-window blur: t9 blur: outer-document blur: outer-window",
+ otherWindow, null, "other window opened");
+
+ otherWindow.document.getElementById("other").focus();
+
+ for (var idx = kTabbableSteps; idx >= 1; idx--) {
+ expectedElement = getById("t" + idx);
+ if (!expectedElement) // skip elements that were removed in doRemoveTests()
+ continue;
+ if ((navigator.platform.indexOf("Mac") == 0) && (idx == kBeforeTabboxIndex + 1))
+ continue;
+
+ expectedElement.focus();
+
+ is(fm.focusedElement.id, "other", "when lowered focusedElement t" + idx);
+ is(fm.focusedWindow, otherWindow, "when lowered focusedWindow t" + idx);
+
+ var checkWindow = expectedElement.ownerGlobal;
+ is(fm.getFocusedElementForWindow(checkWindow, false, {}).id, expectedElement.id,
+ "when lowered getFocusedElementForWindow t" + idx);
+ is(checkWindow.document.activeElement.id, expectedElement.id, "when lowered activeElement t" + idx);
+ if (checkWindow != window) {
+ is(fm.getFocusedElementForWindow(window, false, {}), $("childframe"),
+ "when lowered parent getFocusedElementForWindow t" + idx);
+ is(document.activeElement.id, "childframe",
+ "when lowered parent activeElement t" + idx);
+ }
+ }
+
+ gEvents = gEvents.replace(/commandupdate: cu\s?/g, "");
+ is(gEvents, "", "when lowered no events fired");
+
+ var other = otherWindow.document.getElementById("other");
+ other.focus();
+ is(fm.focusedElement, other, "focus method in second window");
+
+ otherWindow.close();
+
+ getById("n2").focus();
+
+ // next, check modal dialogs
+ // XXXndeakin Bug 621399 - the modal dialog test as well as later tests sometime fail
+ // on Windows 8 so just end the test here.
+ if (navigator.userAgent.includes("Windows NT 6.2")) {
+ done();
+ }
+ else {
+ window.openDialog("focus_window2.xhtml", "_blank", "chrome,modal", modalWindowOpened);
+ }
+}
+
+function modalWindowOpened(modalWindow)
+{
+ var elem = modalWindow.document.getElementById("other");
+ if (gPartialTabbing)
+ elem.focus();
+ else
+ synthesizeKey("KEY_Tab", {}, modalWindow);
+ is(fm.activeWindow, modalWindow, "modal activeWindow");
+ is(fm.focusedElement, elem, "modal focusedElement");
+
+ modalWindow.close();
+ SimpleTest.waitForFocus(modalWindowClosed);
+}
+
+function modalWindowClosed()
+{
+ is(fm.activeWindow, window, "modal window closed activeWindow");
+ is(fm.focusedElement, getById("n2"), "modal window closed focusedElement");
+
+ window.arguments[0].framesetWindowLoaded = framesetWindowLoaded;
+ window.arguments[0].open("focus_frameset.html", "_blank", "width=400,height=400,toolbar=no");
+}
+
+function framesetWindowLoaded(framesetWindow)
+{
+ gLastFocus = null;
+ gLastFocusWindow = framesetWindow;
+ gEvents = "";
+
+ is(fm.activeWindow, getTopWindow(framesetWindow), "frameset window active");
+ gOldExpectedWindow = getTopWindow(framesetWindow);
+
+ gMoveToFocusFrame = true;
+ for (var idx = 1; idx <= 8; idx++) {
+ gNewExpectedWindow = framesetWindow.frames[(idx - 1) >> 1];
+ if (idx % 2)
+ initEvents(gNewExpectedWindow);
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {}, framesetWindow),
+ gNewExpectedWindow, getById("f" + idx), true, "frameset tab key f" + idx);
+ gMoveToFocusFrame = false;
+ gOldExpectedWindow = gNewExpectedWindow;
+ }
+
+ gNewExpectedWindow = framesetWindow.frames[0];
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {}, framesetWindow),
+ gNewExpectedWindow, getById("f1"), true, "frameset tab key wrap to start");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[3];
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f8"), true, "frameset shift tab key wrap to end");
+
+ for (idx = 7; idx >= 1; idx--) {
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[(idx - 1) >> 1];
+ expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f" + idx), true, "frameset shift tab key f" + idx);
+ }
+
+ // document shifting
+ // XXXndeakin P3 ctrl+tab doesn't seem to be testable currently for some reason
+ gNewExpectedWindow = framesetWindow.frames[1];
+ expectFocusShift(() => synthesizeKey("KEY_F6", {ctrlKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f3"), true, "switch document forward with f6");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[2];
+ expectFocusShift(() => synthesizeKey("KEY_F6", {}, framesetWindow),
+ gNewExpectedWindow, getById("f5"), true, "switch document forward with ctrl+tab");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[3];
+ expectFocusShift(() => synthesizeKey("KEY_F6", {ctrlKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f7"), true, "switch document forward with ctrl+f6");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[0];
+ expectFocusShift(() => synthesizeKey("KEY_F6", {ctrlKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f1"), true, "switch document forward and wrap");
+
+// going backwards by document and wrapping doesn't currently work, but didn't work
+// before the focus reworking either
+
+/*
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[3];
+ expectFocusShift(() => synthesizeKey("KEY_F6", { ctrlKey: true, shiftKey: true }, framesetWindow),
+ gNewExpectedWindow, getById("f7"), true, "switch document backward and wrap");
+ */
+
+ fm.moveFocus(framesetWindow.frames[3], null, fm.MOVEFOCUS_ROOT, 0);
+ gEvents = "";
+
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[2];
+ expectFocusShift(() => synthesizeKey("KEY_F6", {ctrlKey: true, shiftKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f5"), true, "switch document backward with f6");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[1];
+ expectFocusShift(() => synthesizeKey("KEY_F6", {ctrlKey: true, shiftKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f3"), true, "switch document backward with ctrl+tab");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[0];
+ expectFocusShift(() => synthesizeKey("KEY_F6", {ctrlKey: true, shiftKey: true}, framesetWindow),
+ gNewExpectedWindow, getById("f1"), true, "switch document backward with ctrl+f6");
+
+ // skip the window switching tests for now on Linux, as raising and lowering
+ // a window is asynchronous there
+ if (!navigator.platform.includes("Linux")) {
+ window.openDialog("focus_window2.xhtml", "_blank", "chrome", switchWindowTest, framesetWindow);
+ }
+ else {
+ gOldExpectedWindow = null;
+ gNewExpectedWindow = null;
+ framesetWindow.close();
+ SimpleTest.waitForFocus(doWindowNoRootTest);
+ }
+}
+
+// test switching between two windows
+function switchWindowTest(otherWindow, framesetWindow)
+{
+ initEvents(otherWindow);
+ var otherElement = otherWindow.document.getElementById("other");
+ otherElement.focus();
+
+ framesetWindow.frames[1].document.getElementById("f4").focus();
+
+ is(fm.focusedElement, otherElement, "focus after inactive window focus");
+
+ gLastFocus = otherElement;
+ gLastFocusWindow = otherWindow;
+ gEvents = "";
+ gOldExpectedWindow = otherWindow;
+ gNewExpectedWindow = framesetWindow.frames[1];
+
+ expectFocusShift(() => gNewExpectedWindow.focus(),
+ gNewExpectedWindow, getById("f4"), true, "switch to frame in another window");
+ is(fm.getFocusedElementForWindow(otherWindow, false, {}).id, "other", "inactive window has focused element");
+
+ gOldExpectedWindow = framesetWindow.frames[1];
+ gNewExpectedWindow = otherWindow;
+ expectFocusShift(() => otherWindow.focus(),
+ gNewExpectedWindow, getById("other"), true, "switch to another window");
+
+ var topWindow = getTopWindow(framesetWindow);
+
+ ok(topWindow.document.commandDispatcher.getControllerForCommand("cmd_copy"),
+ "getControllerForCommand for focused window set");
+ ok(otherWindow.document.commandDispatcher.getControllerForCommand("cmd_copy"),
+ "getControllerForCommand for non-focused window set");
+ ok(topWindow.document.commandDispatcher.getControllerForCommand("cmd_copy") !=
+ otherWindow.document.commandDispatcher.getControllerForCommand("cmd_copy"),
+ "getControllerForCommand for two windows different");
+ ok(topWindow.document.commandDispatcher.getControllers() !=
+ otherWindow.document.commandDispatcher.getControllers(),
+ "getControllers for two windows different");
+
+ gOldExpectedWindow = otherWindow;
+ gNewExpectedWindow = framesetWindow.frames[1];
+ expectFocusShift(() => topWindow.focus(),
+ gNewExpectedWindow, getById("f4"), true, "switch to frame activeWindow");
+
+ fm.clearFocus(otherWindow);
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = otherWindow;
+ expectFocusShift(() => fm.setFocus(otherElement, fm.FLAG_RAISE),
+ gNewExpectedWindow, getById("other"), true, "switch to window with raise");
+
+ getTopWindow(framesetWindow).document.commandDispatcher.focusedWindow = gOldExpectedWindow;
+ is(fm.activeWindow, gNewExpectedWindow, "setting commandDispatcher focusedWindow doesn't raise window");
+
+ fm.moveFocus(otherWindow, null, fm.MOVEFOCUS_FORWARD, 0);
+ var otherInput = otherWindow.document.getElementById("other-input");
+ otherInput.setSelectionRange(2, 3);
+ topWindow.focus();
+ otherWindow.focus();
+ is(otherInput.selectionStart, 2, "selectionStart after input focus and window raise");
+ is(otherInput.selectionEnd, 3, "selectionEnd after input focus and window raise");
+ is(fm.getLastFocusMethod(null), fm.FLAG_BYMOVEFOCUS, "last focus method after input focus and window raise");
+
+ fm.clearFocus(otherWindow);
+
+ // test to ensure that a synthetic event won't move focus
+ var synevent = new FocusEvent("focus", {});
+ otherInput.dispatchEvent(synevent);
+ is(synevent.type, "focus", "event.type after synthetic focus event");
+ is(synevent.target, otherInput, "event.target after synthetic focus event");
+ is(fm.focusedElement, null, "focusedElement after synthetic focus event");
+ is(otherWindow.document.activeElement, otherWindow.document.documentElement,
+ "document.activeElement after synthetic focus event");
+
+ // check accessing a focus event after the event has finishing firing
+ function continueTest(event) {
+ is(event.type, "focus", "event.type after accessing focus event in timeout");
+ is(event.target, otherInput, "event.target after accessing focus event in timeout");
+
+ gOldExpectedWindow = null;
+ gNewExpectedWindow = null;
+ otherWindow.close();
+ framesetWindow.close();
+
+ SimpleTest.waitForFocus(doWindowNoRootTest);
+ }
+
+ function inputFocused(event) {
+ otherInput.removeEventListener("focus", inputFocused, true);
+ setTimeout(continueTest, 0, event);
+ }
+
+ otherInput.addEventListener("focus", inputFocused, true);
+ otherInput.focus();
+}
+
+// open a window with no root element
+var noRootWindow = null;
+function doWindowNoRootTest()
+{
+ addEventListener("focus", doFrameSwitchingTests, true);
+ noRootWindow = window.open("window_focus_inner.xhtml", "_blank", "chrome,width=100,height=100");
+}
+
+// these tests check when focus is moved between a tree of frames to ensure
+// that the focus is in the right place at each event step.
+function doFrameSwitchingTests()
+{
+ removeEventListener("focus", doFrameSwitchingTests, true);
+ noRootWindow.close();
+
+ var framea = document.getElementById("ifa");
+ var frameb = document.getElementById("ifb");
+ framea.style.MozUserFocus = "";
+ frameb.style.MozUserFocus = "";
+
+ window.removeEventListener("focus", eventOccured, true);
+ window.removeEventListener("blur", eventOccured, true);
+
+ var inputa = framea.contentDocument.body.firstChild;
+ inputa.focus();
+
+ addFrameSwitchingListeners(framea);
+ addFrameSwitchingListeners(frameb);
+ var framec = framea.contentDocument.body.lastChild;
+ addFrameSwitchingListeners(framec);
+
+ var framed = framec.contentDocument.body.lastChild;
+ addFrameSwitchingListeners(framed);
+
+ var inputc = framec.contentDocument.body.firstChild;
+
+ var expectedMainWindowFocus = framea;
+
+ // An element in the immediate parent frame is focused. Focus an element in
+ // the child. The child should be focused and the parent's current focus should
+ // be the child iframe.
+ gEventMatched = true;
+ is(fm.getFocusedElementForWindow(window, false, {}), expectedMainWindowFocus,
+ "parent of framea has iframe focused");
+ gExpectedEvents = [[inputa, "blur", null, framea.contentWindow, window, framea],
+ [framea.contentDocument, "blur", null, null, window, framea],
+ [framea.contentWindow, "blur", null, null, window, framea],
+ [framec.contentDocument, "focus", null, framec.contentWindow, window, framea],
+ [framec.contentWindow, "focus", null, framec.contentWindow, window, framea],
+ [inputc, "focus", inputc, framec.contentWindow, window, framea]];
+ inputc.focus();
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch from parent input to child input" + gExpectedEvents);
+
+ // An element in a child is focused. Focus an element in the immediate
+ // parent.
+ gEventMatched = true;
+ gExpectedEvents = [[inputc, "blur", null, framec.contentWindow, window, framea],
+ [framec.contentDocument, "blur", null, null, window, framea],
+ [framec.contentWindow, "blur", null, null, window, framea],
+ [framea.contentDocument, "focus", null, framea.contentWindow, window, framea],
+ [framea.contentWindow, "focus", null, framea.contentWindow, window, framea],
+ [inputa, "focus", inputa, framea.contentWindow, window, framea]];
+ inputa.focus();
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch from child input to parent input");
+
+ // An element in a frame is focused. Focus an element in a sibling frame.
+ // The common ancestor of the two frames should have its focused node
+ // cleared after the element is blurred.
+ var inputb = frameb.contentDocument.body.firstChild;
+
+ gEventMatched = true;
+ gExpectedEvents = [[inputa, "blur", null, framea.contentWindow, window, framea],
+ [framea.contentDocument, "blur", null, null, window, null],
+ [framea.contentWindow, "blur", null, null, window, null],
+ [frameb.contentDocument, "focus", null, frameb.contentWindow, window, frameb],
+ [frameb.contentWindow, "focus", null, frameb.contentWindow, window, frameb],
+ [inputb, "focus", inputb, frameb.contentWindow, window, frameb]];
+ inputb.focus();
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch from input to sibling frame");
+ is(fm.getFocusedElementForWindow(framea.contentWindow, false, {}), inputa,
+ "blurred frame still has input as focus");
+
+ // focus a descendant in a sibling
+ var inputd = framed.contentDocument.body.firstChild;
+ gEventMatched = true;
+ gExpectedEvents = [[inputb, "blur", null, frameb.contentWindow, window, frameb],
+ [frameb.contentDocument, "blur", null, null, window, null],
+ [frameb.contentWindow, "blur", null, null, window, null],
+ [framed.contentDocument, "focus", null, framed.contentWindow, window, framea],
+ [framed.contentWindow, "focus", null, framed.contentWindow, window, framea],
+ [inputd, "focus", inputd, framed.contentWindow, window, framea]];
+ inputd.focus();
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch from input to sibling descendant");
+ is(fm.getFocusedElementForWindow(framea.contentWindow, false, {}), framec,
+ "sibling parent focus has shifted to frame");
+
+ // focus an ancestor
+ gEventMatched = true;
+ gExpectedEvents = [[inputd, "blur", null, framed.contentWindow, window, framea],
+ [framed.contentDocument, "blur", null, null, window, framea],
+ [framed.contentWindow, "blur", null, null, window, framea],
+ [framea.contentDocument, "focus", null, framea.contentWindow, window, framea],
+ [framea.contentWindow, "focus", null, framea.contentWindow, window, framea],
+ [inputa, "focus", inputa, framea.contentWindow, window, framea]];
+ inputa.focus();
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch from child input to ancestor");
+
+ // focus a descendant
+ gEventMatched = true;
+ gExpectedEvents = [[inputa, "blur", null, framea.contentWindow, window, framea],
+ [framea.contentDocument, "blur", null, null, window, framea],
+ [framea.contentWindow, "blur", null, null, window, framea],
+ [framed.contentDocument, "focus", null, framed.contentWindow, window, framea],
+ [framed.contentWindow, "focus", null, framed.contentWindow, window, framea],
+ [inputd, "focus", inputd, framed.contentWindow, window, framea]];
+ inputd.focus();
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch from child input to ancestor");
+ is(fm.getFocusedElementForWindow(framea.contentWindow, false, {}), framec,
+ "parent focus has shifted to frame");
+
+ // focus a sibling frame by setting focusedWindow
+ gEventMatched = true;
+ gExpectedEvents = [[inputd, "blur", null, framed.contentWindow, window, framea],
+ [framed.contentDocument, "blur", null, null, window, null],
+ [framed.contentWindow, "blur", null, null, window, null],
+ [frameb.contentDocument, "focus", null, frameb.contentWindow, window, frameb],
+ [frameb.contentWindow, "focus", null, frameb.contentWindow, window, frameb]];
+ fm.focusedWindow = frameb.contentWindow;
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch using focusedWindow");
+
+ // clear the focus in an unfocused frame
+ gEventMatched = true;
+ gExpectedEvents = [];
+ fm.clearFocus(framec.contentWindow);
+ ok(gEventMatched && !gExpectedEvents.length, "clearFocus in unfocused frame");
+
+ // focus a sibling frame by setting focusedWindow when no element is focused in that frame
+ gEventMatched = true;
+ gExpectedEvents = [[frameb.contentDocument, "blur", null, null, window, null],
+ [frameb.contentWindow, "blur", null, null, window, null],
+ [framec.contentDocument, "focus", null, framec.contentWindow, window, framea],
+ [framec.contentWindow, "focus", null, framec.contentWindow, window, framea]];
+ fm.focusedWindow = framec.contentWindow;
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch using focusedWindow with no element focused");
+ is(fm.getFocusedElementForWindow(framea.contentWindow, false, {}), framec,
+ "parent focus has shifted to frame using focusedWindow");
+
+ // focus the parent frame by setting focusedWindow. This should have no effect.
+ gEventMatched = true;
+ gExpectedEvents = [];
+ fm.focusedWindow = framea.contentWindow;
+ ok(gEventMatched && !gExpectedEvents.length, "frame switch to parent using focusedWindow");
+
+ // clear the focus in the parent frame
+ gEventMatched = true;
+ gExpectedEvents = [[framec.contentDocument, "blur", null, null, window, framea],
+ [framec.contentWindow, "blur", null, null, window, framea],
+ [framea.contentDocument, "focus", null, framea.contentWindow, window, framea],
+ [framea.contentWindow, "focus", null, framea.contentWindow, window, framea]];
+ fm.clearFocus(framea.contentWindow);
+ ok(gEventMatched && !gExpectedEvents.length, "clearFocus in parent frame");
+
+ // clear the focus in an unfocused child frame
+ gEventMatched = true;
+ gExpectedEvents = [];
+ fm.clearFocus(framed.contentWindow);
+ ok(gEventMatched && !gExpectedEvents.length, "clearFocus in unfocused child frame");
+
+ var exh = false;
+ try {
+ fm.focusedWindow = null;
+ }
+ catch (ex) { exh = true; }
+ is(exh, true, "focusedWindow set to null");
+ is(fm.focusedWindow, framea.contentWindow, "window not changed when focusedWindow set to null");
+
+ doFrameHistoryTests()
+}
+
+function doFrameHistoryTests()
+{
+ let frame = $("childframe");
+ frame.setAttribute("maychangeremoteness", "true");
+ let loaded = BrowserTestUtils.browserLoaded(frame, true);
+ let firstLocation = "https://example.org/chrome/dom/tests/mochitest/chrome/child_focus_frame.html";
+ frame.src = firstLocation;
+ loaded.then(() => {
+ return ContentTask.spawn(frame, {}, () => {
+ let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
+ let t20 = content.document.getElementById("t20");
+ t20.focus();
+ let goneBack = new Promise(resolve => {
+ content.addEventListener("pageshow", ({ persisted }) => {
+ resolve({ location: content.location.href, persisted });
+ }, { once: true });
+ });
+ // make sure that loading a new page and then going back maintains the focus
+ content.location = "data:text/html,<script>window.onload=function() {setTimeout(function () { history.back() }, 0);}</script>";
+ return goneBack;
+ });
+ }).then(({ location, persisted }) => {
+ is(location, firstLocation, "should go back to the right page");
+ ok(persisted, "test relies on BFCache");
+ return ContentTask.spawn(frame, {}, () => {
+ let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
+ let t20 = content.document.getElementById("t20");
+ return fm.focusedElement === t20;
+ });
+ }).then((focusCorrect) => {
+ if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
+ todo(focusCorrect, "focus restored after history back");
+ } else {
+ ok(focusCorrect, "focus restored after history back");
+ }
+ done();
+ });
+}
+
+function addFrameSwitchingListeners(frame)
+{
+ frame.contentWindow.addEventListener("focus", frameSwitchingEventOccured, false);
+ frame.contentWindow.addEventListener("blur", frameSwitchingEventOccured, false);
+ frame.contentDocument.addEventListener("focus", frameSwitchingEventOccured, false);
+ frame.contentDocument.addEventListener("blur", frameSwitchingEventOccured, false);
+
+ var node = frame.contentDocument.body.firstChild;
+ node.addEventListener("focus", frameSwitchingEventOccured, false);
+ node.addEventListener("blur", frameSwitchingEventOccured, false);
+}
+
+function frameSwitchingEventOccured(event)
+{
+ if (!gExpectedEvents.length) {
+ gEventMatched = false;
+ return;
+ }
+
+ try {
+ var events = gExpectedEvents.shift();
+ is(event.target, events[0], "event target");
+ is(event.type, events[1], "event type");
+ is(fm.focusedElement, events[2], "focused element");
+ is(fm.focusedWindow, events[3], "focused frame");
+ if (events[4])
+ is(fm.getFocusedElementForWindow(events[4], false, {}), events[5], "focused element in frame");
+
+ if (gEventMatched && event.target == events[0] && event.type == events[1] &&
+ fm.focusedElement == events[2] && fm.focusedWindow == events[3]) {
+ if (!events[4] || fm.getFocusedElementForWindow(events[4], false, {}) == events[5])
+ return;
+ }
+ } catch (ex) { ok(ex, "exception"); }
+
+ gEventMatched = false;
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(startTest);
+
+]]>
+</script>
+
+<commandset id="cu"
+ commandupdater="true"
+ events="focus"
+ oncommandupdate="eventOccured(event)"/>
+
+<!--
+ The elements with ids starting with t are focusable and in the taborder.
+ The elements with ids starting with o are:
+ odd numbered ids - focusable but not part of the tab order
+ even numbered ids - not focusable with -moz-user-focus: ignore or disabled
+ The elements with ids starting with n are:
+ odd numbered ids - not focusable with -moz-user-focus: none
+ even numbered ids - focusable but not part of the tab order
+ -->
+<vbox id="buttonbox">
+<hbox id="innerbox">
+ <button id="t4" accesskey="h" label="no tabindex"/>
+ <button id="o1" accesskey="i" label="tabindex = -1" tabindex="-1"/>
+ <richlistbox id="t5" label="tabindex = 0" tabindex="0" style="width: 50px">
+ <richlistitem height="10"/>
+ </richlistbox>
+ <button id="t1" label="tabindex = 2" tabindex="2"/>
+</hbox>
+<hbox>
+ <button id="o2" accesskey="o" style="-moz-user-focus: ignore;" label="no tabindex"/>
+ <button id="o4" style="-moz-user-focus: ignore;" label="no tabindex"/>
+ <button id="t6" style="-moz-user-focus: ignore;" label="tabindex = 0" tabindex="0"/>
+ <button id="t2" style="-moz-user-focus: ignore;" label="tabindex = 2" tabindex="2"/>
+</hbox>
+<hbox id="specialroot">
+ <button id="t7" style="-moz-user-focus: normal;" label="no tabindex"/>
+ <button id="o3" style="-moz-user-focus: normal;" label="tabindex = -1" tabindex="-1"/>
+ <button id="t8" style="-moz-user-focus: normal;" label="tabindex = 0" tabindex="0"/>
+ <richlistbox id="t3" style="-moz-user-focus: normal; width: 50px" label="tabindex = 2" tabindex="2">
+ <richlistitem style="height: 10px"/>
+ </richlistbox>
+</hbox>
+<hbox>
+ <button accesskey="p" style="display: none;"/> <button accesskey="q" style="visibility: collapse;"/>
+ <button style="display: none;" tabindex="2"/> <button style="visibility: collapse;" tabindex="2"/>
+</hbox>
+<hbox>
+ <button id="o20" accesskey="s" label="no tabindex" disabled="true"/>
+ <button id="o22" label="tabindex = -1" tabindex="-1" disabled="true"/>
+ <button id="o24" label="tabindex = 0" tabindex="0" disabled="true"/>
+ <button id="o26" label="tabindex = 2" tabindex="2" disabled="true"/>
+</hbox>
+</vbox>
+<vbox>
+<hbox>
+ <dropmarker id="o6" value="no tabindex"/>
+ <dropmarker id="o8" value="no tabindex"/>
+ <dropmarker id="o10" value="no tabindx"/>
+ <dropmarker id="o12" value="no tabindex"/>
+ <dropmarker id="t9" accesskey="r" style="-moz-user-focus: normal;" value="no tabindex" />
+ <dropmarker id="t10" style="-moz-user-focus: normal;" value="no tabindex"/>
+ <dropmarker id="t11" style="-moz-user-focus: normal;" value="tabindex = 0" tabindex="0" />
+ <dropmarker id="t12" style="-moz-user-focus: normal;" value="no tabindex"/>
+ <dropmarker id="o14" style="-moz-user-focus: ignore;" value="no tabindex"/>
+ <dropmarker id="o16" style="-moz-user-focus: ignore;" value="no tabindex"/>
+ <dropmarker id="n1" style="-moz-user-focus: none;" value="no tabindex"/>
+ <dropmarker id="n3" style="-moz-user-focus: none;" value="no tabindex"/>
+</hbox>
+</vbox>
+<browser id="childframe" type="content" src="child_focus_frame.html" style="height: 195px"/>
+<button id="t34"/>
+<tabbox id="tabbox">
+ <tabs><tab id="t35" label="One"/><tab id="tab2" label="Two"/></tabs>
+ <tabpanels>
+ <tabpanel>
+ <checkbox id="t36"/>
+ <button id="t37"/>
+ </tabpanel>
+ <tabpanel>
+ <checkbox id="htab1"/>
+ <button id="nohtab2" tabindex="7"/>
+ <checkbox id="htab2" tabindex="0"/>
+ </tabpanel>
+ </tabpanels>
+</tabbox>
+<hbox>
+<panel>
+ <button id="inpopup1" label="One"/>
+ <input xmlns="http://www.w3.org/1999/xhtml" label="Two"/>
+</panel>
+<description label="o" accesskey="v"/>
+<button id="t38"/>
+<!-- The 't' element tests end here so it doesn't matter that these elements are tabbable -->
+<label id="aj" value="j" accesskey="j" control="o9"/>
+<label id="ak" accesskey="k" control="n4">k</label>
+<checkbox id="o5"/><checkbox id="o7"/><hbox><checkbox id="o9"/></hbox>
+<checkbox id="o13"/><checkbox id="o15"/><checkbox id="o17"/><checkbox id="o19"/><checkbox id="o21"/><checkbox id="o23"/><checkbox id="o25"/>
+<checkbox id="n2"/><checkbox id="n4"/>
+<richlistbox id="last" style="width: 20px; height: 20px"/>
+
+<iframe id="ifa" style="-moz-user-focus: ignore; width: 40px; height: 60px" type="content"
+ src="data:text/html,&lt;input id=fra size='2'&gt;&lt;input id='fra-b' size='2'&gt;
+ &lt;iframe src='data:text/html,&lt;input id=frc&gt;&lt;iframe src=&quot;data:text/html,&lt;input id=frd&gt;&quot;&gt;&lt;/iframe&gt;'&gt;&lt;/iframe&gt;"/>
+<iframe id="ifb" style="-moz-user-focus: ignore; width: 20px; height: 20px"
+ src="data:text/html,&lt;input id=frd&gt;&lt;/iframe&gt;"/>
+
+</hbox>
+</window>
diff --git a/dom/tests/mochitest/chrome/window_focus_docnav.xhtml b/dom/tests/mochitest/chrome/window_focus_docnav.xhtml
new file mode 100644
index 0000000000..33bff7ec0a
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_focus_docnav.xhtml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+<window onload="start()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<input xmlns="http://www.w3.org/1999/xhtml" id="textbox1"/>
+<input xmlns="http://www.w3.org/1999/xhtml" id="textbox2"/>
+
+<panel id="panel" onpopupshown="runTests(this, 1);"
+ onpopuphidden="noChildrenTest()">
+ <input xmlns="http://www.w3.org/1999/xhtml" id="p1textbox" value="Popup1"/>
+</panel>
+<panel id="panel2" onpopupshown="runTests(this, 2);" onpopuphidden="document.getElementById('panel').hidePopup()">
+ <input xmlns="http://www.w3.org/1999/xhtml" id="p2textbox" value="Popup2"/>
+</panel>
+
+<browser id="browser" type="content" src="focus_frameset.html" style="width: 500px; height: 400px"/>
+
+<script type="application/javascript">
+<![CDATA[
+
+var fm = Cc["@mozilla.org/focus-manager;1"].
+ getService(Ci.nsIFocusManager);
+
+function is(l, r, n) { window.arguments[0].SimpleTest.is(l,r,n); }
+function ok(v, n) { window.arguments[0].SimpleTest.ok(v,n); }
+
+function noChildrenTest()
+{
+ // Remove the browser element and test navigation when there are no other documents.
+ // The focus should move or stay on the first focusable element.
+ let browser = document.getElementById("browser");
+ browser.remove();
+
+ let textbox1 = document.getElementById("textbox1");
+ let textbox2 = document.getElementById("textbox2");
+
+ textbox2.focus();
+ next(window, textbox1, "Focus forward when no child documents");
+ next(window, textbox1, "Focus forward again when no child documents");
+
+ textbox2.focus();
+ previous(window, textbox1, "Focus backward when no child documents");
+ previous(window, textbox1, "Focus backward again when no child documents");
+
+ done();
+}
+
+function done()
+{
+ window.close();
+ window.arguments[0].SimpleTest.finish();
+}
+
+function previous(expectedWindow, expectedElement, desc)
+{
+ synthesizeKey("KEY_F6", {shiftKey: true});
+ is(fm.focusedWindow, expectedWindow, desc);
+ is(fm.focusedElement, expectedElement, desc + " element");
+}
+
+function next(expectedWindow, expectedElement, desc)
+{
+ synthesizeKey("KEY_F6");
+ is(fm.focusedWindow, expectedWindow, desc);
+ is(fm.focusedElement, expectedElement, desc + " element" + "::" + (fm.focusedElement ? fm.focusedElement.parentNode.id : "<none>"));
+}
+
+// This test runs through three cases. Document navigation forward and
+// backward using the F6 key when no popups are open, with one popup open and
+// with two popups open.
+function runTests(panel, popupCount)
+{
+ if (!popupCount || popupCount > 2)
+ popupCount = 0;
+
+ fm.clearFocus(window);
+
+ var childwin = document.getElementById("browser").contentWindow;
+
+ if (popupCount) {
+ next(window, document.getElementById("p1textbox"), "First into popup 1 with " + popupCount);
+
+ if (popupCount == 2) {
+ next(window, document.getElementById("p2textbox"), "First into popup 2 with " + popupCount);
+ }
+ }
+
+ next(childwin.frames[0], childwin.frames[0].document.documentElement, "First with " + popupCount);
+ next(childwin.frames[1], childwin.frames[1].document.documentElement, "Second with " + popupCount);
+ previous(childwin.frames[0], childwin.frames[0].document.documentElement, "Second back with " + popupCount);
+
+ if (popupCount) {
+ if (popupCount == 2) {
+ previous(window, document.getElementById("p2textbox"), "First back from popup 2 with " + popupCount);
+ }
+
+ previous(window, document.getElementById("p1textbox"), "First back from popup 1 with " + popupCount);
+ }
+
+ previous(window, document.getElementById("textbox1"), "First back with " + popupCount);
+
+ if (panel == document.getElementById("panel"))
+ document.getElementById("panel2").openPopup(null, "after_start", 100, 20);
+ else if (panel == document.getElementById("panel2"))
+ panel.hidePopup();
+ else
+ document.getElementById("panel").openPopup(null, "after_start");
+}
+
+function start()
+{
+ window.arguments[0].SimpleTest.waitForExplicitFinish();
+ window.arguments[0].SimpleTest.waitForFocus(
+ function() { runTests(null, 0); },
+ document.getElementById("browser").contentWindow);
+}
+
+]]></script>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/window_focus_inner.xhtml b/dom/tests/mochitest/chrome/window_focus_inner.xhtml
new file mode 100644
index 0000000000..6887555fa7
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_focus_inner.xhtml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<window onfocus='dostuff()' xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' style='-moz-user-focus: normal;'>
+<script>
+ function dostuff() {
+ setTimeout(function() {
+ document.documentElement.focus();
+ document.removeChild(document.documentElement);
+ window.opener.focus();
+ }, 100);
+ }
+</script>
+</window>
diff --git a/dom/tests/mochitest/crypto/mochitest.ini b/dom/tests/mochitest/crypto/mochitest.ini
new file mode 100644
index 0000000000..cb87de1391
--- /dev/null
+++ b/dom/tests/mochitest/crypto/mochitest.ini
@@ -0,0 +1 @@
+[test_getRandomValues.html]
diff --git a/dom/tests/mochitest/crypto/test_getRandomValues.html b/dom/tests/mochitest/crypto/test_getRandomValues.html
new file mode 100644
index 0000000000..6281241f46
--- /dev/null
+++ b/dom/tests/mochitest/crypto/test_getRandomValues.html
@@ -0,0 +1,211 @@
+<!DOCTYPE HTML>
+<html><head>
+ <title>Test window.crypto.getRandomValues</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="onWindowLoad()">
+<script class="testbody" type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+
+var testData = [ { len: 32, type: "Int8", pass: true },
+ { len: 32, type: "Int16", pass: true },
+ { len: 32, type: "Int32", pass: true },
+ { len: 32, type: "Uint8", pass: true },
+ { len: 32, type: "Uint16", pass: true },
+ { len: 32, type: "Uint32", pass: true },
+ { len: 65536, type: "Uint8", pass: true },
+ { len: 32, type: "Uint8Clamped", pass: true },
+ { len: 65537, type: "Uint8", pass: false },
+ { len: 32, type: "Float32", pass: false },
+ { len: 32, type: "Float64", pass: false } ];
+
+
+var testCount = 0;
+
+function testNsCryptoGetRandomValues(aLength, aType)
+{
+ var arrayTypes = {
+ Int8: Int8Array,
+ Int16: Int16Array,
+ Int32: Int32Array,
+ Uint8: Uint8Array,
+ Uint16: Uint16Array,
+ Uint32: Uint32Array,
+ Float32: Float32Array,
+ Float64: Float64Array,
+ Uint8Clamped: Uint8ClampedArray,
+ };
+
+ testCount++;
+
+ var buf = new ArrayBuffer(aLength);
+ var arBuf = new arrayTypes[aType](buf);
+
+ var pass = false;
+ var b = window.crypto.getRandomValues(arBuf);
+ ok(b === arBuf, "ArrayBuffer result is argument buffer");
+
+ for (var i = 0; i < arBuf.length; i++) {
+ if (arBuf.length > 6) {
+ // XXXddahl: THIS MIGHT FAIL EVERY FULL MOON, SORRY QA!!!
+ if (arBuf[i] != 0) {
+ pass = true;
+ break;
+ }
+ }
+ else {
+ pass = true;
+ }
+ }
+ is(pass, true, "Non-zero result: " + i + " found in the " + aType + ": " + aLength + " ArrayBufferView");
+}
+
+function onWindowLoad()
+{
+ window.removeEventListener("load", onWindowLoad);
+ var failedWithCorrectError = false;
+ try {
+ for (var i = 0; i < testData.length; i++) {
+ if (testData[i].pass) {
+ try {
+ testNsCryptoGetRandomValues(testData[i].len, testData[i].type, testData[i].pass);
+ }
+ catch (ex) {
+ ok(false, "testNsCryptoGetRandomValues failed, test should have passed: " + testData[i].type);
+ }
+ }
+ else {
+ // failing tests are dealt with here
+ if (i == 8) {
+ try {
+ testNsCryptoGetRandomValues(testData[i].len, testData[i].type, testData[i].pass);
+ }
+ catch (ex) {
+ todo("QuotaExceededError" in window && ex instanceof QuotaExceededError,
+ "Exception was the correct type");
+ failedWithCorrectError = ex.toString().search(/QUOTA_EXCEEDED_ERR/);
+ ok(failedWithCorrectError, "Extended length array buffer fails, NS_ERROR_DOM_QUOTA_EXCEEDED_ERR thrown");
+ }
+ } // 8
+
+ if (i == 9) {
+ try {
+ testNsCryptoGetRandomValues(testData[i].len, testData[i].type, testData[i].pass);
+ }
+ catch (ex) {
+ failedWithCorrectError = ex.toString().search(/TYPE_MISMATCH_ERR/);
+ ok(failedWithCorrectError,
+ "Expected TYPE_MISMATCH_ERR: Float32Array is not valid, got " + ex + ".");
+ }
+ } // 9
+
+ if (i == 10) {
+ try {
+ testNsCryptoGetRandomValues(testData[i].len, testData[i].type, testData[i].pass);
+ }
+ catch (ex) {
+ failedWithCorrectError = ex.toString().search(/TYPE_MISMATCH_ERR/);
+ ok(failedWithCorrectError,
+ "Expected TYPE_MISMATCH_ERR: Float64Array is not valid, got " + ex + ".");
+ }
+ }
+ }
+ } // end main for loop
+ }
+ catch (ex) {
+ ok(false, "Unexpected Error: " + ex);
+ }
+ // Count the tests in the testData array
+ ok(testCount == 11, "11 tests run via testData");
+
+ // Test a null argument
+ try {
+ window.crypto.getRandomValues(null);
+ }
+ catch (ex) {
+ var test = ex.toString().search(/1003|TypeError/);
+ ok((test > -1), "Expected TYPE_ERR, got " + ex + ".");
+ }
+
+ // Test a zero-length buffer view
+ try {
+ var a = new Int8Array(0);
+ window.crypto.getRandomValues(a);
+ ok(a[0] === undefined, "The array buffer is unchanged, still 0 length");
+ }
+ catch (ex) {
+ ok(false, "A zero-length array buffer view should not fail");
+ }
+
+ // Test a one-length buffer view
+ var randomVal = 0;
+ // The probability of getRandomValues generating a zero value is 1/256 so we
+ // run this in a loop until it returns a non-zero value to guard against
+ // false failures
+ do {
+ try {
+ var a = new Uint8Array(1);
+ var b = window.crypto.getRandomValues(a);
+ randomVal = a[0];
+ ok(a === b, "ArrayBuffer result is argument buffer");
+ }
+ catch (ex) {
+ ok(false, "A one-length array buffer view should not fail");
+ }
+ }
+ while (randomVal == 0);
+ ok(randomVal !== 0, "The array buffer eventually had one random value");
+
+ // Test a 16 byte length buffer
+ var testConfig = { len: 16, type: "Int8", pass: true };
+ testNsCryptoGetRandomValues(testConfig.len,
+ testConfig.type,
+ testConfig.pass);
+
+ // Test a 31 byte length buffer
+ testConfig = { len: 31, type: "Int8", pass: true };
+ testNsCryptoGetRandomValues(testConfig.len,
+ testConfig.type,
+ testConfig.pass);
+
+ // Test a 33 byte length buffer
+ testConfig = { len: 33, type: "Int8", pass: true };
+ testNsCryptoGetRandomValues(testConfig.len,
+ testConfig.type,
+ testConfig.pass);
+
+ // Test a range of an array buffer view
+ var buffer = new ArrayBuffer(32);
+ var view = new Int8Array(buffer, 0, 16);
+ var view2 = new Int8Array(buffer, 16, 16);
+ for (var i = 0; i < view2.byteLength; i++) {
+ view2[i] = 1;
+ }
+ var b = window.crypto.getRandomValues(view);
+ ok(b === view, "ArrayBuffer result is argument buffer");
+ for (var i = 0; i < view.byteLength; i++) {
+ is(view2[i], 1, "view2 is unchanged");
+ }
+
+ // test an offset view
+ var result = false;
+ var b = window.crypto.getRandomValues(view2);
+ for (var i = 0; i < view2.length; i++) {
+ if (view2[i] != 1) {
+ result = true;
+ break;
+ }
+ }
+ ok(result, "view2 has been updated correctly");
+ ok(b === view2, "ArrayBuffer result is argument buffer");
+ // test the return value
+ buffer = new ArrayBuffer(32);
+ view = new Int8Array(buffer, 0, 16);
+ var retval = window.crypto.getRandomValues(view);
+ ok(view === retval, "The view and return value are the same");
+
+ SimpleTest.finish();
+}
+</script>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level0/child_ip_address.html b/dom/tests/mochitest/dom-level0/child_ip_address.html
new file mode 100644
index 0000000000..24c1f0ba30
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/child_ip_address.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Child window at 127.0.0.1</title>
+ <script type="application/javascript">
+function run()
+{
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+
+ var message = "child-response";
+
+ var domain = document.domain;
+ if (domain !== "127.0.0.1")
+ message += " wrong-initial-domain(" + domain + ")";
+
+ try
+ {
+ document.domain = "0.0.1";
+ domain = document.domain;
+ message += " ip-address-shortened-to(" + domain + ")";
+ }
+ catch (e)
+ {
+ domain = document.domain;
+ if (domain !== "127.0.0.1")
+ message += " ip-address-mutated-on-throw(" + domain + ")";
+ }
+
+ window.parent.postMessage(message, "http://mochi.test:8888");
+}
+
+window.addEventListener("load", run);
+ </script>
+</head>
+<body>
+<h1 id="location">Somewhere!</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/file_crossdomainprops_inner.html b/dom/tests/mochitest/dom-level0/file_crossdomainprops_inner.html
new file mode 100644
index 0000000000..8ffaa87a97
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/file_crossdomainprops_inner.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script>
+ var myVar = 10;
+ </script>
+</head>
+<body>
+inner
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/file_location.html b/dom/tests/mochitest/dom-level0/file_location.html
new file mode 100644
index 0000000000..3a74b32d18
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/file_location.html
@@ -0,0 +1,10 @@
+<html>
+ <script>
+ try {
+ parent.SimpleTest.ok(!("existingprop" in location), "got a new location object in the iframe");
+ } catch (e) {
+ }
+
+ location.iframeprop = 42;
+ </script>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/file_separate_post_message_queue.html b/dom/tests/mochitest/dom-level0/file_separate_post_message_queue.html
new file mode 100644
index 0000000000..ce1494e3d2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/file_separate_post_message_queue.html
@@ -0,0 +1,39 @@
+<script>
+
+let runnable1 = {
+ run() {
+ window.opener.callOrder.push("Runnable1");
+ }
+}
+
+let runnable2 = {
+ run() {
+ window.opener.callOrder.push("Runnable2");
+ }
+}
+
+let runnable3 = {
+ run() {
+ window.opener.callOrder.push("Runnable3");
+ }
+}
+
+window.onmessage = function () {
+ window.opener.callOrder.push("PostMessage");
+ if (window.loadCount == 1) {
+ window.loadCount += 1;
+ location.reload();
+ } else {
+ window.opener.onDone();
+ }
+};
+
+// Pushed to normal queue
+SpecialPowers.Services.tm.dispatchToMainThread(runnable1);
+// Pushed to idle queue
+window.postMessage("bar", "*");
+// Pushed to normal queue
+SpecialPowers.Services.tm.dispatchToMainThread(runnable2);
+// Pushed to normal queue
+SpecialPowers.Services.tm.dispatchToMainThread(runnable3);
+</script>
diff --git a/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html b/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html
new file mode 100644
index 0000000000..27cc47ca72
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html
@@ -0,0 +1,19 @@
+<html>
+ <body>
+ <script>
+ var onloadFiredAt;
+
+ let start = performance.now();
+ while (performance.now() - start < 5000);
+
+ window.onload = function() {
+ onloadFiredAt = performance.now();
+ }
+
+ window.addEventListener('message', function(event) {
+ window.parent.postMessage(onloadFiredAt, "*");
+ })
+
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/framed_location.html b/dom/tests/mochitest/dom-level0/framed_location.html
new file mode 100644
index 0000000000..a2b65906f3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/framed_location.html
@@ -0,0 +1,11 @@
+<script>
+ window.parent.postMessage({
+ "hash": window.location.hash,
+ "host": window.location.host,
+ "hostname": window.location.hostname,
+ "origin": window.location.origin,
+ "pathname": window.location.pathname,
+ "port": window.location.port,
+ "protocol": window.location.protocol,
+ }, "*");
+</script>
diff --git a/dom/tests/mochitest/dom-level0/idn_child.html b/dom/tests/mochitest/dom-level0/idn_child.html
new file mode 100644
index 0000000000..7a44d790ea
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/idn_child.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Child window on a site whose "base" domain contains IDN</title>
+ <script type="application/javascript">
+function run()
+{
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+}
+
+function receiveMessage(evt)
+{
+ if (evt.origin !== "http://mochi.test:8888")
+ return;
+
+ var message = evt.data + "-response";
+
+ var domain = document.domain;
+ if (/test$/.test(domain))
+ {
+ if (domain !== "sub1.xn--exaple-kqf.test")
+ message += " wrong-initial-domain(" + domain + ")";
+ }
+ else
+ {
+ if (domain !== "sub1.xn--hxajbheg2az3al.xn--jxalpdlp")
+ message += " wrong-initial-domain(" + domain + ")";
+ }
+
+ switch (location.search)
+ {
+ case "?idn-whitelist":
+ message += idnTest("παράδειγμα.δοκιμή");
+ break;
+
+ case "?punycode-whitelist":
+ message += punycodeTest("xn--hxajbheg2az3al.xn--jxalpdlp");
+ break;
+
+ case "?idn-nowhitelist":
+ message += idnTest("exaмple.test");
+ break;
+
+ case "?punycode-nowhitelist":
+ message += punycodeTest("xn--exaple-kqf.test");
+ break;
+
+ default:
+ message += " unexpected-query(" + location.search + ")";
+ break;
+ }
+
+ evt.source.postMessage(message, evt.origin);
+}
+
+function idnTest(newDomain)
+{
+ var errors = "";
+
+ try
+ {
+ document.domain = newDomain;
+ }
+ catch (e)
+ {
+ errors += " error-thrown-setting-to-idn(" + String(e).split("").join(",") + ")";
+ }
+
+ return errors;
+}
+
+function punycodeTest(newDomain)
+{
+ var errors = "";
+
+ try
+ {
+ document.domain = newDomain;
+ }
+ catch (e)
+ {
+ errors += " error-thrown-setting-to-punycode(" + String(e).split("").join(",") + ")";
+ }
+
+ return errors;
+}
+
+window.addEventListener("message", receiveMessage);
+window.addEventListener("load", run);
+ </script>
+</head>
+<body>
+<h1 id="location">Somewhere!</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/iframe1_location_setters.html b/dom/tests/mochitest/dom-level0/iframe1_location_setters.html
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/iframe1_location_setters.html
@@ -0,0 +1 @@
+1
diff --git a/dom/tests/mochitest/dom-level0/iframe2_location_setters.html b/dom/tests/mochitest/dom-level0/iframe2_location_setters.html
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/iframe2_location_setters.html
@@ -0,0 +1 @@
+2
diff --git a/dom/tests/mochitest/dom-level0/iframe3_location_setters.html b/dom/tests/mochitest/dom-level0/iframe3_location_setters.html
new file mode 100644
index 0000000000..00750edc07
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/iframe3_location_setters.html
@@ -0,0 +1 @@
+3
diff --git a/dom/tests/mochitest/dom-level0/innerWidthHeight_script.html b/dom/tests/mochitest/dom-level0/innerWidthHeight_script.html
new file mode 100644
index 0000000000..08f90111df
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/innerWidthHeight_script.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="width=320,height=320" />
+ <title>Bug 602580 - Test layout viewport and visual viewport sizes with meta tags and changed innerWidth</title>
+ <script class="testbody" type="text/javascript">
+ function runSubTest()
+ {
+ /* CSS viewport is set the by the meta tag in this document. */
+ window.opener.is(document.documentElement.clientWidth, 320, "CSS viewport width is meta viewport width");
+ window.opener.is(document.documentElement.clientHeight, 320, "CSS viewport height is meta viewport height");
+
+ /* Visual viewport values can be changed by setting window.innerWidth and innerHeight. */
+ var oldWidth = window.innerWidth;
+ var oldHeight = window.innerHeight;
+
+ window.innerWidth = 300;
+ window.opener.is(window.innerWidth, 300, "visual viewport width returns set value");
+ window.innerWidth = oldWidth;
+
+ window.innerHeight = 300;
+ window.opener.is(window.innerHeight, 300, "visual viewport height returns set value");
+ window.innerHeight = oldHeight;
+
+ window.opener.finish();
+ }
+ </script>
+</head>
+<body onload="runSubTest()">
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/mochitest.ini b/dom/tests/mochitest/dom-level0/mochitest.ini
new file mode 100644
index 0000000000..8758c63f45
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/mochitest.ini
@@ -0,0 +1,43 @@
+[DEFAULT]
+support-files =
+ child_ip_address.html
+ file_crossdomainprops_inner.html
+ file_location.html
+ file_separate_post_message_queue.html
+ framed_location.html
+ idn_child.html
+ innerWidthHeight_script.html
+ iframe1_location_setters.html
+ iframe2_location_setters.html
+ iframe3_location_setters.html
+ file_test_background_loading_iframes.html
+
+[test_crossdomainprops.html]
+skip-if =
+ http3
+[test_innerWidthHeight_script.html]
+[test_location.html]
+skip-if =
+ http3
+[test_location_framed.html]
+skip-if =
+ http3
+[test_location_getters.html]
+skip-if =
+ http3
+[test_location_sandboxed.html]
+skip-if =
+ http3
+[test_location_setters.html]
+skip-if =
+ http3
+[test_setting_document.domain_idn.html]
+skip-if =
+ http3
+[test_setting_document.domain_to_shortened_ipaddr.html]
+skip-if =
+ http3
+[test_separate_post_message_queue.html]
+[test_background_loading_iframes.html]
+skip-if =
+ http3
diff --git a/dom/tests/mochitest/dom-level0/test_background_loading_iframes.html b/dom/tests/mochitest/dom-level0/test_background_loading_iframes.html
new file mode 100644
index 0000000000..62488557ec
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_background_loading_iframes.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for background loading iframes</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<pre id="test">
+
+<script class="testbody" type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+
+var myLoadTime;
+var receivedPostMessage = [];
+
+window.addEventListener('message', function(event) {
+ receivedPostMessage.push(parseInt(event.data));
+ if (receivedPostMessage.length == 3) {
+ if (!myLoadTime){
+ ok(false, "Child iframes are loaded earlier than the parent document");
+ } else {
+ receivedPostMessage.forEach(function(iframeLoadTime, index) {
+ ok(iframeLoadTime, "Iframe load time should not be null");
+ ok(iframeLoadTime >= myLoadTime, "Parent document should be loaded earlier than child iframes");
+ })
+ }
+ SimpleTest.finish();
+ }
+})
+
+window.onload = function() {
+ myLoadTime = performance.now();
+}
+
+SpecialPowers.pushPrefEnv({"set":[["dom.background_loading_iframe", true]]}).then(async function () {
+ await SpecialPowers.promiseTimeout(0);
+
+ var iframe1 = document.createElement("iframe");
+ var iframe2 = document.createElement("iframe");
+ var iframe3 = document.createElement("iframe");
+
+ iframe1.src = "http://example.org:80/tests/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html";
+ iframe2.src = "http://example.org:80/tests/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html";
+ iframe3.src = "http://example.org:80/tests/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html";
+
+ iframe1.onload = function() {
+ iframe1.contentWindow.postMessage("test", "*");
+ }
+
+ iframe2.onload = function() {
+ iframe2.contentWindow.postMessage("test", "*");
+ }
+
+ iframe3.onload = function() {
+ iframe3.contentWindow.postMessage("test", "*");
+ }
+
+ document.body.append(iframe1);
+ document.body.append(iframe2);
+ document.body.append(iframe3);
+
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_crossdomainprops.html b/dom/tests/mochitest/dom-level0/test_crossdomainprops.html
new file mode 100644
index 0000000000..e0ee42f081
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_crossdomainprops.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Cross domain access to properties</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="runTest()">
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<iframe name="frame1" src="file_crossdomainprops_inner.html"></iframe>
+<iframe name="frame2" src="http://example.com/tests/dom/tests/mochitest/dom-level0/file_crossdomainprops_inner.html"></iframe>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+ ok(frames.frame1.myVar == 10, "access same domain inner window variable");
+ var otherDomainVar = null;
+ try {
+ otherDomainVar = frames.frame2.myVar;
+ }
+ catch (e) {
+ otherDomainVar = -1;
+ }
+ is(otherDomainVar, -1, "access other domain inner window variable");
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_innerWidthHeight_script.html b/dom/tests/mochitest/dom-level0/test_innerWidthHeight_script.html
new file mode 100644
index 0000000000..eff351dabb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_innerWidthHeight_script.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <!--
+ This acts funny when run in the normal content frame
+ so instead We load it in a separate window.
+ -->
+</head>
+<body onload="startTest()">
+ <script class="testbody" type="text/javascript">
+ SimpleTest.waitForExplicitFinish();
+ var newWin = null;
+ function runTest() {
+ newWin = window.open("innerWidthHeight_script.html", '_new', 'width=600,height=400');
+ }
+
+ function finish() {
+ newWin.close();
+ SimpleTest.finish();
+ }
+
+ function startTest() {
+ SpecialPowers.pushPrefEnv({"set": [
+ ["dom.disable_window_move_resize", false],
+ ["ui.useOverlayScrollbars", 1],
+ ["dom.meta-viewport.enabled", true],
+ ["dom.window_position_size_properties_replaceable.enabled", false],
+ ]}, runTest);
+ }
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_location.html b/dom/tests/mochitest/dom-level0/test_location.html
new file mode 100644
index 0000000000..52106395fd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_location.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for location object behaviors</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var count = 0;
+var firstlocation;
+var lastlocation;
+
+function runTest() {
+ ++count;
+ if (count == 1) {
+ firstlocation = $('ifr').contentWindow.location;
+ firstlocation.existingprop = 'fail';
+ firstlocation.href = 'file_location.html';
+ return;
+ }
+
+ if (count == 2) {
+ lastlocation = $('ifr').contentWindow.location;
+ is(lastlocation.iframeprop, 42, 'can read the new prop');
+ ok(firstlocation !== lastlocation, 'got a new location object');
+ // firstlocation should still work.
+ ok(firstlocation.href.indexOf('file_location.html'), 'can read location.href');
+ firstlocation.href = 'http://example.com/tests/dom/tests/mochitest/dom-level0/file_location.html';
+ return;
+ }
+
+ if (count == 3) {
+ var permissionDenied = false;
+ try {
+ var foo = $('ifr').contentWindow.location.href == '';
+ } catch (e) {
+ permissionDenied = /Permission denied/.test(e.message);
+ }
+ ok(permissionDenied, 'correctly threw a permission denied security error when reading location.href');
+
+ permissionDenied = false;
+ try {
+ var foo = $('ifr').contentWindow.location.iframeprop == 42;
+ } catch (e) {
+ permissionDenied = /Permission denied/.test(e.message);
+ }
+ ok(permissionDenied, 'correctly threw a permission denied security error an expando on location');
+
+ firstlocation.href = 'http://mochi.test:8888/tests/dom/tests/mochitest/dom-level0/file_location.html';
+ return;
+ }
+
+ is(lastlocation.iframeprop, 42, 'can still read old values of the location object');
+ ok(lastlocation !== $('ifr').contentWindow.location, 'location objects are distinct');
+ ok(firstlocation.href.indexOf('file_location.html'), 'can read location.href');
+
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+<iframe id="ifr" onload="runTest()"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_location_framed.html b/dom/tests/mochitest/dom-level0/test_location_framed.html
new file mode 100644
index 0000000000..35663cf193
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_location_framed.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>MessageEvent tests</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <p id="display"></p>
+ <pre id="test">
+ <script>
+ SimpleTest.waitForExplicitFinish();
+
+ window.addEventListener('message', function (e) {
+ console.log(e);
+ console.dir(e);
+ var loc = e.data;
+ is(loc.hash, '', 'Unexpected hash.');
+ is(loc.host, 'mochi.test:8888', 'Unexpected host.');
+ is(loc.hostname, 'mochi.test', 'Unexpected hostname.');
+ is(loc.origin, 'http://mochi.test:8888', 'Unexpected origin.');
+ is(loc.pathname, '/tests/dom/tests/mochitest/dom-level0/framed_location.html', 'Unexpected pathname.');
+ is(loc.port, '8888', 'Unexpected port.');
+ is(loc.protocol, 'http:', 'Unexpected protocol.');
+ SimpleTest.finish();
+ });
+ </script>
+ <iframe src="framed_location.html"></iframe>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_location_getters.html b/dom/tests/mochitest/dom-level0/test_location_getters.html
new file mode 100644
index 0000000000..1f1ce1215b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_location_getters.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>MessageEvent tests</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="test()">
+ <p id="display"></p>
+ <pre id="test">
+ <script>
+ SimpleTest.waitForExplicitFinish();
+
+ function test()
+ {
+ var loc = window.location;
+ is(loc.hash, '', 'Unexpected hash.');
+ is(loc.host, 'mochi.test:8888', 'Unexpected host.');
+ is(loc.hostname, 'mochi.test', 'Unexpected hostname.');
+ is(loc.origin, 'http://mochi.test:8888', 'Unexpected origin.');
+ is(loc.pathname, '/tests/dom/tests/mochitest/dom-level0/test_location_getters.html', 'Unexpected pathname.');
+ is(loc.port, '8888', 'Unexpected port.');
+ is(loc.protocol, 'http:', 'Unexpected protocol.');
+ SimpleTest.finish();
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_location_sandboxed.html b/dom/tests/mochitest/dom-level0/test_location_sandboxed.html
new file mode 100644
index 0000000000..3872bad793
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_location_sandboxed.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>MessageEvent tests</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <p id="display"></p>
+ <pre id="test">
+ <script>
+ SimpleTest.waitForExplicitFinish();
+
+ window.addEventListener('message', function (e) {
+ console.log(e);
+ console.dir(e);
+ var loc = e.data;
+ is(loc.hash, '', 'Unexpected hash.');
+ is(loc.host, 'mochi.test:8888', 'Unexpected host.');
+ is(loc.hostname, 'mochi.test', 'Unexpected hostname.');
+ // Is this correct? It matches WebKit, but it seems wrong:
+ // https://bugs.webkit.org/show_bug.cgi?id=106488
+ is(loc.origin, 'http://mochi.test:8888', 'Unexpected origin.');
+ is(loc.pathname, '/tests/dom/tests/mochitest/dom-level0/framed_location.html', 'Unexpected pathname.');
+ is(loc.port, '8888', 'Unexpected port.');
+ is(loc.protocol, 'http:', 'Unexpected protocol.');
+ SimpleTest.finish();
+ });
+ </script>
+ <iframe sandbox="allow-scripts" src="framed_location.html"></iframe>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_location_setters.html b/dom/tests/mochitest/dom-level0/test_location_setters.html
new file mode 100644
index 0000000000..e97ada110a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_location_setters.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=639720
+-->
+<head>
+ <title>Test for Bug 639720</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=639720">Mozilla Bug 639720</a>
+<p id="display">
+ <iframe id="f"></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 639720 **/
+SimpleTest.waitForExplicitFinish();
+
+var BASE_URI = "http://mochi.test:8888/tests/dom/tests/mochitest/dom-level0/";
+var tests = [
+ { url: BASE_URI + "iframe1_location_setters.html" },
+ { url: BASE_URI + "iframe2_location_setters.html",
+ useDocument: true },
+ { prepURL: "http://www.example.com",
+ url: BASE_URI + "iframe3_location_setters.html" }
+];
+
+var currentTest = 0;
+
+function checkTest() {
+ is($("f").contentWindow.location.href, tests[currentTest].url,
+ "href of content window's location should match url of current test");
+ ++currentTest;
+ runNextTest();
+}
+
+function runCurrentTest() {
+ var test = tests[currentTest];
+ $("f").onload = checkTest;
+ if (test.useDocument) {
+ $("f").contentDocument.location = test.url;
+ } else {
+ $("f").contentWindow.location = test.url;
+ }
+ is(typeof($("f").contentWindow.location), "object",
+ "Location should not have become string");
+}
+
+function prepComplete() {
+ runCurrentTest();
+}
+
+function runNextTest() {
+ if (currentTest == tests.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ var test = tests[currentTest];
+ if ("prepURL" in test) {
+ $("f").onload = prepComplete;
+ $("f").src = test.prepURL;
+ return;
+ }
+
+ runCurrentTest();
+}
+
+addLoadEvent(runNextTest);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_separate_post_message_queue.html b/dom/tests/mochitest/dom-level0/test_separate_post_message_queue.html
new file mode 100644
index 0000000000..357faa6b09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_separate_post_message_queue.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for using separate event queue for post messages during page load behaviors</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+var tab;
+var callOrder = [];
+function onDone() {
+ tab.close();
+ isDeeply(callOrder, ["Runnable1", "Runnable2", "Runnable3", "PostMessage",
+ "Runnable1", "Runnable2", "Runnable3", "PostMessage"], "Runnables should be fired prior to PostMessage");
+ SimpleTest.finish();
+}
+
+SpecialPowers.pushPrefEnv({"set":[["dom.separate_event_queue_for_post_message.enabled", true]]}, function () {
+ tab = window.open('file_separate_post_message_queue.html');
+ tab.loadCount = 1;
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html b/dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html
new file mode 100644
index 0000000000..b6e8c05462
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html
@@ -0,0 +1,153 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Setting document.domain and IDN</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+
+<!--
+
+This test checks that the value of document.domain is always punycode,
+no matter if the TLD is whitelisted or not.
+Prior to bug 945240 that was not true.
+
+-->
+
+<div>
+<h2>Whitelisted</h2>
+<iframe name="idnKidWhitelist" src="http://sub1.παράδειγμα.δοκιμή/tests/dom/tests/mochitest/dom-level0/idn_child.html?idn-whitelist"></iframe>
+<iframe name="punycodeKidWhitelist" src="http://sub1.παράδειγμα.δοκιμή/tests/dom/tests/mochitest/dom-level0/idn_child.html?punycode-whitelist"></iframe>
+</div>
+
+<div>
+<h2>Not whitelisted</h2>
+<iframe name="idnKidNoWhitelist" src="http://sub1.exaмple.test/tests/dom/tests/mochitest/dom-level0/idn_child.html?idn-nowhitelist"></iframe>
+<iframe name="punycodeKidNoWhitelist" src="http://sub1.exaмple.test/tests/dom/tests/mochitest/dom-level0/idn_child.html?punycode-nowhitelist"></iframe>
+</div>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var gotIDNNoWhitelist = false;
+var gotPunycodeNoWhitelist = false;
+var gotIDNWhitelist = false;
+var gotPunycodeWhitelist = false;
+
+var whitelistRegex =
+ new RegExp("^http://sub1\\.παράδειγμα\\.δοκιμή/tests/dom/tests/" +
+ "mochitest/dom-level0/idn_child\\.html\\?(.+)$");
+
+var noWhitelistRegex =
+ new RegExp("^http://sub1\\.exaмple\\.test/tests/dom/tests/" +
+ "mochitest/dom-level0/idn_child\\.html\\?(.+)$");
+
+var state = 0;
+
+var messages =
+ [
+ "idn-whitelist",
+ "punycode-whitelist",
+ "idn-nowhitelist",
+ "punycode-nowhitelist",
+ ];
+
+
+function receiveMessage(evt)
+{
+ var origin = evt.origin;
+ var match;
+ if (/test$/.test(origin))
+ {
+ is(evt.origin, "http://sub1.xn--exaple-kqf.test", "wrong sender");
+ }
+ else
+ {
+ is(evt.origin, "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp", "wrong sender");
+ }
+
+ is(messages[state] + "-response", evt.data.split(" ")[0],
+ "unexpected data: " + evt.data);
+
+ switch (messages[state])
+ {
+ case "idn-whitelist":
+ gotIDNWhitelist = true;
+ ok(evt.source === window.frames.idnKidWhitelist, "wrong source");
+ is(evt.data, "idn-whitelist-response", "wrong response for IDN");
+ break;
+
+ case "punycode-whitelist":
+ gotPunycodeWhitelist = true;
+ ok(evt.source === window.frames.punycodeKidWhitelist, "wrong source");
+ is(evt.data, "punycode-whitelist-response", "wrong response for punycode");
+ break;
+
+ case "idn-nowhitelist":
+ gotIDNNoWhitelist = true;
+ ok(evt.source === window.frames.idnKidNoWhitelist, "wrong source");
+ is(evt.data, "idn-nowhitelist-response", "wrong response for IDN");
+ break;
+
+ case "punycode-nowhitelist":
+ gotPunycodeNoWhitelist = true;
+ ok(evt.source === window.frames.punycodeKidNoWhitelist, "wrong source");
+ is(evt.data, "punycode-nowhitelist-response", "wrong response for punycode");
+ break;
+
+ default:
+ ok(false, "unreached");
+ break;
+ }
+
+ state++;
+}
+
+function* rungen() {
+ var target = window.frames.idnKidWhitelist;
+ target.postMessage("idn-whitelist", "http://sub1.παράδειγμα.δοκιμή");
+ receiveMessage(yield);
+
+ ok(gotIDNWhitelist, "IDN whitelist message not received");
+
+ var target = window.frames.punycodeKidWhitelist;
+ target.postMessage("punycode-whitelist", "http://sub1.παράδειγμα.δοκιμή");
+
+ receiveMessage(yield);
+
+ ok(gotPunycodeWhitelist, "punycode whitelist message not received");
+
+ var target = window.frames.idnKidNoWhitelist;
+ target.postMessage("idn-nowhitelist", "http://sub1.exaмple.test");
+
+ receiveMessage(yield);
+
+ ok(gotIDNNoWhitelist, "IDN no-whitelist message not received");
+
+ var target = window.frames.punycodeKidNoWhitelist;
+ target.postMessage("punycode-nowhitelist",
+ "http://sub1.exaмple.test");
+
+ receiveMessage(yield);
+
+ ok(gotPunycodeNoWhitelist,
+ "punycode no-whitelist message not received");
+
+ SimpleTest.finish();
+}
+
+var gen = rungen();
+window.addEventListener("message", (m) => gen.next(m));
+window.addEventListener("load", () => gen.next());
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html b/dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html
new file mode 100644
index 0000000000..a80532fe57
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>document.domain can't be meaningfully set on pages at IP address hosts</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+
+<iframe id="childframe" name="child"></iframe>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveMessage(evt)
+{
+ is(evt.origin, "http://127.0.0.1:8888", "wrong sender");
+ ok(evt.source === window.frames.child, "wrong sender");
+
+ is(evt.data, "child-response", "got wrong response");
+
+ SimpleTest.finish();
+}
+window.addEventListener("message", receiveMessage);
+
+// By default, proxies don't apply to 127.0.0.1.
+// We need them to for this test (at least on android), though:
+SpecialPowers.pushPrefEnv({set: [
+ ["network.proxy.allow_hijacking_localhost", true]
+]}).then(function() {
+ var iframe = document.getElementById("childframe");
+ iframe.src = "http://127.0.0.1:8888/tests/dom/tests/mochitest/dom-level0/child_ip_address.html";
+});
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/DOMTestCase.js b/dom/tests/mochitest/dom-level1-core/DOMTestCase.js
new file mode 100644
index 0000000000..3c5aed5056
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/DOMTestCase.js
@@ -0,0 +1,699 @@
+/*
+Copyright (c) 2001-2005 World Wide Web Consortium,
+(Massachusetts Institute of Technology, Institut National de
+Recherche en Informatique et en Automatique, Keio University). All
+Rights Reserved. This program is distributed under the W3C's Software
+Intellectual Property License. This program is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.
+See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+*/
+
+function assertNull(descr, actual) {
+ return ok(actual === null, descr);
+}
+
+
+function assertNotNull(descr, actual) {
+ return ok(actual !== null, descr);
+}
+
+function assertTrue(descr, actual) {
+ return ok(actual === true, descr);
+}
+
+function assertFalse(descr, actual) {
+ return ok(actual === false, descr);
+}
+
+function assertEquals(descr, expected, actual) {
+ return is(expected, actual, descr);
+}
+
+ function assertSize(descr, expected, actual) {
+ ok(actual !== null, descr);
+ // Work around too strict checks.
+ if (!actual) {
+ ok(actual, "[assertSize()] 'actual' has a value");
+ return;
+ }
+
+ is(actual.length, expected, descr);
+ }
+
+ function assertEqualsAutoCase(context, descr, expected, actual) {
+ if (builder.contentType == "text/html") {
+ if(context == "attribute") {
+ is(actual.toLowerCase(), expected.toLowerCase(), descr);
+ } else {
+ is(actual, expected.toUpperCase(), descr);
+ }
+ } else {
+ is(expected, actual, descr);
+ }
+ }
+
+
+ function assertEqualsCollectionAutoCase(context, descr, expected, actual) {
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+
+ //
+ // if there length is the same, then every entry in the expected list
+ // must appear once and only once in the actual list
+ var expectedLen = expected.length;
+ var expectedValue;
+ var actualLen = actual.length;
+ var i;
+ var j;
+ var matches;
+ for(i = 0; i < expectedLen; i++) {
+ matches = 0;
+ expectedValue = expected[i];
+ for(j = 0; j < actualLen; j++) {
+ if (builder.contentType == "text/html") {
+ if (context == "attribute") {
+ if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
+ matches++;
+ }
+ } else {
+ if (expectedValue.toUpperCase() == actual[j]) {
+ matches++;
+ }
+ }
+ } else {
+ if(expectedValue == actual[j]) {
+ matches++;
+ }
+ }
+ }
+ if(matches == 0) {
+ ok(false, descr + ": No match found for " + expectedValue);
+ }
+ if(matches > 1) {
+ ok(false, descr + ": Multiple matches found for " + expectedValue);
+ }
+ }
+ }
+
+ function assertEqualsCollection(descr, expected, actual) {
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ //
+ // if there length is the same, then every entry in the expected list
+ // must appear once and only once in the actual list
+ var expectedLen = expected.length;
+ var expectedValue;
+ var actualLen = actual.length;
+ var i;
+ var j;
+ var matches;
+ for(i = 0; i < expectedLen; i++) {
+ matches = 0;
+ expectedValue = expected[i];
+ for(j = 0; j < actualLen; j++) {
+ if(expectedValue == actual[j]) {
+ matches++;
+ }
+ }
+ if(matches == 0) {
+ ok(false, descr + ": No match found for " + expectedValue);
+ }
+ if(matches > 1) {
+ ok(false, descr + ": Multiple matches found for " + expectedValue);
+ }
+ }
+ }
+
+
+ function assertEqualsListAutoCase(context, descr, expected, actual) {
+ var minLength = expected.length;
+ if (actual.length < minLength) {
+ minLength = actual.length;
+ }
+ //
+ for(var i = 0; i < minLength; i++) {
+ assertEqualsAutoCase(context, descr, expected[i], actual[i]);
+ }
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ }
+
+
+ function assertEqualsList(descr, expected, actual) {
+ var minLength = expected.length;
+ if (actual.length < minLength) {
+ minLength = actual.length;
+ }
+ //
+ for(var i = 0; i < minLength; i++) {
+ if(expected[i] != actual[i]) {
+ is(actual[i], expected[i], descr);
+ }
+ }
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ }
+
+ function assertInstanceOf(descr, type, obj) {
+ if(type == "Attr") {
+ is(2, obj.nodeType, descr);
+ var specd = obj.specified;
+ }
+/*
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_is(type, "Attr", "[DOMTestCase.assertInstanceOf()] Fake default check.");
+ }
+*/
+ }
+
+ function assertSame(descr, expected, actual) {
+ if(expected != actual) {
+ is(expected.nodeType, actual.nodeType, descr);
+ is(expected.nodeValue, actual.nodeValue, descr);
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(expected, actual, "[DOMTestCase.assertSame()] Fake default check." +
+ " (Type=" + actual.nodeType + ", Value=" + actual.nodeValue + ")");
+ }
+ }
+
+ function assertURIEquals(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) {
+ //
+ // URI must be non-null
+ ok(assertID, "[assertURIEquals()] 'assertID' has a value");
+ ok(actual, "[assertURIEquals()] 'actual' has a value");
+/*
+ // Add missing early return.
+ if (!actual)
+ return;
+*/
+
+ var uri = actual;
+
+ var lastPound = actual.lastIndexOf("#");
+ var actualFragment = "";
+ if(lastPound != -1) {
+ //
+ // substring before pound
+ //
+ uri = actual.substring(0,lastPound);
+ actualFragment = actual.substring(lastPound+1);
+ }
+ if(fragment != null) is(actualFragment, fragment, assertID);
+
+ var lastQuestion = uri.lastIndexOf("?");
+ var actualQuery = "";
+ if(lastQuestion != -1) {
+ //
+ // substring before pound
+ //
+ uri = actual.substring(0,lastQuestion);
+ actualQuery = actual.substring(lastQuestion+1);
+ }
+ if(query != null) is(actualQuery, query, assertID);
+
+ var firstColon = uri.indexOf(":");
+ var firstSlash = uri.indexOf("/");
+ var actualPath = uri;
+ var actualScheme = "";
+ if(firstColon != -1 && firstColon < firstSlash) {
+ actualScheme = uri.substring(0,firstColon);
+ actualPath = uri.substring(firstColon + 1);
+ }
+
+ if(scheme != null) {
+ is(scheme, actualScheme, assertID);
+ }
+
+ if(path != null) {
+ is(path, actualPath, assertID);
+ }
+
+ if(host != null) {
+ var actualHost = "";
+ if(actualPath.substring(0,2) == "//") {
+ var termSlash = actualPath.substring(2).indexOf("/") + 2;
+ actualHost = actualPath.substring(0,termSlash);
+ }
+ is(actualHost, host, assertID);
+ }
+
+ if(file != null || name != null) {
+ var actualFile = actualPath;
+ var finalSlash = actualPath.lastIndexOf("/");
+ if(finalSlash != -1) {
+ actualFile = actualPath.substring(finalSlash+1);
+ }
+ if (file != null) {
+ is(actualFile, file, assertID);
+ }
+ if (name != null) {
+ var actualName = actualFile;
+ var finalDot = actualFile.lastIndexOf(".");
+ if (finalDot != -1) {
+ actualName = actualName.substring(0, finalDot);
+ }
+ is(actualName, name, assertID);
+ }
+ }
+
+ if(isAbsolute != null) {
+ is(actualPath.substring(0,1) == "/", isAbsolute, assertID);
+ }
+ }
+
+
+// size() used by assertSize element
+function size(collection)
+{
+ return collection.length;
+}
+
+function same(expected, actual)
+{
+ return expected === actual;
+}
+
+function getSuffix(contentType) {
+ switch(contentType) {
+ case "text/html":
+ return ".html";
+
+ case "text/xml":
+ return ".xml";
+
+ case "application/xhtml+xml":
+ return ".xhtml";
+
+ case "image/svg+xml":
+ return ".svg";
+
+ case "text/mathml":
+ return ".mml";
+ }
+ return ".html";
+}
+
+function equalsAutoCase(context, expected, actual) {
+ if (builder.contentType == "text/html") {
+ if (context == "attribute") {
+ return expected.toLowerCase() == actual;
+ }
+ return expected.toUpperCase() == actual;
+ }
+ return expected == actual;
+}
+
+function catchInitializationError(blder, ex) {
+ if (blder == null) {
+ alert(ex);
+ } else {
+ blder.initializationError = ex;
+ blder.initializationFatalError = ex;
+ }
+}
+
+function checkInitialization(blder, testname) {
+ if (blder.initializationError != null) {
+ // Fake a "warn()" function, as it was missing :-|
+ function warn(msg) {
+ info("[checkInitialization() warning] " + msg);
+ }
+
+ if (blder.skipIncompatibleTests) {
+ warn(testname + " not run:" + blder.initializationError);
+ return blder.initializationError;
+ } else {
+ //
+ // if an exception was thrown
+ // rethrow it and do not run the test
+ if (blder.initializationFatalError != null) {
+ throw blder.initializationFatalError;
+ } else {
+ //
+ // might be recoverable, warn but continue the test
+ warn(testname + ": " + blder.initializationError);
+ }
+ }
+ }
+ return null;
+}
+function createTempURI(scheme) {
+ if (scheme == "http") {
+ return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
+ }
+ return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
+}
+
+
+function EventMonitor() {
+ this.atEvents = new Array();
+ this.bubbledEvents = new Array();
+ this.capturedEvents = new Array();
+ this.allEvents = new Array();
+}
+
+EventMonitor.prototype.handleEvent = function(evt) {
+ switch(evt.eventPhase) {
+ case 1:
+ monitor.capturedEvents[monitor.capturedEvents.length] = evt;
+ break;
+
+ case 2:
+ monitor.atEvents[monitor.atEvents.length] = evt;
+ break;
+
+ case 3:
+ monitor.bubbledEvents[monitor.bubbledEvents.length] = evt;
+ break;
+ }
+ monitor.allEvents[monitor.allEvents.length] = evt;
+}
+
+function DOMErrorImpl(err) {
+ this.severity = err.severity;
+ this.message = err.message;
+ this.type = err.type;
+ this.relatedException = err.relatedException;
+ this.relatedData = err.relatedData;
+ this.location = err.location;
+}
+
+
+
+function DOMErrorMonitor() {
+ this.allErrors = new Array();
+}
+
+DOMErrorMonitor.prototype.handleError = function(err) {
+ errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err);
+}
+
+DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) {
+ var i;
+ for (i = 0; i < errorMonitor.allErrors.length; i++) {
+ if (errorMonitor.allErrors[i].severity >= severity) {
+ assertEquals(id, severity - 1, errorMonitor.allErrors[i].severity);
+ }
+ }
+}
+
+function UserDataNotification(operation, key, data, src, dst) {
+ this.operation = operation;
+ this.key = key;
+ this.data = data;
+ this.src = src;
+ this.dst = dst;
+}
+
+function UserDataMonitor() {
+ this.allNotifications = new Array();
+}
+
+UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
+ userDataMonitor.allNotifications[this.allNotifications.length] =
+ new UserDataNotification(operation, key, data, src, dst);
+}
+
+
+
+function IFrameBuilder() {
+ this.contentType = "text/html";
+ this.supportedContentTypes = [ "text/html",
+ "text/xml",
+ "image/svg+xml",
+ "application/xhtml+xml" ];
+
+ this.supportsAsyncChange = false;
+ this.async = true;
+ this.fixedAttributeNames = [
+ "validating", "expandEntityReferences", "coalescing",
+ "signed", "hasNullString", "ignoringElementContentWhitespace", "namespaceAware", "ignoringComments", "schemaValidating"];
+
+ this.fixedAttributeValues = [false, true, false, true, true , false, false, true, false ];
+ this.configurableAttributeNames = [ ];
+ this.configurableAttributeValues = [ ];
+ this.initializationError = null;
+ this.initializationFatalError = null;
+ this.skipIncompatibleTests = false;
+}
+
+IFrameBuilder.prototype.hasFeature = function(feature, version) {
+ return document.implementation.hasFeature(feature, version);
+}
+
+IFrameBuilder.prototype.getImplementation = function() {
+ return document.implementation;
+}
+
+IFrameBuilder.prototype.setContentType = function(contentType) {
+ this.contentType = contentType;
+ if (contentType == "text/html") {
+ this.fixedAttributeValues[6] = false;
+ } else {
+ this.fixedAttributeValues[6] = true;
+ }
+}
+
+
+
+IFrameBuilder.prototype.preload = function(frame, varname, url) {
+ var suffix;
+ if (this.contentType == "text/html" || this.contentType == "application/xhtml+xml") {
+ if (url.substring(0,5) == "staff" || url == "nodtdstaff" || url == "datatype_normalization") {
+ suffix = ".xml";
+ }
+ }
+
+ if (!suffix) suffix = getSuffix(this.contentType);
+
+ var iframe = document.createElement("iframe");
+ var srcname = url + suffix;
+ iframe.setAttribute("name", srcname);
+ iframe.setAttribute("src", fileBase + srcname);
+ //
+ // HTML and XHTML have onload attributes that will invoke loadComplete
+ //
+ if (suffix.indexOf("html") < 0) {
+ iframe.addEventListener("load", loadComplete, false);
+ }
+ document.getElementsByTagName("body").item(0).appendChild(iframe);
+ return 0;
+}
+
+IFrameBuilder.prototype.load = function(frame, varname, url) {
+ var suffix;
+ if (url.substring(0,5) == "staff" || url == "nodtdstaff" || url == "datatype_normalization") {
+ suffix = ".xml";
+ }
+ if (!suffix) suffix = getSuffix(this.contentType);
+ var name = url + suffix;
+ var iframes = document.getElementsByTagName("iframe");
+ for(var i = 0; i < iframes.length; i++) {
+ if (iframes.item(i).getAttribute("name") == name) {
+ var item = iframes.item(i);
+ if (typeof(item.contentDocument) != 'undefined') {
+ return item.contentDocument;
+ }
+ if (typeof(item.document) != 'undefined') {
+ return item.document;
+ }
+ return null;
+ }
+ }
+ return null;
+}
+
+IFrameBuilder.prototype.getImplementationAttribute = function(attr) {
+ for (var i = 0; i < this.fixedAttributeNames.length; i++) {
+ if (this.fixedAttributeNames[i] == attr) {
+ return this.fixedAttributeValues[i];
+ }
+ }
+ throw "Unrecognized implementation attribute: " + attr;
+}
+
+
+
+IFrameBuilder.prototype.setImplementationAttribute = function(attribute, value) {
+ var supported = this.getImplementationAttribute(attribute);
+ if (supported != value) {
+ this.initializationError = "IFrame loader does not support " + attribute + "=" + value;
+ }
+}
+
+
+IFrameBuilder.prototype.canSetImplementationAttribute = function(attribute, value) {
+ var supported = this.getImplementationAttribute(attribute);
+ return (supported == value);
+}
+
+
+function createBuilder(implementation) {
+ if (implementation == null) {
+ return new IFrameBuilder();
+ }
+ switch(implementation) {
+/* case "msxml3":
+ return new MSXMLBuilder("Msxml2.DOMDocument.3.0");
+
+ case "msxml4":
+ return new MSXMLBuilder("Msxml2.DOMDocument.4.0");*/
+
+ case "mozillaXML":
+ return new MozillaXMLBuilder();
+/*
+ case "svgplugin":
+ return new SVGPluginBuilder();
+
+ case "dom3ls":
+ return new DOM3LSBuilder(); */
+
+ case "iframe":
+ return new IFrameBuilder();
+
+ case "xmlhttprequest":
+ return new XMLHttpRequestBuilder();
+
+ default:
+ alert ("unrecognized implementation " + implementation);
+ }
+ return new IFrameBuilder();
+}
+
+function checkFeature(feature, version)
+{
+ if (!builder.hasFeature(feature, version))
+ {
+ //
+ // don't throw exception so that users can select to ignore the precondition
+ //
+ builder.initializationError = "builder does not support feature " + feature + " version " + version;
+ }
+}
+
+function createConfiguredBuilder() {
+ var builder = null;
+ var contentType = null;
+ var i;
+ var contentTypeSet = false;
+ var parm = null;
+ builder = new IFrameBuilder();
+ return builder;
+}
+
+
+function preload(frame, varname, url) {
+ return builder.preload(frame, varname, url);
+}
+
+function load(frame, varname, url) {
+ return builder.load(frame, varname, url);
+}
+
+function getImplementationAttribute(attr) {
+ return builder.getImplementationAttribute(attr);
+}
+
+
+function setImplementationAttribute(attribute, value) {
+ builder.setImplementationAttribute(attribute, value);
+}
+
+function setAsynchronous(value) {
+ if (builder.supportsAsyncChange) {
+ builder.async = value;
+ } else {
+ update();
+ }
+}
+
+
+function createXPathEvaluator(doc) {
+ try {
+ return doc.getFeature("XPath", null);
+ }
+ catch(ex) {
+ }
+ return doc;
+}
+
+function toLowerArray(src) {
+ var newArray = new Array();
+ var i;
+ for (i = 0; i < src.length; i++) {
+ newArray[i] = src[i].toLowerCase();
+ }
+ return newArray;
+}
+
+function MSXMLBuilder_onreadystatechange() {
+ if (builder.parser.readyState == 4) {
+ loadComplete();
+ }
+}
+
+
+
+var fileBase = location.href;
+if (fileBase.indexOf('?') != -1) {
+ fileBase = fileBase.substring(0, fileBase.indexOf('?'));
+}
+fileBase = fileBase.substring(0, fileBase.lastIndexOf('/') + 1) + "files/";
+
+function getResourceURI(name, scheme, contentType) {
+ return fileBase + name + getSuffix(contentType);
+}
+
+
+function getImplementation() {
+ return builder.getImplementation();
+}
+
+// Count of failures overridden as todos.
+var gFailuresAsTodos = 0;
+
+// Override SimpleTest result logger.
+var ST_logResult = SimpleTest._logResult;
+SimpleTest._logResult = function overrideSTlR(test, passString, failString) {
+ if (todoTests[docName] && !test.result && !test.todo) {
+ test.name = "[failure as todo] " + test.name;
+ test.todo = true;
+ failString = "TEST-KNOWN-FAIL";
+
+ ++gFailuresAsTodos;
+ }
+
+ ST_logResult(test, passString, failString);
+}
+
+// Actual marking code is in overrideSTlR() now.
+function markTodos() {
+ if (todoTests[docName]) {
+ isnot(gFailuresAsTodos, 0, "test marked todo should have failed somewhere");
+ }
+}
+
+function runJSUnitTests() {
+ try {
+ var tests = exposeTestFunctionNames();
+ for (var i = 0; i < tests.length; i++) {
+ window[tests[i]]();
+ }
+ } catch (ex) {
+ if (todoTests[docName]) {
+ todo(false, "[failure as todo] Test threw exception: " + ex);
+ ++gFailuresAsTodos;
+ } else {
+ ok(false, "Test threw exception: " + ex);
+ }
+ }
+}
diff --git a/dom/tests/mochitest/dom-level1-core/activity-home.css b/dom/tests/mochitest/dom-level1-core/activity-home.css
new file mode 100644
index 0000000000..a68242d4fd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/activity-home.css
@@ -0,0 +1,127 @@
+/* Copyright 1997-2003 W3C (MIT, ERCIM, Keio). All Rights Reserved.
+ The following software licensing rules apply:
+ http://www.w3.org/Consortium/Legal/copyright-software */
+
+/* $Id: activity-home.css,v 1.4 2003/01/17 22:44:17 slesch Exp $ */
+
+/* Single style sheet for ALL activity Home pages please
+** Tim
+** We need consistency on our web site - Nov 99 AC meeting
+** Please do NOT use in-line style.
+** Discuss this style sheet with other users and me
+** before fixing it
+*/
+
+/* These bits from Dave's inline stylein the HTML home page
+ tbl 19991115
+*/
+
+ body {
+ margin-left: 10%;
+ margin-right: 5%;
+ font-family: sans-serif
+ }
+ h1 { margin-left: -8% }
+ h2 { margin-left: -4% }
+ h2 { color: #990066}
+ h3 { color: black }
+ pre { color: green; font-weight: bold }
+ em { font-style: italic; font-weight: bold }
+ strong { text-transform: uppercase; font-weight: bold }
+ b { color:#990066}
+
+ td { background: #FFBFBF }
+ th { background: #A0A0A4 }
+ caption { text-decoration: underline; margin-top: 1em }
+ .splash { color: #009966}
+ p.banner { margin-left: -4% }
+ b.black { color: black}
+ b.pink {color:#990066} /* gimme a break -tbl */
+ p.pink {color:#990066} /* sep of form and content?! */
+
+ blockquote { color: black; font-style:italic;
+ font-family: "Comic Sans MS", sans-serif;}
+ pre { font-family: monospace }
+ div.disclaimer {margin-left: -8%}
+ div.color {
+ background: rgb(255,204,255);
+ padding: 0.5em;
+ border: none
+ }
+
+
+ h3.c3 {text-align: center}
+ p.c2 {text-align: center}
+ h1.c1 {text-align: left}
+
+/* These bits from Chris L's inline style in the
+ Graphics home page
+ tbl 19991115
+*/
+
+body {
+ background: white; color: black;
+/* font-family: serif; WinIE 4 to 5.5 problem with generic serif 20010726 */
+}
+
+div.main {
+ margin-left: 5%; margin-right: 2%
+}
+h1, h2, h3 {
+ font-family: arial, helvetica, sans-serif
+}
+h2 {
+ margin-left:-2%
+}
+.date {color: #000; background: #DFD; font-style: italic; font-weight: bold;
+vertical-align: top; border: none}
+.format {
+ color: #000;
+ background: #DFD;
+ font-style: italic;
+ font-weight: bold;
+ vertical-align: top;
+ border: none
+}
+
+td {
+ margin: 6px
+}
+
+.offsite:link {
+ color: #393
+}
+
+.offsite:visited {
+ color: #666
+}
+.newslist {
+ margin: 3px 8px
+}
+
+pre {
+ font-family: Syntax, "Courier New", Courier, monospace
+}
+
+.qdlogo {
+ height: 48px;
+ color: #903;
+
+ /* border: thin solid #903;
+ */ font-weight: bold; font-family: Hattenschweiller, Impact, serif; vertical-align: middle
+
+}
+
+.filler {
+ color: #777;
+ font-style: italic
+}
+
+
+
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/dom-level1-core/exclusions.js b/dom/tests/mochitest/dom-level1-core/exclusions.js
new file mode 100644
index 0000000000..d846a8a8eb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/exclusions.js
@@ -0,0 +1,97 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+// tests that depend on DTD features no one cares about
+var dtdTests = ["attrdefaultvalue","attrnotspecifiedvalue", "attrremovechild1",
+ "attrreplacechild1", "attrsetvaluenomodificationallowederr",
+ "attrsetvaluenomodificationallowederrEE", "attrspecifiedvalueremove",
+ "characterdataappenddatanomodificationallowederr", "characterdataappenddatanomodificationallowederrEE",
+ "characterdatadeletedatanomodificationallowederr", "characterdatadeletedatanomodificationallowederrEE",
+ "characterdatainsertdatanomodificationallowederr", "characterdatainsertdatanomodificationallowederrEE",
+ "characterdatareplacedatanomodificationallowederr", "characterdatareplacedatanomodificationallowederrEE",
+ "characterdatasetdatanomodificationallowederr", "characterdatasetdatanomodificationallowederrEE",
+ "documentcreateelementdefaultattr", "documentcreateentityreference", "documentcreateentityreferenceknown",
+ "documenttypegetentities", "documenttypegetentitieslength", "documenttypegetentitiestype",
+ "documenttypegetnotations", "documenttypegetnotationstype", "elementremoveattribute",
+ "elementremoveattributenodenomodificationallowederr", "elementremoveattributenodenomodificationallowederrEE",
+ "elementremoveattributenomodificationallowederr", "elementremoveattributenomodificationallowederrEE",
+ "elementremoveattributerestoredefaultvalue", "elementretrieveallattributes",
+ "elementsetattributenodenomodificationallowederr", "elementsetattributenodenomodificationallowederrEE",
+ "elementsetattributenomodificationallowederr", "elementsetattributenomodificationallowederrEE",
+ "entitygetentityname", "entitygetpublicid", "entitygetpublicidnull", "namednodemapremovenameditem",
+ "namednodemapremovenameditemgetvalue", "nodeappendchildnomodificationallowederr", "nodeappendchildnomodificationallowederrEE",
+ "nodeentitynodeattributes", "nodeentitynodename", "nodeentitynodetype", "nodeentitynodevalue",
+ "nodeentityreferencenodeattributes", "nodeentityreferencenodename", "nodeentityreferencenodetype",
+ "nodeentityreferencenodevalue", "nodeentitysetnodevalue", "nodeinsertbeforenomodificationallowederr",
+ "nodeinsertbeforenomodificationallowederrEE", "nodenotationnodeattributes", "nodenotationnodename",
+ "nodenotationnodetype", "nodenotationnodevalue", "noderemovechildnomodificationallowederr",
+ "noderemovechildnomodificationallowederrEE", "nodereplacechildnomodificationallowederr",
+ "nodereplacechildnomodificationallowederrEE", "nodesetnodevaluenomodificationallowederr",
+ "nodesetnodevaluenomodificationallowederrEE", "nodevalue03","nodevalue07", "nodevalue08",
+ "notationgetnotationname", "notationgetpublicid", "notationgetpublicidnull", "notationgetsystemid",
+ "notationgetsystemidnull", "processinginstructionsetdatanomodificationallowederr",
+ "processinginstructionsetdatanomodificationallowederrEE", "textsplittextnomodificationallowederr",
+ "textsplittextnomodificationallowederrEE"];
+
+// we don't pass these, unfortunately
+var indexErrTests = ["characterdataindexsizeerrdeletedatacountnegative", "characterdataindexsizeerrreplacedatacountnegative",
+ "characterdataindexsizeerrsubstringcountnegative", "hc_characterdataindexsizeerrdeletedatacountnegative",
+ "hc_characterdataindexsizeerrreplacedatacountnegative", "hc_characterdataindexsizeerrsubstringcountnegative"];
+
+var attributeModTests = ["hc_attrappendchild1", "hc_attrappendchild3", "hc_attrappendchild5",
+ "hc_attrappendchild6", "hc_attrchildnodes2", "hc_attrclonenode1", "hc_attrinsertbefore1",
+ "hc_attrinsertbefore2", "hc_attrinsertbefore3", "hc_attrinsertbefore4", "hc_attrinsertbefore6",
+ "hc_attrnormalize", "hc_attrreplacechild1", "hc_attrreplacechild2",
+ "hc_attrsetvalue2", "hc_elementnormalize2", "hc_elementnotfounderr", "hc_elementremoveattribute", "hc_elementnormalize2",
+ "hc_elementnotfounderr", "hc_elementremoveattribute",
+ "hc_attrchildnodes1", "hc_attrfirstchild",
+ "hc_attrhaschildnodes", "hc_attrlastchild",
+ "hc_attrremovechild1", "hc_attrsetvalue1"];
+var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument", "hc_nodeinsertbeforenewchilddiffdocument",
+ "hc_nodereplacechildnewchilddiffdocument", "hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument",
+ "hc_nodeinsertbeforenewchilddiffdocument", "hc_nodereplacechildnewchilddiffdocument", "elementwrongdocumenterr", "namednodemapwrongdocumenterr",
+ "nodeappendchildnewchilddiffdocument", "nodeinsertbeforenewchilddiffdocument", "nodereplacechildnewchilddiffdocument"];
+// These tests rely on an implementation of document.createEntityReference.
+var createEntityRef = ["documentinvalidcharacterexceptioncreateentref",
+ "documentinvalidcharacterexceptioncreateentref1",
+ "hc_attrgetvalue2", "hc_nodevalue03"];
+var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi",
+ "documentinvalidcharacterexceptioncreatepi1"];
+// These tests expect Node.attributes to exist.
+var attributesOnNode = [
+ "hc_commentgetcomment",
+ "hc_documentgetdoctype",
+ "hc_nodeattributenodeattribute",
+ "hc_nodecommentnodeattributes",
+ "hc_nodecommentnodeattributes",
+ "hc_nodedocumentfragmentnodevalue",
+ "hc_nodedocumentnodeattribute",
+ "hc_nodetextnodeattribute",
+ "nodeattributenodeattribute",
+ "nodecommentnodeattributes",
+ "nodecommentnodeattributes",
+ "nodedocumentfragmentnodevalue",
+ "nodedocumentnodeattribute",
+ "nodeprocessinginstructionnodeattributes",
+ "nodetextnodeattribute",
+ "nodecdatasectionnodeattribute",
+ "nodedocumenttypenodevalue"
+]
+
+var todoTests = {};
+function concat(lst/*...*/) {
+ var f = [];
+ if (arguments !== null) {
+ f = arguments[0];
+ }
+ for (var i = 1; i < arguments.length; i++) {
+ f = f.concat(arguments[i]);
+ }
+ return f;
+}
+var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef, createProcessingInstructionHTML, attributesOnNode);
+for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; }
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.html b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.html
new file mode 100644
index 0000000000..f98d0be115
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.html
@@ -0,0 +1,10 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.svg b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.svg
new file mode 100644
index 0000000000..89f26f6c76
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.svg
@@ -0,0 +1,10 @@
+<svg xmlns='http://www.w3.org/2000/svg'><rect x="0" y="0" width="100" height="100"/><head xmlns='http://www.w3.org/1999/xhtml'><title>hc_nodtdstaff</title></head><body xmlns='http://www.w3.org/1999/xhtml'>
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+</body></svg>
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xhtml b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xhtml
new file mode 100644
index 0000000000..8a5d8a8621
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xhtml
@@ -0,0 +1,10 @@
+<html xmlns="http://www.w3.org/1999/xhtml"><head><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xml b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xml
new file mode 100644
index 0000000000..85c06931d8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xml
@@ -0,0 +1,10 @@
+<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.html b/dom/tests/mochitest/dom-level1-core/files/hc_staff.html
new file mode 100644
index 0000000000..9acf750493
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd" >
+<!-- This is comment number 1.-->
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_staff</title><script type="text/javascript" src="svgunit.js"></script><script charset="UTF-8" type="text/javascript" src="svgtest.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.svg b/dom/tests/mochitest/dom-level1-core/files/hc_staff.svg
new file mode 100644
index 0000000000..cd0cc47f9a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE svg
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd" [
+ <!ENTITY alpha "&#945;">
+ <!ENTITY beta "&#946;">
+ <!ENTITY gamma "&#947;">
+ <!ENTITY delta "&#948;">
+ <!ENTITY epsilon "&#949;">
+ <!ENTITY alpha "&#950;">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST acronym dir CDATA "ltr">
+ <!ATTLIST head xmlns CDATA #IMPLIED>
+ <!ATTLIST body xmlns CDATA #IMPLIED>
+ <!ELEMENT svg (rect, script, head, body)>
+ <!ATTLIST svg xmlns CDATA #IMPLIED>
+ <!ELEMENT rect EMPTY>
+ <!ATTLIST rect
+ x CDATA #IMPLIED
+ y CDATA #IMPLIED
+ width CDATA #IMPLIED
+ height CDATA #IMPLIED>
+ <!ENTITY svgunit SYSTEM "svgunit.js">
+ <!ENTITY svgtest SYSTEM "svgtest.js">
+]>
+<!-- This is comment number 1.-->
+<svg xmlns='http://www.w3.org/2000/svg'><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgtest;&svgunit;</script><head xmlns='http://www.w3.org/1999/xhtml'><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title></head><body xmlns='http://www.w3.org/1999/xhtml'>
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></svg>
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.xhtml b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xhtml
new file mode 100644
index 0000000000..16d4eb0958
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xhtml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd" [
+ <!ENTITY alpha "&#945;">
+ <!ENTITY beta "&#946;">
+ <!ENTITY gamma "&#947;">
+ <!ENTITY delta "&#948;">
+ <!ENTITY epsilon "&#949;">
+ <!ENTITY alpha "&#950;">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST acronym dir CDATA "ltr">
+]>
+<!-- This is comment number 1.-->
+<html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title><script type="text/javascript" src="svgunit.js"/><script charset="UTF-8" type="text/javascript" src="svgtest.js"/><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.xml b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xml
new file mode 100644
index 0000000000..2df9a74154
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd" [
+ <!ENTITY alpha "&#945;">
+ <!ENTITY beta "&#946;">
+ <!ENTITY gamma "&#947;">
+ <!ENTITY delta "&#948;">
+ <!ENTITY epsilon "&#949;">
+ <!ENTITY alpha "&#950;">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST acronym dir CDATA "ltr">
+]>
+<!-- This is comment number 1.-->
+<html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title><script type="text/javascript" src="svgunit.js"/><script charset="UTF-8" type="text/javascript" src="svgtest.js"/><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level1-core/files/staff.dtd b/dom/tests/mochitest/dom-level1-core/files/staff.dtd
new file mode 100644
index 0000000000..02a994d57d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/staff.dtd
@@ -0,0 +1,17 @@
+<!ELEMENT employeeId (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT position (#PCDATA)>
+<!ELEMENT salary (#PCDATA)>
+<!ELEMENT address (#PCDATA)>
+<!ELEMENT entElement ( #PCDATA ) >
+<!ELEMENT gender ( #PCDATA | entElement )* >
+<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
+<!ELEMENT staff (employee)+>
+<!ATTLIST entElement
+ attr1 CDATA "Attr">
+<!ATTLIST address
+ domestic CDATA #IMPLIED
+ street CDATA "Yes">
+<!ATTLIST entElement
+ domestic CDATA "MALE" >
+
diff --git a/dom/tests/mochitest/dom-level1-core/files/staff.svg b/dom/tests/mochitest/dom-level1-core/files/staff.svg
new file mode 100644
index 0000000000..77c9b5bd2a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/staff.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE svg SYSTEM "staff.dtd" [
+ <!ENTITY ent1 "es">
+ <!ENTITY ent2 "1900 Dallas Road">
+ <!ENTITY ent3 "Texas">
+ <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>">
+ <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
+ <!ENTITY ent1 "This entity should be discarded">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST employee xmlns CDATA #IMPLIED>
+ <!ELEMENT svg (rect, script, employee+)>
+ <!ATTLIST svg
+ xmlns CDATA #FIXED "http://www.w3.org/2000/svg"
+ name CDATA #IMPLIED>
+ <!ELEMENT rect EMPTY>
+ <!ATTLIST rect
+ x CDATA #REQUIRED
+ y CDATA #REQUIRED
+ width CDATA #REQUIRED
+ height CDATA #REQUIRED>
+ <!ELEMENT script (#PCDATA)>
+ <!ATTLIST script type CDATA #IMPLIED>
+ <!ENTITY svgunit SYSTEM "svgunit.js">
+ <!ENTITY svgtest SYSTEM "svgtest.js">
+]>
+<!-- This is comment number 1.-->
+<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgunit;&svgtest;</script>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0002</employeeId>
+ <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
+<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
+ <position>Secretary</position>
+ <salary>35,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
+ 98554</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0003</employeeId>
+ <name>Roger
+ Jones</name>
+ <position>Department Manager</position>
+ <salary>100,000</salary>
+ <gender>&ent4;</gender>
+ <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0004</employeeId>
+ <name>Jeny Oconnor</name>
+ <position>Personnel Director</position>
+ <salary>95,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0005</employeeId>
+ <name>Robert Myers</name>
+ <position>Computer Specialist</position>
+ <salary>90,000</salary>
+ <gender>male</gender>
+ <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address>
+ </employee>
+ </svg>
diff --git a/dom/tests/mochitest/dom-level1-core/files/staff.xml b/dom/tests/mochitest/dom-level1-core/files/staff.xml
new file mode 100644
index 0000000000..f89c5107db
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/staff.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE staff SYSTEM "staff.dtd" [
+ <!ENTITY ent1 "es">
+ <!ENTITY ent2 "1900 Dallas Road">
+ <!ENTITY ent3 "Texas">
+ <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>">
+ <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
+ <!ENTITY ent1 "This entity should be discarded">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+]>
+<!-- This is comment number 1.-->
+<staff>
+ <employee>
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0002</employeeId>
+ <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
+<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
+ <position>Secretary</position>
+ <salary>35,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
+ 98554</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0003</employeeId>
+ <name>Roger
+ Jones</name>
+ <position>Department Manager</position>
+ <salary>100,000</salary>
+ <gender>&ent4;</gender>
+ <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0004</employeeId>
+ <name>Jeny Oconnor</name>
+ <position>Personnel Director</position>
+ <salary>95,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0005</employeeId>
+ <name>Robert Myers</name>
+ <position>Computer Specialist</position>
+ <salary>90,000</salary>
+ <gender>male</gender>
+ <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address>
+ </employee>
+ </staff>
diff --git a/dom/tests/mochitest/dom-level1-core/files/svgtest.js b/dom/tests/mochitest/dom-level1-core/files/svgtest.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/svgtest.js
diff --git a/dom/tests/mochitest/dom-level1-core/files/svgunit.js b/dom/tests/mochitest/dom-level1-core/files/svgunit.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/svgunit.js
diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml-lat1.ent b/dom/tests/mochitest/dom-level1-core/files/xhtml-lat1.ent
new file mode 100644
index 0000000000..ffee223eb1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/xhtml-lat1.ent
@@ -0,0 +1,196 @@
+<!-- Portions (C) International Organization for Standardization 1986
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+ %HTMLlat1;
+-->
+
+<!ENTITY nbsp "&#160;"> <!-- no-break space = non-breaking space,
+ U+00A0 ISOnum -->
+<!ENTITY iexcl "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+ U+00A6 ISOnum -->
+<!ENTITY sect "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml "&#168;"> <!-- diaeresis = spacing diaeresis,
+ U+00A8 ISOdia -->
+<!ENTITY copy "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo "&#171;"> <!-- left-pointing double angle quotation mark
+ = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not "&#172;"> <!-- not sign = angled dash,
+ U+00AC ISOnum -->
+<!ENTITY shy "&#173;"> <!-- soft hyphen = discretionary hyphen,
+ U+00AD ISOnum -->
+<!ENTITY reg "&#174;"> <!-- registered sign = registered trade mark sign,
+ U+00AE ISOnum -->
+<!ENTITY macr "&#175;"> <!-- macron = spacing macron = overline
+ = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+ U+00B1 ISOnum -->
+<!ENTITY sup2 "&#178;"> <!-- superscript two = superscript digit two
+ = squared, U+00B2 ISOnum -->
+<!ENTITY sup3 "&#179;"> <!-- superscript three = superscript digit three
+ = cubed, U+00B3 ISOnum -->
+<!ENTITY acute "&#180;"> <!-- acute accent = spacing acute,
+ U+00B4 ISOdia -->
+<!ENTITY micro "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para "&#182;"> <!-- pilcrow sign = paragraph sign,
+ U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+ = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1 "&#185;"> <!-- superscript one = superscript digit one,
+ U+00B9 ISOnum -->
+<!ENTITY ordm "&#186;"> <!-- masculine ordinal indicator,
+ U+00BA ISOnum -->
+<!ENTITY raquo "&#187;"> <!-- right-pointing double angle quotation mark
+ = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+ = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+ = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+ = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+ = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+ = latin capital letter A grave,
+ U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+ U+00C1 ISOlat1 -->
+<!ENTITY Acirc "&#194;"> <!-- latin capital letter A with circumflex,
+ U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+ U+00C3 ISOlat1 -->
+<!ENTITY Auml "&#196;"> <!-- latin capital letter A with diaeresis,
+ U+00C4 ISOlat1 -->
+<!ENTITY Aring "&#197;"> <!-- latin capital letter A with ring above
+ = latin capital letter A ring,
+ U+00C5 ISOlat1 -->
+<!ENTITY AElig "&#198;"> <!-- latin capital letter AE
+ = latin capital ligature AE,
+ U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+ U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+ U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+ U+00C9 ISOlat1 -->
+<!ENTITY Ecirc "&#202;"> <!-- latin capital letter E with circumflex,
+ U+00CA ISOlat1 -->
+<!ENTITY Euml "&#203;"> <!-- latin capital letter E with diaeresis,
+ U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+ U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+ U+00CD ISOlat1 -->
+<!ENTITY Icirc "&#206;"> <!-- latin capital letter I with circumflex,
+ U+00CE ISOlat1 -->
+<!ENTITY Iuml "&#207;"> <!-- latin capital letter I with diaeresis,
+ U+00CF ISOlat1 -->
+<!ENTITY ETH "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+ U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+ U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+ U+00D3 ISOlat1 -->
+<!ENTITY Ocirc "&#212;"> <!-- latin capital letter O with circumflex,
+ U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+ U+00D5 ISOlat1 -->
+<!ENTITY Ouml "&#214;"> <!-- latin capital letter O with diaeresis,
+ U+00D6 ISOlat1 -->
+<!ENTITY times "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+ = latin capital letter O slash,
+ U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+ U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+ U+00DA ISOlat1 -->
+<!ENTITY Ucirc "&#219;"> <!-- latin capital letter U with circumflex,
+ U+00DB ISOlat1 -->
+<!ENTITY Uuml "&#220;"> <!-- latin capital letter U with diaeresis,
+ U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+ U+00DD ISOlat1 -->
+<!ENTITY THORN "&#222;"> <!-- latin capital letter THORN,
+ U+00DE ISOlat1 -->
+<!ENTITY szlig "&#223;"> <!-- latin small letter sharp s = ess-zed,
+ U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+ = latin small letter a grave,
+ U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+ U+00E1 ISOlat1 -->
+<!ENTITY acirc "&#226;"> <!-- latin small letter a with circumflex,
+ U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+ U+00E3 ISOlat1 -->
+<!ENTITY auml "&#228;"> <!-- latin small letter a with diaeresis,
+ U+00E4 ISOlat1 -->
+<!ENTITY aring "&#229;"> <!-- latin small letter a with ring above
+ = latin small letter a ring,
+ U+00E5 ISOlat1 -->
+<!ENTITY aelig "&#230;"> <!-- latin small letter ae
+ = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+ U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+ U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+ U+00E9 ISOlat1 -->
+<!ENTITY ecirc "&#234;"> <!-- latin small letter e with circumflex,
+ U+00EA ISOlat1 -->
+<!ENTITY euml "&#235;"> <!-- latin small letter e with diaeresis,
+ U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+ U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+ U+00ED ISOlat1 -->
+<!ENTITY icirc "&#238;"> <!-- latin small letter i with circumflex,
+ U+00EE ISOlat1 -->
+<!ENTITY iuml "&#239;"> <!-- latin small letter i with diaeresis,
+ U+00EF ISOlat1 -->
+<!ENTITY eth "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+ U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+ U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+ U+00F3 ISOlat1 -->
+<!ENTITY ocirc "&#244;"> <!-- latin small letter o with circumflex,
+ U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+ U+00F5 ISOlat1 -->
+<!ENTITY ouml "&#246;"> <!-- latin small letter o with diaeresis,
+ U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+ = latin small letter o slash,
+ U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+ U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+ U+00FA ISOlat1 -->
+<!ENTITY ucirc "&#251;"> <!-- latin small letter u with circumflex,
+ U+00FB ISOlat1 -->
+<!ENTITY uuml "&#252;"> <!-- latin small letter u with diaeresis,
+ U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+ U+00FD ISOlat1 -->
+<!ENTITY thorn "&#254;"> <!-- latin small letter thorn,
+ U+00FE ISOlat1 -->
+<!ENTITY yuml "&#255;"> <!-- latin small letter y with diaeresis,
+ U+00FF ISOlat1 -->
diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml-special.ent b/dom/tests/mochitest/dom-level1-core/files/xhtml-special.ent
new file mode 100644
index 0000000000..ca358b2fec
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/xhtml-special.ent
@@ -0,0 +1,80 @@
+<!-- Special characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+ %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot "&#34;"> <!-- quotation mark, U+0022 ISOnum -->
+<!ENTITY amp "&#38;#38;"> <!-- ampersand, U+0026 ISOnum -->
+<!ENTITY lt "&#38;#60;"> <!-- less-than sign, U+003C ISOnum -->
+<!ENTITY gt "&#62;"> <!-- greater-than sign, U+003E ISOnum -->
+<!ENTITY apos "&#39;"> <!-- apostrophe = APL quote, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;"> <!-- latin capital ligature OE,
+ U+0152 ISOlat2 -->
+<!ENTITY oelig "&#339;"> <!-- latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;"> <!-- latin capital letter S with caron,
+ U+0160 ISOlat2 -->
+<!ENTITY scaron "&#353;"> <!-- latin small letter s with caron,
+ U+0161 ISOlat2 -->
+<!ENTITY Yuml "&#376;"> <!-- latin capital letter Y with diaeresis,
+ U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;"> <!-- modifier letter circumflex accent,
+ U+02C6 ISOpub -->
+<!ENTITY tilde "&#732;"> <!-- small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj "&#8204;"> <!-- zero width non-joiner,
+ U+200C NEW RFC 2070 -->
+<!ENTITY zwj "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo "&#8216;"> <!-- left single quotation mark,
+ U+2018 ISOnum -->
+<!ENTITY rsquo "&#8217;"> <!-- right single quotation mark,
+ U+2019 ISOnum -->
+<!ENTITY sbquo "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo "&#8220;"> <!-- left double quotation mark,
+ U+201C ISOnum -->
+<!ENTITY rdquo "&#8221;"> <!-- right double quotation mark,
+ U+201D ISOnum -->
+<!ENTITY bdquo "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo "&#8249;"> <!-- single left-pointing angle quotation mark,
+ U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;"> <!-- single right-pointing angle quotation mark,
+ U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+
+<!-- Currency Symbols -->
+<!ENTITY euro "&#8364;"> <!-- euro sign, U+20AC NEW -->
diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml-symbol.ent b/dom/tests/mochitest/dom-level1-core/files/xhtml-symbol.ent
new file mode 100644
index 0000000000..63c2abfa6f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/xhtml-symbol.ent
@@ -0,0 +1,237 @@
+<!-- Mathematical, Greek and Symbolic characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+ %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;"> <!-- latin small letter f with hook = function
+ = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma "&#915;"> <!-- greek capital letter gamma,
+ U+0393 ISOgrk3 -->
+<!ENTITY Delta "&#916;"> <!-- greek capital letter delta,
+ U+0394 ISOgrk3 -->
+<!ENTITY Epsilon "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta "&#920;"> <!-- greek capital letter theta,
+ U+0398 ISOgrk3 -->
+<!ENTITY Iota "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda "&#923;"> <!-- greek capital letter lamda,
+ U+039B ISOgrk3 -->
+<!ENTITY Mu "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma "&#931;"> <!-- greek capital letter sigma,
+ U+03A3 ISOgrk3 -->
+<!ENTITY Tau "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon "&#933;"> <!-- greek capital letter upsilon,
+ U+03A5 ISOgrk3 -->
+<!ENTITY Phi "&#934;"> <!-- greek capital letter phi,
+ U+03A6 ISOgrk3 -->
+<!ENTITY Chi "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi "&#936;"> <!-- greek capital letter psi,
+ U+03A8 ISOgrk3 -->
+<!ENTITY Omega "&#937;"> <!-- greek capital letter omega,
+ U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha "&#945;"> <!-- greek small letter alpha,
+ U+03B1 ISOgrk3 -->
+<!ENTITY beta "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma "&#947;"> <!-- greek small letter gamma,
+ U+03B3 ISOgrk3 -->
+<!ENTITY delta "&#948;"> <!-- greek small letter delta,
+ U+03B4 ISOgrk3 -->
+<!ENTITY epsilon "&#949;"> <!-- greek small letter epsilon,
+ U+03B5 ISOgrk3 -->
+<!ENTITY zeta "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta "&#952;"> <!-- greek small letter theta,
+ U+03B8 ISOgrk3 -->
+<!ENTITY iota "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa "&#954;"> <!-- greek small letter kappa,
+ U+03BA ISOgrk3 -->
+<!ENTITY lambda "&#955;"> <!-- greek small letter lamda,
+ U+03BB ISOgrk3 -->
+<!ENTITY mu "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf "&#962;"> <!-- greek small letter final sigma,
+ U+03C2 ISOgrk3 -->
+<!ENTITY sigma "&#963;"> <!-- greek small letter sigma,
+ U+03C3 ISOgrk3 -->
+<!ENTITY tau "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon "&#965;"> <!-- greek small letter upsilon,
+ U+03C5 ISOgrk3 -->
+<!ENTITY phi "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega "&#969;"> <!-- greek small letter omega,
+ U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek theta symbol,
+ U+03D1 NEW -->
+<!ENTITY upsih "&#978;"> <!-- greek upsilon with hook symbol,
+ U+03D2 NEW -->
+<!ENTITY piv "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;"> <!-- bullet = black small circle,
+ U+2022 ISOpub -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+ U+2026 ISOpub -->
+<!ENTITY prime "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime "&#8243;"> <!-- double prime = seconds = inches,
+ U+2033 ISOtech -->
+<!ENTITY oline "&#8254;"> <!-- overline = spacing overscore,
+ U+203E NEW -->
+<!ENTITY frasl "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;"> <!-- script capital P = power set
+ = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image "&#8465;"> <!-- black-letter capital I = imaginary part,
+ U+2111 ISOamso -->
+<!ENTITY real "&#8476;"> <!-- black-letter capital R = real part symbol,
+ U+211C ISOamso -->
+<!ENTITY trade "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+ U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+ U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr "&#8629;"> <!-- downwards arrow with corner leftwards
+ = carriage return, U+21B5 NEW -->
+<!ENTITY lArr "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+ but also does not have any other character for that function. So lArr can
+ be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr "&#8658;"> <!-- rightwards double arrow,
+ U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have
+ another character with this function so rArr can be used for 'implies'
+ as ISOtech suggests -->
+<!ENTITY dArr "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr "&#8660;"> <!-- left right double arrow,
+ U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part "&#8706;"> <!-- partial differential, U+2202 ISOtech -->
+<!ENTITY exist "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty "&#8709;"> <!-- empty set = null set, U+2205 ISOamso -->
+<!ENTITY nabla "&#8711;"> <!-- nabla = backward difference,
+ U+2207 ISOtech -->
+<!ENTITY isin "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!ENTITY prod "&#8719;"> <!-- n-ary product = product sign,
+ U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+ the same glyph might be used for both -->
+<!ENTITY sum "&#8721;"> <!-- n-ary summation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+ though the same glyph might be used for both -->
+<!ENTITY minus "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic "&#8730;"> <!-- square root = radical sign,
+ U+221A ISOtech -->
+<!ENTITY prop "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4 "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim "&#8764;"> <!-- tilde operator = varies with = similar to,
+ U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+ although the same glyph might be used to represent both -->
+<!ENTITY cong "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp "&#8776;"> <!-- almost equal to = asymptotic to,
+ U+2248 ISOamsr -->
+<!ENTITY ne "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge "&#8805;"> <!-- greater-than or equal to,
+ U+2265 ISOtech -->
+<!ENTITY sub "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!ENTITY nsub "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe "&#8839;"> <!-- superset of or equal to,
+ U+2287 ISOtech -->
+<!ENTITY oplus "&#8853;"> <!-- circled plus = direct sum,
+ U+2295 ISOamsb -->
+<!ENTITY otimes "&#8855;"> <!-- circled times = vector product,
+ U+2297 ISOamsb -->
+<!ENTITY perp "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+ U+22A5 ISOtech -->
+<!ENTITY sdot "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;"> <!-- left ceiling = APL upstile,
+ U+2308 ISOamsc -->
+<!ENTITY rceil "&#8969;"> <!-- right ceiling, U+2309 ISOamsc -->
+<!ENTITY lfloor "&#8970;"> <!-- left floor = APL downstile,
+ U+230A ISOamsc -->
+<!ENTITY rfloor "&#8971;"> <!-- right floor, U+230B ISOamsc -->
+<!ENTITY lang "&#9001;"> <!-- left-pointing angle bracket = bra,
+ U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than sign'
+ or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang "&#9002;"> <!-- right-pointing angle bracket = ket,
+ U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than sign'
+ or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs "&#9827;"> <!-- black club suit = shamrock,
+ U+2663 ISOpub -->
+<!ENTITY hearts "&#9829;"> <!-- black heart suit = valentine,
+ U+2665 ISOpub -->
+<!ENTITY diams "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml1-frameset.dtd b/dom/tests/mochitest/dom-level1-core/files/xhtml1-frameset.dtd
new file mode 100644
index 0000000000..0102078c09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/xhtml1-frameset.dtd
@@ -0,0 +1,1235 @@
+<!--
+ Extensible HTML version 1.0 Frameset DTD
+
+ This is the same as HTML 4 Frameset except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2007/02/24 01:51:16 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % MultiLengths "CDATA">
+ <!-- comma-separated list of MultiLength -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+ "object | applet | img | map | iframe">
+
+<!ENTITY % special.basic
+ "br | span | bdo">
+
+<!ENTITY % special
+ "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+ | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex | fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ sub, sup, font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+ %inline.forms; | %misc.inline;)*">
+
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, frameset)>
+<!ATTLIST html
+ %i18n;
+ id ID #IMPLIED
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ id ID #IMPLIED
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title
+ %i18n;
+ id ID #IMPLIED
+ >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ id ID #IMPLIED
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ id ID #IMPLIED
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ id ID #IMPLIED
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ id ID #IMPLIED
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- only one noframes element permitted per document -->
+
+<!ELEMENT frameset (frameset|frame|noframes)*>
+<!ATTLIST frameset
+ %coreattrs;
+ rows %MultiLengths; #IMPLIED
+ cols %MultiLengths; #IMPLIED
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ >
+
+<!-- reserved frame names start with "_" otherwise starts with letter -->
+
+<!-- tiled window within frameset -->
+
+<!ELEMENT frame EMPTY>
+<!ATTLIST frame
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ noresize (noresize) #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ >
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes (body)>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ %focus;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form |%inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ %focus;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ %focus;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=":"
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml1-strict.dtd b/dom/tests/mochitest/dom-level1-core/files/xhtml1-strict.dtd
new file mode 100644
index 0000000000..f3d0fba350
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/xhtml1-strict.dtd
@@ -0,0 +1,65 @@
+<!--
+
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, Institut National de
+Recherche en Informatique et en Automatique, Keio University). All
+Rights Reserved. This program is distributed under the W3C's Software
+Intellectual Property License. This program is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.
+
+See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+
+-->
+
+<!--
+
+This is a radically simplified DTD for use in the DOM Test Suites
+due to a XML non-conformance of one implementation in processing
+parameter entities. When that non-conformance is resolved,
+this DTD can be replaced by the normal DTD for XHTML.
+
+-->
+
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html xmlns CDATA #IMPLIED>
+<!ELEMENT head (meta,title,script*)>
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ http-equiv CDATA #IMPLIED
+ content CDATA #IMPLIED>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT body (p*)>
+<!ATTLIST body onload CDATA #IMPLIED>
+<!ELEMENT p (#PCDATA|em|strong|code|sup|var|acronym|abbr)*>
+<!ATTLIST p
+ xmlns:dmstc CDATA #IMPLIED
+ xmlns:nm CDATA #IMPLIED
+ xmlns:emp2 CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT em (#PCDATA)>
+<!ELEMENT span (#PCDATA)>
+<!ELEMENT strong (#PCDATA)>
+<!ELEMENT code (#PCDATA)>
+<!ELEMENT sup (#PCDATA)>
+<!ELEMENT var (#PCDATA|span)*>
+<!ELEMENT acronym (#PCDATA)>
+<!ATTLIST acronym
+ title CDATA #IMPLIED
+ class CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT abbr (#PCDATA)>
+<!ATTLIST abbr
+ title CDATA #IMPLIED
+ class CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ type CDATA #IMPLIED
+ src CDATA #IMPLIED
+ charset CDATA #IMPLIED>
diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml1-transitional.dtd b/dom/tests/mochitest/dom-level1-core/files/xhtml1-transitional.dtd
new file mode 100644
index 0000000000..f8073c836b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/files/xhtml1-transitional.dtd
@@ -0,0 +1,1201 @@
+<!--
+ Extensible HTML version 1.0 Transitional DTD
+
+ This is the same as HTML 4 Transitional except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2007/02/24 01:51:16 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+ "object | applet | img | map | iframe">
+
+<!ENTITY % special.basic
+ "br | span | bdo">
+
+<!ENTITY % special
+ "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+ | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+ %inline.forms; | %misc.inline;)*">
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+ %i18n;
+ id ID #IMPLIED
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ id ID #IMPLIED
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title
+ %i18n;
+ id ID #IMPLIED
+ >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ id ID #IMPLIED
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ id ID #IMPLIED
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ id ID #IMPLIED
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ id ID #IMPLIED
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes %Flow;>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ %focus;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Length; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name CDATA #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ %focus;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ %focus;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Length; #IMPLIED
+ height %Length; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Length; #IMPLIED
+ height %Length; #IMPLIED
+ >
+
diff --git a/dom/tests/mochitest/dom-level1-core/mochitest.ini b/dom/tests/mochitest/dom-level1-core/mochitest.ini
new file mode 100644
index 0000000000..df96124a8d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/mochitest.ini
@@ -0,0 +1,552 @@
+[DEFAULT]
+support-files =
+ DOMTestCase.js
+ activity-home.css
+ exclusions.js
+ files/hc_nodtdstaff.html
+ files/hc_nodtdstaff.xhtml
+ files/hc_staff.html
+ files/hc_staff.xhtml
+ files/staff.dtd
+ files/staff.xml
+ files/svgunit.js
+ files/xhtml-special.ent
+ files/xhtml1-frameset.dtd
+ files/xhtml1-transitional.dtd
+ files/hc_nodtdstaff.svg
+ files/hc_nodtdstaff.xml
+ files/hc_staff.svg
+ files/hc_staff.xml
+ files/staff.svg
+ files/svgtest.js
+ files/xhtml-lat1.ent
+ files/xhtml-symbol.ent
+ files/xhtml1-strict.dtd
+
+[test_PIsetdatanomodificationallowederrEE.html]
+[test_attrcreatedocumentfragment.html]
+[test_attrcreatetextnode.html]
+[test_attrcreatetextnode2.html]
+[test_attrdefaultvalue.html]
+[test_attreffectivevalue.html]
+[test_attrentityreplacement.html]
+[test_attrname.html]
+[test_attrnextsiblingnull.html]
+[test_attrnotspecifiedvalue.html]
+[test_attrparentnodenull.html]
+[test_attrprevioussiblingnull.html]
+[test_attrremovechild1.html]
+[test_attrreplacechild1.html]
+[test_attrsetvaluenomodificationallowederr.html]
+[test_attrsetvaluenomodificationallowederrEE.html]
+[test_attrspecifiedvalue.html]
+[test_attrspecifiedvaluechanged.html]
+[test_attrspecifiedvalueremove.html]
+[test_cdatasectiongetdata.html]
+[test_cdatasectionnormalize.html]
+[test_characterdataappenddata.html]
+[test_characterdataappenddatagetdata.html]
+[test_characterdataappenddatanomodificationallowederr.html]
+[test_characterdataappenddatanomodificationallowederrEE.html]
+[test_characterdatadeletedatabegining.html]
+[test_characterdatadeletedataend.html]
+[test_characterdatadeletedataexceedslength.html]
+[test_characterdatadeletedatagetlengthanddata.html]
+[test_characterdatadeletedatamiddle.html]
+[test_characterdatadeletedatanomodificationallowederr.html]
+[test_characterdatadeletedatanomodificationallowederrEE.html]
+[test_characterdatagetdata.html]
+[test_characterdatagetlength.html]
+[test_characterdataindexsizeerrdeletedatacountnegative.html]
+[test_characterdataindexsizeerrdeletedataoffsetgreater.html]
+[test_characterdataindexsizeerrdeletedataoffsetnegative.html]
+[test_characterdataindexsizeerrinsertdataoffsetgreater.html]
+[test_characterdataindexsizeerrinsertdataoffsetnegative.html]
+[test_characterdataindexsizeerrreplacedatacountnegative.html]
+[test_characterdataindexsizeerrreplacedataoffsetgreater.html]
+[test_characterdataindexsizeerrreplacedataoffsetnegative.html]
+[test_characterdataindexsizeerrsubstringcountnegative.html]
+[test_characterdataindexsizeerrsubstringnegativeoffset.html]
+[test_characterdataindexsizeerrsubstringoffsetgreater.html]
+[test_characterdatainsertdatabeginning.html]
+[test_characterdatainsertdataend.html]
+[test_characterdatainsertdatamiddle.html]
+[test_characterdatainsertdatanomodificationallowederr.html]
+[test_characterdatainsertdatanomodificationallowederrEE.html]
+[test_characterdatareplacedatabegining.html]
+[test_characterdatareplacedataend.html]
+[test_characterdatareplacedataexceedslengthofarg.html]
+[test_characterdatareplacedataexceedslengthofdata.html]
+[test_characterdatareplacedatamiddle.html]
+[test_characterdatareplacedatanomodificationallowederr.html]
+[test_characterdatareplacedatanomodificationallowederrEE.html]
+[test_characterdatasetdatanomodificationallowederr.html]
+[test_characterdatasetdatanomodificationallowederrEE.html]
+[test_characterdatasetnodevalue.html]
+[test_characterdatasubstringexceedsvalue.html]
+[test_characterdatasubstringvalue.html]
+[test_commentgetcomment.html]
+[test_documentcreateattribute.html]
+[test_documentcreatecdatasection.html]
+[test_documentcreatecomment.html]
+[test_documentcreatedocumentfragment.html]
+[test_documentcreateelement.html]
+[test_documentcreateelementcasesensitive.html]
+[test_documentcreateelementdefaultattr.html]
+[test_documentcreateentityreference.html]
+[test_documentcreateentityreferenceknown.html]
+[test_documentcreateprocessinginstruction.html]
+[test_documentcreatetextnode.html]
+[test_documentgetdoctype.html]
+[test_documentgetdoctypenodtd.html]
+[test_documentgetelementsbytagnamelength.html]
+[test_documentgetelementsbytagnametotallength.html]
+[test_documentgetelementsbytagnamevalue.html]
+[test_documentgetimplementation.html]
+[test_documentgetrootnode.html]
+[test_documentinvalidcharacterexceptioncreateattribute.html]
+[test_documentinvalidcharacterexceptioncreateelement.html]
+[test_documentinvalidcharacterexceptioncreateentref.html]
+[test_documentinvalidcharacterexceptioncreateentref1.html]
+[test_documentinvalidcharacterexceptioncreatepi.html]
+[test_documentinvalidcharacterexceptioncreatepi1.html]
+[test_documenttypegetdoctype.html]
+[test_documenttypegetentities.html]
+[test_documenttypegetentitieslength.html]
+[test_documenttypegetentitiestype.html]
+[test_documenttypegetnotations.html]
+[test_documenttypegetnotationstype.html]
+[test_domimplementationfeaturenoversion.html]
+[test_domimplementationfeaturenull.html]
+[test_domimplementationfeaturexml.html]
+[test_elementaddnewattribute.html]
+[test_elementassociatedattribute.html]
+[test_elementchangeattributevalue.html]
+[test_elementcreatenewattribute.html]
+[test_elementgetattributenode.html]
+[test_elementgetattributenodenull.html]
+[test_elementgetelementempty.html]
+[test_elementgetelementsbytagname.html]
+[test_elementgetelementsbytagnameaccessnodelist.html]
+[test_elementgetelementsbytagnamenomatch.html]
+[test_elementgetelementsbytagnamespecialvalue.html]
+[test_elementgettagname.html]
+[test_elementinuseattributeerr.html]
+[test_elementinvalidcharacterexception.html]
+[test_elementnormalize.html]
+[test_elementnotfounderr.html]
+[test_elementremoveattribute.html]
+[test_elementremoveattributeaftercreate.html]
+[test_elementremoveattributenode.html]
+[test_elementremoveattributenodenomodificationallowederr.html]
+[test_elementremoveattributenodenomodificationallowederrEE.html]
+[test_elementremoveattributenomodificationallowederr.html]
+[test_elementremoveattributenomodificationallowederrEE.html]
+[test_elementremoveattributerestoredefaultvalue.html]
+[test_elementreplaceattributewithself.html]
+[test_elementreplaceexistingattribute.html]
+[test_elementreplaceexistingattributegevalue.html]
+[test_elementretrieveallattributes.html]
+[test_elementretrieveattrvalue.html]
+[test_elementretrievetagname.html]
+[test_elementsetattributenodenomodificationallowederr.html]
+[test_elementsetattributenodenomodificationallowederrEE.html]
+[test_elementsetattributenodenull.html]
+[test_elementsetattributenomodificationallowederr.html]
+[test_elementsetattributenomodificationallowederrEE.html]
+[test_elementwrongdocumenterr.html]
+[test_entitygetentityname.html]
+[test_entitygetpublicid.html]
+[test_entitygetpublicidnull.html]
+[test_hc_attrappendchild1.html]
+[test_hc_attrappendchild2.html]
+[test_hc_attrappendchild3.html]
+[test_hc_attrappendchild4.html]
+[test_hc_attrappendchild5.html]
+[test_hc_attrappendchild6.html]
+[test_hc_attrchildnodes1.html]
+[test_hc_attrchildnodes2.html]
+[test_hc_attrclonenode1.html]
+[test_hc_attrcreatedocumentfragment.html]
+[test_hc_attrcreatetextnode.html]
+[test_hc_attrcreatetextnode2.html]
+[test_hc_attreffectivevalue.html]
+[test_hc_attrfirstchild.html]
+[test_hc_attrgetvalue1.html]
+[test_hc_attrgetvalue2.html]
+[test_hc_attrhaschildnodes.html]
+[test_hc_attrinsertbefore1.html]
+[test_hc_attrinsertbefore2.html]
+[test_hc_attrinsertbefore3.html]
+[test_hc_attrinsertbefore4.html]
+[test_hc_attrinsertbefore5.html]
+[test_hc_attrinsertbefore6.html]
+[test_hc_attrinsertbefore7.html]
+[test_hc_attrlastchild.html]
+[test_hc_attrname.html]
+[test_hc_attrnextsiblingnull.html]
+[test_hc_attrnormalize.html]
+[test_hc_attrparentnodenull.html]
+[test_hc_attrprevioussiblingnull.html]
+[test_hc_attrremovechild1.html]
+[test_hc_attrremovechild2.html]
+[test_hc_attrreplacechild1.html]
+[test_hc_attrreplacechild2.html]
+[test_hc_attrsetvalue1.html]
+[test_hc_attrsetvalue2.html]
+[test_hc_attrspecifiedvalue.html]
+[test_hc_attrspecifiedvaluechanged.html]
+[test_hc_characterdataappenddata.html]
+[test_hc_characterdataappenddatagetdata.html]
+[test_hc_characterdatadeletedatabegining.html]
+[test_hc_characterdatadeletedataend.html]
+[test_hc_characterdatadeletedataexceedslength.html]
+[test_hc_characterdatadeletedatagetlengthanddata.html]
+[test_hc_characterdatadeletedatamiddle.html]
+[test_hc_characterdatagetdata.html]
+[test_hc_characterdatagetlength.html]
+[test_hc_characterdataindexsizeerrdeletedatacountnegative.html]
+[test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html]
+[test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html]
+[test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html]
+[test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html]
+[test_hc_characterdataindexsizeerrreplacedatacountnegative.html]
+[test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html]
+[test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html]
+[test_hc_characterdataindexsizeerrsubstringcountnegative.html]
+[test_hc_characterdataindexsizeerrsubstringnegativeoffset.html]
+[test_hc_characterdataindexsizeerrsubstringoffsetgreater.html]
+[test_hc_characterdatainsertdatabeginning.html]
+[test_hc_characterdatainsertdataend.html]
+[test_hc_characterdatainsertdatamiddle.html]
+[test_hc_characterdatareplacedatabegining.html]
+[test_hc_characterdatareplacedataend.html]
+[test_hc_characterdatareplacedataexceedslengthofarg.html]
+[test_hc_characterdatareplacedataexceedslengthofdata.html]
+[test_hc_characterdatareplacedatamiddle.html]
+[test_hc_characterdatasetnodevalue.html]
+[test_hc_characterdatasubstringexceedsvalue.html]
+[test_hc_characterdatasubstringvalue.html]
+[test_hc_commentgetcomment.html]
+[test_hc_documentcreateattribute.html]
+[test_hc_documentcreatecomment.html]
+[test_hc_documentcreatedocumentfragment.html]
+[test_hc_documentcreateelement.html]
+[test_hc_documentcreateelementcasesensitive.html]
+[test_hc_documentcreatetextnode.html]
+[test_hc_documentgetdoctype.html]
+[test_hc_documentgetelementsbytagnamelength.html]
+[test_hc_documentgetelementsbytagnametotallength.html]
+[test_hc_documentgetelementsbytagnamevalue.html]
+[test_hc_documentgetimplementation.html]
+[test_hc_documentgetrootnode.html]
+[test_hc_documentinvalidcharacterexceptioncreateattribute.html]
+[test_hc_documentinvalidcharacterexceptioncreateattribute1.html]
+[test_hc_documentinvalidcharacterexceptioncreateelement.html]
+[test_hc_documentinvalidcharacterexceptioncreateelement1.html]
+[test_hc_domimplementationfeaturenoversion.html]
+[test_hc_domimplementationfeaturenull.html]
+[test_hc_domimplementationfeaturexml.html]
+[test_hc_elementaddnewattribute.html]
+[test_hc_elementassociatedattribute.html]
+[test_hc_elementchangeattributevalue.html]
+[test_hc_elementcreatenewattribute.html]
+[test_hc_elementgetattributenode.html]
+[test_hc_elementgetattributenodenull.html]
+[test_hc_elementgetelementempty.html]
+[test_hc_elementgetelementsbytagname.html]
+[test_hc_elementgetelementsbytagnameaccessnodelist.html]
+[test_hc_elementgetelementsbytagnamenomatch.html]
+[test_hc_elementgetelementsbytagnamespecialvalue.html]
+[test_hc_elementgettagname.html]
+[test_hc_elementinuseattributeerr.html]
+[test_hc_elementinvalidcharacterexception.html]
+[test_hc_elementinvalidcharacterexception1.html]
+[test_hc_elementnormalize.html]
+[test_hc_elementnormalize2.html]
+[test_hc_elementnotfounderr.html]
+[test_hc_elementremoveattribute.html]
+[test_hc_elementremoveattributeaftercreate.html]
+[test_hc_elementremoveattributenode.html]
+[test_hc_elementreplaceattributewithself.html]
+[test_hc_elementreplaceexistingattribute.html]
+[test_hc_elementreplaceexistingattributegevalue.html]
+[test_hc_elementretrieveallattributes.html]
+[test_hc_elementretrieveattrvalue.html]
+[test_hc_elementretrievetagname.html]
+[test_hc_elementsetattributenodenull.html]
+[test_hc_elementwrongdocumenterr.html]
+[test_hc_entitiesremovenameditem1.html]
+[test_hc_entitiessetnameditem1.html]
+[test_hc_namednodemapchildnoderange.html]
+[test_hc_namednodemapgetnameditem.html]
+[test_hc_namednodemapinuseattributeerr.html]
+[test_hc_namednodemapnotfounderr.html]
+[test_hc_namednodemapnumberofnodes.html]
+[test_hc_namednodemapremovenameditem.html]
+[test_hc_namednodemapreturnattrnode.html]
+[test_hc_namednodemapreturnfirstitem.html]
+[test_hc_namednodemapreturnlastitem.html]
+[test_hc_namednodemapreturnnull.html]
+[test_hc_namednodemapsetnameditem.html]
+[test_hc_namednodemapsetnameditemreturnvalue.html]
+[test_hc_namednodemapsetnameditemthatexists.html]
+[test_hc_namednodemapsetnameditemwithnewvalue.html]
+[test_hc_namednodemapwrongdocumenterr.html]
+[test_hc_nodeappendchild.html]
+[test_hc_nodeappendchildchildexists.html]
+[test_hc_nodeappendchilddocfragment.html]
+[test_hc_nodeappendchildgetnodename.html]
+[test_hc_nodeappendchildinvalidnodetype.html]
+[test_hc_nodeappendchildnewchilddiffdocument.html]
+[test_hc_nodeappendchildnodeancestor.html]
+[test_hc_nodeattributenodeattribute.html]
+[test_hc_nodeattributenodename.html]
+[test_hc_nodeattributenodetype.html]
+[test_hc_nodeattributenodevalue.html]
+[test_hc_nodechildnodes.html]
+[test_hc_nodechildnodesappendchild.html]
+[test_hc_nodechildnodesempty.html]
+[test_hc_nodecloneattributescopied.html]
+[test_hc_nodeclonefalsenocopytext.html]
+[test_hc_nodeclonegetparentnull.html]
+[test_hc_nodeclonenodefalse.html]
+[test_hc_nodeclonenodetrue.html]
+[test_hc_nodeclonetruecopytext.html]
+[test_hc_nodecommentnodeattributes.html]
+[test_hc_nodecommentnodename.html]
+[test_hc_nodecommentnodetype.html]
+[test_hc_nodecommentnodevalue.html]
+[test_hc_nodedocumentfragmentnodename.html]
+[test_hc_nodedocumentfragmentnodetype.html]
+[test_hc_nodedocumentfragmentnodevalue.html]
+[test_hc_nodedocumentnodeattribute.html]
+[test_hc_nodedocumentnodename.html]
+[test_hc_nodedocumentnodetype.html]
+[test_hc_nodedocumentnodevalue.html]
+[test_hc_nodeelementnodeattributes.html]
+[test_hc_nodeelementnodename.html]
+[test_hc_nodeelementnodetype.html]
+[test_hc_nodeelementnodevalue.html]
+[test_hc_nodegetfirstchild.html]
+[test_hc_nodegetfirstchildnull.html]
+[test_hc_nodegetlastchild.html]
+[test_hc_nodegetlastchildnull.html]
+[test_hc_nodegetnextsibling.html]
+[test_hc_nodegetnextsiblingnull.html]
+[test_hc_nodegetownerdocument.html]
+[test_hc_nodegetownerdocumentnull.html]
+[test_hc_nodegetprevioussibling.html]
+[test_hc_nodegetprevioussiblingnull.html]
+[test_hc_nodehaschildnodes.html]
+[test_hc_nodehaschildnodesfalse.html]
+[test_hc_nodeinsertbefore.html]
+[test_hc_nodeinsertbeforedocfragment.html]
+[test_hc_nodeinsertbeforeinvalidnodetype.html]
+[test_hc_nodeinsertbeforenewchilddiffdocument.html]
+[test_hc_nodeinsertbeforenewchildexists.html]
+[test_hc_nodeinsertbeforenodeancestor.html]
+[test_hc_nodeinsertbeforenodename.html]
+[test_hc_nodeinsertbeforerefchildnonexistent.html]
+[test_hc_nodeinsertbeforerefchildnull.html]
+[test_hc_nodelistindexequalzero.html]
+[test_hc_nodelistindexgetlength.html]
+[test_hc_nodelistindexgetlengthofemptylist.html]
+[test_hc_nodelistindexnotzero.html]
+[test_hc_nodelistreturnfirstitem.html]
+[test_hc_nodelistreturnlastitem.html]
+[test_hc_nodelisttraverselist.html]
+[test_hc_nodeparentnode.html]
+[test_hc_nodeparentnodenull.html]
+[test_hc_noderemovechild.html]
+[test_hc_noderemovechildgetnodename.html]
+[test_hc_noderemovechildnode.html]
+[test_hc_noderemovechildoldchildnonexistent.html]
+[test_hc_nodereplacechild.html]
+[test_hc_nodereplacechildinvalidnodetype.html]
+[test_hc_nodereplacechildnewchilddiffdocument.html]
+[test_hc_nodereplacechildnewchildexists.html]
+[test_hc_nodereplacechildnodeancestor.html]
+[test_hc_nodereplacechildnodename.html]
+[test_hc_nodereplacechildoldchildnonexistent.html]
+[test_hc_nodetextnodeattribute.html]
+[test_hc_nodetextnodename.html]
+[test_hc_nodetextnodetype.html]
+[test_hc_nodetextnodevalue.html]
+[test_hc_nodevalue01.html]
+[test_hc_nodevalue02.html]
+[test_hc_nodevalue03.html]
+[test_hc_nodevalue04.html]
+[test_hc_nodevalue05.html]
+[test_hc_nodevalue06.html]
+[test_hc_nodevalue07.html]
+[test_hc_nodevalue08.html]
+[test_hc_notationsremovenameditem1.html]
+[test_hc_notationssetnameditem1.html]
+[test_hc_textindexsizeerrnegativeoffset.html]
+[test_hc_textindexsizeerroffsetoutofbounds.html]
+[test_hc_textparseintolistofelements.html]
+[test_hc_textsplittextfour.html]
+[test_hc_textsplittextone.html]
+[test_hc_textsplittextthree.html]
+[test_hc_textsplittexttwo.html]
+[test_hc_textwithnomarkup.html]
+[test_namednodemapchildnoderange.html]
+[test_namednodemapgetnameditem.html]
+[test_namednodemapinuseattributeerr.html]
+[test_namednodemapnotfounderr.html]
+[test_namednodemapnumberofnodes.html]
+[test_namednodemapremovenameditem.html]
+[test_namednodemapremovenameditemgetvalue.html]
+[test_namednodemapremovenameditemreturnnodevalue.html]
+[test_namednodemapreturnattrnode.html]
+[test_namednodemapreturnfirstitem.html]
+[test_namednodemapreturnlastitem.html]
+[test_namednodemapreturnnull.html]
+[test_namednodemapsetnameditem.html]
+[test_namednodemapsetnameditemreturnvalue.html]
+[test_namednodemapsetnameditemthatexists.html]
+[test_namednodemapsetnameditemwithnewvalue.html]
+[test_namednodemapwrongdocumenterr.html]
+[test_nodeappendchild.html]
+[test_nodeappendchildchildexists.html]
+[test_nodeappendchilddocfragment.html]
+[test_nodeappendchildgetnodename.html]
+[test_nodeappendchildinvalidnodetype.html]
+[test_nodeappendchildnewchilddiffdocument.html]
+[test_nodeappendchildnodeancestor.html]
+[test_nodeappendchildnomodificationallowederr.html]
+[test_nodeappendchildnomodificationallowederrEE.html]
+[test_nodeattributenodeattribute.html]
+[test_nodeattributenodename.html]
+[test_nodeattributenodetype.html]
+[test_nodeattributenodevalue.html]
+[test_nodecdatasectionnodeattribute.html]
+[test_nodecdatasectionnodename.html]
+[test_nodecdatasectionnodetype.html]
+[test_nodecdatasectionnodevalue.html]
+[test_nodechildnodes.html]
+[test_nodechildnodesappendchild.html]
+[test_nodechildnodesempty.html]
+[test_nodecloneattributescopied.html]
+[test_nodeclonefalsenocopytext.html]
+[test_nodeclonegetparentnull.html]
+[test_nodeclonenodefalse.html]
+[test_nodeclonenodetrue.html]
+[test_nodeclonetruecopytext.html]
+[test_nodecommentnodeattributes.html]
+[test_nodecommentnodename.html]
+[test_nodecommentnodetype.html]
+[test_nodecommentnodevalue.html]
+[test_nodedocumentfragmentnodename.html]
+[test_nodedocumentfragmentnodetype.html]
+[test_nodedocumentfragmentnodevalue.html]
+[test_nodedocumentnodeattribute.html]
+[test_nodedocumentnodename.html]
+[test_nodedocumentnodetype.html]
+[test_nodedocumentnodevalue.html]
+[test_nodedocumenttypenodename.html]
+[test_nodedocumenttypenodetype.html]
+[test_nodedocumenttypenodevalue.html]
+[test_nodeelementnodeattributes.html]
+[test_nodeelementnodename.html]
+[test_nodeelementnodetype.html]
+[test_nodeelementnodevalue.html]
+[test_nodeentitynodeattributes.html]
+[test_nodeentitynodename.html]
+[test_nodeentitynodetype.html]
+[test_nodeentitynodevalue.html]
+[test_nodeentityreferencenodeattributes.html]
+[test_nodeentityreferencenodename.html]
+[test_nodeentityreferencenodetype.html]
+[test_nodeentityreferencenodevalue.html]
+[test_nodeentitysetnodevalue.html]
+[test_nodegetfirstchild.html]
+[test_nodegetfirstchildnull.html]
+[test_nodegetlastchild.html]
+[test_nodegetlastchildnull.html]
+[test_nodegetnextsibling.html]
+[test_nodegetnextsiblingnull.html]
+[test_nodegetownerdocument.html]
+[test_nodegetownerdocumentnull.html]
+[test_nodegetprevioussibling.html]
+[test_nodegetprevioussiblingnull.html]
+[test_nodehaschildnodes.html]
+[test_nodehaschildnodesfalse.html]
+[test_nodeinsertbefore.html]
+[test_nodeinsertbeforedocfragment.html]
+[test_nodeinsertbeforeinvalidnodetype.html]
+[test_nodeinsertbeforenewchilddiffdocument.html]
+[test_nodeinsertbeforenewchildexists.html]
+[test_nodeinsertbeforenodeancestor.html]
+[test_nodeinsertbeforenodename.html]
+[test_nodeinsertbeforenomodificationallowederr.html]
+[test_nodeinsertbeforenomodificationallowederrEE.html]
+[test_nodeinsertbeforerefchildnonexistent.html]
+[test_nodeinsertbeforerefchildnull.html]
+[test_nodelistindexequalzero.html]
+[test_nodelistindexgetlength.html]
+[test_nodelistindexgetlengthofemptylist.html]
+[test_nodelistindexnotzero.html]
+[test_nodelistreturnfirstitem.html]
+[test_nodelistreturnlastitem.html]
+[test_nodelisttraverselist.html]
+[test_nodenotationnodeattributes.html]
+[test_nodenotationnodename.html]
+[test_nodenotationnodetype.html]
+[test_nodenotationnodevalue.html]
+[test_nodeparentnode.html]
+[test_nodeparentnodenull.html]
+[test_nodeprocessinginstructionnodeattributes.html]
+[test_nodeprocessinginstructionnodename.html]
+[test_nodeprocessinginstructionnodetype.html]
+[test_nodeprocessinginstructionnodevalue.html]
+[test_nodeprocessinginstructionsetnodevalue.html]
+[test_noderemovechild.html]
+[test_noderemovechildgetnodename.html]
+[test_noderemovechildnode.html]
+[test_noderemovechildnomodificationallowederr.html]
+[test_noderemovechildnomodificationallowederrEE.html]
+[test_noderemovechildoldchildnonexistent.html]
+[test_nodereplacechild.html]
+[test_nodereplacechildinvalidnodetype.html]
+[test_nodereplacechildnewchilddiffdocument.html]
+[test_nodereplacechildnewchildexists.html]
+[test_nodereplacechildnodeancestor.html]
+[test_nodereplacechildnodename.html]
+[test_nodereplacechildnomodificationallowederr.html]
+[test_nodereplacechildnomodificationallowederrEE.html]
+[test_nodereplacechildoldchildnonexistent.html]
+[test_nodesetnodevaluenomodificationallowederr.html]
+[test_nodesetnodevaluenomodificationallowederrEE.html]
+[test_nodetextnodeattribute.html]
+[test_nodetextnodename.html]
+[test_nodetextnodetype.html]
+[test_nodetextnodevalue.html]
+[test_nodevalue01.html]
+[test_nodevalue02.html]
+[test_nodevalue03.html]
+[test_nodevalue04.html]
+[test_nodevalue05.html]
+[test_nodevalue06.html]
+[test_nodevalue07.html]
+[test_nodevalue08.html]
+[test_nodevalue09.html]
+[test_notationgetnotationname.html]
+[test_notationgetpublicid.html]
+[test_notationgetpublicidnull.html]
+[test_notationgetsystemid.html]
+[test_notationgetsystemidnull.html]
+[test_processinginstructiongetdata.html]
+[test_processinginstructiongettarget.html]
+[test_processinginstructionsetdatanomodificationallowederr.html]
+[test_textindexsizeerrnegativeoffset.html]
+[test_textindexsizeerroffsetoutofbounds.html]
+[test_textparseintolistofelements.html]
+[test_textsplittextfour.html]
+[test_textsplittextnomodificationallowederr.html]
+[test_textsplittextnomodificationallowederrEE.html]
+[test_textsplittextone.html]
+[test_textsplittextthree.html]
+[test_textsplittexttwo.html]
+[test_textwithnomarkup.html]
diff --git a/dom/tests/mochitest/dom-level1-core/test_PIsetdatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_PIsetdatanomodificationallowederrEE.html
new file mode 100644
index 0000000000..0dc730a5c0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_PIsetdatanomodificationallowederrEE.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['processinginstructionsetdatanomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'processinginstructionsetdatanomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setData(data)" method for a processing instruction causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an ent4 entity reference and add to document of the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove the "domestic" attribute
+ from the entity reference by executing the "setData(data)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-837822393')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0053.html
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederr.xml
+*/
+function processinginstructionsetdatanomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "processinginstructionsetdatanomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var piNode;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = doc.createEntityReference("ent4");
+ appendedChild = gender.appendChild(entRef);
+ entRef = gender.lastChild;
+
+ assertNotNull("entRefNotNull",entRef);
+piNode = entRef.lastChild;
+
+ assertNotNull("piNodeNotNull",piNode);
+
+ {
+ success = false;
+ try {
+ piNode.data = "newData";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_attrcreatedocumentfragment.html
new file mode 100644
index 0000000000..1b82e46edd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrcreatedocumentfragment.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatedocumentfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrcreatedocumentfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrcreatedocumentfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Attr nodes may be associated with Element nodes contained within a DocumentFragment.
+ Create a new DocumentFragment and add a newly created Element node(with one attribute).
+ Once the element is added, its attribute should be available as an attribute associated
+ with an Element within a DocumentFragment.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+*/
+function attrcreatedocumentfragment() {
+ var success;
+ if(checkInitialization(builder, "attrcreatedocumentfragment") != null) return;
+ var doc;
+ var docFragment;
+ var newOne;
+ var domesticNode;
+ var domesticAttr;
+ var attrs;
+ var attrName;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docFragment = doc.createDocumentFragment();
+ newOne = doc.createElement("newElement");
+ newOne.setAttribute("newdomestic","Yes");
+ appendedChild = docFragment.appendChild(newOne);
+ domesticNode = docFragment.firstChild;
+
+ domesticAttr = domesticNode.attributes;
+
+ attrs = domesticAttr.item(0);
+ attrName = attrs.name;
+
+ assertEquals("attrCreateDocumentFragmentAssert","newdomestic",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatedocumentfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode.html
new file mode 100644
index 0000000000..eb76fc3c6a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrcreatetextnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrcreatetextnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setValue()" method for an attribute creates a
+ Text node with the unparsed content of the string.
+ Retrieve the attribute named "street" from the last
+ child of of the fourth employee and assign the "Y&ent1;"
+ string to its value attribute. This value is not yet
+ parsed and therefore should still be the same upon
+ retrieval. This test uses the "getNamedItem(name)" method
+ from the NamedNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html
+*/
+function attrcreatetextnode() {
+ var success;
+ if(checkInitialization(builder, "attrcreatetextnode") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(3);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ streetAttr.value = "Y&ent1;";
+
+ value = streetAttr.value;
+
+ assertEquals("value","Y&ent1;",value);
+ value = streetAttr.nodeValue;
+
+ assertEquals("nodeValue","Y&ent1;",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode2.html b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode2.html
new file mode 100644
index 0000000000..7ea58109cb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode2.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrcreatetextnode2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrcreatetextnode2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNodeValue()" method for an attribute creates a
+ Text node with the unparsed content of the string.
+ Retrieve the attribute named "street" from the last
+ child of of the fourth employee and assign the "Y&ent1;"
+ string to its value attribute. This value is not yet
+ parsed and therefore should still be the same upon
+ retrieval. This test uses the "getNamedItem(name)" method
+ from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html
+*/
+function attrcreatetextnode2() {
+ var success;
+ if(checkInitialization(builder, "attrcreatetextnode2") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(3);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ streetAttr.nodeValue = "Y&ent1;";
+
+ value = streetAttr.value;
+
+ assertEquals("value","Y&ent1;",value);
+ value = streetAttr.nodeValue;
+
+ assertEquals("nodeValue","Y&ent1;",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrdefaultvalue.html b/dom/tests/mochitest/dom-level1-core/test_attrdefaultvalue.html
new file mode 100644
index 0000000000..03628ff43d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrdefaultvalue.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrdefaultvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrdefaultvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrdefaultvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If there is not an explicit value assigned to an attribute
+ and there is a declaration for this attribute and that
+ declaration includes a default value, then that default
+ value is the attributes default value.
+ Retrieve the attribute named "street" from the last
+ child of of the first employee and examine its
+ value. That value should be the value given the
+ attribute in the DTD file. The test uses the
+ "getNamedItem(name)" method from the NamedNodeMap
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function attrdefaultvalue() {
+ var success;
+ if(checkInitialization(builder, "attrdefaultvalue") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ value = streetAttr.nodeValue;
+
+ assertEquals("attrDefaultValueAssert","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrdefaultvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attreffectivevalue.html b/dom/tests/mochitest/dom-level1-core/test_attreffectivevalue.html
new file mode 100644
index 0000000000..ace800dd1f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attreffectivevalue.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attreffectivevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attreffectivevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attreffectivevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If an Attr is explicitly assigned any value, then that value is the attributes effective value.
+ Retrieve the attribute named "domestic" from the last child of of the first employee
+ and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method
+ from the NamedNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+*/
+function attreffectivevalue() {
+ var success;
+ if(checkInitialization(builder, "attreffectivevalue") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ value = domesticAttr.nodeValue;
+
+ assertEquals("attrEffectiveValueAssert","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attreffectivevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrentityreplacement.html b/dom/tests/mochitest/dom-level1-core/test_attrentityreplacement.html
new file mode 100644
index 0000000000..ddb9ec758f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrentityreplacement.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrentityreplacement</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrentityreplacement'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrentityreplacement';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getValue()" method will return the value of the
+ attribute as a string. The general entity references
+ are replaced with their values.
+ Retrieve the attribute named "street" from the last
+ child of of the fourth employee and examine the string
+ returned by the "getValue()" method. The value should
+ be set to "Yes" after the EntityReference is
+ replaced with its value. This test uses the
+ "getNamedItem(name)" method from the NamedNodeMap
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+*/
+function attrentityreplacement() {
+ var success;
+ if(checkInitialization(builder, "attrentityreplacement") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(3);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ value = streetAttr.value;
+
+ assertEquals("streetYes","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrentityreplacement</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrname.html b/dom/tests/mochitest/dom-level1-core/test_attrname.html
new file mode 100644
index 0000000000..fbed36f594
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrname.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The getNodeName() method of an Attribute node.
+ Retrieve the attribute named street from the last
+ child of of the second employee and examine its
+ NodeName. This test uses the getNamedItem(name) method from the NamedNodeMap
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403
+*/
+function attrname() {
+ var success;
+ if(checkInitialization(builder, "attrname") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(1);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ name = streetAttr.nodeName;
+
+ assertEquals("nodeName","street",name);
+ name = streetAttr.name;
+
+ assertEquals("name","street",name);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_attrnextsiblingnull.html
new file mode 100644
index 0000000000..41731b7523
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrnextsiblingnull.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnextsiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrnextsiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrnextsiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getNextSibling()" method for an Attr node should return null.
+Retrieve the attribute named "domestic" from the last child of of the
+first employee and examine its NextSibling node. This test uses the
+"getNamedItem(name)" method from the NamedNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function attrnextsiblingnull() {
+ var success;
+ if(checkInitialization(builder, "attrnextsiblingnull") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var s;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ s = domesticAttr.nextSibling;
+
+ assertNull("attrNextSiblingNullAssert",s);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnextsiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrnotspecifiedvalue.html b/dom/tests/mochitest/dom-level1-core/test_attrnotspecifiedvalue.html
new file mode 100644
index 0000000000..a7f2ab526a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrnotspecifiedvalue.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrnotspecifiedvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrnotspecifiedvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getSpecified()" method for an Attr node should
+ be set to false if the attribute was not explicitly given
+ a value.
+ Retrieve the attribute named "street" from the last
+ child of of the first employee and examine the value
+ returned by the "getSpecified()" method. This test uses
+ the "getNamedItem(name)" method from the NamedNodeMap
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function attrnotspecifiedvalue() {
+ var success;
+ if(checkInitialization(builder, "attrnotspecifiedvalue") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ state = streetAttr.specified;
+
+ assertFalse("streetNotSpecified",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_attrparentnodenull.html
new file mode 100644
index 0000000000..19c3513353
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrparentnodenull.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrparentnodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrparentnodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrparentnodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getParentNode()" method for an Attr node should return null. Retrieve
+the attribute named "domestic" from the last child of the first employee
+and examine its parentNode attribute. This test also uses the "getNamedItem(name)"
+method from the NamedNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function attrparentnodenull() {
+ var success;
+ if(checkInitialization(builder, "attrparentnodenull") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var s;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ s = domesticAttr.parentNode;
+
+ assertNull("attrParentNodeNullAssert",s);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrparentnodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_attrprevioussiblingnull.html
new file mode 100644
index 0000000000..47bb7c1110
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrprevioussiblingnull.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrprevioussiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrprevioussiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrprevioussiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getPreviousSibling()" method for an Attr node should return null.
+Retrieve the attribute named "domestic" from the last child of of the
+first employee and examine its PreviousSibling node. This test uses the
+"getNamedItem(name)" method from the NamedNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function attrprevioussiblingnull() {
+ var success;
+ if(checkInitialization(builder, "attrprevioussiblingnull") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var s;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ s = domesticAttr.previousSibling;
+
+ assertNull("attrPreviousSiblingNullAssert",s);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrprevioussiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrremovechild1.html b/dom/tests/mochitest/dom-level1-core/test_attrremovechild1.html
new file mode 100644
index 0000000000..3ef32c9c6c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrremovechild1.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrremovechild1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrremovechild1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrremovechild1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Removing a child node from an attribute in an entity reference
+should result in an NO_MODIFICATION_ALLOWED_ERR DOMException.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+*/
+function attrremovechild1() {
+ var success;
+ if(checkInitialization(builder, "attrremovechild1") != null) return;
+ var doc;
+ var entRef;
+ var entElement;
+ var attrNode;
+ var textNode;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+attrNode = entElement.getAttributeNode("domestic");
+ textNode = attrNode.firstChild;
+
+ assertNotNull("attrChildNotNull",textNode);
+
+ {
+ success = false;
+ try {
+ removedNode = attrNode.removeChild(textNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("setValue_throws_NO_MODIFICATION_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrremovechild1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrreplacechild1.html b/dom/tests/mochitest/dom-level1-core/test_attrreplacechild1.html
new file mode 100644
index 0000000000..4b7e4a7ef5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrreplacechild1.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrreplacechild1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrreplacechild1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrreplacechild1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Replacing a child node from an attribute in an entity reference
+should result in an NO_MODIFICATION_ALLOWED_ERR DOMException.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+*/
+function attrreplacechild1() {
+ var success;
+ if(checkInitialization(builder, "attrreplacechild1") != null) return;
+ var doc;
+ var entRef;
+ var entElement;
+ var attrNode;
+ var textNode;
+ var removedNode;
+ var newChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+attrNode = entElement.getAttributeNode("domestic");
+ textNode = attrNode.firstChild;
+
+ assertNotNull("attrChildNotNull",textNode);
+newChild = doc.createTextNode("Yesterday");
+
+ {
+ success = false;
+ try {
+ removedNode = attrNode.replaceChild(newChild,textNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("setValue_throws_NO_MODIFICATION_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrreplacechild1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederr.html
new file mode 100644
index 0000000000..3d53998a7d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederr.html
@@ -0,0 +1,175 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrsetvaluenomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("expandEntityReferences", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrsetvaluenomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setValue()" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the "domestic" attribute
+ from the entity reference and execute the "setValue()" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474
+* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+*/
+function attrsetvaluenomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "attrsetvaluenomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var genList;
+ var gen;
+ var gList;
+ var g;
+ var attrList;
+ var attrNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ assertNotNull("genderNotNull",gender);
+genList = gender.childNodes;
+
+ gen = genList.item(0);
+ assertNotNull("genderFirstChildNotNull",gen);
+gList = gen.childNodes;
+
+ g = gList.item(0);
+ assertNotNull("genderFirstGrandchildNotNull",g);
+attrList = g.attributes;
+
+ assertNotNull("attributesNotNull",attrList);
+attrNode = attrList.getNamedItem("domestic");
+ assertNotNull("attrNotNull",attrNode);
+
+ {
+ success = false;
+ try {
+ attrNode.value = "newvalue";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("setValue_throws_NO_MODIFICATION",success);
+ }
+
+ {
+ success = false;
+ try {
+ attrNode.nodeValue = "newvalue2";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("setNodeValue_throws_NO_MODIFICATION",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederrEE.html
new file mode 100644
index 0000000000..2615060115
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederrEE.html
@@ -0,0 +1,170 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrsetvaluenomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrsetvaluenomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setValue()" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an entity reference using document.createEntityReference()
+ Get the "domestic" attribute from the entity
+ reference and execute the "setValue()" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474
+* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr.xml
+*/
+function attrsetvaluenomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "attrsetvaluenomodificationallowederrEE") != null) return;
+ var doc;
+ var entRef;
+ var entElement;
+ var attrList;
+ var attrNode;
+ var gender;
+ var genderList;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ assertNotNull("genderNotNull",gender);
+entRef = doc.createEntityReference("ent4");
+ assertNotNull("entRefNotNull",entRef);
+appendedChild = gender.appendChild(entRef);
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+attrList = entElement.attributes;
+
+ attrNode = attrList.getNamedItem("domestic");
+
+ {
+ success = false;
+ try {
+ attrNode.value = "newvalue";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("setValue_throws_NO_MODIFICATION",success);
+ }
+
+ {
+ success = false;
+ try {
+ attrNode.nodeValue = "newvalue2";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("setNodeValue_throws_NO_MODIFICATION",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalue.html b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalue.html
new file mode 100644
index 0000000000..59b2a45fe5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalue.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrspecifiedvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrspecifiedvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getSpecified()" method for an Attr node should
+ be set to true if the attribute was explicitly given
+ a value.
+ Retrieve the attribute named "domestic" from the last
+ child of of the first employee and examine the value
+ returned by the "getSpecified()" method. This test uses
+ the "getNamedItem(name)" method from the NamedNodeMap
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273
+*/
+function attrspecifiedvalue() {
+ var success;
+ if(checkInitialization(builder, "attrspecifiedvalue") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ state = domesticAttr.specified;
+
+ assertTrue("domesticSpecified",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvaluechanged.html b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvaluechanged.html
new file mode 100644
index 0000000000..151ac4ce45
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvaluechanged.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvaluechanged</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrspecifiedvaluechanged'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrspecifiedvaluechanged';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getSpecified()" method for an Attr node should return true if the
+ value of the attribute is changed.
+ Retrieve the attribute named "street" from the last
+ child of of the THIRD employee and change its
+ value to "Yes"(which is the default DTD value). This
+ should cause the "getSpecified()" method to be true.
+ This test uses the "setAttribute(name,value)" method
+ from the Element interface and the "getNamedItem(name)"
+ method from the NamedNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273
+*/
+function attrspecifiedvaluechanged() {
+ var success;
+ if(checkInitialization(builder, "attrspecifiedvaluechanged") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(2);
+ testNode.setAttribute("street","Yes");
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ state = streetAttr.specified;
+
+ assertTrue("streetSpecified",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvaluechanged</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalueremove.html b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalueremove.html
new file mode 100644
index 0000000000..b55c449e08
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalueremove.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalueremove</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrspecifiedvalueremove'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrspecifiedvalueremove';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+To respecify the attribute to its default value from
+the DTD, the attribute must be deleted. This will then
+make a new attribute available with the "getSpecified()"
+method value set to false.
+Retrieve the attribute named "street" from the last
+child of of the THIRD employee and delete it. This
+should then create a new attribute with its default
+value and also cause the "getSpecified()" method to
+return false.
+This test uses the "removeAttribute(name)" method
+from the Element interface and the "getNamedItem(name)"
+method from the NamedNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function attrspecifiedvalueremove() {
+ var success;
+ if(checkInitialization(builder, "attrspecifiedvalueremove") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(2);
+ testNode.removeAttribute("street");
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ assertNotNull("streetAttrNotNull",streetAttr);
+state = streetAttr.specified;
+
+ assertFalse("attrSpecifiedValueRemoveAssert",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalueremove</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_cdatasectiongetdata.html b/dom/tests/mochitest/dom-level1-core/test_cdatasectiongetdata.html
new file mode 100644
index 0000000000..e174a55ec2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_cdatasectiongetdata.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectiongetdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['cdatasectiongetdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("coalescing", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'cdatasectiongetdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Retrieve the last CDATASection node located inside the
+second child of the second employee and examine its
+content. Since the CDATASection interface inherits
+from the CharacterData interface(via the Text node),
+the "getData()" method can be used to access the
+CDATA content.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+*/
+function cdatasectiongetdata() {
+ var success;
+ if(checkInitialization(builder, "cdatasectiongetdata") != null) return;
+ var doc;
+ var nameList;
+ var child;
+ var lastChild;
+ var data;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ nameList = doc.getElementsByTagName("name");
+ child = nameList.item(1);
+ lastChild = child.lastChild;
+
+ nodeType = lastChild.nodeType;
+
+ assertEquals("isCDATA",4,nodeType);
+ data = lastChild.data;
+
+ assertEquals("data","This is an adjacent CDATASection with a reference to a tab &tab;",data);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectiongetdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_cdatasectionnormalize.html b/dom/tests/mochitest/dom-level1-core/test_cdatasectionnormalize.html
new file mode 100644
index 0000000000..4f5d99621e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_cdatasectionnormalize.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectionnormalize</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['cdatasectionnormalize'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'cdatasectionnormalize';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Adjacent CDATASection nodes cannot be merged together by
+use of the "normalize()" method from the Element interface.
+Retrieve second child of the second employee and invoke
+the "normalize()" method. The Element under contains
+two CDATASection nodes that should not be merged together
+by the "normalize()" method.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083
+*/
+function cdatasectionnormalize() {
+ var success;
+ if(checkInitialization(builder, "cdatasectionnormalize") != null) return;
+ var doc;
+ var nameList;
+ var lChild;
+ var childNodes;
+ var cdataN;
+ var data;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ nameList = doc.getElementsByTagName("name");
+ lChild = nameList.item(1);
+ lChild.normalize();
+ childNodes = lChild.childNodes;
+
+ cdataN = childNodes.item(1);
+ assertNotNull("firstCDATASection",cdataN);
+data = cdataN.data;
+
+ assertEquals("data1","This is a CDATASection with EntityReference number 2 &ent2;",data);
+ cdataN = childNodes.item(3);
+ assertNotNull("secondCDATASection",cdataN);
+data = cdataN.data;
+
+ assertEquals("data3","This is an adjacent CDATASection with a reference to a tab &tab;",data);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectionnormalize</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddata.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddata.html
new file mode 100644
index 0000000000..e15f9ca7c9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddata.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataappenddata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataappenddata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendData(arg)" method appends a string to the end
+ of the character data of the node.
+
+ Retrieve the character data from the second child
+ of the first employee. The appendData(arg) method is
+ called with arg=", Esquire". The method should append
+ the specified data to the already existing character
+ data. The new value return by the "getLength()" method
+ should be 24.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+*/
+function characterdataappenddata() {
+ var success;
+ if(checkInitialization(builder, "characterdataappenddata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childValue;
+ var childLength;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.appendData(", Esquire");
+ childValue = child.data;
+
+ childLength = childValue.length;
+ assertEquals("characterdataAppendDataAssert",24,childLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatagetdata.html
new file mode 100644
index 0000000000..d3e8f5d525
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatagetdata.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatagetdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataappenddatagetdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataappenddatagetdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ On successful invocation of the "appendData(arg)"
+ method the "getData()" method provides access to the
+ concatentation of data and the specified string.
+
+ Retrieve the character data from the second child
+ of the first employee. The appendData(arg) method is
+ called with arg=", Esquire". The method should append
+ the specified data to the already existing character
+ data. The new value return by the "getData()" method
+ should be "Margaret Martin, Esquire".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+*/
+function characterdataappenddatagetdata() {
+ var success;
+ if(checkInitialization(builder, "characterdataappenddatagetdata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.appendData(", Esquire");
+ childData = child.data;
+
+ assertEquals("characterdataAppendDataGetDataAssert","Margaret Martin, Esquire",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatagetdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederr.html
new file mode 100644
index 0000000000..d2cda40d34
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederr.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataappenddatanomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataappenddatanomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendData(arg)" method raises a NO_MODIFICATION_ALLOWED_ERR
+ DOMException if the node is readonly.
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "appendData(arg)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+*/
+function characterdataappenddatanomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "characterdataappenddatanomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entElement;
+ var entElementContent;
+ var entReference;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = genderNode.firstChild;
+
+ assertNotNull("entReferenceNotNull",entReference);
+nodeType = entReference.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entReference = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entReference);
+
+ }
+ entElement = entReference.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+entElementContent = entElement.firstChild;
+
+ assertNotNull("entElementContentNotNull",entElementContent);
+
+ {
+ success = false;
+ try {
+ entElementContent.appendData("newString");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederrEE.html
new file mode 100644
index 0000000000..4704393ad5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederrEE.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataappenddatanomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataappenddatanomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Create an ent3 entity reference and call appendData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr.xml
+*/
+function characterdataappenddatanomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "characterdataappenddatanomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entText;
+ var entReference;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entReference);
+appendedChild = genderNode.appendChild(entReference);
+ entText = entReference.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ entText.appendData("newString");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatabegining.html
new file mode 100644
index 0000000000..fa72f32fc7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatabegining.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatabegining</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatadeletedatabegining'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatadeletedatabegining';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "deleteData(offset,count)" method removes a range of
+characters from the node. Delete data at the beginning
+of the character data.
+
+Retrieve the character data from the last child of the
+first employee. The "deleteData(offset,count)"
+method is then called with offset=0 and count=16.
+The method should delete the characters from position
+0 thru position 16. The new value of the character data
+should be "Dallas, Texas 98551".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function characterdatadeletedatabegining() {
+ var success;
+ if(checkInitialization(builder, "characterdatadeletedatabegining") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(0,16);
+ childData = child.data;
+
+ assertEquals("characterdataDeleteDataBeginingAssert","Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatabegining</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataend.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataend.html
new file mode 100644
index 0000000000..92e4ae7aa3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataend.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataend</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatadeletedataend'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatadeletedataend';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method removes a range of
+ characters from the node. Delete data at the end
+ of the character data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=30 and count=5.
+ The method should delete the characters from position
+ 30 thru position 35. The new value of the character data
+ should be "1230 North Ave. Dallas, Texas".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function characterdatadeletedataend() {
+ var success;
+ if(checkInitialization(builder, "characterdatadeletedataend") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(30,5);
+ childData = child.data;
+
+ assertEquals("characterdataDeleteDataEndAssert","1230 North Ave. Dallas, Texas ",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataend</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataexceedslength.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataexceedslength.html
new file mode 100644
index 0000000000..512d227241
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataexceedslength.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataexceedslength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatadeletedataexceedslength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatadeletedataexceedslength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the sum of the offset and count used in the
+ "deleteData(offset,count) method is greater than the
+ length of the character data then all the characters
+ from the offset to the end of the data are deleted.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=4 and count=50.
+ The method should delete the characters from position 4
+ to the end of the data since the offset+count(50+4)
+ is greater than the length of the character data(35).
+ The new value of the character data should be "1230".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function characterdatadeletedataexceedslength() {
+ var success;
+ if(checkInitialization(builder, "characterdatadeletedataexceedslength") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(4,50);
+ childData = child.data;
+
+ assertEquals("characterdataDeleteDataExceedsLengthAssert","1230",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataexceedslength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatagetlengthanddata.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatagetlengthanddata.html
new file mode 100644
index 0000000000..ceaf5cd174
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatagetlengthanddata.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatagetlengthanddata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatadeletedatagetlengthanddata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatadeletedatagetlengthanddata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ On successful invocation of the "deleteData(offset,count)"
+ method, the "getData()" and "getLength()" methods reflect
+ the changes.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=30 and count=5.
+ The method should delete the characters from position
+ 30 thru position 35. The new value of the character data
+ should be "1230 North Ave. Dallas, Texas" which is
+ returned by the "getData()" method and "getLength()"
+ method should return 30".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function characterdatadeletedatagetlengthanddata() {
+ var success;
+ if(checkInitialization(builder, "characterdatadeletedatagetlengthanddata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+ var childLength;
+ var result = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(30,5);
+ childData = child.data;
+
+ assertEquals("data","1230 North Ave. Dallas, Texas ",childData);
+ childLength = child.length;
+
+ assertEquals("length",30,childLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatagetlengthanddata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatamiddle.html
new file mode 100644
index 0000000000..7e19ee0dbd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatamiddle.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatamiddle</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatadeletedatamiddle'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatadeletedatamiddle';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method removes a range of
+ characters from the node. Delete data in the middle
+ of the character data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=16 and count=8.
+ The method should delete the characters from position
+ 16 thru position 24. The new value of the character data
+ should be "1230 North Ave. Texas 98551".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function characterdatadeletedatamiddle() {
+ var success;
+ if(checkInitialization(builder, "characterdatadeletedatamiddle") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(16,8);
+ childData = child.data;
+
+ assertEquals("characterdataDeleteDataMiddleAssert","1230 North Ave. Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatamiddle</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederr.html
new file mode 100644
index 0000000000..e03b42cae9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederr.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatadeletedatanomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatadeletedatanomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method raises a NO_MODIFICATION_ALLOWED_ERR
+ DOMException if the node is readonly.
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "deleteData(offset,count)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function characterdatadeletedatanomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "characterdatadeletedatanomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entElement;
+ var entElementContent;
+ var nodeType;
+ var entReference;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = genderNode.firstChild;
+
+ assertNotNull("entReferenceNotNull",entReference);
+nodeType = entReference.nodeType;
+
+
+ if(
+ (3 == nodeType)
+ ) {
+ entReference = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entReference);
+
+ }
+ entElement = entReference.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+entElementContent = entElement.firstChild;
+
+ assertNotNull("entElementContentNotNull",entElementContent);
+
+ {
+ success = false;
+ try {
+ entElementContent.deleteData(1,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederrEE.html
new file mode 100644
index 0000000000..5a0b28e1a6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederrEE.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatadeletedatanomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatadeletedatanomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Create an ent3 entity reference and call deleteData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr.xml
+*/
+function characterdatadeletedatanomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "characterdatadeletedatanomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entText;
+ var entReference;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entReference);
+appendedChild = genderNode.appendChild(entReference);
+ entText = entReference.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ entText.deleteData(1,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_characterdatagetdata.html
new file mode 100644
index 0000000000..a5dea6d1a1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatagetdata.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatagetdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatagetdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getData()" method retrieves the character data
+
+ currently stored in the node.
+
+ Retrieve the character data from the second child
+
+ of the first employee and invoke the "getData()"
+
+ method. The method returns the character data
+
+ string.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+*/
+function characterdatagetdata() {
+ var success;
+ if(checkInitialization(builder, "characterdatagetdata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ childData = child.data;
+
+ assertEquals("characterdataGetDataAssert","Margaret Martin",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatagetlength.html b/dom/tests/mochitest/dom-level1-core/test_characterdatagetlength.html
new file mode 100644
index 0000000000..2a4cf77b9d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatagetlength.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetlength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatagetlength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatagetlength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLength()" method returns the number of characters
+ stored in this nodes data.
+ Retrieve the character data from the second
+ child of the first employee and examine the
+ value returned by the getLength() method.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
+*/
+function characterdatagetlength() {
+ var success;
+ if(checkInitialization(builder, "characterdatagetlength") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childValue;
+ var childLength;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ childValue = child.data;
+
+ childLength = childValue.length;
+ assertEquals("characterdataGetLengthAssert",15,childLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetlength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedatacountnegative.html
new file mode 100644
index 0000000000..1004271afa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedatacountnegative.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedatacountnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrdeletedatacountnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrdeletedatacountnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified count
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "deleteData(offset,count)"
+ method with offset=10 and count=-3. It should raise the
+ desired exception since the count is negative.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function characterdataindexsizeerrdeletedatacountnegative() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrdeletedatacountnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.deleteData(10,-3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedatacountnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetgreater.html
new file mode 100644
index 0000000000..ea6d9f2ca6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetgreater.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrdeletedataoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrdeletedataoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater that the number of characters in the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "deleteData(offset,count)"
+ method with offset=40 and count=3. It should raise the
+ desired exception since the offset is greater than the
+ number of characters in the string.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function characterdataindexsizeerrdeletedataoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrdeletedataoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.deleteData(40,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetnegative.html
new file mode 100644
index 0000000000..a624539aa1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetnegative.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrdeletedataoffsetnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrdeletedataoffsetnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "deleteData(offset,count)"
+ method with offset=-5 and count=3. It should raise the
+ desired exception since the offset is negative.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function characterdataindexsizeerrdeletedataoffsetnegative() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrdeletedataoffsetnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.deleteData(-5,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetgreater.html
new file mode 100644
index 0000000000..e7c3e498e4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetgreater.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrinsertdataoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrinsertdataoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater than the number of characters in the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its insertData"(offset,arg)"
+ method with offset=40 and arg="ABC". It should raise
+ the desired exception since the offset is greater than
+ the number of characters in the string.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function characterdataindexsizeerrinsertdataoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrinsertdataoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.insertData(40,"ABC");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetnegative.html
new file mode 100644
index 0000000000..07629d8cff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetnegative.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrinsertdataoffsetnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrinsertdataoffsetnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its insertData"(offset,arg)"
+ method with offset=-5 and arg="ABC". It should raise
+ the desired exception since the offset is negative.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function characterdataindexsizeerrinsertdataoffsetnegative() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrinsertdataoffsetnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.insertData(-5,"ABC");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedatacountnegative.html
new file mode 100644
index 0000000000..33596a89c4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedatacountnegative.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedatacountnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrreplacedatacountnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrreplacedatacountnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified count
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its
+ "replaceData(offset,count,arg) method with offset=10
+ and count=-3 and arg="ABC". It should raise the
+ desired exception since the count is negative.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function characterdataindexsizeerrreplacedatacountnegative() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrreplacedatacountnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.replaceData(10,-3,"ABC");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedatacountnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetgreater.html
new file mode 100644
index 0000000000..f0d68a2375
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetgreater.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrreplacedataoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrreplacedataoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater than the length of the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its
+ "replaceData(offset,count,arg) method with offset=40
+ and count=3 and arg="ABC". It should raise the
+ desired exception since the offset is greater than the
+ length of the string.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function characterdataindexsizeerrreplacedataoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrreplacedataoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.replaceData(40,3,"ABC");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetnegative.html
new file mode 100644
index 0000000000..939ca80f4d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetnegative.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrreplacedataoffsetnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrreplacedataoffsetnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its
+ "replaceData(offset,count,arg) method with offset=-5
+ and count=3 and arg="ABC". It should raise the
+ desired exception since the offset is negative.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function characterdataindexsizeerrreplacedataoffsetnegative() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrreplacedataoffsetnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.replaceData(-5,3,"ABC");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringcountnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringcountnegative.html
new file mode 100644
index 0000000000..68750b9e63
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringcountnegative.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringcountnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrsubstringcountnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrsubstringcountnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified count
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "substringData(offset,count)
+ method with offset=10 and count=-3. It should raise the
+ desired exception since the count is negative.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function characterdataindexsizeerrsubstringcountnegative() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrsubstringcountnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var badSubstring;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ badSubstring = child.substringData(10,-3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringcountnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringnegativeoffset.html
new file mode 100644
index 0000000000..2a724d22ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringnegativeoffset.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringnegativeoffset</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrsubstringnegativeoffset'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrsubstringnegativeoffset';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "substringData(offset,count)
+ method with offset=-5 and count=3. It should raise the
+ desired exception since the offset is negative.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function characterdataindexsizeerrsubstringnegativeoffset() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrsubstringnegativeoffset") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var badString;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ badString = child.substringData(-5,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringnegativeoffset</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringoffsetgreater.html
new file mode 100644
index 0000000000..569cf6ac10
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringoffsetgreater.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdataindexsizeerrsubstringoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdataindexsizeerrsubstringoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater than the number of characters in the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "substringData(offset,count)
+ method with offset=40 and count=3. It should raise the
+ desired exception since the offsets value is greater
+ than the length.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function characterdataindexsizeerrsubstringoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "characterdataindexsizeerrsubstringoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var badString;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ badString = child.substringData(40,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatabeginning.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatabeginning.html
new file mode 100644
index 0000000000..049a94e6ea
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatabeginning.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatabeginning</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatainsertdatabeginning'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatainsertdatabeginning';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "insertData(offset,arg)" method will insert a string
+at the specified character offset. Insert the data at
+the beginning of the character data.
+
+Retrieve the character data from the second child of
+the first employee. The "insertData(offset,arg)"
+method is then called with offset=0 and arg="Mss.".
+The method should insert the string "Mss." at position 0.
+The new value of the character data should be
+"Mss. Margaret Martin".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+*/
+function characterdatainsertdatabeginning() {
+ var success;
+ if(checkInitialization(builder, "characterdatainsertdatabeginning") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.insertData(0,"Mss. ");
+ childData = child.data;
+
+ assertEquals("characterdataInsertDataBeginningAssert","Mss. Margaret Martin",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatabeginning</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdataend.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdataend.html
new file mode 100644
index 0000000000..a6ba22ddf5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdataend.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdataend</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatainsertdataend'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatainsertdataend';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method will insert a string
+ at the specified character offset. Insert the data at
+ the end of the character data.
+
+ Retrieve the character data from the second child of
+ the first employee. The "insertData(offset,arg)"
+ method is then called with offset=15 and arg=", Esquire".
+ The method should insert the string ", Esquire" at
+ position 15. The new value of the character data should
+ be "Margaret Martin, Esquire".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+*/
+function characterdatainsertdataend() {
+ var success;
+ if(checkInitialization(builder, "characterdatainsertdataend") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.insertData(15,", Esquire");
+ childData = child.data;
+
+ assertEquals("characterdataInsertDataEndAssert","Margaret Martin, Esquire",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdataend</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatamiddle.html
new file mode 100644
index 0000000000..ec056627eb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatamiddle.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatamiddle</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatainsertdatamiddle'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatainsertdatamiddle';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method will insert a string
+ at the specified character offset. Insert the data in
+ the middle of the character data.
+
+ Retrieve the character data from the second child of
+ the first employee. The "insertData(offset,arg)"
+ method is then called with offset=9 and arg="Ann".
+ The method should insert the string "Ann" at position 9.
+ The new value of the character data should be
+ "Margaret Ann Martin".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+*/
+function characterdatainsertdatamiddle() {
+ var success;
+ if(checkInitialization(builder, "characterdatainsertdatamiddle") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.insertData(9,"Ann ");
+ childData = child.data;
+
+ assertEquals("characterdataInsertDataMiddleAssert","Margaret Ann Martin",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatamiddle</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederr.html
new file mode 100644
index 0000000000..63d9d0aa2c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederr.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatainsertdatanomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatainsertdatanomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method raises a NO_MODIFICATION_ALLOWED_ERR
+ DOMException if the node is readonly.
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "insertData(offset,arg)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+*/
+function characterdatainsertdatanomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "characterdatainsertdatanomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entElement;
+ var nodeType;
+ var entElementContent;
+ var entReference;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = genderNode.firstChild;
+
+ assertNotNull("entReferenceNotNull",entReference);
+nodeType = entReference.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entReference = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entReference);
+
+ }
+ entElement = entReference.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+entElementContent = entElement.firstChild;
+
+ assertNotNull("entElementContentNotNull",entElementContent);
+
+ {
+ success = false;
+ try {
+ entElementContent.insertData(1,"newArg");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederrEE.html
new file mode 100644
index 0000000000..6a17addf4b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederrEE.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatainsertdatanomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatainsertdatanomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Create an ent3 entity reference and call insertData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr.xml
+*/
+function characterdatainsertdatanomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "characterdatainsertdatanomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entText;
+ var entReference;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entReference);
+entText = entReference.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ entText.insertData(1,"newArg");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatabegining.html
new file mode 100644
index 0000000000..c1b61606e9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatabegining.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatabegining</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatareplacedatabegining'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatareplacedatabegining';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "replaceData(offset,count,arg)" method replaces the
+characters starting at the specified offset with the
+specified string. Test for replacement in the
+middle of the data.
+
+Retrieve the character data from the last child of the
+first employee. The "replaceData(offset,count,arg)"
+method is then called with offset=5 and count=5 and
+arg="South". The method should replace characters five
+thru 9 of the character data with "South".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function characterdatareplacedatabegining() {
+ var success;
+ if(checkInitialization(builder, "characterdatareplacedatabegining") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(0,4,"2500");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataBeginingAssert","2500 North Ave. Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatabegining</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataend.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataend.html
new file mode 100644
index 0000000000..ea6829218d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataend.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataend</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatareplacedataend'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatareplacedataend';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method replaces the
+ characters starting at the specified offset with the
+ specified string. Test for replacement at the
+ end of the data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=30 and count=5 and
+ arg="98665". The method should replace characters 30
+ thru 34 of the character data with "98665".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function characterdatareplacedataend() {
+ var success;
+ if(checkInitialization(builder, "characterdatareplacedataend") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(30,5,"98665");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataEndAssert","1230 North Ave. Dallas, Texas 98665",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataend</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofarg.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofarg.html
new file mode 100644
index 0000000000..3fb9a72a2d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofarg.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofarg</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatareplacedataexceedslengthofarg'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatareplacedataexceedslengthofarg';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method replaces the
+ characters starting at the specified offset with the
+ specified string. Test the situation where the length
+ of the arg string is greater than the specified offset.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=0 and count=4 and
+ arg="260030". The method should replace characters one
+ thru four with "260030". Note that the length of the
+ specified string is greater that the specified offset.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function characterdatareplacedataexceedslengthofarg() {
+ var success;
+ if(checkInitialization(builder, "characterdatareplacedataexceedslengthofarg") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(0,4,"260030");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataExceedsLengthOfArgAssert","260030 North Ave. Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofarg</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofdata.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofdata.html
new file mode 100644
index 0000000000..94e5a8053a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofdata.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatareplacedataexceedslengthofdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatareplacedataexceedslengthofdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the sum of the offset and count exceeds the length then
+ all the characters to the end of the data are replaced.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=0 and count=50 and
+ arg="2600". The method should replace all the characters
+ with "2600". This is because the sum of the offset and
+ count exceeds the length of the character data.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function characterdatareplacedataexceedslengthofdata() {
+ var success;
+ if(checkInitialization(builder, "characterdatareplacedataexceedslengthofdata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(0,50,"2600");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataExceedsLengthOfDataAssert","2600",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatamiddle.html
new file mode 100644
index 0000000000..3f65f14f77
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatamiddle.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatamiddle</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatareplacedatamiddle'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatareplacedatamiddle';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method replaces the
+ characters starting at the specified offset with the
+ specified string. Test for replacement in the
+ middle of the data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=5 and count=5 and
+ arg="South". The method should replace characters five
+ thru 9 of the character data with "South".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function characterdatareplacedatamiddle() {
+ var success;
+ if(checkInitialization(builder, "characterdatareplacedatamiddle") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(5,5,"South");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataMiddleAssert","1230 South Ave. Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatamiddle</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederr.html
new file mode 100644
index 0000000000..fd624c6b16
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederr.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatareplacedatanomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatareplacedatanomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method raises a NO_MODIFICATION_ALLOWED_ERR
+ DOMException if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "replaceData(offset,count,arg)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function characterdatareplacedatanomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "characterdatareplacedatanomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entElement;
+ var entElementContent;
+ var entReference;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = genderNode.firstChild;
+
+ assertNotNull("entReferenceNotNull",entReference);
+nodeType = entReference.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entReference = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entReference);
+
+ }
+ entElement = entReference.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+entElementContent = entElement.firstChild;
+
+ assertNotNull("entElementContentNotNull",entElementContent);
+
+ {
+ success = false;
+ try {
+ entElementContent.replaceData(1,3,"newArg");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederrEE.html
new file mode 100644
index 0000000000..0ef63da7c6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederrEE.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatareplacedatanomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatareplacedatanomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Create an ent3 entity reference and call replaceData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr.xml
+*/
+function characterdatareplacedatanomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "characterdatareplacedatanomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entText;
+ var entReference;
+ var appendedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entReference);
+appendedNode = genderNode.appendChild(entReference);
+ entText = entReference.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ entText.replaceData(1,3,"newArg");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederr.html
new file mode 100644
index 0000000000..7b346ce4e1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederr.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatasetdatanomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatasetdatanomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setData(data)" method raises a NO_MODIFICATION_ALLOWED_ERR
+ DOMException if the node is readonly.
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "setData(data)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+*/
+function characterdatasetdatanomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "characterdatasetdatanomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entElement;
+ var entElementContent;
+ var entReference;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entReference = genderNode.firstChild;
+
+ assertNotNull("entReferenceNotNull",entReference);
+nodeType = entReference.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entReference = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entReference);
+
+ }
+ entElement = entReference.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+entElementContent = entElement.firstChild;
+
+ assertNotNull("entElementContentNotNull",entElementContent);
+
+ {
+ success = false;
+ try {
+ entElementContent.data = "newData";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederrEE.html
new file mode 100644
index 0000000000..c9278bc8be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederrEE.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatasetdatanomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatasetdatanomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Create an ent3 entity reference and call setData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr.xml
+*/
+function characterdatasetdatanomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "characterdatasetdatanomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entText;
+ var entReference;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(4);
+ entReference = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entReference);
+entText = entReference.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ entText.data = "newData";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasetnodevalue.html
new file mode 100644
index 0000000000..d69eacf107
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasetnodevalue.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatasetnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatasetnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNodeValue()" method changes the character data
+ currently stored in the node.
+ Retrieve the character data from the second child
+ of the first employee and invoke the "setNodeValue()"
+ method, call "getData()" and compare.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+*/
+function characterdatasetnodevalue() {
+ var success;
+ if(checkInitialization(builder, "characterdatasetnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.nodeValue = "Marilyn Martin";
+
+ childData = child.data;
+
+ assertEquals("data","Marilyn Martin",childData);
+ childValue = child.nodeValue;
+
+ assertEquals("value","Marilyn Martin",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringexceedsvalue.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringexceedsvalue.html
new file mode 100644
index 0000000000..1cb5221b6c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringexceedsvalue.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringexceedsvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatasubstringexceedsvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatasubstringexceedsvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the sum of the "offset" and "count" exceeds the
+ "length" then the "substringData(offset,count)" method
+ returns all the characters to the end of the data.
+
+ Retrieve the character data from the second child
+ of the first employee and access part of the data
+ by using the substringData(offset,count) method
+ with offset=9 and count=10. The method should return
+ the substring "Martin" since offset+count > length
+ (19 > 15).
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+*/
+function characterdatasubstringexceedsvalue() {
+ var success;
+ if(checkInitialization(builder, "characterdatasubstringexceedsvalue") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var substring;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ substring = child.substringData(9,10);
+ assertEquals("characterdataSubStringExceedsValueAssert","Martin",substring);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringexceedsvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringvalue.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringvalue.html
new file mode 100644
index 0000000000..dc4aa78aed
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringvalue.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['characterdatasubstringvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'characterdatasubstringvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method returns the
+ specified string.
+
+ Retrieve the character data from the second child
+ of the first employee and access part of the data
+ by using the substringData(offset,count) method. The
+ method should return the specified substring starting
+ at position "offset" and extract "count" characters.
+ The method should return the string "Margaret".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+*/
+function characterdatasubstringvalue() {
+ var success;
+ if(checkInitialization(builder, "characterdatasubstringvalue") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var substring;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ substring = child.substringData(0,8);
+ assertEquals("characterdataSubStringValueAssert","Margaret",substring);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_commentgetcomment.html b/dom/tests/mochitest/dom-level1-core/test_commentgetcomment.html
new file mode 100644
index 0000000000..6f7f921da6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_commentgetcomment.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/commentgetcomment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['commentgetcomment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'commentgetcomment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ A comment is all the characters between the starting
+ '<!--' and ending '-->'
+ Retrieve the nodes of the DOM document. Search for a
+ comment node and the content is its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function commentgetcomment() {
+ var success;
+ if(checkInitialization(builder, "commentgetcomment") != null) return;
+ var doc;
+ var elementList;
+ var child;
+ var childName;
+ var childValue;
+ var commentCount = 0;
+ var childType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.childNodes;
+
+ for(var indexN65623 = 0;indexN65623 < elementList.length; indexN65623++) {
+ child = elementList.item(indexN65623);
+ childType = child.nodeType;
+
+
+ if(
+ (8 == childType)
+ ) {
+ childName = child.nodeName;
+
+ assertEquals("nodeName","#comment",childName);
+ childValue = child.nodeValue;
+
+ assertEquals("nodeValue"," This is comment number 1.",childValue);
+ commentCount = commentCount + 1;
+
+ }
+
+ }
+ assertEquals("commentCount",1,commentCount);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/commentgetcomment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateattribute.html
new file mode 100644
index 0000000000..ff57a99114
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateattribute.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createAttribute(name)" method creates an Attribute
+ node of the given name.
+
+ Retrieve the entire DOM document and invoke its
+ "createAttribute(name)" method. It should create a
+ new Attribute node with the given name. The name, value
+ and type of the newly created object are retrieved and
+ output.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+*/
+function documentcreateattribute() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattribute") != null) return;
+ var doc;
+ var newAttrNode;
+ var attrValue;
+ var attrName;
+ var attrType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newAttrNode = doc.createAttribute("district");
+ attrValue = newAttrNode.nodeValue;
+
+ assertEquals("value","",attrValue);
+ attrName = newAttrNode.nodeName;
+
+ assertEquals("name","district",attrName);
+ attrType = newAttrNode.nodeType;
+
+ assertEquals("type",2,attrType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatecdatasection.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatecdatasection.html
new file mode 100644
index 0000000000..b7e50cfad2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatecdatasection.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecdatasection</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreatecdatasection'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreatecdatasection';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createCDATASection(data)" method creates a new
+ CDATASection node whose value is the specified string.
+ Retrieve the entire DOM document and invoke its
+ "createCDATASection(data)" method. It should create a
+ new CDATASection node whose "data" is the specified
+ string. The content, name and type are retrieved and
+ output.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D26C0AF8
+*/
+function documentcreatecdatasection() {
+ var success;
+ if(checkInitialization(builder, "documentcreatecdatasection") != null) return;
+ var doc;
+ var newCDATASectionNode;
+ var newCDATASectionValue;
+ var newCDATASectionName;
+ var newCDATASectionType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newCDATASectionNode = doc.createCDATASection("This is a new CDATASection node");
+ newCDATASectionValue = newCDATASectionNode.nodeValue;
+
+ assertEquals("nodeValue","This is a new CDATASection node",newCDATASectionValue);
+ newCDATASectionName = newCDATASectionNode.nodeName;
+
+ assertEquals("nodeName","#cdata-section",newCDATASectionName);
+ newCDATASectionType = newCDATASectionNode.nodeType;
+
+ assertEquals("nodeType",4,newCDATASectionType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecdatasection</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatecomment.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatecomment.html
new file mode 100644
index 0000000000..d448578d46
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatecomment.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecomment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreatecomment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreatecomment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createComment(data)" method creates a new Comment
+ node given the specified string.
+ Retrieve the entire DOM document and invoke its
+ "createComment(data)" method. It should create a new
+ Comment node whose "data" is the specified string.
+ The content, name and type are retrieved and output.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328
+*/
+function documentcreatecomment() {
+ var success;
+ if(checkInitialization(builder, "documentcreatecomment") != null) return;
+ var doc;
+ var newCommentNode;
+ var newCommentValue;
+ var newCommentName;
+ var newCommentType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newCommentNode = doc.createComment("This is a new Comment node");
+ newCommentValue = newCommentNode.nodeValue;
+
+ assertEquals("value","This is a new Comment node",newCommentValue);
+ newCommentName = newCommentNode.nodeName;
+
+ assertEquals("name","#comment",newCommentName);
+ newCommentType = newCommentNode.nodeType;
+
+ assertEquals("type",8,newCommentType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecomment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatedocumentfragment.html
new file mode 100644
index 0000000000..ff47fab9c5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatedocumentfragment.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatedocumentfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreatedocumentfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreatedocumentfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createDocumentFragment()" method creates an empty
+ DocumentFragment object.
+ Retrieve the entire DOM document and invoke its
+ "createDocumentFragment()" method. The content, name,
+ type and value of the newly created object are output.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5
+*/
+function documentcreatedocumentfragment() {
+ var success;
+ if(checkInitialization(builder, "documentcreatedocumentfragment") != null) return;
+ var doc;
+ var newDocFragment;
+ var children;
+ var length;
+ var newDocFragmentName;
+ var newDocFragmentType;
+ var newDocFragmentValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newDocFragment = doc.createDocumentFragment();
+ children = newDocFragment.childNodes;
+
+ length = children.length;
+
+ assertEquals("length",0,length);
+ newDocFragmentName = newDocFragment.nodeName;
+
+ assertEquals("name","#document-fragment",newDocFragmentName);
+ newDocFragmentType = newDocFragment.nodeType;
+
+ assertEquals("type",11,newDocFragmentType);
+ newDocFragmentValue = newDocFragment.nodeValue;
+
+ assertNull("value",newDocFragmentValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatedocumentfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateelement.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateelement.html
new file mode 100644
index 0000000000..a81513c152
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateelement.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelement</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateelement'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateelement';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createElement(tagName)" method creates an Element
+ of the type specified.
+ Retrieve the entire DOM document and invoke its
+ "createElement(tagName)" method with tagName="address".
+ The method should create an instance of an Element node
+ whose tagName is "address". The NodeName, NodeType
+ and NodeValue are returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+*/
+function documentcreateelement() {
+ var success;
+ if(checkInitialization(builder, "documentcreateelement") != null) return;
+ var doc;
+ var newElement;
+ var newElementName;
+ var newElementType;
+ var newElementValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newElement = doc.createElement("address");
+ newElementName = newElement.nodeName;
+
+ assertEquals("name","address",newElementName);
+ newElementType = newElement.nodeType;
+
+ assertEquals("type",1,newElementType);
+ newElementValue = newElement.nodeValue;
+
+ assertNull("valueInitiallyNull",newElementValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelement</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateelementcasesensitive.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementcasesensitive.html
new file mode 100644
index 0000000000..a609bc6140
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementcasesensitive.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementcasesensitive</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateelementcasesensitive'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateelementcasesensitive';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The tagName parameter in the "createElement(tagName)"
+ method is case-sensitive for XML documents.
+ Retrieve the entire DOM document and invoke its
+ "createElement(tagName)" method twice. Once for tagName
+ equal to "address" and once for tagName equal to "ADDRESS"
+ Each call should create a distinct Element node. The
+ newly created Elements are then assigned attributes
+ that are retrieved.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+*/
+function documentcreateelementcasesensitive() {
+ var success;
+ if(checkInitialization(builder, "documentcreateelementcasesensitive") != null) return;
+ var doc;
+ var newElement1;
+ var newElement2;
+ var attribute1;
+ var attribute2;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newElement1 = doc.createElement("ADDRESS");
+ newElement2 = doc.createElement("address");
+ newElement1.setAttribute("district","Fort Worth");
+ newElement2.setAttribute("county","Dallas");
+ attribute1 = newElement1.getAttribute("district");
+ attribute2 = newElement2.getAttribute("county");
+ assertEquals("attrib1","Fort Worth",attribute1);
+ assertEquals("attrib2","Dallas",attribute2);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementcasesensitive</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateelementdefaultattr.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementdefaultattr.html
new file mode 100644
index 0000000000..bd7bb0f8db
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementdefaultattr.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementdefaultattr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateelementdefaultattr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateelementdefaultattr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createElement(tagName)" method creates an Element
+ of the type specified. In addition, if there are known attributes
+ with default values, Attr nodes representing them are automatically
+ created and attached to the element.
+ Retrieve the entire DOM document and invoke its
+ "createElement(tagName)" method with tagName="address".
+ The method should create an instance of an Element node
+ whose tagName is "address". The tagName "address" has an
+ attribute with default values, therefore the newly created element
+ will have them.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function documentcreateelementdefaultattr() {
+ var success;
+ if(checkInitialization(builder, "documentcreateelementdefaultattr") != null) return;
+ var doc;
+ var newElement;
+ var defaultAttr;
+ var child;
+ var name;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newElement = doc.createElement("address");
+ defaultAttr = newElement.attributes;
+
+ child = defaultAttr.item(0);
+ assertNotNull("defaultAttrNotNull",child);
+name = child.nodeName;
+
+ assertEquals("attrName","street",name);
+ value = child.nodeValue;
+
+ assertEquals("attrValue","Yes",value);
+ assertSize("attrCount",1,defaultAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementdefaultattr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreference.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreference.html
new file mode 100644
index 0000000000..200644f6aa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreference.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreference</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateentityreference'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateentityreference';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createEntityReference(name)" method creates an
+ EntityReferrence node.
+
+ Retrieve the entire DOM document and invoke its
+ "createEntityReference(name)" method. It should create
+ a new EntityReference node for the Entity with the
+ given name. The name, value and type are retrieved and
+ output.
+
+* @author NIST
+* @author Mary Brady
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function documentcreateentityreference() {
+ var success;
+ if(checkInitialization(builder, "documentcreateentityreference") != null) return;
+ var doc;
+ var newEntRefNode;
+ var entRefValue;
+ var entRefName;
+ var entRefType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newEntRefNode = doc.createEntityReference("ent1");
+ assertNotNull("createdEntRefNotNull",newEntRefNode);
+entRefValue = newEntRefNode.nodeValue;
+
+ assertNull("value",entRefValue);
+ entRefName = newEntRefNode.nodeName;
+
+ assertEquals("name","ent1",entRefName);
+ entRefType = newEntRefNode.nodeType;
+
+ assertEquals("type",5,entRefType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreference</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreferenceknown.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreferenceknown.html
new file mode 100644
index 0000000000..c854b5c766
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreferenceknown.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreferenceknown</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateentityreferenceknown'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateentityreferenceknown';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createEntityReference(name)" method creates an
+ EntityReference node. In addition, if the referenced entity
+ is known, the child list of the "EntityReference" node
+ is the same as the corresponding "Entity" node.
+
+ Retrieve the entire DOM document and invoke its
+ "createEntityReference(name)" method. It should create
+ a new EntityReference node for the Entity with the
+ given name. The referenced entity is known, therefore the child
+ list of the "EntityReference" node is the same as the corresponding
+ "Entity" node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE
+*/
+function documentcreateentityreferenceknown() {
+ var success;
+ if(checkInitialization(builder, "documentcreateentityreferenceknown") != null) return;
+ var doc;
+ var newEntRefNode;
+ var newEntRefList;
+ var child;
+ var name;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newEntRefNode = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",newEntRefNode);
+newEntRefList = newEntRefNode.childNodes;
+
+ assertSize("size",1,newEntRefList);
+child = newEntRefNode.firstChild;
+
+ name = child.nodeName;
+
+ assertEquals("name","#text",name);
+ value = child.nodeValue;
+
+ assertEquals("value","Texas",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreferenceknown</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateprocessinginstruction.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateprocessinginstruction.html
new file mode 100644
index 0000000000..4b461ed877
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateprocessinginstruction.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateprocessinginstruction</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateprocessinginstruction'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateprocessinginstruction';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createProcessingInstruction(target,data)" method
+ creates a new ProcessingInstruction node with the
+ specified name and data string.
+
+ Retrieve the entire DOM document and invoke its
+ "createProcessingInstruction(target,data)" method.
+ It should create a new PI node with the specified target
+ and data. The target, data and type are retrieved and
+ output.
+
+* @author NIST
+* @author Mary Brady
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2001Apr/0020.html
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function documentcreateprocessinginstruction() {
+ var success;
+ if(checkInitialization(builder, "documentcreateprocessinginstruction") != null) return;
+ var doc;
+ var newPINode;
+ var piValue;
+ var piName;
+ var piType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newPINode = doc.createProcessingInstruction("TESTPI","This is a new PI node");
+ assertNotNull("createdPINotNull",newPINode);
+piName = newPINode.nodeName;
+
+ assertEquals("name","TESTPI",piName);
+ piValue = newPINode.nodeValue;
+
+ assertEquals("value","This is a new PI node",piValue);
+ piType = newPINode.nodeType;
+
+ assertEquals("type",7,piType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateprocessinginstruction</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatetextnode.html
new file mode 100644
index 0000000000..e369135a59
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatetextnode.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatetextnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreatetextnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreatetextnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createTextNode(data)" method creates a Text node
+ given the specfied string.
+ Retrieve the entire DOM document and invoke its
+ "createTextNode(data)" method. It should create a
+ new Text node whose "data" is the specified string.
+ The NodeName and NodeType are also checked.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127
+*/
+function documentcreatetextnode() {
+ var success;
+ if(checkInitialization(builder, "documentcreatetextnode") != null) return;
+ var doc;
+ var newTextNode;
+ var newTextName;
+ var newTextValue;
+ var newTextType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newTextNode = doc.createTextNode("This is a new Text node");
+ newTextValue = newTextNode.nodeValue;
+
+ assertEquals("value","This is a new Text node",newTextValue);
+ newTextName = newTextNode.nodeName;
+
+ assertEquals("name","#text",newTextName);
+ newTextType = newTextNode.nodeType;
+
+ assertEquals("type",3,newTextType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatetextnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetdoctype.html b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctype.html
new file mode 100644
index 0000000000..a4bc82a818
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctype.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetdoctype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetdoctype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getDoctype()" method returns the Document
+ Type Declaration associated with this document.
+ Retrieve the entire DOM document and invoke its
+ "getDoctype()" method. The name of the document
+ type should be returned. The "getName()" method
+ should be equal to "staff" or "svg".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function documentgetdoctype() {
+ var success;
+ if(checkInitialization(builder, "documentgetdoctype") != null) return;
+ var doc;
+ var docType;
+ var docTypeName;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+docTypeName = docType.name;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("doctypeNameSVG","svg",docTypeName);
+
+ }
+
+ else {
+ assertEquals("doctypeName","staff",docTypeName);
+
+ }
+ nodeValue = docType.nodeValue;
+
+ assertNull("initiallyNull",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetdoctypenodtd.html b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctypenodtd.html
new file mode 100644
index 0000000000..f02b6dfdbf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctypenodtd.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctypenodtd</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetdoctypenodtd'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_nodtdstaff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetdoctypenodtd';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getDoctype()" method returns null for XML documents
+ without a document type declaration.
+ Retrieve the XML document without a DTD and invoke the
+ "getDoctype()" method. It should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
+*/
+function documentgetdoctypenodtd() {
+ var success;
+ if(checkInitialization(builder, "documentgetdoctypenodtd") != null) return;
+ var doc;
+ var docType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_nodtdstaff");
+ docType = doc.doctype;
+
+ assertNull("documentGetDocTypeNoDTDAssert",docType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctypenodtd</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_nodtdstaff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamelength.html b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamelength.html
new file mode 100644
index 0000000000..4fa670435d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamelength.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamelength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnamelength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnamelength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getElementsByTagName(tagName)" method returns a
+ NodeList of all the Elements with a given tagName.
+
+ Retrieve the entire DOM document and invoke its
+ "getElementsByTagName(tagName)" method with tagName
+ equal to "name". The method should return a NodeList
+ that contains 5 elements.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
+*/
+function documentgetelementsbytagnamelength() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnamelength") != null) return;
+ var doc;
+ var nameList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ nameList = doc.getElementsByTagName("name");
+ assertSize("documentGetElementsByTagNameLengthAssert",5,nameList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamelength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnametotallength.html b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnametotallength.html
new file mode 100644
index 0000000000..e06cf3adcd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnametotallength.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnametotallength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnametotallength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnametotallength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the entire DOM document, invoke
+ getElementsByTagName("*") and check the length of the NodeList.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
+*/
+function documentgetelementsbytagnametotallength() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnametotallength") != null) return;
+ var doc;
+ var nameList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ nameList = doc.getElementsByTagName("*");
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertSize("elementCountSVG",39,nameList);
+
+ }
+
+ else {
+ assertSize("documentGetElementsByTagNameTotalLengthAssert",37,nameList);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnametotallength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamevalue.html b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamevalue.html
new file mode 100644
index 0000000000..bb85caac68
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamevalue.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnamevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnamevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getElementsByTagName(tagName)" method returns a
+ NodeList of all the Elements with a given tagName
+ in a pre-order traversal of the tree.
+
+ Retrieve the entire DOM document and invoke its
+ "getElementsByTagName(tagName)" method with tagName
+ equal to "name". The method should return a NodeList
+ that contains 5 elements. The FOURTH item in the
+ list is retrieved and output.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
+*/
+function documentgetelementsbytagnamevalue() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnamevalue") != null) return;
+ var doc;
+ var nameList;
+ var nameNode;
+ var firstChild;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ nameList = doc.getElementsByTagName("name");
+ nameNode = nameList.item(3);
+ firstChild = nameNode.firstChild;
+
+ childValue = firstChild.nodeValue;
+
+ assertEquals("documentGetElementsByTagNameValueAssert","Jeny Oconnor",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetimplementation.html b/dom/tests/mochitest/dom-level1-core/test_documentgetimplementation.html
new file mode 100644
index 0000000000..8c4b52d729
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentgetimplementation.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetimplementation</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetimplementation'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetimplementation';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getImplementation()" method returns the
+ DOMImplementation object that handles this document.
+ Retrieve the entire DOM document and invoke its
+ "getImplementation()" method. It should return a
+ DOMImplementation whose "hasFeature("XML","1.0")
+ method returns the boolean value "true".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA
+*/
+function documentgetimplementation() {
+ var success;
+ if(checkInitialization(builder, "documentgetimplementation") != null) return;
+ var doc;
+ var docImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docImpl = doc.implementation;
+state = docImpl.hasFeature("XML","1.0");
+assertTrue("documentGetImplementationAssert",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetimplementation</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetrootnode.html b/dom/tests/mochitest/dom-level1-core/test_documentgetrootnode.html
new file mode 100644
index 0000000000..b57042018f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentgetrootnode.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetrootnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetrootnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetrootnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getDocumentElement()" method provides direct access
+ to the child node that is the root element of the document.
+ Retrieve the entire DOM document and invoke its
+ "getDocumentElement()" method. It should return an
+ Element node whose NodeName is "staff" (or "svg").
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function documentgetrootnode() {
+ var success;
+ if(checkInitialization(builder, "documentgetrootnode") != null) return;
+ var doc;
+ var root;
+ var rootName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ root = doc.documentElement;
+
+ rootName = root.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgRootNode","svg",rootName);
+
+ }
+
+ else {
+ assertEquals("documentGetRootNodeAssert","staff",rootName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetrootnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateattribute.html
new file mode 100644
index 0000000000..312f7bf5d4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateattribute.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentinvalidcharacterexceptioncreateattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentinvalidcharacterexceptioncreateattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createAttribute(tagName)" method raises an
+ INVALID_CHARACTER_ERR DOMException if the specified
+ tagName contains an invalid character.
+
+ Retrieve the entire DOM document and invoke its
+ "createAttribute(tagName)" method with the tagName equal
+ to the string "invalid^Name". Due to the invalid
+ character the desired EXCEPTION should be raised.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function documentinvalidcharacterexceptioncreateattribute() {
+ var success;
+ if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateattribute") != null) return;
+ var doc;
+ var createdAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+
+ {
+ success = false;
+ try {
+ createdAttr = doc.createAttribute("invalid^Name");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateelement.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateelement.html
new file mode 100644
index 0000000000..071f634832
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateelement.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateelement</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentinvalidcharacterexceptioncreateelement'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentinvalidcharacterexceptioncreateelement';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createElement(tagName)" method raises an
+ INVALID_CHARACTER_ERR DOMException if the specified
+ tagName contains an invalid character.
+
+ Retrieve the entire DOM document and invoke its
+ "createElement(tagName)" method with the tagName equal
+ to the string "invalid^Name". Due to the invalid
+ character the desired EXCEPTION should be raised.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function documentinvalidcharacterexceptioncreateelement() {
+ var success;
+ if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateelement") != null) return;
+ var doc;
+ var badElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+
+ {
+ success = false;
+ try {
+ badElement = doc.createElement("invalid^Name");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateelement</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref.html
new file mode 100644
index 0000000000..47e1daca5b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentinvalidcharacterexceptioncreateentref'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentinvalidcharacterexceptioncreateentref';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createEntityReference(tagName)" method raises an
+ INVALID_CHARACTER_ERR DOMException if the specified
+ tagName contains an invalid character.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function documentinvalidcharacterexceptioncreateentref() {
+ var success;
+ if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateentref") != null) return;
+ var doc;
+ var badEntityRef;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ badEntityRef = doc.createEntityReference("foo");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+
+ {
+ success = false;
+ try {
+ badEntityRef = doc.createEntityReference("invalid^Name");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref1.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref1.html
new file mode 100644
index 0000000000..ccebfd2cfc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref1.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentinvalidcharacterexceptioncreateentref1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentinvalidcharacterexceptioncreateentref1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Creating an entity reference with an empty name should cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function documentinvalidcharacterexceptioncreateentref1() {
+ var success;
+ if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateentref1") != null) return;
+ var doc;
+ var badEntityRef;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ badEntityRef = doc.createEntityReference("foo");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+
+ {
+ success = false;
+ try {
+ badEntityRef = doc.createEntityReference("");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi.html
new file mode 100644
index 0000000000..8be46b87e5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentinvalidcharacterexceptioncreatepi'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentinvalidcharacterexceptioncreatepi';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createProcessingInstruction(target,data) method
+ raises an INVALID_CHARACTER_ERR DOMException if the
+ specified tagName contains an invalid character.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function documentinvalidcharacterexceptioncreatepi() {
+ var success;
+ if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi") != null) return;
+ var doc;
+ var badPI;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ badPI = doc.createProcessingInstruction("foo","data");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+
+ {
+ success = false;
+ try {
+ badPI = doc.createProcessingInstruction("invalid^Name","data");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi1.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi1.html
new file mode 100644
index 0000000000..9ef4fe3e09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi1.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentinvalidcharacterexceptioncreatepi1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentinvalidcharacterexceptioncreatepi1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Creating a processing instruction with an empty target should cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function documentinvalidcharacterexceptioncreatepi1() {
+ var success;
+ if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi1") != null) return;
+ var doc;
+ var badPI;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ badPI = doc.createProcessingInstruction("foo","data");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+
+ {
+ success = false;
+ try {
+ badPI = doc.createProcessingInstruction("","data");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetdoctype.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetdoctype.html
new file mode 100644
index 0000000000..ccb9aca95e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetdoctype.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetdoctype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypegetdoctype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypegetdoctype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getName()" method contains the name of the DTD.
+
+ Retrieve the Document Type for this document and examine
+ the string returned by the "getName()" method.
+ It should be set to "staff".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1844763134
+*/
+function documenttypegetdoctype() {
+ var success;
+ if(checkInitialization(builder, "documenttypegetdoctype") != null) return;
+ var doc;
+ var docType;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+name = docType.name;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("doctypeName","svg",name);
+
+ }
+
+ else {
+ assertEquals("documenttypeGetDocTypeAssert","staff",name);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetdoctype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetentities.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentities.html
new file mode 100644
index 0000000000..00de7950b5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentities.html
@@ -0,0 +1,171 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentities</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypegetentities'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypegetentities';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getEntities()" method is a NamedNodeMap that contains
+ the general entities for this document.
+
+ Retrieve the Document Type for this document and create
+ a NamedNodeMap of all its entities. The entire map is
+ traversed and the names of the entities are retrieved.
+ There should be 5 entities. Duplicates should be ignored.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630
+*/
+function documenttypegetentities() {
+ var success;
+ if(checkInitialization(builder, "documenttypegetentities") != null) return;
+ var doc;
+ var docType;
+ var entityList;
+ var name;
+ expectedResult = new Array();
+ expectedResult[0] = "ent1";
+ expectedResult[1] = "ent2";
+ expectedResult[2] = "ent3";
+ expectedResult[3] = "ent4";
+ expectedResult[4] = "ent5";
+
+ expectedResultSVG = new Array();
+ expectedResultSVG[0] = "ent1";
+ expectedResultSVG[1] = "ent2";
+ expectedResultSVG[2] = "ent3";
+ expectedResultSVG[3] = "ent4";
+ expectedResultSVG[4] = "ent5";
+ expectedResultSVG[5] = "svgunit";
+ expectedResultSVG[6] = "svgtest";
+
+ var nameList = new Array();
+
+ var entity;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entityList = docType.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+for(var indexN65659 = 0;indexN65659 < entityList.length; indexN65659++) {
+ entity = entityList.item(indexN65659);
+ name = entity.nodeName;
+
+ nameList[nameList.length] = name;
+
+ }
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEqualsCollection("entityNamesSVG",expectedResultSVG,nameList);
+
+ }
+
+ else {
+ assertEqualsCollection("entityNames",expectedResult,nameList);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentities</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitieslength.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitieslength.html
new file mode 100644
index 0000000000..88058e01d2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitieslength.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitieslength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypegetentitieslength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypegetentitieslength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Duplicate entities are to be discarded.
+ Retrieve the Document Type for this document and create
+ a NamedNodeMap of all its entities. The entity named
+ "ent1" is defined twice and therefore that last
+ occurrance should be discarded.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630
+*/
+function documenttypegetentitieslength() {
+ var success;
+ if(checkInitialization(builder, "documenttypegetentitieslength") != null) return;
+ var doc;
+ var docType;
+ var entityList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entityList = docType.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertSize("entitySizeSVG",7,entityList);
+
+ }
+
+ else {
+ assertSize("entitySize",5,entityList);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitieslength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitiestype.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitiestype.html
new file mode 100644
index 0000000000..ecbc9ae142
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitiestype.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitiestype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypegetentitiestype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypegetentitiestype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Every node in the map returned by the "getEntities()"
+ method implements the Entity interface.
+
+ Retrieve the Document Type for this document and create
+ a NamedNodeMap of all its entities. Traverse the
+ entire list and examine the NodeType of each node
+ in the list.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630
+*/
+function documenttypegetentitiestype() {
+ var success;
+ if(checkInitialization(builder, "documenttypegetentitiestype") != null) return;
+ var doc;
+ var docType;
+ var entityList;
+ var entity;
+ var entityType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entityList = docType.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+for(var indexN65609 = 0;indexN65609 < entityList.length; indexN65609++) {
+ entity = entityList.item(indexN65609);
+ entityType = entity.nodeType;
+
+ assertEquals("documenttypeGetEntitiesTypeAssert",6,entityType);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitiestype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotations.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotations.html
new file mode 100644
index 0000000000..6c2819d377
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotations.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotations</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypegetnotations'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypegetnotations';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNotations()" method creates a NamedNodeMap that
+ contains all the notations declared in the DTD.
+
+ Retrieve the Document Type for this document and create
+ a NamedNodeMap object of all the notations. There
+ should be two items in the list (notation1 and notation2).
+
+* @author NIST
+* @author Mary Brady
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF
+*/
+function documenttypegetnotations() {
+ var success;
+ if(checkInitialization(builder, "documenttypegetnotations") != null) return;
+ var doc;
+ var docType;
+ var notationList;
+ var notation;
+ var notationName;
+ var actual = new Array();
+
+ expected = new Array();
+ expected[0] = "notation1";
+ expected[1] = "notation2";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notationList = docType.notations;
+
+ assertNotNull("notationsNotNull",notationList);
+for(var indexN65627 = 0;indexN65627 < notationList.length; indexN65627++) {
+ notation = notationList.item(indexN65627);
+ notationName = notation.nodeName;
+
+ actual[actual.length] = notationName;
+
+ }
+ assertEqualsCollection("names",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotations</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotationstype.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotationstype.html
new file mode 100644
index 0000000000..6a467eb742
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotationstype.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotationstype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypegetnotationstype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypegetnotationstype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Every node in the map returned by the "getNotations()"
+ method implements the Notation interface.
+
+ Retrieve the Document Type for this document and create
+ a NamedNodeMap object of all the notations. Traverse
+ the entire list and examine the NodeType of each node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF
+*/
+function documenttypegetnotationstype() {
+ var success;
+ if(checkInitialization(builder, "documenttypegetnotationstype") != null) return;
+ var doc;
+ var docType;
+ var notationList;
+ var notation;
+ var notationType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notationList = docType.notations;
+
+ assertNotNull("notationsNotNull",notationList);
+for(var indexN65609 = 0;indexN65609 < notationList.length; indexN65609++) {
+ notation = notationList.item(indexN65609);
+ notationType = notation.nodeType;
+
+ assertEquals("documenttypeGetNotationsTypeAssert",12,notationType);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotationstype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenoversion.html b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenoversion.html
new file mode 100644
index 0000000000..699e640344
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenoversion.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenoversion</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationfeaturenoversion'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationfeaturenoversion';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+hasFeature("XML", "") should return true for implementations that can read staff files.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
+* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14
+*/
+function domimplementationfeaturenoversion() {
+ var success;
+ if(checkInitialization(builder, "domimplementationfeaturenoversion") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ domImpl = doc.implementation;
+state = domImpl.hasFeature("XML","");
+assertTrue("hasXMLEmpty",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenoversion</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenull.html b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenull.html
new file mode 100644
index 0000000000..b086fdd703
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenull.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationfeaturenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("hasNullString", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationfeaturenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+hasFeature("XML", null) should return true for implementations that can read staff documents.
+
+* @author NIST
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
+* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14
+*/
+function domimplementationfeaturenull() {
+ var success;
+ if(checkInitialization(builder, "domimplementationfeaturenull") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+ var nullVersion = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ domImpl = doc.implementation;
+state = domImpl.hasFeature("XML",nullVersion);
+assertTrue("hasXMLnull",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturexml.html b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturexml.html
new file mode 100644
index 0000000000..b4a436565b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturexml.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturexml</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationfeaturexml'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationfeaturexml';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+hasFeature("xml", "1.0") should return true for implementations that can read staff documents.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
+*/
+function domimplementationfeaturexml() {
+ var success;
+ if(checkInitialization(builder, "domimplementationfeaturexml") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ domImpl = doc.implementation;
+state = domImpl.hasFeature("xml","1.0");
+assertTrue("hasXML1",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturexml</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementaddnewattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementaddnewattribute.html
new file mode 100644
index 0000000000..06eaedf79c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementaddnewattribute.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementaddnewattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementaddnewattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementaddnewattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttribute(name,value)" method adds a new attribute
+ to the Element
+
+ Retrieve the last child of the last employee, then
+ add an attribute to it by invoking the
+ "setAttribute(name,value)" method. It should create
+ a "name" attribute with an assigned value equal to
+ "value".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+*/
+function elementaddnewattribute() {
+ var success;
+ if(checkInitialization(builder, "elementaddnewattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(4);
+ testEmployee.setAttribute("district","dallas");
+ attrValue = testEmployee.getAttribute("district");
+ assertEquals("elementAddNewAttributeAssert","dallas",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementaddnewattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementassociatedattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementassociatedattribute.html
new file mode 100644
index 0000000000..2382d8acfd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementassociatedattribute.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementassociatedattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementassociatedattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementassociatedattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Elements may have attributes associated with them.
+
+ Retrieve the first attribute from the last child of
+ the first employee and invoke the "getSpecified()"
+ method. This test is only intended to show that
+ Elements can actually have attributes. This test uses
+ the "getNamedItem(name)" method from the NamedNodeMap
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function elementassociatedattribute() {
+ var success;
+ if(checkInitialization(builder, "elementassociatedattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var domesticAttr;
+ var specified;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(0);
+ attributes = testEmployee.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ specified = domesticAttr.specified;
+
+ assertTrue("domesticSpecified",specified);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementassociatedattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementchangeattributevalue.html b/dom/tests/mochitest/dom-level1-core/test_elementchangeattributevalue.html
new file mode 100644
index 0000000000..a09d357243
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementchangeattributevalue.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementchangeattributevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementchangeattributevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementchangeattributevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttribute(name,value)" method adds a new attribute
+ to the Element. If the "name" is already present, then
+ its value should be changed to the new one that is in
+ the "value" parameter.
+
+ Retrieve the last child of the fourth employee, then add
+ an attribute to it by invoking the
+ "setAttribute(name,value)" method. Since the name of the
+ used attribute("street") is already present in this
+ element, then its value should be changed to the new one
+ of the "value" parameter.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+*/
+function elementchangeattributevalue() {
+ var success;
+ if(checkInitialization(builder, "elementchangeattributevalue") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(3);
+ testEmployee.setAttribute("street","Neither");
+ attrValue = testEmployee.getAttribute("street");
+ assertEquals("elementChangeAttributeValueAssert","Neither",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementchangeattributevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementcreatenewattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementcreatenewattribute.html
new file mode 100644
index 0000000000..f329f1aab0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementcreatenewattribute.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementcreatenewattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementcreatenewattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementcreatenewattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method adds a new
+ attribute to the Element.
+
+ Retrieve first address element and add
+ a new attribute node to it by invoking its
+ "setAttributeNode(newAttr)" method. This test makes use
+ of the "createAttribute(name)" method from the Document
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+*/
+function elementcreatenewattribute() {
+ var success;
+ if(checkInitialization(builder, "elementcreatenewattribute") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var newAttribute;
+ var oldAttr;
+ var districtAttr;
+ var attrVal;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(0);
+ newAttribute = doc.createAttribute("district");
+ oldAttr = testAddress.setAttributeNode(newAttribute);
+ assertNull("old_attr_doesnt_exist",oldAttr);
+ districtAttr = testAddress.getAttributeNode("district");
+ assertNotNull("new_district_accessible",districtAttr);
+attrVal = testAddress.getAttribute("district");
+ assertEquals("attr_value","",attrVal);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementcreatenewattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetattributenode.html b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenode.html
new file mode 100644
index 0000000000..b1d72647dd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenode.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetattributenode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetattributenode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributeNode(name)" method retrieves an
+ attribute node by name.
+
+ Retrieve the attribute "domestic" from the last child
+ of the first employee. Since the method returns an
+ Attr object, the "name" can be examined to ensure the
+ proper attribute was retrieved.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8
+*/
+function elementgetattributenode() {
+ var success;
+ if(checkInitialization(builder, "elementgetattributenode") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var domesticAttr;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(0);
+ domesticAttr = testEmployee.getAttributeNode("domestic");
+ name = domesticAttr.nodeName;
+
+ assertEquals("elementGetAttributeNodeAssert","domestic",name);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenodenull.html
new file mode 100644
index 0000000000..22c42058ce
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenodenull.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetattributenodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetattributenodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributeNode(name)" method retrieves an
+ attribute node by name. It should return null if the
+ "name" attribute does not exist.
+
+ Retrieve the last child of the first employee and attempt
+ to retrieve a non-existing attribute. The method should
+ return "null". The non-existing attribute to be used
+ is "invalidAttribute".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8
+*/
+function elementgetattributenodenull() {
+ var success;
+ if(checkInitialization(builder, "elementgetattributenodenull") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var domesticAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(0);
+ domesticAttr = testEmployee.getAttributeNode("invalidAttribute");
+ assertNull("elementGetAttributeNodeNullAssert",domesticAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementempty.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementempty.html
new file mode 100644
index 0000000000..ef32feb8a8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementempty.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementempty</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementempty'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementempty';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttribute(name)" method returns an empty
+ string if no value was assigned to an attribute and
+ no default value was given in the DTD file.
+
+ Retrieve the last child of the last employee, then
+ invoke "getAttribute(name)" method, where "name" is an
+ attribute without a specified or DTD default value.
+ The "getAttribute(name)" method should return the empty
+ string. This method makes use of the
+ "createAttribute(newAttr)" method from the Document
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9
+*/
+function elementgetelementempty() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementempty") != null) return;
+ var doc;
+ var newAttribute;
+ var elementList;
+ var testEmployee;
+ var domesticAttr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newAttribute = doc.createAttribute("district");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(3);
+ domesticAttr = testEmployee.setAttributeNode(newAttribute);
+ attrValue = testEmployee.getAttribute("district");
+ assertEquals("elementGetElementEmptyAssert","",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementempty</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagname.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagname.html
new file mode 100644
index 0000000000..72ad7f0811
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagname.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementsbytagname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementsbytagname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getElementsByTagName(name)" method returns a list
+of all descendant Elements with the given tag name.
+Test for an empty list.
+
+Create a NodeList of all the descendant elements
+using the string "noMatch" as the tagName.
+The method should return a NodeList whose length is
+"0" since there are not any descendant elements
+that match the given tag name.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+*/
+function elementgetelementsbytagname() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementsbytagname") != null) return;
+ var doc;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ assertSize("elementGetElementsByTagNameAssert",5,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnameaccessnodelist.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnameaccessnodelist.html
new file mode 100644
index 0000000000..0a3dce9ebc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnameaccessnodelist.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnameaccessnodelist</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementsbytagnameaccessnodelist'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementsbytagnameaccessnodelist';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Element.getElementsByTagName("employee") should return a NodeList whose length is
+"5" in the order the children were encountered.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+*/
+function elementgetelementsbytagnameaccessnodelist() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementsbytagnameaccessnodelist") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var child;
+ var childName;
+ var childValue;
+ var childType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ testEmployee = elementList.item(3);
+ child = testEmployee.firstChild;
+
+ childType = child.nodeType;
+
+
+ if(
+ (3 == childType)
+ ) {
+ child = child.nextSibling;
+
+
+ }
+ childName = child.nodeName;
+
+ assertEquals("nodename","employeeId",childName);
+ child = child.firstChild;
+
+ childValue = child.nodeValue;
+
+ assertEquals("emp0004","EMP0004",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnameaccessnodelist</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamenomatch.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamenomatch.html
new file mode 100644
index 0000000000..bbebeb5a73
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamenomatch.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamenomatch</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementsbytagnamenomatch'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementsbytagnamenomatch';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getElementsByTagName(name)" method returns a list
+of all descendant Elements with the given tag name.
+
+Create a NodeList of all the descendant elements
+using the string "employee" as the tagName.
+The method should return a NodeList whose length is
+"5".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+*/
+function elementgetelementsbytagnamenomatch() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementsbytagnamenomatch") != null) return;
+ var doc;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("noMatch");
+ assertSize("elementGetElementsByTagNameNoMatchNoMatchAssert",0,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamenomatch</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamespecialvalue.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamespecialvalue.html
new file mode 100644
index 0000000000..a82b229e6b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamespecialvalue.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamespecialvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementsbytagnamespecialvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementsbytagnamespecialvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getElementsByTagName(name)" method may use the
+special value "*" to match all tags in the element
+tree.
+
+Create a NodeList of all the descendant elements
+of the last employee by using the special value "*".
+The method should return all the descendant children(6)
+in the order the children were encountered.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+*/
+function elementgetelementsbytagnamespecialvalue() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementsbytagnamespecialvalue") != null) return;
+ var doc;
+ var elementList;
+ var lastEmployee;
+ var lastempList;
+ var child;
+ var childName;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "employeeId";
+ expectedResult[1] = "name";
+ expectedResult[2] = "position";
+ expectedResult[3] = "salary";
+ expectedResult[4] = "gender";
+ expectedResult[5] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ lastEmployee = elementList.item(4);
+ lastempList = lastEmployee.getElementsByTagName("*");
+ for(var indexN65642 = 0;indexN65642 < lastempList.length; indexN65642++) {
+ child = lastempList.item(indexN65642);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+ assertEqualsList("tagNames",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamespecialvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgettagname.html b/dom/tests/mochitest/dom-level1-core/test_elementgettagname.html
new file mode 100644
index 0000000000..2ddf8c9463
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementgettagname.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgettagname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgettagname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgettagname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getTagName()" method returns the
+
+ tagName of an element.
+
+
+
+ Invoke the "getTagName()" method one the
+
+ root node. The value returned should be "staff".
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function elementgettagname() {
+ var success;
+ if(checkInitialization(builder, "elementgettagname") != null) return;
+ var doc;
+ var root;
+ var tagname;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ root = doc.documentElement;
+
+ tagname = root.tagName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgTagName","svg",tagname);
+
+ }
+
+ else {
+ assertEquals("elementGetTagNameAssert","staff",tagname);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgettagname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_elementinuseattributeerr.html
new file mode 100644
index 0000000000..a87e71cf09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementinuseattributeerr.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinuseattributeerr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementinuseattributeerr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementinuseattributeerr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method raises an
+ "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr"
+ is already an attribute of another element.
+
+ Retrieve the last child of the second employee and append
+ a newly created element. The "createAttribute(name)"
+ and "setAttributeNode(newAttr)" methods are invoked
+ to create and add a new attribute to the newly created
+ Element. The "setAttributeNode(newAttr)" method is
+ once again called to add the new attribute causing an
+ exception to be raised since the attribute is already
+ an attribute of another element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+*/
+function elementinuseattributeerr() {
+ var success;
+ if(checkInitialization(builder, "elementinuseattributeerr") != null) return;
+ var doc;
+ var newAttribute;
+ var addressElementList;
+ var testAddress;
+ var newElement;
+ var appendedChild;
+ var setAttr1;
+ var setAttr2;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressElementList = doc.getElementsByTagName("address");
+ testAddress = addressElementList.item(1);
+ newElement = doc.createElement("newElement");
+ appendedChild = testAddress.appendChild(newElement);
+ newAttribute = doc.createAttribute("newAttribute");
+ setAttr1 = newElement.setAttributeNode(newAttribute);
+
+ {
+ success = false;
+ try {
+ setAttr2 = testAddress.setAttributeNode(newAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("throw_INUSE_ATTRIBUTE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinuseattributeerr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementinvalidcharacterexception.html b/dom/tests/mochitest/dom-level1-core/test_elementinvalidcharacterexception.html
new file mode 100644
index 0000000000..aa64f2c814
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementinvalidcharacterexception.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinvalidcharacterexception</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementinvalidcharacterexception'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementinvalidcharacterexception';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "setAttribute(name,value)" method raises an
+
+ "INVALID_CHARACTER_ERR DOMException if the specified
+
+ name contains an invalid character.
+
+
+
+ Retrieve the last child of the first employee and
+
+ call its "setAttribute(name,value)" method with
+
+ "name" containing an invalid character.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function elementinvalidcharacterexception() {
+ var success;
+ if(checkInitialization(builder, "elementinvalidcharacterexception") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddress.setAttribute("invalid^Name","value");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinvalidcharacterexception</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementnormalize.html b/dom/tests/mochitest/dom-level1-core/test_elementnormalize.html
new file mode 100644
index 0000000000..ac0100807d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementnormalize.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnormalize</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementnormalize'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementnormalize';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "normalize()" method puts all the nodes in the full
+ depth of the sub-tree underneath this element into a
+ "normal" form.
+
+ Retrieve the third employee and access its second child.
+ This child contains a block of text that is spread
+ across multiple lines. The content of the "name" child
+ should be parsed and treated as a single Text node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083
+*/
+function elementnormalize() {
+ var success;
+ if(checkInitialization(builder, "elementnormalize") != null) return;
+ var doc;
+ var root;
+ var elementList;
+ var testName;
+ var firstChild;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ root = doc.documentElement;
+
+ root.normalize();
+ elementList = root.getElementsByTagName("name");
+ testName = elementList.item(2);
+ firstChild = testName.firstChild;
+
+ childValue = firstChild.nodeValue;
+
+ assertEquals("elementNormalizeAssert","Roger\n Jones",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnormalize</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_elementnotfounderr.html
new file mode 100644
index 0000000000..e75e633aac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementnotfounderr.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnotfounderr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementnotfounderr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementnotfounderr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method raises a
+ NOT_FOUND_ERR DOMException if the "oldAttr" attribute
+ is not an attribute of the element.
+
+ Retrieve the last employee and attempt to remove
+ a non existing attribute node. This should cause the
+ intended exception to be raised. This test makes use
+ of the "createAttribute(name)" method from the Document
+ interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function elementnotfounderr() {
+ var success;
+ if(checkInitialization(builder, "elementnotfounderr") != null) return;
+ var doc;
+ var oldAttribute;
+ var addressElementList;
+ var testAddress;
+ var attrAddress;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressElementList = doc.getElementsByTagName("address");
+ testAddress = addressElementList.item(4);
+ oldAttribute = doc.createAttribute("oldAttribute");
+
+ {
+ success = false;
+ try {
+ attrAddress = testAddress.removeAttributeNode(oldAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnotfounderr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattribute.html
new file mode 100644
index 0000000000..cd7f3a63a5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattribute.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttribute(name)" removes an attribute by name.
+ If the attribute has a default value, it is immediately
+ replaced.
+
+ Retrieve the attribute named "street" from the last child
+ of the fourth employee, then remove the "street"
+ attribute by invoking the "removeAttribute(name)" method.
+ The "street" attribute has a default value defined in the
+ DTD file, that value should immediately replace the old
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function elementremoveattribute() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(3);
+ testEmployee.removeAttribute("street");
+ attrValue = testEmployee.getAttribute("street");
+ assertEquals("streetYes","Yes",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributeaftercreate.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributeaftercreate.html
new file mode 100644
index 0000000000..8ba3bb22bc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributeaftercreate.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributeaftercreate</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributeaftercreate'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributeaftercreate';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method removes the
+ specified attribute.
+
+ Retrieve the last child of the third employee, add a
+ new "district" node to it and then try to remove it.
+ To verify that the node was removed use the
+ "getNamedItem(name)" method from the NamedNodeMap
+ interface. It also uses the "getAttributes()" method
+ from the Node interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+*/
+function elementremoveattributeaftercreate() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributeaftercreate") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var attributes;
+ var districtAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("district");
+ districtAttr = testEmployee.setAttributeNode(newAttribute);
+ districtAttr = testEmployee.removeAttributeNode(newAttribute);
+ attributes = testEmployee.attributes;
+
+ districtAttr = attributes.getNamedItem("district");
+ assertNull("elementRemoveAttributeAfterCreateAssert",districtAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributeaftercreate</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenode.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenode.html
new file mode 100644
index 0000000000..816400b456
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenode.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributenode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributenode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method returns the
+ node that was removed.
+
+ Retrieve the last child of the third employee and
+ remove its "street" Attr node. The method should
+ return the old attribute node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+*/
+function elementremoveattributenode() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributenode") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var streetAttr;
+ var removedAttr;
+ var removedValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ streetAttr = testEmployee.getAttributeNode("street");
+ removedAttr = testEmployee.removeAttributeNode(streetAttr);
+ removedValue = removedAttr.value;
+
+ assertEquals("elementRemoveAttributeNodeAssert","No",removedValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederr.html
new file mode 100644
index 0000000000..2fce51ea1a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederr.html
@@ -0,0 +1,170 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributenodenomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributenodenomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove the "domestic" attribute
+ from the entity reference by executing the "removeAttributeNode(oldAttr)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+*/
+function elementremoveattributenodenomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributenodenomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var genList;
+ var gen;
+ var nodeType;
+ var gList;
+ var genElement;
+ var attrList;
+ var attrNode;
+ var removedAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ genList = gender.childNodes;
+
+ gen = genList.item(0);
+ assertNotNull("genNotNull",gen);
+nodeType = gen.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ gen = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",gen);
+
+ }
+ gList = gen.childNodes;
+
+ genElement = gList.item(0);
+ assertNotNull("genElementNotNull",genElement);
+attrList = genElement.attributes;
+
+ attrNode = attrList.getNamedItem("domestic");
+
+ {
+ success = false;
+ try {
+ removedAttr = genElement.removeAttributeNode(attrNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederrEE.html
new file mode 100644
index 0000000000..8722318cb4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederrEE.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributenodenomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributenodenomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an entity reference and add it to the children of the THIRD "gender" element.
+ Try to remove the "domestic" attribute from the entity
+ reference by executing the "removeAttributeNode(oldAttr)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederr.xml
+*/
+function elementremoveattributenodenomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributenodenomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var entElement;
+ var attrList;
+ var attrNode;
+ var nodeType;
+ var removedAttr;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+appendedChild = gender.appendChild(entRef);
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+attrList = entElement.attributes;
+
+ attrNode = attrList.getNamedItem("domestic");
+ assertNotNull("attrNodeNotNull",attrNode);
+
+ {
+ success = false;
+ try {
+ removedAttr = entElement.removeAttributeNode(attrNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederr.html
new file mode 100644
index 0000000000..542f26aedc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederr.html
@@ -0,0 +1,164 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributenomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributenomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttribute(name)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove the "domestic" attribute
+ from the entity reference by executing the "removeAttribute(name)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6D6AC0F9')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
+*/
+function elementremoveattributenomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributenomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var genList;
+ var gen;
+ var gList;
+ var nodeType;
+ var genElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ genList = gender.childNodes;
+
+ gen = genList.item(0);
+ assertNotNull("genNotNull",gen);
+nodeType = gen.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ gen = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",gen);
+
+ }
+ gList = gen.childNodes;
+
+ genElement = gList.item(0);
+ assertNotNull("genElementNotNull",genElement);
+
+ {
+ success = false;
+ try {
+ genElement.removeAttribute("domestic");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederrEE.html
new file mode 100644
index 0000000000..36965ef362
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederrEE.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributenomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributenomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttribute(name)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an reference the entity ent4 and add it to the THIRD "gender" element.
+ Try to remove the "domestic" attribute from the entity reference by executing the "removeAttribute(name)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6D6AC0F9')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederr.xml
+*/
+function elementremoveattributenomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributenomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var entElement;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+appendedChild = gender.appendChild(entRef);
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+
+ {
+ success = false;
+ try {
+ entElement.removeAttribute("domestic");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributerestoredefaultvalue.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributerestoredefaultvalue.html
new file mode 100644
index 0000000000..8c8b56b43e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributerestoredefaultvalue.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributerestoredefaultvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributerestoredefaultvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributerestoredefaultvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method removes the
+ specified attribute node and restores any default values.
+
+ Retrieve the last child of the third employeed and
+ remove its "street" Attr node. Since this node has a
+ default value defined in the DTD file, that default
+ should immediately be the new value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function elementremoveattributerestoredefaultvalue() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributerestoredefaultvalue") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var streetAttr;
+ var attribute;
+ var removedAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ streetAttr = testEmployee.getAttributeNode("street");
+ removedAttr = testEmployee.removeAttributeNode(streetAttr);
+ attribute = testEmployee.getAttribute("street");
+ assertEquals("streetYes","Yes",attribute);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributerestoredefaultvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementreplaceattributewithself.html b/dom/tests/mochitest/dom-level1-core/test_elementreplaceattributewithself.html
new file mode 100644
index 0000000000..68742fb8e7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementreplaceattributewithself.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceattributewithself</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementreplaceattributewithself'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementreplaceattributewithself';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+This test calls setAttributeNode to replace an attribute with itself.
+Since the node is not an attribute of another Element, it would
+be inappropriate to throw an INUSE_ATTRIBUTE_ERR.
+
+This test was derived from elementinuserattributeerr which
+inadvertanly made this test.
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+*/
+function elementreplaceattributewithself() {
+ var success;
+ if(checkInitialization(builder, "elementreplaceattributewithself") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var streetAttr;
+ var replacedAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ streetAttr = testEmployee.getAttributeNode("street");
+ replacedAttr = testEmployee.setAttributeNode(streetAttr);
+ assertSame("replacedAttr",streetAttr,replacedAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceattributewithself</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattribute.html
new file mode 100644
index 0000000000..408fdc8634
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattribute.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementreplaceexistingattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementreplaceexistingattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method adds a new
+ attribute to the Element. If the "newAttr" Attr node is
+ already present in this element, it should replace the
+ existing one.
+
+ Retrieve the last child of the third employee and add a
+ new attribute node by invoking the "setAttributeNode(new
+ Attr)" method. The new attribute node to be added is
+ "street", which is already present in this element. The
+ method should replace the existing Attr node with the
+ new one. This test uses the "createAttribute(name)"
+ method from the Document interface.
+
+* @author NIST
+* @author Mary Brady
+*/
+function elementreplaceexistingattribute() {
+ var success;
+ if(checkInitialization(builder, "elementreplaceexistingattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var name;
+ var setAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("street");
+ setAttr = testEmployee.setAttributeNode(newAttribute);
+ name = testEmployee.getAttribute("street");
+ assertEquals("elementReplaceExistingAttributeAssert","",name);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattributegevalue.html b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattributegevalue.html
new file mode 100644
index 0000000000..2722367f30
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattributegevalue.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattributegevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementreplaceexistingattributegevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementreplaceexistingattributegevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+If the "setAttributeNode(newAttr)" method replaces an
+existing Attr node with the same name, then it should
+return the previously existing Attr node.
+
+Retrieve the last child of the third employee and add a
+new attribute node. The new attribute node is "street",
+which is already present in this Element. The method
+should return the existing Attr node(old "street" Attr).
+This test uses the "createAttribute(name)" method
+from the Document interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+*/
+function elementreplaceexistingattributegevalue() {
+ var success;
+ if(checkInitialization(builder, "elementreplaceexistingattributegevalue") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("street");
+ streetAttr = testEmployee.setAttributeNode(newAttribute);
+ value = streetAttr.value;
+
+ assertEquals("streetNo","No",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattributegevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementretrieveallattributes.html b/dom/tests/mochitest/dom-level1-core/test_elementretrieveallattributes.html
new file mode 100644
index 0000000000..9b3e981231
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementretrieveallattributes.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveallattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementretrieveallattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementretrieveallattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributes()" method(Node Interface) may
+ be used to retrieve the set of all attributes of an
+ element.
+
+ Create a list of all the attributes of the last child
+ of the first employee by using the "getAttributes()"
+ method. Examine the length of the attribute list.
+ This test uses the "getLength()" method from the
+ NameNodeMap interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function elementretrieveallattributes() {
+ var success;
+ if(checkInitialization(builder, "elementretrieveallattributes") != null) return;
+ var doc;
+ var addressList;
+ var testAddress;
+ var attributes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testAddress = addressList.item(0);
+ attributes = testAddress.attributes;
+
+ assertSize("elementRetrieveAllAttributesAssert",2,attributes);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveallattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementretrieveattrvalue.html b/dom/tests/mochitest/dom-level1-core/test_elementretrieveattrvalue.html
new file mode 100644
index 0000000000..ad2e7fe4fe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementretrieveattrvalue.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveattrvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementretrieveattrvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementretrieveattrvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttribute(name)" method returns an attribute
+ value by name.
+
+ Retrieve the second address element, then
+ invoke the 'getAttribute("street")' method. This should
+ return the value of the attribute("No").
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9
+*/
+function elementretrieveattrvalue() {
+ var success;
+ if(checkInitialization(builder, "elementretrieveattrvalue") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(2);
+ attrValue = testAddress.getAttribute("street");
+ assertEquals("attrValue","No",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveattrvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementretrievetagname.html b/dom/tests/mochitest/dom-level1-core/test_elementretrievetagname.html
new file mode 100644
index 0000000000..5082f76b4f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementretrievetagname.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrievetagname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementretrievetagname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementretrievetagname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getElementsByTagName()" method returns a NodeList
+ of all descendant elements with a given tagName.
+
+ Invoke the "getElementsByTagName()" method and create
+ a NodeList of "position" elements. Retrieve the second
+ "position" element in the list and return the NodeName.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815
+*/
+function elementretrievetagname() {
+ var success;
+ if(checkInitialization(builder, "elementretrievetagname") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("position");
+ testEmployee = elementList.item(1);
+ name = testEmployee.nodeName;
+
+ assertEquals("nodename","position",name);
+ name = testEmployee.tagName;
+
+ assertEquals("tagname","position",name);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrievetagname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederr.html
new file mode 100644
index 0000000000..d58ebc80fa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederr.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodenomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodenomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove the "domestic" attribute
+ from the entity reference by executing the "setAttributeNode(newAttr)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+*/
+function elementsetattributenodenomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodenomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var entElement;
+ var newAttr;
+ var nodeType;
+ var badAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = gender.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+nodeType = entRef.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+
+ }
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+newAttr = doc.createAttribute("newAttr");
+
+ {
+ success = false;
+ try {
+ badAttr = entElement.setAttributeNode(newAttr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederrEE.html
new file mode 100644
index 0000000000..c4dc54be3c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederrEE.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodenomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("expandEntityReferences", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodenomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an entity reference and add to the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove the "domestic" attribute
+ from the entity reference by executing the "setAttributeNode(newAttr)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederr.xml
+*/
+function elementsetattributenodenomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodenomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var entElement;
+ var newAttr;
+ var badAttr;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+appendedChild = gender.appendChild(entRef);
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+newAttr = doc.createAttribute("newAttr");
+
+ {
+ success = false;
+ try {
+ badAttr = entElement.setAttributeNode(newAttr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenull.html
new file mode 100644
index 0000000000..a409168c4a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenull.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method returns the
+ null value if no previously existing Attr node with the
+ same name was replaced.
+
+ Retrieve the last child of the third employee and add a
+ new attribute to it. The new attribute node added is
+ "district", which is not part of this Element. The
+ method should return the null value.
+ This test uses the "createAttribute(name)"
+ method from the Document interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+*/
+function elementsetattributenodenull() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodenull") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var districtAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("district");
+ districtAttr = testEmployee.setAttributeNode(newAttribute);
+ assertNull("elementSetAttributeNodeNullAssert",districtAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederr.html
new file mode 100644
index 0000000000..202ef30245
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederr.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("expandEntityReferences", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttribute(name,value)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove the "domestic" attribute
+ from the entity reference by executing the "setAttribute(name,value)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+*/
+function elementsetattributenomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var entElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = gender.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+
+ {
+ success = false;
+ try {
+ entElement.setAttribute("newAttr","newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederrEE.html
new file mode 100644
index 0000000000..9fe4d14ba0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederrEE.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttribute(name,value)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Add an ent4 reference to the children of the THIRD "gender" element.
+ Try to remove the "domestic" attribute
+ from the entity reference by executing the "setAttribute(name,value)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederr.xml
+*/
+function elementsetattributenomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenomodificationallowederrEE") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var entElement;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = doc.createEntityReference("ent4");
+ appendedChild = gender.appendChild(entRef);
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+
+ {
+ success = false;
+ try {
+ entElement.setAttribute("newAttr","newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_elementwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_elementwrongdocumenterr.html
new file mode 100644
index 0000000000..72ba6534c2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_elementwrongdocumenterr.html
@@ -0,0 +1,174 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementwrongdocumenterr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementwrongdocumenterr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementwrongdocumenterr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "setAttributeNode(newAttr)" method raises an
+
+ "WRONG_DOCUMENT_ERR DOMException if the "newAttr"
+
+ was created from a different document than the one that
+
+ created this document.
+
+
+
+ Retrieve the last employee and attempt to set a new
+
+ attribute node for its "employee" element. The new
+
+ attribute was created from a document other than the
+
+ one that created this element, therefore a
+
+ WRONG_DOCUMENT_ERR DOMException should be raised.
+
+ This test uses the "createAttribute(newAttr)" method
+
+ from the Document interface.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function elementwrongdocumenterr() {
+ var success;
+ if(checkInitialization(builder, "elementwrongdocumenterr") != null) return;
+ var doc1;
+ var doc2;
+ var newAttribute;
+ var addressElementList;
+ var testAddress;
+ var attrAddress;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "staff");
+ newAttribute = doc2.createAttribute("newAttribute");
+ addressElementList = doc1.getElementsByTagName("address");
+ testAddress = addressElementList.item(4);
+
+ {
+ success = false;
+ try {
+ attrAddress = testAddress.setAttributeNode(newAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementwrongdocumenterr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_entitygetentityname.html b/dom/tests/mochitest/dom-level1-core/test_entitygetentityname.html
new file mode 100644
index 0000000000..d25572e980
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_entitygetentityname.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetentityname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['entitygetentityname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'entitygetentityname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The nodeName attribute that is inherited from Node
+ contains the name of the entity.
+
+ Retrieve the entity named "ent1" and access its name by
+ invoking the "getNodeName()" method inherited from
+ the Node interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function entitygetentityname() {
+ var success;
+ if(checkInitialization(builder, "entitygetentityname") != null) return;
+ var doc;
+ var docType;
+ var entityList;
+ var entityNode;
+ var entityName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entityList = docType.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+entityNode = entityList.getNamedItem("ent1");
+ entityName = entityNode.nodeName;
+
+ assertEquals("entityGetEntityNameAssert","ent1",entityName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetentityname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_entitygetpublicid.html b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicid.html
new file mode 100644
index 0000000000..c308e4ae66
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicid.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicid</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['entitygetpublicid'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'entitygetpublicid';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getPublicId()" method of an Entity node contains
+ the public identifier associated with the entity, if
+ one was specified.
+
+ Retrieve the entity named "ent5" and access its
+ public identifier. The string "entityURI" should be
+ returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D7303025
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6ABAEB38
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D7C29F3E
+*/
+function entitygetpublicid() {
+ var success;
+ if(checkInitialization(builder, "entitygetpublicid") != null) return;
+ var doc;
+ var docType;
+ var entityList;
+ var entityNode;
+ var publicId;
+ var systemId;
+ var notation;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entityList = docType.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+entityNode = entityList.getNamedItem("ent5");
+ publicId = entityNode.publicId;
+
+ assertEquals("publicId","entityURI",publicId);
+ systemId = entityNode.systemId;
+
+ assertURIEquals("systemId",null,null,null,"entityFile",null,null,null,null,systemId);
+notation = entityNode.notationName;
+
+ assertEquals("notation","notation1",notation);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicid</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_entitygetpublicidnull.html b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicidnull.html
new file mode 100644
index 0000000000..b6d9647d06
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicidnull.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicidnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['entitygetpublicidnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'entitygetpublicidnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getPublicId()" method of an Entity node contains
+ the public identifier associated with the entity, if
+ one was not specified a null value should be returned.
+
+ Retrieve the entity named "ent1" and access its
+ public identifier. Since a public identifier was not
+ specified for this entity, the "getPublicId()" method
+ should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D7303025
+*/
+function entitygetpublicidnull() {
+ var success;
+ if(checkInitialization(builder, "entitygetpublicidnull") != null) return;
+ var doc;
+ var docType;
+ var entityList;
+ var entityNode;
+ var publicId;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entityList = docType.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+entityNode = entityList.getNamedItem("ent1");
+ publicId = entityNode.publicId;
+
+ assertNull("entityGetPublicIdNullAssert",publicId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicidnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild1.html
new file mode 100644
index 0000000000..4e4e801e82
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild1.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrappendchild1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrappendchild1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Appends a text node to an attribute and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function hc_attrappendchild1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrappendchild1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var lastChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("terday");
+ retval = titleAttr.appendChild(textNode);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","Yesterday",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Yesterday",value);
+ value = retval.nodeValue;
+
+ assertEquals("retvalValue","terday",value);
+ lastChild = titleAttr.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","terday",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html
new file mode 100644
index 0000000000..93e0c8e6af
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrappendchild2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrappendchild2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Attempts to append an element to the child nodes of an attribute.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function hc_attrappendchild2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrappendchild2") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var newChild;
+ var retval;
+ var lastChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ newChild = doc.createElement("terday");
+
+ {
+ success = false;
+ try {
+ retval = titleAttr.appendChild(newChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild3.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild3.html
new file mode 100644
index 0000000000..a7c691d00a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild3.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild3</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrappendchild3'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrappendchild3';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Appends a document fragment to an attribute and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function hc_attrappendchild3() {
+ var success;
+ if(checkInitialization(builder, "hc_attrappendchild3") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var terNode;
+ var dayNode;
+ var retval;
+ var lastChild;
+ var docFrag;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ terNode = doc.createTextNode("ter");
+ dayNode = doc.createTextNode("day");
+ docFrag = doc.createDocumentFragment();
+ retval = docFrag.appendChild(terNode);
+ retval = docFrag.appendChild(dayNode);
+ retval = titleAttr.appendChild(docFrag);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","Yesterday",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Yesterday",value);
+ value = retval.nodeValue;
+
+ assertNull("retvalValue",value);
+ lastChild = titleAttr.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","day",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild3</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild4.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild4.html
new file mode 100644
index 0000000000..1b7dc9680e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild4.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild4</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrappendchild4'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrappendchild4';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Attempt to append a CDATASection to an attribute which should result
+in a HIERARCHY_REQUEST_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function hc_attrappendchild4() {
+ var success;
+ if(checkInitialization(builder, "hc_attrappendchild4") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var lastChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ textNode = doc.createCDATASection("terday");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+ textNode = doc.createCDATASection("terday");
+
+ {
+ success = false;
+ try {
+ retval = titleAttr.appendChild(textNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild4</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild5.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild5.html
new file mode 100644
index 0000000000..75116fe76b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild5.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild5</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrappendchild5'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ var otherDocRef = null;
+ if (typeof(this.otherDoc) != 'undefined') {
+ otherDocRef = this.otherDoc;
+ }
+ docsLoaded += preload(otherDocRef, "otherDoc", "hc_staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrappendchild5';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Attempt to append a node from another document to an attribute which should result
+in a WRONG_DOCUMENT_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function hc_attrappendchild5() {
+ var success;
+ if(checkInitialization(builder, "hc_attrappendchild5") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var lastChild;
+ var otherDoc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ var otherDocRef = null;
+ if (typeof(this.otherDoc) != 'undefined') {
+ otherDocRef = this.otherDoc;
+ }
+ otherDoc = load(otherDocRef, "otherDoc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = otherDoc.createTextNode("terday");
+
+ {
+ success = false;
+ try {
+ retval = titleAttr.appendChild(textNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild5</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+<iframe name="otherDoc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild6.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild6.html
new file mode 100644
index 0000000000..2ab7c9cc0f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild6.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild6</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrappendchild6'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrappendchild6';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Creates an new attribute node and appends a text node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function hc_attrappendchild6() {
+ var success;
+ if(checkInitialization(builder, "hc_attrappendchild6") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var lastChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ titleAttr = doc.createAttribute("title");
+ textNode = doc.createTextNode("Yesterday");
+ retval = titleAttr.appendChild(textNode);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","Yesterday",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Yesterday",value);
+ value = retval.nodeValue;
+
+ assertEquals("retvalValue","Yesterday",value);
+ lastChild = titleAttr.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","Yesterday",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild6</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes1.html
new file mode 100644
index 0000000000..ad3f06682e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes1.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrchildnodes1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrchildnodes1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Checks that Node.childNodes for an attribute node contains
+the expected text node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+*/
+function hc_attrchildnodes1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrchildnodes1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var childNodes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ childNodes = titleAttr.childNodes;
+
+ assertSize("childNodesSize",1,childNodes);
+textNode = childNodes.item(0);
+ value = textNode.nodeValue;
+
+ assertEquals("child1IsYes","Yes",value);
+ textNode = childNodes.item(1);
+ assertNull("secondItemIsNull",textNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes2.html
new file mode 100644
index 0000000000..c48f78dc05
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes2.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrchildnodes2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrchildnodes2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Checks Node.childNodes for an attribute with multiple child nodes.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+*/
+function hc_attrchildnodes2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrchildnodes2") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var childNodes;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ childNodes = titleAttr.childNodes;
+
+ textNode = doc.createTextNode("terday");
+ retval = titleAttr.appendChild(textNode);
+ assertSize("childNodesSize",2,childNodes);
+textNode = childNodes.item(0);
+ value = textNode.nodeValue;
+
+ assertEquals("child1IsYes","Yes",value);
+ textNode = childNodes.item(1);
+ value = textNode.nodeValue;
+
+ assertEquals("child2IsTerday","terday",value);
+ textNode = childNodes.item(2);
+ assertNull("thirdItemIsNull",textNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrclonenode1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrclonenode1.html
new file mode 100644
index 0000000000..5ee88a5cdf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrclonenode1.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrclonenode1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrclonenode1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrclonenode1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Appends a text node to an attribute and clones the node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function hc_attrclonenode1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrclonenode1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var lastChild;
+ var clonedTitle;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("terday");
+ retval = titleAttr.appendChild(textNode);
+ clonedTitle = titleAttr.cloneNode(false);
+ textNode.nodeValue = "text_node_not_cloned";
+
+ value = clonedTitle.value;
+
+ assertEquals("attrValue","Yesterday",value);
+ value = clonedTitle.nodeValue;
+
+ assertEquals("attrNodeValue","Yesterday",value);
+ lastChild = clonedTitle.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","terday",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrclonenode1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatedocumentfragment.html
new file mode 100644
index 0000000000..0c1266f47d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatedocumentfragment.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatedocumentfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrcreatedocumentfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrcreatedocumentfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a new DocumentFragment and add a newly created Element node(with one attribute).
+ Once the element is added, its attribute should be available as an attribute associated
+ with an Element within a DocumentFragment.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
+*/
+function hc_attrcreatedocumentfragment() {
+ var success;
+ if(checkInitialization(builder, "hc_attrcreatedocumentfragment") != null) return;
+ var doc;
+ var docFragment;
+ var newOne;
+ var domesticNode;
+ var attributes;
+ var attribute;
+ var attrName;
+ var appendedChild;
+ var langAttrCount = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docFragment = doc.createDocumentFragment();
+ newOne = doc.createElement("html");
+ newOne.setAttribute("lang","EN");
+ appendedChild = docFragment.appendChild(newOne);
+ domesticNode = docFragment.firstChild;
+
+ attributes = domesticNode.attributes;
+
+ for(var indexN65656 = 0;indexN65656 < attributes.length; indexN65656++) {
+ attribute = attributes.item(indexN65656);
+ attrName = attribute.nodeName;
+
+
+ if(
+ equalsAutoCase("attribute", "lang", attrName)
+ ) {
+ langAttrCount += 1;
+
+ }
+
+ }
+ assertEquals("hasLangAttr",1,langAttrCount);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatedocumentfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode.html
new file mode 100644
index 0000000000..95bc79e590
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrcreatetextnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrcreatetextnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setValue()" method for an attribute creates a
+ Text node with the unparsed content of the string.
+ Retrieve the attribute named "class" from the last
+ child of of the fourth employee and assign the "Y&ent1;"
+ string to its value attribute. This value is not yet
+ parsed and therefore should still be the same upon
+ retrieval. This test uses the "getNamedItem(name)" method
+ from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html
+*/
+function hc_attrcreatetextnode() {
+ var success;
+ if(checkInitialization(builder, "hc_attrcreatetextnode") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(3);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("class");
+ streetAttr.value = "Y&ent1;";
+
+ value = streetAttr.value;
+
+ assertEquals("value","Y&ent1;",value);
+ value = streetAttr.nodeValue;
+
+ assertEquals("nodeValue","Y&ent1;",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode2.html
new file mode 100644
index 0000000000..bd0e58e5b4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode2.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrcreatetextnode2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrcreatetextnode2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNodeValue()" method for an attribute creates a
+ Text node with the unparsed content of the string.
+ Retrieve the attribute named "class" from the last
+ child of of the fourth employee and assign the "Y&ent1;"
+ string to its value attribute. This value is not yet
+ parsed and therefore should still be the same upon
+ retrieval. This test uses the "getNamedItem(name)" method
+ from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html
+*/
+function hc_attrcreatetextnode2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrcreatetextnode2") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(3);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("class");
+ streetAttr.nodeValue = "Y&ent1;";
+
+ value = streetAttr.value;
+
+ assertEquals("value","Y&ent1;",value);
+ value = streetAttr.nodeValue;
+
+ assertEquals("nodeValue","Y&ent1;",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attreffectivevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_attreffectivevalue.html
new file mode 100644
index 0000000000..cdee5306fd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attreffectivevalue.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attreffectivevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attreffectivevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attreffectivevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If an Attr is explicitly assigned any value, then that value is the attributes effective value.
+ Retrieve the attribute named "domestic" from the last child of of the first employee
+ and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method
+ from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+*/
+function hc_attreffectivevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_attreffectivevalue") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("title");
+ value = domesticAttr.nodeValue;
+
+ assertEquals("attrEffectiveValueAssert","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attreffectivevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrfirstchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrfirstchild.html
new file mode 100644
index 0000000000..91f7dffc7b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrfirstchild.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrfirstchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrfirstchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrfirstchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Checks that Node.firstChild for an attribute node contains
+the expected text node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388
+*/
+function hc_attrfirstchild() {
+ var success;
+ if(checkInitialization(builder, "hc_attrfirstchild") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var otherChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = titleAttr.firstChild;
+
+ assertNotNull("textNodeNotNull",textNode);
+value = textNode.nodeValue;
+
+ assertEquals("child1IsYes","Yes",value);
+ otherChild = textNode.nextSibling;
+
+ assertNull("nextSiblingIsNull",otherChild);
+ otherChild = textNode.previousSibling;
+
+ assertNull("previousSiblingIsNull",otherChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrfirstchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue1.html
new file mode 100644
index 0000000000..31a1e0947e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue1.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrgetvalue1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrgetvalue1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Checks the value of an attribute that contains entity references.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+*/
+function hc_attrgetvalue1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrgetvalue1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var lastChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("class");
+ value = titleAttr.value;
+
+ assertEquals("attrValue1","Yα",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue2.html
new file mode 100644
index 0000000000..cd2187224e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue2.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrgetvalue2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrgetvalue2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Checks the value of an attribute that contains entity references.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+*/
+function hc_attrgetvalue2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrgetvalue2") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var firstChild;
+ var alphaRef;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("class");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ alphaRef = doc.createEntityReference("alpha");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+ alphaRef = doc.createEntityReference("alpha");
+ firstChild = titleAttr.firstChild;
+
+ retval = titleAttr.insertBefore(alphaRef,firstChild);
+ value = titleAttr.value;
+
+ assertEquals("attrValue1","αYα",value);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrhaschildnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrhaschildnodes.html
new file mode 100644
index 0000000000..9135d6462f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrhaschildnodes.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrhaschildnodes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrhaschildnodes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrhaschildnodes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Checks that Node.hasChildNodes() is true for an attribute with content.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187
+*/
+function hc_attrhaschildnodes() {
+ var success;
+ if(checkInitialization(builder, "hc_attrhaschildnodes") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var hasChildNodes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ hasChildNodes = titleAttr.hasChildNodes();
+ assertTrue("hasChildrenIsTrue",hasChildNodes);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrhaschildnodes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore1.html
new file mode 100644
index 0000000000..d07c9764ce
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore1.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrinsertbefore1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrinsertbefore1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Appends a text node to an attribute and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_attrinsertbefore1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrinsertbefore1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var firstChild;
+ var lastChild;
+ var refChild = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("terday");
+ retval = titleAttr.insertBefore(textNode,refChild);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","Yesterday",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Yesterday",value);
+ value = retval.nodeValue;
+
+ assertEquals("retvalValue","terday",value);
+ firstChild = titleAttr.firstChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","Yes",value);
+ lastChild = titleAttr.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","terday",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore2.html
new file mode 100644
index 0000000000..026886b920
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore2.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrinsertbefore2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrinsertbefore2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Prepends a text node to an attribute and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_attrinsertbefore2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrinsertbefore2") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var lastChild;
+ var firstChild;
+ var refChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("terday");
+ refChild = titleAttr.firstChild;
+
+ retval = titleAttr.insertBefore(textNode,refChild);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","terdayYes",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","terdayYes",value);
+ value = retval.nodeValue;
+
+ assertEquals("retvalValue","terday",value);
+ firstChild = titleAttr.firstChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","terday",value);
+ lastChild = titleAttr.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore3.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore3.html
new file mode 100644
index 0000000000..3a48a4c24c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore3.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore3</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrinsertbefore3'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrinsertbefore3';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Appends a document fragment to an attribute and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_attrinsertbefore3() {
+ var success;
+ if(checkInitialization(builder, "hc_attrinsertbefore3") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var terNode;
+ var dayNode;
+ var docFrag;
+ var retval;
+ var firstChild;
+ var lastChild;
+ var refChild = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ terNode = doc.createTextNode("ter");
+ dayNode = doc.createTextNode("day");
+ docFrag = doc.createDocumentFragment();
+ retval = docFrag.appendChild(terNode);
+ retval = docFrag.appendChild(dayNode);
+ retval = titleAttr.insertBefore(docFrag,refChild);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","Yesterday",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Yesterday",value);
+ value = retval.nodeValue;
+
+ assertNull("retvalValue",value);
+ firstChild = titleAttr.firstChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","Yes",value);
+ lastChild = titleAttr.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","day",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore3</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore4.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore4.html
new file mode 100644
index 0000000000..d02c153e06
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore4.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore4</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrinsertbefore4'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrinsertbefore4';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Prepends a document fragment to an attribute and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_attrinsertbefore4() {
+ var success;
+ if(checkInitialization(builder, "hc_attrinsertbefore4") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var terNode;
+ var dayNode;
+ var docFrag;
+ var retval;
+ var firstChild;
+ var lastChild;
+ var refChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ terNode = doc.createTextNode("ter");
+ dayNode = doc.createTextNode("day");
+ docFrag = doc.createDocumentFragment();
+ retval = docFrag.appendChild(terNode);
+ retval = docFrag.appendChild(dayNode);
+ refChild = titleAttr.firstChild;
+
+ retval = titleAttr.insertBefore(docFrag,refChild);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","terdayYes",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","terdayYes",value);
+ value = retval.nodeValue;
+
+ assertNull("retvalValue",value);
+ firstChild = titleAttr.firstChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","ter",value);
+ lastChild = titleAttr.lastChild;
+
+ value = lastChild.nodeValue;
+
+ assertEquals("lastChildValue","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore4</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore5.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore5.html
new file mode 100644
index 0000000000..97a01079b7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore5.html
@@ -0,0 +1,169 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore5</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrinsertbefore5'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrinsertbefore5';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Attempt to append a CDATASection to an attribute which should result
+in a HIERARCHY_REQUEST_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_attrinsertbefore5() {
+ var success;
+ if(checkInitialization(builder, "hc_attrinsertbefore5") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var refChild = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ textNode = doc.createCDATASection("terday");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+ textNode = doc.createCDATASection("terday");
+
+ {
+ success = false;
+ try {
+ retval = titleAttr.insertBefore(textNode,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore5</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore6.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore6.html
new file mode 100644
index 0000000000..0fcf1a4c3f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore6.html
@@ -0,0 +1,160 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore6</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrinsertbefore6'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ var otherDocRef = null;
+ if (typeof(this.otherDoc) != 'undefined') {
+ otherDocRef = this.otherDoc;
+ }
+ docsLoaded += preload(otherDocRef, "otherDoc", "hc_staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrinsertbefore6';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Attempt to append a text node from another document to an attribute which should result
+in a WRONG_DOCUMENT_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_attrinsertbefore6() {
+ var success;
+ if(checkInitialization(builder, "hc_attrinsertbefore6") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var refChild = null;
+
+ var otherDoc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ var otherDocRef = null;
+ if (typeof(this.otherDoc) != 'undefined') {
+ otherDocRef = this.otherDoc;
+ }
+ otherDoc = load(otherDocRef, "otherDoc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = otherDoc.createTextNode("terday");
+
+ {
+ success = false;
+ try {
+ retval = titleAttr.insertBefore(textNode,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore6</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+<iframe name="otherDoc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore7.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore7.html
new file mode 100644
index 0000000000..e8707d2409
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore7.html
@@ -0,0 +1,176 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore7</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrinsertbefore7'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrinsertbefore7';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Appends a document fragment containing a CDATASection to an attribute.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_attrinsertbefore7() {
+ var success;
+ if(checkInitialization(builder, "hc_attrinsertbefore7") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var terNode;
+ var dayNode;
+ var docFrag;
+ var retval;
+ var firstChild;
+ var lastChild;
+ var refChild = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ terNode = doc.createTextNode("ter");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ dayNode = doc.createCDATASection("day");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+ dayNode = doc.createCDATASection("day");
+ docFrag = doc.createDocumentFragment();
+ retval = docFrag.appendChild(terNode);
+ retval = docFrag.appendChild(dayNode);
+
+ {
+ success = false;
+ try {
+ retval = titleAttr.insertBefore(docFrag,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore7</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrlastchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrlastchild.html
new file mode 100644
index 0000000000..99d6545c92
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrlastchild.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrlastchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrlastchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrlastchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Checks that Node.lastChild for an attribute node contains
+the expected text node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB
+*/
+function hc_attrlastchild() {
+ var success;
+ if(checkInitialization(builder, "hc_attrlastchild") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var otherChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = titleAttr.firstChild;
+
+ assertNotNull("textNodeNotNull",textNode);
+value = textNode.nodeValue;
+
+ assertEquals("child1IsYes","Yes",value);
+ otherChild = textNode.nextSibling;
+
+ assertNull("nextSiblingIsNull",otherChild);
+ otherChild = textNode.previousSibling;
+
+ assertNull("previousSiblingIsNull",otherChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrlastchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrname.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrname.html
new file mode 100644
index 0000000000..8310419283
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrname.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the attribute named class from the last
+ child of of the second "p" element and examine its
+ NodeName.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+*/
+function hc_attrname() {
+ var success;
+ if(checkInitialization(builder, "hc_attrname") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var strong1;
+ var strong2;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(1);
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("class");
+ strong1 = streetAttr.nodeName;
+
+ strong2 = streetAttr.name;
+
+ assertEqualsAutoCase("attribute", "nodeName","class",strong1);
+ assertEqualsAutoCase("attribute", "name","class",strong2);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrnextsiblingnull.html
new file mode 100644
index 0000000000..3a6c6be0ca
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrnextsiblingnull.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnextsiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrnextsiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrnextsiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getNextSibling()" method for an Attr node should return null.
+Retrieve the attribute named "domestic" from the last child of of the
+first employee and examine its NextSibling node. This test uses the
+"getNamedItem(name)" method from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function hc_attrnextsiblingnull() {
+ var success;
+ if(checkInitialization(builder, "hc_attrnextsiblingnull") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var s;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("title");
+ s = domesticAttr.nextSibling;
+
+ assertNull("attrNextSiblingNullAssert",s);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnextsiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrnormalize.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrnormalize.html
new file mode 100644
index 0000000000..e0105a09fd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrnormalize.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnormalize</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrnormalize'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrnormalize';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Appends a text node to an attribute, normalizes the attribute
+and checks for a single child node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083
+*/
+function hc_attrnormalize() {
+ var success;
+ if(checkInitialization(builder, "hc_attrnormalize") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var firstChild;
+ var secondChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("terday");
+ retval = titleAttr.appendChild(textNode);
+ textNode = doc.createTextNode("");
+ retval = titleAttr.appendChild(textNode);
+ testNode.normalize();
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Yesterday",value);
+ firstChild = titleAttr.firstChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","Yesterday",value);
+ secondChild = firstChild.nextSibling;
+
+ assertNull("secondChildIsNull",secondChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnormalize</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrparentnodenull.html
new file mode 100644
index 0000000000..49c4ab08fb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrparentnodenull.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrparentnodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrparentnodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrparentnodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getParentNode()" method for an Attr node should return null. Retrieve
+the attribute named "domestic" from the last child of the first employee
+and examine its parentNode attribute. This test also uses the "getNamedItem(name)"
+method from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function hc_attrparentnodenull() {
+ var success;
+ if(checkInitialization(builder, "hc_attrparentnodenull") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var s;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("title");
+ s = domesticAttr.parentNode;
+
+ assertNull("attrParentNodeNullAssert",s);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrparentnodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrprevioussiblingnull.html
new file mode 100644
index 0000000000..1d6ab33960
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrprevioussiblingnull.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrprevioussiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrprevioussiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrprevioussiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getPreviousSibling()" method for an Attr node should return null.
+Retrieve the attribute named "domestic" from the last child of of the
+first employee and examine its PreviousSibling node. This test uses the
+"getNamedItem(name)" method from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function hc_attrprevioussiblingnull() {
+ var success;
+ if(checkInitialization(builder, "hc_attrprevioussiblingnull") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var s;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("title");
+ s = domesticAttr.previousSibling;
+
+ assertNull("attrPreviousSiblingNullAssert",s);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrprevioussiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild1.html
new file mode 100644
index 0000000000..eb48bbbcb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild1.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrremovechild1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrremovechild1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Removes the child node of an attribute and checks that the value is empty.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+*/
+function hc_attrremovechild1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrremovechild1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var firstChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = titleAttr.firstChild;
+
+ assertNotNull("attrChildNotNull",textNode);
+retval = titleAttr.removeChild(textNode);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","",value);
+ value = retval.nodeValue;
+
+ assertEquals("retvalValue","Yes",value);
+ firstChild = titleAttr.firstChild;
+
+ assertNull("firstChildNull",firstChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild2.html
new file mode 100644
index 0000000000..735a9f4cc7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild2.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrremovechild2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrremovechild2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+/**
+*
+Attempts to remove a freshly created text node which should result in a NOT_FOUND_ERR exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+*/
+function hc_attrremovechild2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrremovechild2") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("Yesterday");
+
+ {
+ success = false;
+ try {
+ retval = titleAttr.removeChild(textNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild1.html
new file mode 100644
index 0000000000..729346237d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild1.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrreplacechild1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrreplacechild1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Replaces a text node of an attribute and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function hc_attrreplacechild1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrreplacechild1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var firstChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("terday");
+ firstChild = titleAttr.firstChild;
+
+ assertNotNull("attrChildNotNull",firstChild);
+retval = titleAttr.replaceChild(textNode,firstChild);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","terday",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","terday",value);
+ value = retval.nodeValue;
+
+ assertEquals("retvalValue","Yes",value);
+ firstChild = titleAttr.firstChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","terday",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild2.html
new file mode 100644
index 0000000000..1069345ff0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild2.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrreplacechild2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrreplacechild2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Replaces a text node of an attribute with a document fragment and checks if the value of
+the attribute is changed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function hc_attrreplacechild2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrreplacechild2") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var terNode;
+ var dayNode;
+ var docFrag;
+ var retval;
+ var firstChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ terNode = doc.createTextNode("ter");
+ dayNode = doc.createTextNode("day");
+ docFrag = doc.createDocumentFragment();
+ retval = docFrag.appendChild(terNode);
+ retval = docFrag.appendChild(dayNode);
+ firstChild = titleAttr.firstChild;
+
+ assertNotNull("attrChildNotNull",firstChild);
+retval = titleAttr.replaceChild(docFrag,firstChild);
+ value = titleAttr.value;
+
+ assertEquals("attrValue","terday",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","terday",value);
+ value = retval.nodeValue;
+
+ assertEquals("retvalValue","Yes",value);
+ firstChild = titleAttr.firstChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","ter",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue1.html
new file mode 100644
index 0000000000..1c049e62b9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue1.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrsetvalue1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrsetvalue1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Sets Attr.value on an attribute that only has a simple value.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+*/
+function hc_attrsetvalue1() {
+ var success;
+ if(checkInitialization(builder, "hc_attrsetvalue1") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var retval;
+ var firstChild;
+ var otherChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ firstChild = titleAttr.firstChild;
+
+ assertNotNull("attrChildNotNull",firstChild);
+titleAttr.value = "Tomorrow";
+
+ firstChild.nodeValue = "impl reused node";
+
+ value = titleAttr.value;
+
+ assertEquals("attrValue","Tomorrow",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Tomorrow",value);
+ firstChild = titleAttr.lastChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","Tomorrow",value);
+ otherChild = firstChild.nextSibling;
+
+ assertNull("nextSiblingIsNull",otherChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue2.html
new file mode 100644
index 0000000000..cc7b9ff9dc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue2.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrsetvalue2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrsetvalue2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Sets Attr.value on an attribute that should contain multiple child nodes.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474
+*/
+function hc_attrsetvalue2() {
+ var success;
+ if(checkInitialization(builder, "hc_attrsetvalue2") != null) return;
+ var doc;
+ var acronymList;
+ var testNode;
+ var attributes;
+ var titleAttr;
+ var value;
+ var textNode;
+ var retval;
+ var firstChild;
+ var otherChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ acronymList = doc.getElementsByTagName("acronym");
+ testNode = acronymList.item(3);
+ attributes = testNode.attributes;
+
+ titleAttr = attributes.getNamedItem("title");
+ textNode = doc.createTextNode("terday");
+ retval = titleAttr.appendChild(textNode);
+ firstChild = titleAttr.firstChild;
+
+ assertNotNull("attrChildNotNull",firstChild);
+titleAttr.value = "Tomorrow";
+
+ firstChild.nodeValue = "impl reused node";
+
+ value = titleAttr.value;
+
+ assertEquals("attrValue","Tomorrow",value);
+ value = titleAttr.nodeValue;
+
+ assertEquals("attrNodeValue","Tomorrow",value);
+ firstChild = titleAttr.lastChild;
+
+ value = firstChild.nodeValue;
+
+ assertEquals("firstChildValue","Tomorrow",value);
+ otherChild = firstChild.nextSibling;
+
+ assertNull("nextSiblingIsNull",otherChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvalue.html
new file mode 100644
index 0000000000..6a684a2fbc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvalue.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrspecifiedvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrspecifiedvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getSpecified()" method for an Attr node should
+ be set to true if the attribute was explicitly given
+ a value.
+ Retrieve the attribute named "domestic" from the last
+ child of of the first employee and examine the value
+ returned by the "getSpecified()" method. This test uses
+ the "getNamedItem(name)" method from the NamedNodeMap
+ interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273
+*/
+function hc_attrspecifiedvalue() {
+ var success;
+ if(checkInitialization(builder, "hc_attrspecifiedvalue") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("title");
+ state = domesticAttr.specified;
+
+ assertTrue("acronymTitleSpecified",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvaluechanged.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvaluechanged.html
new file mode 100644
index 0000000000..b5402bdc62
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvaluechanged.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvaluechanged</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_attrspecifiedvaluechanged'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_attrspecifiedvaluechanged';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getSpecified()" method for an Attr node should return true if the
+ value of the attribute is changed.
+ Retrieve the attribute named "class" from the last
+ child of of the THIRD employee and change its
+ value to "Yes"(which is the default DTD value). This
+ should cause the "getSpecified()" method to be true.
+ This test uses the "setAttribute(name,value)" method
+ from the Element interface and the "getNamedItem(name)"
+ method from the NamedNodeMap interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273
+*/
+function hc_attrspecifiedvaluechanged() {
+ var success;
+ if(checkInitialization(builder, "hc_attrspecifiedvaluechanged") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var streetAttr;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testNode = addressList.item(2);
+ testNode.setAttribute("class","Yα");
+ attributes = testNode.attributes;
+
+ streetAttr = attributes.getNamedItem("class");
+ state = streetAttr.specified;
+
+ assertTrue("acronymClassSpecified",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvaluechanged</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddata.html
new file mode 100644
index 0000000000..fba42ffca6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddata.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataappenddata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataappenddata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendData(arg)" method appends a string to the end
+ of the character data of the node.
+
+ Retrieve the character data from the second child
+ of the first employee. The appendData(arg) method is
+ called with arg=", Esquire". The method should append
+ the specified data to the already existing character
+ data. The new value return by the "getLength()" method
+ should be 24.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+*/
+function hc_characterdataappenddata() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataappenddata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childValue;
+ var childLength;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.appendData(", Esquire");
+ childValue = child.data;
+
+ childLength = childValue.length;
+ assertEquals("characterdataAppendDataAssert",24,childLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddatagetdata.html
new file mode 100644
index 0000000000..502e71b816
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddatagetdata.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddatagetdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataappenddatagetdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataappenddatagetdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ On successful invocation of the "appendData(arg)"
+ method the "getData()" method provides access to the
+ concatentation of data and the specified string.
+
+ Retrieve the character data from the second child
+ of the first employee. The appendData(arg) method is
+ called with arg=", Esquire". The method should append
+ the specified data to the already existing character
+ data. The new value return by the "getData()" method
+ should be "Margaret Martin, Esquire".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
+*/
+function hc_characterdataappenddatagetdata() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataappenddatagetdata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.appendData(", Esquire");
+ childData = child.data;
+
+ assertEquals("characterdataAppendDataGetDataAssert","Margaret Martin, Esquire",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddatagetdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatabegining.html
new file mode 100644
index 0000000000..05c5a58ccf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatabegining.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatabegining</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatadeletedatabegining'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatadeletedatabegining';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "deleteData(offset,count)" method removes a range of
+characters from the node. Delete data at the beginning
+of the character data.
+
+Retrieve the character data from the last child of the
+first employee. The "deleteData(offset,count)"
+method is then called with offset=0 and count=16.
+The method should delete the characters from position
+0 thru position 16. The new value of the character data
+should be "Dallas, Texas 98551".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function hc_characterdatadeletedatabegining() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatadeletedatabegining") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(0,16);
+ childData = child.data;
+
+ assertEquals("data","Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatabegining</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataend.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataend.html
new file mode 100644
index 0000000000..5e9b8eab27
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataend.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataend</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatadeletedataend'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatadeletedataend';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method removes a range of
+ characters from the node. Delete data at the end
+ of the character data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=30 and count=5.
+ The method should delete the characters from position
+ 30 thru position 35. The new value of the character data
+ should be "1230 North Ave. Dallas, Texas".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function hc_characterdatadeletedataend() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatadeletedataend") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(30,5);
+ childData = child.data;
+
+ assertEquals("characterdataDeleteDataEndAssert","1230 North Ave. Dallas, Texas ",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataend</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataexceedslength.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataexceedslength.html
new file mode 100644
index 0000000000..374641dedc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataexceedslength.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataexceedslength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatadeletedataexceedslength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatadeletedataexceedslength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the sum of the offset and count used in the
+ "deleteData(offset,count) method is greater than the
+ length of the character data then all the characters
+ from the offset to the end of the data are deleted.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=4 and count=50.
+ The method should delete the characters from position 4
+ to the end of the data since the offset+count(50+4)
+ is greater than the length of the character data(35).
+ The new value of the character data should be "1230".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function hc_characterdatadeletedataexceedslength() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatadeletedataexceedslength") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(4,50);
+ childData = child.data;
+
+ assertEquals("characterdataDeleteDataExceedsLengthAssert","1230",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataexceedslength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatagetlengthanddata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatagetlengthanddata.html
new file mode 100644
index 0000000000..d6cc722bf7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatagetlengthanddata.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatagetlengthanddata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatadeletedatagetlengthanddata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatadeletedatagetlengthanddata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ On successful invocation of the "deleteData(offset,count)"
+ method, the "getData()" and "getLength()" methods reflect
+ the changes.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=30 and count=5.
+ The method should delete the characters from position
+ 30 thru position 35. The new value of the character data
+ should be "1230 North Ave. Dallas, Texas" which is
+ returned by the "getData()" method and "getLength()"
+ method should return 30".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function hc_characterdatadeletedatagetlengthanddata() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatadeletedatagetlengthanddata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+ var childLength;
+ var result = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(30,5);
+ childData = child.data;
+
+ assertEquals("data","1230 North Ave. Dallas, Texas ",childData);
+ childLength = child.length;
+
+ assertEquals("length",30,childLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatagetlengthanddata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatamiddle.html
new file mode 100644
index 0000000000..4849166842
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatamiddle.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatamiddle</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatadeletedatamiddle'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatadeletedatamiddle';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method removes a range of
+ characters from the node. Delete data in the middle
+ of the character data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "deleteData(offset,count)"
+ method is then called with offset=16 and count=8.
+ The method should delete the characters from position
+ 16 thru position 24. The new value of the character data
+ should be "1230 North Ave. Texas 98551".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function hc_characterdatadeletedatamiddle() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatadeletedatamiddle") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.deleteData(16,8);
+ childData = child.data;
+
+ assertEquals("characterdataDeleteDataMiddleAssert","1230 North Ave. Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatamiddle</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetdata.html
new file mode 100644
index 0000000000..4633933e0c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetdata.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatagetdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatagetdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getData()" method retrieves the character data
+
+ currently stored in the node.
+
+ Retrieve the character data from the second child
+
+ of the first employee and invoke the "getData()"
+
+ method. The method returns the character data
+
+ string.
+
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+*/
+function hc_characterdatagetdata() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatagetdata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ childData = child.data;
+
+ assertEquals("characterdataGetDataAssert","Margaret Martin",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetlength.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetlength.html
new file mode 100644
index 0000000000..22981ed603
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetlength.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetlength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatagetlength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatagetlength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLength()" method returns the number of characters
+ stored in this nodes data.
+ Retrieve the character data from the second
+ child of the first employee and examine the
+ value returned by the getLength() method.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
+*/
+function hc_characterdatagetlength() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatagetlength") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childValue;
+ var childLength;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ childValue = child.data;
+
+ childLength = childValue.length;
+ assertEquals("characterdataGetLengthAssert",15,childLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetlength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedatacountnegative.html
new file mode 100644
index 0000000000..95b68700bf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedatacountnegative.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrdeletedatacountnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrdeletedatacountnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified count
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "deleteData(offset,count)"
+ method with offset=10 and count=-3. It should raise the
+ desired exception since the count is negative.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function hc_characterdataindexsizeerrdeletedatacountnegative() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedatacountnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childSubstring;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ childSubstring = child.substringData(10,-3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html
new file mode 100644
index 0000000000..3bc5f19ffe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrdeletedataoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrdeletedataoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater that the number of characters in the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "deleteData(offset,count)"
+ method with offset=40 and count=3. It should raise the
+ desired exception since the offset is greater than the
+ number of characters in the string.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_characterdataindexsizeerrdeletedataoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.deleteData(40,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html
new file mode 100644
index 0000000000..099faec06c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrdeletedataoffsetnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrdeletedataoffsetnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "deleteData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "deleteData(offset,count)"
+ method with offset=-5 and count=3. It should raise the
+ desired exception since the offset is negative.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+*/
+function hc_characterdataindexsizeerrdeletedataoffsetnegative() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.deleteData(-5,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html
new file mode 100644
index 0000000000..21b42e1ab0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrinsertdataoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrinsertdataoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater than the number of characters in the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its insertData"(offset,arg)"
+ method with offset=40 and arg="ABC". It should raise
+ the desired exception since the offset is greater than
+ the number of characters in the string.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_characterdataindexsizeerrinsertdataoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.deleteData(40,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html
new file mode 100644
index 0000000000..aa93eca45e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrinsertdataoffsetnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrinsertdataoffsetnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its insertData"(offset,arg)"
+ method with offset=-5 and arg="ABC". It should raise
+ the desired exception since the offset is negative.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function hc_characterdataindexsizeerrinsertdataoffsetnegative() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.replaceData(-5,3,"ABC");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedatacountnegative.html
new file mode 100644
index 0000000000..6f3dbed097
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedatacountnegative.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrreplacedatacountnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrreplacedatacountnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified count
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its
+ "replaceData(offset,count,arg) method with offset=10
+ and count=-3 and arg="ABC". It should raise the
+ desired exception since the count is negative.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function hc_characterdataindexsizeerrreplacedatacountnegative() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedatacountnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var badString;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ badString = child.substringData(10,-3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html
new file mode 100644
index 0000000000..119141232e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrreplacedataoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrreplacedataoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater than the length of the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its
+ "replaceData(offset,count,arg) method with offset=40
+ and count=3 and arg="ABC". It should raise the
+ desired exception since the offset is greater than the
+ length of the string.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=242
+*/
+function hc_characterdataindexsizeerrreplacedataoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedataoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.deleteData(40,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html
new file mode 100644
index 0000000000..30c9033d9f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrreplacedataoffsetnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrreplacedataoffsetnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its
+ "replaceData(offset,count,arg) method with offset=-5
+ and count=3 and arg="ABC". It should raise the
+ desired exception since the offset is negative.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function hc_characterdataindexsizeerrreplacedataoffsetnegative() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedataoffsetnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ child.replaceData(-5,3,"ABC");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringcountnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringcountnegative.html
new file mode 100644
index 0000000000..151d6451a7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringcountnegative.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringcountnegative</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrsubstringcountnegative'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrsubstringcountnegative';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified count
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "substringData(offset,count)
+ method with offset=10 and count=-3. It should raise the
+ desired exception since the count is negative.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function hc_characterdataindexsizeerrsubstringcountnegative() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringcountnegative") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var badSubstring;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ badSubstring = child.substringData(10,-3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringcountnegative</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringnegativeoffset.html
new file mode 100644
index 0000000000..da485c7a95
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringnegativeoffset.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringnegativeoffset</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrsubstringnegativeoffset'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrsubstringnegativeoffset';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is negative.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "substringData(offset,count)
+ method with offset=-5 and count=3. It should raise the
+ desired exception since the offset is negative.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function hc_characterdataindexsizeerrsubstringnegativeoffset() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringnegativeoffset") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var badString;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ badString = child.substringData(-5,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringnegativeoffset</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringoffsetgreater.html
new file mode 100644
index 0000000000..853b4f4006
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringoffsetgreater.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdataindexsizeerrsubstringoffsetgreater'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdataindexsizeerrsubstringoffsetgreater';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset
+ is greater than the number of characters in the string.
+
+ Retrieve the character data of the last child of the
+ first employee and invoke its "substringData(offset,count)
+ method with offset=40 and count=3. It should raise the
+ desired exception since the offsets value is greater
+ than the length.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_characterdataindexsizeerrsubstringoffsetgreater() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringoffsetgreater") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var badString;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ badString = child.substringData(40,3);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatabeginning.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatabeginning.html
new file mode 100644
index 0000000000..d482898a05
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatabeginning.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatabeginning</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatainsertdatabeginning'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatainsertdatabeginning';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "insertData(offset,arg)" method will insert a string
+at the specified character offset. Insert the data at
+the beginning of the character data.
+
+Retrieve the character data from the second child of
+the first employee. The "insertData(offset,arg)"
+method is then called with offset=0 and arg="Mss.".
+The method should insert the string "Mss." at position 0.
+The new value of the character data should be
+"Mss. Margaret Martin".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+*/
+function hc_characterdatainsertdatabeginning() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatainsertdatabeginning") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.insertData(0,"Mss. ");
+ childData = child.data;
+
+ assertEquals("characterdataInsertDataBeginningAssert","Mss. Margaret Martin",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatabeginning</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdataend.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdataend.html
new file mode 100644
index 0000000000..1436b68464
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdataend.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdataend</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatainsertdataend'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatainsertdataend';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method will insert a string
+ at the specified character offset. Insert the data at
+ the end of the character data.
+
+ Retrieve the character data from the second child of
+ the first employee. The "insertData(offset,arg)"
+ method is then called with offset=15 and arg=", Esquire".
+ The method should insert the string ", Esquire" at
+ position 15. The new value of the character data should
+ be "Margaret Martin, Esquire".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+*/
+function hc_characterdatainsertdataend() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatainsertdataend") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.insertData(15,", Esquire");
+ childData = child.data;
+
+ assertEquals("characterdataInsertDataEndAssert","Margaret Martin, Esquire",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdataend</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatamiddle.html
new file mode 100644
index 0000000000..022ce13b9c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatamiddle.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatamiddle</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatainsertdatamiddle'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatainsertdatamiddle';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertData(offset,arg)" method will insert a string
+ at the specified character offset. Insert the data in
+ the middle of the character data.
+
+ Retrieve the character data from the second child of
+ the first employee. The "insertData(offset,arg)"
+ method is then called with offset=9 and arg="Ann".
+ The method should insert the string "Ann" at position 9.
+ The new value of the character data should be
+ "Margaret Ann Martin".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
+*/
+function hc_characterdatainsertdatamiddle() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatainsertdatamiddle") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.insertData(9,"Ann ");
+ childData = child.data;
+
+ assertEquals("characterdataInsertDataMiddleAssert","Margaret Ann Martin",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatamiddle</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatabegining.html
new file mode 100644
index 0000000000..9f517bd68f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatabegining.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatabegining</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatareplacedatabegining'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatareplacedatabegining';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "replaceData(offset,count,arg)" method replaces the
+characters starting at the specified offset with the
+specified string. Test for replacement in the
+middle of the data.
+
+Retrieve the character data from the last child of the
+first employee. The "replaceData(offset,count,arg)"
+method is then called with offset=5 and count=5 and
+arg="South". The method should replace characters five
+thru 9 of the character data with "South".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function hc_characterdatareplacedatabegining() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatareplacedatabegining") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(0,4,"2500");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataBeginingAssert","2500 North Ave. Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatabegining</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataend.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataend.html
new file mode 100644
index 0000000000..12eb071252
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataend.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataend</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatareplacedataend'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatareplacedataend';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method replaces the
+ characters starting at the specified offset with the
+ specified string. Test for replacement at the
+ end of the data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=30 and count=5 and
+ arg="98665". The method should replace characters 30
+ thru 34 of the character data with "98665".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function hc_characterdatareplacedataend() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatareplacedataend") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(30,5,"98665");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataEndAssert","1230 North Ave. Dallas, Texas 98665",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataend</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofarg.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofarg.html
new file mode 100644
index 0000000000..b3ba8eb0ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofarg.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofarg</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatareplacedataexceedslengthofarg'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatareplacedataexceedslengthofarg';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method replaces the
+ characters starting at the specified offset with the
+ specified string. Test the situation where the length
+ of the arg string is greater than the specified offset.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=0 and count=4 and
+ arg="260030". The method should replace characters one
+ thru four with "260030". Note that the length of the
+ specified string is greater that the specified offset.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function hc_characterdatareplacedataexceedslengthofarg() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatareplacedataexceedslengthofarg") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(0,4,"260030");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataExceedsLengthOfArgAssert","260030 North Ave. Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofarg</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofdata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofdata.html
new file mode 100644
index 0000000000..747a4c674a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofdata.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatareplacedataexceedslengthofdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatareplacedataexceedslengthofdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the sum of the offset and count exceeds the length then
+ all the characters to the end of the data are replaced.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=0 and count=50 and
+ arg="2600". The method should replace all the characters
+ with "2600". This is because the sum of the offset and
+ count exceeds the length of the character data.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function hc_characterdatareplacedataexceedslengthofdata() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatareplacedataexceedslengthofdata") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(0,50,"2600");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataExceedsLengthOfDataAssert","2600",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatamiddle.html
new file mode 100644
index 0000000000..16b522821f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatamiddle.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatamiddle</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatareplacedatamiddle'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatareplacedatamiddle';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceData(offset,count,arg)" method replaces the
+ characters starting at the specified offset with the
+ specified string. Test for replacement in the
+ middle of the data.
+
+ Retrieve the character data from the last child of the
+ first employee. The "replaceData(offset,count,arg)"
+ method is then called with offset=5 and count=5 and
+ arg="South". The method should replace characters five
+ thru 9 of the character data with "South".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
+*/
+function hc_characterdatareplacedatamiddle() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatareplacedatamiddle") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.replaceData(5,5,"South");
+ childData = child.data;
+
+ assertEquals("characterdataReplaceDataMiddleAssert","1230 South Ave. Dallas, Texas 98551",childData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatamiddle</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasetnodevalue.html
new file mode 100644
index 0000000000..895a5bc724
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasetnodevalue.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasetnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatasetnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatasetnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNodeValue()" method changes the character data
+ currently stored in the node.
+ Retrieve the character data from the second child
+ of the first employee and invoke the "setNodeValue()"
+ method, call "getData()" and compare.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
+*/
+function hc_characterdatasetnodevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatasetnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var childData;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ child.nodeValue = "Marilyn Martin";
+
+ childData = child.data;
+
+ assertEquals("data","Marilyn Martin",childData);
+ childValue = child.nodeValue;
+
+ assertEquals("value","Marilyn Martin",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasetnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringexceedsvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringexceedsvalue.html
new file mode 100644
index 0000000000..dbcdbb01be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringexceedsvalue.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringexceedsvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatasubstringexceedsvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatasubstringexceedsvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the sum of the "offset" and "count" exceeds the
+ "length" then the "substringData(offset,count)" method
+ returns all the characters to the end of the data.
+
+ Retrieve the character data from the second child
+ of the first employee and access part of the data
+ by using the substringData(offset,count) method
+ with offset=9 and count=10. The method should return
+ the substring "Martin" since offset+count > length
+ (19 > 15).
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+*/
+function hc_characterdatasubstringexceedsvalue() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatasubstringexceedsvalue") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var substring;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ substring = child.substringData(9,10);
+ assertEquals("characterdataSubStringExceedsValueAssert","Martin",substring);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringexceedsvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringvalue.html
new file mode 100644
index 0000000000..a43eaafbe2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringvalue.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_characterdatasubstringvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_characterdatasubstringvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "substringData(offset,count)" method returns the
+ specified string.
+
+ Retrieve the character data from the second child
+ of the first employee and access part of the data
+ by using the substringData(offset,count) method. The
+ method should return the specified substring starting
+ at position "offset" and extract "count" characters.
+ The method should return the string "Margaret".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
+*/
+function hc_characterdatasubstringvalue() {
+ var success;
+ if(checkInitialization(builder, "hc_characterdatasubstringvalue") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var child;
+ var substring;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(0);
+ child = nameNode.firstChild;
+
+ substring = child.substringData(0,8);
+ assertEquals("characterdataSubStringValueAssert","Margaret",substring);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_commentgetcomment.html b/dom/tests/mochitest/dom-level1-core/test_hc_commentgetcomment.html
new file mode 100644
index 0000000000..a07cdd4811
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_commentgetcomment.html
@@ -0,0 +1,160 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_commentgetcomment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_commentgetcomment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_commentgetcomment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ A comment is all the characters between the starting
+ '<!--' and ending '-->'
+ Retrieve the nodes of the DOM document. Search for a
+ comment node and the content is its value.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=509
+*/
+function hc_commentgetcomment() {
+ var success;
+ if(checkInitialization(builder, "hc_commentgetcomment") != null) return;
+ var doc;
+ var elementList;
+ var child;
+ var childName;
+ var childValue;
+ var commentCount = 0;
+ var childType;
+ var attributes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.childNodes;
+
+ for(var indexN65630 = 0;indexN65630 < elementList.length; indexN65630++) {
+ child = elementList.item(indexN65630);
+ childType = child.nodeType;
+
+
+ if(
+ (8 == childType)
+ ) {
+ childName = child.nodeName;
+
+ assertEquals("nodeName","#comment",childName);
+ childValue = child.nodeValue;
+
+ assertEquals("nodeValue"," This is comment number 1.",childValue);
+ attributes = child.attributes;
+
+ assertNull("attributes",attributes);
+ commentCount += 1;
+
+ }
+
+ }
+ assertTrue("atMostOneComment",
+
+ (commentCount < 2)
+);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_commentgetcomment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateattribute.html
new file mode 100644
index 0000000000..dae55673ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateattribute.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentcreateattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentcreateattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the entire DOM document and invoke its
+ "createAttribute(name)" method. It should create a
+ new Attribute node with the given name. The name, value
+ and type of the newly created object are retrieved and
+ output.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_documentcreateattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_documentcreateattribute") != null) return;
+ var doc;
+ var newAttrNode;
+ var attrValue;
+ var attrName;
+ var attrType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newAttrNode = doc.createAttribute("title");
+ attrValue = newAttrNode.nodeValue;
+
+ assertEquals("value","",attrValue);
+ attrName = newAttrNode.nodeName;
+
+ assertEqualsAutoCase("attribute", "name","title",attrName);
+ attrType = newAttrNode.nodeType;
+
+ assertEquals("type",2,attrType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatecomment.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatecomment.html
new file mode 100644
index 0000000000..815867fa12
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatecomment.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatecomment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentcreatecomment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentcreatecomment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createComment(data)" method creates a new Comment
+ node given the specified string.
+ Retrieve the entire DOM document and invoke its
+ "createComment(data)" method. It should create a new
+ Comment node whose "data" is the specified string.
+ The content, name and type are retrieved and output.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328
+*/
+function hc_documentcreatecomment() {
+ var success;
+ if(checkInitialization(builder, "hc_documentcreatecomment") != null) return;
+ var doc;
+ var newCommentNode;
+ var newCommentValue;
+ var newCommentName;
+ var newCommentType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newCommentNode = doc.createComment("This is a new Comment node");
+ newCommentValue = newCommentNode.nodeValue;
+
+ assertEquals("value","This is a new Comment node",newCommentValue);
+ newCommentName = newCommentNode.nodeName;
+
+ assertEquals("strong","#comment",newCommentName);
+ newCommentType = newCommentNode.nodeType;
+
+ assertEquals("type",8,newCommentType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatecomment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatedocumentfragment.html
new file mode 100644
index 0000000000..084632c381
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatedocumentfragment.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatedocumentfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentcreatedocumentfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentcreatedocumentfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createDocumentFragment()" method creates an empty
+ DocumentFragment object.
+ Retrieve the entire DOM document and invoke its
+ "createDocumentFragment()" method. The content, name,
+ type and value of the newly created object are output.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5
+*/
+function hc_documentcreatedocumentfragment() {
+ var success;
+ if(checkInitialization(builder, "hc_documentcreatedocumentfragment") != null) return;
+ var doc;
+ var newDocFragment;
+ var children;
+ var length;
+ var newDocFragmentName;
+ var newDocFragmentType;
+ var newDocFragmentValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newDocFragment = doc.createDocumentFragment();
+ children = newDocFragment.childNodes;
+
+ length = children.length;
+
+ assertEquals("length",0,length);
+ newDocFragmentName = newDocFragment.nodeName;
+
+ assertEquals("strong","#document-fragment",newDocFragmentName);
+ newDocFragmentType = newDocFragment.nodeType;
+
+ assertEquals("type",11,newDocFragmentType);
+ newDocFragmentValue = newDocFragment.nodeValue;
+
+ assertNull("value",newDocFragmentValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatedocumentfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelement.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelement.html
new file mode 100644
index 0000000000..9f5df4a2c9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelement.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelement</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentcreateelement'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentcreateelement';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createElement(tagName)" method creates an Element
+ of the type specified.
+ Retrieve the entire DOM document and invoke its
+ "createElement(tagName)" method with tagName="acronym".
+ The method should create an instance of an Element node
+ whose tagName is "acronym". The NodeName, NodeType
+ and NodeValue are returned.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+*/
+function hc_documentcreateelement() {
+ var success;
+ if(checkInitialization(builder, "hc_documentcreateelement") != null) return;
+ var doc;
+ var newElement;
+ var newElementName;
+ var newElementType;
+ var newElementValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newElement = doc.createElement("acronym");
+ newElementName = newElement.nodeName;
+
+ assertEqualsAutoCase("element", "strong","acronym",newElementName);
+ newElementType = newElement.nodeType;
+
+ assertEquals("type",1,newElementType);
+ newElementValue = newElement.nodeValue;
+
+ assertNull("valueInitiallyNull",newElementValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelement</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelementcasesensitive.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelementcasesensitive.html
new file mode 100644
index 0000000000..ccad877e48
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelementcasesensitive.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelementcasesensitive</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentcreateelementcasesensitive'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentcreateelementcasesensitive';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The tagName parameter in the "createElement(tagName)"
+ method is case-sensitive for XML documents.
+ Retrieve the entire DOM document and invoke its
+ "createElement(tagName)" method twice. Once for tagName
+ equal to "acronym" and once for tagName equal to "ACRONYM"
+ Each call should create a distinct Element node. The
+ newly created Elements are then assigned attributes
+ that are retrieved.
+
+ Modified on 27 June 2003 to avoid setting an invalid style
+ values and checked the node names to see if they matched expectations.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_documentcreateelementcasesensitive() {
+ var success;
+ if(checkInitialization(builder, "hc_documentcreateelementcasesensitive") != null) return;
+ var doc;
+ var newElement1;
+ var newElement2;
+ var attribute1;
+ var attribute2;
+ var nodeName1;
+ var nodeName2;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newElement1 = doc.createElement("ACRONYM");
+ newElement2 = doc.createElement("acronym");
+ newElement1.setAttribute("lang","EN");
+ newElement2.setAttribute("title","Dallas");
+ attribute1 = newElement1.getAttribute("lang");
+ attribute2 = newElement2.getAttribute("title");
+ assertEquals("attrib1","EN",attribute1);
+ assertEquals("attrib2","Dallas",attribute2);
+ nodeName1 = newElement1.nodeName;
+
+ nodeName2 = newElement2.nodeName;
+
+ assertEqualsAutoCase("element", "nodeName1","ACRONYM",nodeName1);
+ assertEqualsAutoCase("element", "nodeName2","acronym",nodeName2);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelementcasesensitive</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatetextnode.html
new file mode 100644
index 0000000000..a8d6c6abe1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatetextnode.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatetextnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentcreatetextnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentcreatetextnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createTextNode(data)" method creates a Text node
+ given the specfied string.
+ Retrieve the entire DOM document and invoke its
+ "createTextNode(data)" method. It should create a
+ new Text node whose "data" is the specified string.
+ The NodeName and NodeType are also checked.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127
+*/
+function hc_documentcreatetextnode() {
+ var success;
+ if(checkInitialization(builder, "hc_documentcreatetextnode") != null) return;
+ var doc;
+ var newTextNode;
+ var newTextName;
+ var newTextValue;
+ var newTextType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newTextNode = doc.createTextNode("This is a new Text node");
+ newTextValue = newTextNode.nodeValue;
+
+ assertEquals("value","This is a new Text node",newTextValue);
+ newTextName = newTextNode.nodeName;
+
+ assertEquals("strong","#text",newTextName);
+ newTextType = newTextNode.nodeType;
+
+ assertEquals("type",3,newTextType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatetextnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetdoctype.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetdoctype.html
new file mode 100644
index 0000000000..c63b225b8c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetdoctype.html
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetdoctype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentgetdoctype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentgetdoctype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Access Document.doctype for hc_staff, if not text/html should return DocumentType node.
+HTML implementations may return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
+*/
+function hc_documentgetdoctype() {
+ var success;
+ if(checkInitialization(builder, "hc_documentgetdoctype") != null) return;
+ var doc;
+ var docType;
+ var docTypeName;
+ var nodeValue;
+ var attributes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docType = doc.doctype;
+
+
+ if(
+
+ !(
+ (builder.contentType == "text/html")
+)
+
+ ) {
+ assertNotNull("docTypeNotNull",docType);
+
+ }
+
+ if(
+
+ (docType != null)
+
+ ) {
+ docTypeName = docType.name;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("nodeNameSVG","svg",docTypeName);
+
+ }
+
+ else {
+ // Modified to allow lower case for the HTML5 parser and upper case for the old parser
+ assertTrue("nodeName", "HTML" == docTypeName || "html" == docTypeName);
+
+ }
+ nodeValue = docType.nodeValue;
+
+ assertNull("nodeValue",nodeValue);
+ attributes = docType.attributes;
+
+ assertNull("attributes",attributes);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetdoctype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamelength.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamelength.html
new file mode 100644
index 0000000000..7d4b4e6c00
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamelength.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamelength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentgetelementsbytagnamelength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentgetelementsbytagnamelength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getElementsByTagName(tagName)" method returns a
+ NodeList of all the Elements with a given tagName.
+
+ Retrieve the entire DOM document and invoke its
+ "getElementsByTagName(tagName)" method with tagName
+ equal to "strong". The method should return a NodeList
+ that contains 5 elements.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
+*/
+function hc_documentgetelementsbytagnamelength() {
+ var success;
+ if(checkInitialization(builder, "hc_documentgetelementsbytagnamelength") != null) return;
+ var doc;
+ var nameList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ nameList = doc.getElementsByTagName("strong");
+ assertSize("documentGetElementsByTagNameLengthAssert",5,nameList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamelength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnametotallength.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnametotallength.html
new file mode 100644
index 0000000000..0db66cf622
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnametotallength.html
@@ -0,0 +1,237 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnametotallength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentgetelementsbytagnametotallength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentgetelementsbytagnametotallength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the entire DOM document and invoke its
+ "getElementsByTagName(tagName)" method with tagName
+ equal to "*". The method should return a NodeList
+ that contains all the elements of the document.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function hc_documentgetelementsbytagnametotallength() {
+ var success;
+ if(checkInitialization(builder, "hc_documentgetelementsbytagnametotallength") != null) return;
+ var doc;
+ var nameList;
+ expectedNames = new Array();
+ expectedNames[0] = "html";
+ expectedNames[1] = "head";
+ expectedNames[2] = "meta";
+ expectedNames[3] = "title";
+ expectedNames[4] = "script";
+ expectedNames[5] = "script";
+ expectedNames[6] = "script";
+ expectedNames[7] = "body";
+ expectedNames[8] = "p";
+ expectedNames[9] = "em";
+ expectedNames[10] = "strong";
+ expectedNames[11] = "code";
+ expectedNames[12] = "sup";
+ expectedNames[13] = "var";
+ expectedNames[14] = "acronym";
+ expectedNames[15] = "p";
+ expectedNames[16] = "em";
+ expectedNames[17] = "strong";
+ expectedNames[18] = "code";
+ expectedNames[19] = "sup";
+ expectedNames[20] = "var";
+ expectedNames[21] = "acronym";
+ expectedNames[22] = "p";
+ expectedNames[23] = "em";
+ expectedNames[24] = "strong";
+ expectedNames[25] = "code";
+ expectedNames[26] = "sup";
+ expectedNames[27] = "var";
+ expectedNames[28] = "acronym";
+ expectedNames[29] = "p";
+ expectedNames[30] = "em";
+ expectedNames[31] = "strong";
+ expectedNames[32] = "code";
+ expectedNames[33] = "sup";
+ expectedNames[34] = "var";
+ expectedNames[35] = "acronym";
+ expectedNames[36] = "p";
+ expectedNames[37] = "em";
+ expectedNames[38] = "strong";
+ expectedNames[39] = "code";
+ expectedNames[40] = "sup";
+ expectedNames[41] = "var";
+ expectedNames[42] = "acronym";
+
+ svgExpectedNames = new Array();
+ svgExpectedNames[0] = "svg";
+ svgExpectedNames[1] = "rect";
+ svgExpectedNames[2] = "script";
+ svgExpectedNames[3] = "head";
+ svgExpectedNames[4] = "meta";
+ svgExpectedNames[5] = "title";
+ svgExpectedNames[6] = "body";
+ svgExpectedNames[7] = "p";
+ svgExpectedNames[8] = "em";
+ svgExpectedNames[9] = "strong";
+ svgExpectedNames[10] = "code";
+ svgExpectedNames[11] = "sup";
+ svgExpectedNames[12] = "var";
+ svgExpectedNames[13] = "acronym";
+ svgExpectedNames[14] = "p";
+ svgExpectedNames[15] = "em";
+ svgExpectedNames[16] = "strong";
+ svgExpectedNames[17] = "code";
+ svgExpectedNames[18] = "sup";
+ svgExpectedNames[19] = "var";
+ svgExpectedNames[20] = "acronym";
+ svgExpectedNames[21] = "p";
+ svgExpectedNames[22] = "em";
+ svgExpectedNames[23] = "strong";
+ svgExpectedNames[24] = "code";
+ svgExpectedNames[25] = "sup";
+ svgExpectedNames[26] = "var";
+ svgExpectedNames[27] = "acronym";
+ svgExpectedNames[28] = "p";
+ svgExpectedNames[29] = "em";
+ svgExpectedNames[30] = "strong";
+ svgExpectedNames[31] = "code";
+ svgExpectedNames[32] = "sup";
+ svgExpectedNames[33] = "var";
+ svgExpectedNames[34] = "acronym";
+ svgExpectedNames[35] = "p";
+ svgExpectedNames[36] = "em";
+ svgExpectedNames[37] = "strong";
+ svgExpectedNames[38] = "code";
+ svgExpectedNames[39] = "sup";
+ svgExpectedNames[40] = "var";
+ svgExpectedNames[41] = "acronym";
+
+ var actualNames = new Array();
+
+ var thisElement;
+ var thisTag;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ nameList = doc.getElementsByTagName("*");
+ for(var indexN65864 = 0;indexN65864 < nameList.length; indexN65864++) {
+ thisElement = nameList.item(indexN65864);
+ thisTag = thisElement.tagName;
+
+ actualNames[actualNames.length] = thisTag;
+
+ }
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEqualsListAutoCase("element", "svgTagNames",svgExpectedNames,actualNames);
+
+ }
+
+ else {
+ assertEqualsListAutoCase("element", "tagNames",expectedNames,actualNames);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnametotallength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamevalue.html
new file mode 100644
index 0000000000..7e2eb1d2e6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamevalue.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentgetelementsbytagnamevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentgetelementsbytagnamevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getElementsByTagName(tagName)" method returns a
+ NodeList of all the Elements with a given tagName
+ in a pre-order traversal of the tree.
+
+ Retrieve the entire DOM document and invoke its
+ "getElementsByTagName(tagName)" method with tagName
+ equal to "strong". The method should return a NodeList
+ that contains 5 elements. The FOURTH item in the
+ list is retrieved and output.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
+*/
+function hc_documentgetelementsbytagnamevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_documentgetelementsbytagnamevalue") != null) return;
+ var doc;
+ var nameList;
+ var nameNode;
+ var firstChild;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ nameList = doc.getElementsByTagName("strong");
+ nameNode = nameList.item(3);
+ firstChild = nameNode.firstChild;
+
+ childValue = firstChild.nodeValue;
+
+ assertEquals("documentGetElementsByTagNameValueAssert","Jeny Oconnor",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetimplementation.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetimplementation.html
new file mode 100644
index 0000000000..0a4fca9cb4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetimplementation.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetimplementation</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentgetimplementation'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentgetimplementation';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the entire DOM document and invoke its
+ "getImplementation()" method. If contentType="text/html",
+ DOMImplementation.hasFeature("HTML","1.0") should be true.
+ Otherwise, DOMImplementation.hasFeature("XML", "1.0")
+ should be true.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
+*/
+function hc_documentgetimplementation() {
+ var success;
+ if(checkInitialization(builder, "hc_documentgetimplementation") != null) return;
+ var doc;
+ var docImpl;
+ var xmlstate;
+ var htmlstate;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docImpl = doc.implementation;
+xmlstate = docImpl.hasFeature("XML","1.0");
+htmlstate = docImpl.hasFeature("HTML","1.0");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertTrue("supports_HTML_1.0",htmlstate);
+
+ }
+
+ else {
+ assertTrue("supports_XML_1.0",xmlstate);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetimplementation</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetrootnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetrootnode.html
new file mode 100644
index 0000000000..1b03a9b05f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetrootnode.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetrootnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentgetrootnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentgetrootnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Load a document and invoke its
+ "getDocumentElement()" method.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function hc_documentgetrootnode() {
+ var success;
+ if(checkInitialization(builder, "hc_documentgetrootnode") != null) return;
+ var doc;
+ var root;
+ var rootName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ root = doc.documentElement;
+
+ rootName = root.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgTagName","svg",rootName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "docElemName","html",rootName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetrootnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute.html
new file mode 100644
index 0000000000..ad64e33e68
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentinvalidcharacterexceptioncreateattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentinvalidcharacterexceptioncreateattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createAttribute(tagName)" method raises an
+ INVALID_CHARACTER_ERR DOMException if the specified
+ tagName contains an invalid character.
+
+ Retrieve the entire DOM document and invoke its
+ "createAttribute(tagName)" method with the tagName equal
+ to the string "invalid^Name". Due to the invalid
+ character the desired EXCEPTION should be raised.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_documentinvalidcharacterexceptioncreateattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateattribute") != null) return;
+ var doc;
+ var createdAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ {
+ success = false;
+ try {
+ createdAttr = doc.createAttribute("invalid^Name");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute1.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute1.html
new file mode 100644
index 0000000000..55c76fce29
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute1.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentinvalidcharacterexceptioncreateattribute1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentinvalidcharacterexceptioncreateattribute1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Creating an attribute with an empty name should cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function hc_documentinvalidcharacterexceptioncreateattribute1() {
+ var success;
+ if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateattribute1") != null) return;
+ var doc;
+ var createdAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ {
+ success = false;
+ try {
+ createdAttr = doc.createAttribute("");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement.html
new file mode 100644
index 0000000000..4f1418c4d3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentinvalidcharacterexceptioncreateelement'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentinvalidcharacterexceptioncreateelement';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "createElement(tagName)" method raises an
+ INVALID_CHARACTER_ERR DOMException if the specified
+ tagName contains an invalid character.
+
+ Retrieve the entire DOM document and invoke its
+ "createElement(tagName)" method with the tagName equal
+ to the string "invalid^Name". Due to the invalid
+ character the desired EXCEPTION should be raised.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_documentinvalidcharacterexceptioncreateelement() {
+ var success;
+ if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateelement") != null) return;
+ var doc;
+ var badElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ {
+ success = false;
+ try {
+ badElement = doc.createElement("invalid^Name");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement1.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement1.html
new file mode 100644
index 0000000000..8919c95dae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement1.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_documentinvalidcharacterexceptioncreateelement1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_documentinvalidcharacterexceptioncreateelement1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Creating an element with an empty name should cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function hc_documentinvalidcharacterexceptioncreateelement1() {
+ var success;
+ if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateelement1") != null) return;
+ var doc;
+ var badElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ {
+ success = false;
+ try {
+ badElement = doc.createElement("");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenoversion.html b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenoversion.html
new file mode 100644
index 0000000000..f558874383
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenoversion.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenoversion</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_domimplementationfeaturenoversion'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_domimplementationfeaturenoversion';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Load a document and invoke its
+ "getImplementation()" method. This should create a
+ DOMImplementation object whose "hasFeature(feature,
+ version)" method is invoked with version equal to "".
+ If the version is not specified, supporting any version
+ feature will cause the method to return "true".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
+* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
+*/
+function hc_domimplementationfeaturenoversion() {
+ var success;
+ if(checkInitialization(builder, "hc_domimplementationfeaturenoversion") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ domImpl = doc.implementation;
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ state = domImpl.hasFeature("HTML","");
+
+ }
+
+ else {
+ state = domImpl.hasFeature("XML","");
+
+ }
+ assertTrue("hasFeatureBlank",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenoversion</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenull.html
new file mode 100644
index 0000000000..88be6a0593
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenull.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_domimplementationfeaturenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("hasNullString", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_domimplementationfeaturenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Load a document and invoke its
+ "getImplementation()" method. This should create a
+ DOMImplementation object whose "hasFeature(feature,
+ version)" method is invoked with version equal to null.
+ If the version is not specified, supporting any version
+ feature will cause the method to return "true".
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
+* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
+*/
+function hc_domimplementationfeaturenull() {
+ var success;
+ if(checkInitialization(builder, "hc_domimplementationfeaturenull") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ domImpl = doc.implementation;
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ state = domImpl.hasFeature("HTML",null);
+assertTrue("supports_HTML_null",state);
+
+ }
+
+ else {
+ state = domImpl.hasFeature("XML",null);
+assertTrue("supports_XML_null",state);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturexml.html b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturexml.html
new file mode 100644
index 0000000000..1563804e79
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturexml.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturexml</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_domimplementationfeaturexml'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_domimplementationfeaturexml';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the entire DOM document and invoke its
+ "getImplementation()" method. This should create a
+ DOMImplementation object whose "hasFeature(feature,
+ version)" method is invoked with "feature" equal to "html" or "xml".
+ The method should return a boolean "true".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
+*/
+function hc_domimplementationfeaturexml() {
+ var success;
+ if(checkInitialization(builder, "hc_domimplementationfeaturexml") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ domImpl = doc.implementation;
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ state = domImpl.hasFeature("html","1.0");
+assertTrue("supports_html_1.0",state);
+
+ }
+
+ else {
+ state = domImpl.hasFeature("xml","1.0");
+assertTrue("supports_xml_1.0",state);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturexml</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementaddnewattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementaddnewattribute.html
new file mode 100644
index 0000000000..0328cf8c13
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementaddnewattribute.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementaddnewattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementaddnewattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementaddnewattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttribute(name,value)" method adds a new attribute
+ to the Element
+
+ Retrieve the last child of the last employee, then
+ add an attribute to it by invoking the
+ "setAttribute(name,value)" method. It should create
+ a "strong" attribute with an assigned value equal to
+ "value".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_elementaddnewattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_elementaddnewattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(4);
+ testEmployee.setAttribute("lang","EN-us");
+ attrValue = testEmployee.getAttribute("lang");
+ assertEquals("attrValue","EN-us",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementaddnewattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementassociatedattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementassociatedattribute.html
new file mode 100644
index 0000000000..0b279b88f3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementassociatedattribute.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementassociatedattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementassociatedattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementassociatedattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the first attribute from the last child of
+ the first employee and invoke the "getSpecified()"
+ method. This test is only intended to show that
+ Elements can actually have attributes. This test uses
+ the "getNamedItem(name)" method from the NamedNodeMap
+ interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function hc_elementassociatedattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_elementassociatedattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var domesticAttr;
+ var specified;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(0);
+ attributes = testEmployee.attributes;
+
+ domesticAttr = attributes.getNamedItem("title");
+ specified = domesticAttr.specified;
+
+ assertTrue("acronymTitleSpecified",specified);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementassociatedattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementchangeattributevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementchangeattributevalue.html
new file mode 100644
index 0000000000..1918601671
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementchangeattributevalue.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementchangeattributevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementchangeattributevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementchangeattributevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttribute(name,value)" method adds a new attribute
+ to the Element. If the "strong" is already present, then
+ its value should be changed to the new one that is in
+ the "value" parameter.
+
+ Retrieve the last child of the fourth employee, then add
+ an attribute to it by invoking the
+ "setAttribute(name,value)" method. Since the name of the
+ used attribute("class") is already present in this
+ element, then its value should be changed to the new one
+ of the "value" parameter.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+*/
+function hc_elementchangeattributevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_elementchangeattributevalue") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(3);
+ testEmployee.setAttribute("class","Neither");
+ attrValue = testEmployee.getAttribute("class");
+ assertEquals("elementChangeAttributeValueAssert","Neither",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementchangeattributevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementcreatenewattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementcreatenewattribute.html
new file mode 100644
index 0000000000..3d9faa7d27
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementcreatenewattribute.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementcreatenewattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementcreatenewattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementcreatenewattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method adds a new
+ attribute to the Element.
+
+ Retrieve first address element and add
+ a new attribute node to it by invoking its
+ "setAttributeNode(newAttr)" method. This test makes use
+ of the "createAttribute(name)" method from the Document
+ interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_elementcreatenewattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_elementcreatenewattribute") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var newAttribute;
+ var oldAttr;
+ var districtAttr;
+ var attrVal;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(0);
+ newAttribute = doc.createAttribute("lang");
+ oldAttr = testAddress.setAttributeNode(newAttribute);
+ assertNull("old_attr_doesnt_exist",oldAttr);
+ districtAttr = testAddress.getAttributeNode("lang");
+ assertNotNull("new_district_accessible",districtAttr);
+attrVal = testAddress.getAttribute("lang");
+ assertEquals("attr_value","",attrVal);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementcreatenewattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenode.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenode.html
new file mode 100644
index 0000000000..0bdbf285ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenode.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgetattributenode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgetattributenode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the attribute "title" from the last child
+ of the first "p" element and check its node name.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+*/
+function hc_elementgetattributenode() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgetattributenode") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var domesticAttr;
+ var nodeName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(0);
+ domesticAttr = testEmployee.getAttributeNode("title");
+ nodeName = domesticAttr.nodeName;
+
+ assertEqualsAutoCase("attribute", "nodeName","title",nodeName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenodenull.html
new file mode 100644
index 0000000000..902b6e7e69
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenodenull.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgetattributenodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgetattributenodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributeNode(name)" method retrieves an
+ attribute node by name. It should return null if the
+ "strong" attribute does not exist.
+
+ Retrieve the last child of the first employee and attempt
+ to retrieve a non-existing attribute. The method should
+ return "null". The non-existing attribute to be used
+ is "invalidAttribute".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8
+*/
+function hc_elementgetattributenodenull() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgetattributenodenull") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var domesticAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(0);
+ domesticAttr = testEmployee.getAttributeNode("invalidAttribute");
+ assertNull("elementGetAttributeNodeNullAssert",domesticAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementempty.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementempty.html
new file mode 100644
index 0000000000..6457e06429
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementempty.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementempty</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgetelementempty'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgetelementempty';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttribute(name)" method returns an empty
+ string if no value was assigned to an attribute and
+ no default value was given in the DTD file.
+
+ Retrieve the last child of the last employee, then
+ invoke "getAttribute(name)" method, where "strong" is an
+ attribute without a specified or DTD default value.
+ The "getAttribute(name)" method should return the empty
+ string. This method makes use of the
+ "createAttribute(newAttr)" method from the Document
+ interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_elementgetelementempty() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgetelementempty") != null) return;
+ var doc;
+ var newAttribute;
+ var elementList;
+ var testEmployee;
+ var domesticAttr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newAttribute = doc.createAttribute("lang");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(3);
+ domesticAttr = testEmployee.setAttributeNode(newAttribute);
+ attrValue = testEmployee.getAttribute("lang");
+ assertEquals("elementGetElementEmptyAssert","",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementempty</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagname.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagname.html
new file mode 100644
index 0000000000..311b84b52b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagname.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgetelementsbytagname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgetelementsbytagname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getElementsByTagName(name)" method returns a list
+of all descendant Elements with the given tag name.
+Test for an empty list.
+
+Create a NodeList of all the descendant elements
+using the string "noMatch" as the tagName.
+The method should return a NodeList whose length is
+"0" since there are not any descendant elements
+that match the given tag name.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+*/
+function hc_elementgetelementsbytagname() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgetelementsbytagname") != null) return;
+ var doc;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ assertSize("elementGetElementsByTagNameAssert",5,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnameaccessnodelist.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnameaccessnodelist.html
new file mode 100644
index 0000000000..efbaa7f7dd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnameaccessnodelist.html
@@ -0,0 +1,160 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnameaccessnodelist</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgetelementsbytagnameaccessnodelist'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgetelementsbytagnameaccessnodelist';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getElementsByTagName(name)" method returns a list
+of all descendant Elements in the order the children
+were encountered in a pre order traversal of the element
+tree.
+
+Create a NodeList of all the descendant elements
+using the string "p" as the tagName.
+The method should return a NodeList whose length is
+"5" in the order the children were encountered.
+Access the FOURTH element in the NodeList. The FOURTH
+element, the first or second should be an "em" node with
+the content "EMP0004".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_elementgetelementsbytagnameaccessnodelist() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgetelementsbytagnameaccessnodelist") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var firstC;
+ var childName;
+ var nodeType;
+ var employeeIDNode;
+ var employeeID;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ testEmployee = elementList.item(3);
+ firstC = testEmployee.firstChild;
+
+ nodeType = firstC.nodeType;
+
+
+ while(
+ (3 == nodeType)
+ ) {
+ firstC = firstC.nextSibling;
+
+ nodeType = firstC.nodeType;
+
+
+ }
+childName = firstC.nodeName;
+
+ assertEqualsAutoCase("element", "childName","em",childName);
+ employeeIDNode = firstC.firstChild;
+
+ employeeID = employeeIDNode.nodeValue;
+
+ assertEquals("employeeID","EMP0004",employeeID);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnameaccessnodelist</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamenomatch.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamenomatch.html
new file mode 100644
index 0000000000..9c8994241f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamenomatch.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamenomatch</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgetelementsbytagnamenomatch'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgetelementsbytagnamenomatch';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getElementsByTagName(name)" method returns a list
+of all descendant Elements with the given tag name.
+
+Create a NodeList of all the descendant elements
+using the string "employee" as the tagName.
+The method should return a NodeList whose length is
+"5".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+*/
+function hc_elementgetelementsbytagnamenomatch() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgetelementsbytagnamenomatch") != null) return;
+ var doc;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("noMatch");
+ assertSize("elementGetElementsByTagNameNoMatchNoMatchAssert",0,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamenomatch</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamespecialvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamespecialvalue.html
new file mode 100644
index 0000000000..ae4eced5bb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamespecialvalue.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamespecialvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgetelementsbytagnamespecialvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgetelementsbytagnamespecialvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getElementsByTagName(name)" method may use the
+special value "*" to match all tags in the element
+tree.
+
+Create a NodeList of all the descendant elements
+of the last employee by using the special value "*".
+The method should return all the descendant children(6)
+in the order the children were encountered.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
+*/
+function hc_elementgetelementsbytagnamespecialvalue() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgetelementsbytagnamespecialvalue") != null) return;
+ var doc;
+ var elementList;
+ var lastEmployee;
+ var lastempList;
+ var child;
+ var childName;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "em";
+ expectedResult[1] = "strong";
+ expectedResult[2] = "code";
+ expectedResult[3] = "sup";
+ expectedResult[4] = "var";
+ expectedResult[5] = "acronym";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ lastEmployee = elementList.item(4);
+ lastempList = lastEmployee.getElementsByTagName("*");
+ for(var indexN65639 = 0;indexN65639 < lastempList.length; indexN65639++) {
+ child = lastempList.item(indexN65639);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+ assertEqualsListAutoCase("element", "tagNames",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamespecialvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgettagname.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgettagname.html
new file mode 100644
index 0000000000..863ec7ebcd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgettagname.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgettagname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementgettagname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementgettagname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Invoke the "getTagName()" method one the
+ root node. The value returned should be "html" or "svg".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function hc_elementgettagname() {
+ var success;
+ if(checkInitialization(builder, "hc_elementgettagname") != null) return;
+ var doc;
+ var root;
+ var tagname;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ root = doc.documentElement;
+
+ tagname = root.tagName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgTagname","svg",tagname);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "tagname","html",tagname);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgettagname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementinuseattributeerr.html
new file mode 100644
index 0000000000..cb0d6b54c6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementinuseattributeerr.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinuseattributeerr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementinuseattributeerr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementinuseattributeerr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method raises an
+ "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr"
+ is already an attribute of another element.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=244
+*/
+function hc_elementinuseattributeerr() {
+ var success;
+ if(checkInitialization(builder, "hc_elementinuseattributeerr") != null) return;
+ var doc;
+ var newAttribute;
+ var addressElementList;
+ var testAddress;
+ var newElement;
+ var attrAddress;
+ var appendedChild;
+ var setAttr1;
+ var setAttr2;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressElementList = doc.getElementsByTagName("body");
+ testAddress = addressElementList.item(0);
+ newElement = doc.createElement("p");
+ appendedChild = testAddress.appendChild(newElement);
+ newAttribute = doc.createAttribute("title");
+ setAttr1 = newElement.setAttributeNode(newAttribute);
+
+ {
+ success = false;
+ try {
+ setAttr2 = testAddress.setAttributeNode(newAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("throw_INUSE_ATTRIBUTE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinuseattributeerr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception.html
new file mode 100644
index 0000000000..d25fc82ab1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementinvalidcharacterexception'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementinvalidcharacterexception';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttribute(name,value)" method raises an
+ "INVALID_CHARACTER_ERR DOMException if the specified
+ name contains an invalid character.
+
+ Retrieve the last child of the first employee and
+ call its "setAttribute(name,value)" method with
+ "strong" containing an invalid character.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_elementinvalidcharacterexception() {
+ var success;
+ if(checkInitialization(builder, "hc_elementinvalidcharacterexception") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddress.setAttribute("invalid^Name","value");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception1.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception1.html
new file mode 100644
index 0000000000..494c75e0df
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception1.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementinvalidcharacterexception1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementinvalidcharacterexception1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Calling Element.setAttribute with an empty name will cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function hc_elementinvalidcharacterexception1() {
+ var success;
+ if(checkInitialization(builder, "hc_elementinvalidcharacterexception1") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddress.setAttribute("","value");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize.html
new file mode 100644
index 0000000000..8e71f8f9cc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementnormalize'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementnormalize';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Append a couple of text nodes to the first sup element, normalize the
+document element and check that the element has been normalized.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=546
+*/
+function hc_elementnormalize() {
+ var success;
+ if(checkInitialization(builder, "hc_elementnormalize") != null) return;
+ var doc;
+ var root;
+ var elementList;
+ var testName;
+ var firstChild;
+ var childValue;
+ var textNode;
+ var retNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("sup");
+ testName = elementList.item(0);
+ textNode = doc.createTextNode("");
+ retNode = testName.appendChild(textNode);
+ textNode = doc.createTextNode(",000");
+ retNode = testName.appendChild(textNode);
+ root = doc.documentElement;
+
+ root.normalize();
+ elementList = doc.getElementsByTagName("sup");
+ testName = elementList.item(0);
+ firstChild = testName.firstChild;
+
+ childValue = firstChild.nodeValue;
+
+ assertEquals("elementNormalizeAssert","56,000,000",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize2.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize2.html
new file mode 100644
index 0000000000..92013976a9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize2.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize2</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementnormalize2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementnormalize2';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Add an empty text node to an existing attribute node, normalize the containing element
+and check that the attribute node has eliminated the empty text.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=482
+*/
+function hc_elementnormalize2() {
+ var success;
+ if(checkInitialization(builder, "hc_elementnormalize2") != null) return;
+ var doc;
+ var root;
+ var elementList;
+ var element;
+ var firstChild;
+ var secondChild;
+ var childValue;
+ var emptyText;
+ var attrNode;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ root = doc.documentElement;
+
+ emptyText = doc.createTextNode("");
+ elementList = root.getElementsByTagName("acronym");
+ element = elementList.item(0);
+ attrNode = element.getAttributeNode("title");
+ retval = attrNode.appendChild(emptyText);
+ element.normalize();
+ attrNode = element.getAttributeNode("title");
+ firstChild = attrNode.firstChild;
+
+ childValue = firstChild.nodeValue;
+
+ assertEquals("firstChild","Yes",childValue);
+ secondChild = firstChild.nextSibling;
+
+ assertNull("secondChildNull",secondChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementnotfounderr.html
new file mode 100644
index 0000000000..3795e44ba6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementnotfounderr.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnotfounderr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementnotfounderr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementnotfounderr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method raises a
+ NOT_FOUND_ERR DOMException if the "oldAttr" attribute
+ is not an attribute of the element.
+
+ Retrieve the last employee and attempt to remove
+ a non existing attribute node. This should cause the
+ intended exception to be raised. This test makes use
+ of the "createAttribute(name)" method from the Document
+ interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_elementnotfounderr() {
+ var success;
+ if(checkInitialization(builder, "hc_elementnotfounderr") != null) return;
+ var doc;
+ var oldAttribute;
+ var addressElementList;
+ var testAddress;
+ var attrAddress;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressElementList = doc.getElementsByTagName("acronym");
+ testAddress = addressElementList.item(4);
+ oldAttribute = doc.createAttribute("title");
+
+ {
+ success = false;
+ try {
+ attrAddress = testAddress.removeAttributeNode(oldAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnotfounderr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattribute.html
new file mode 100644
index 0000000000..0561851a39
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattribute.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementremoveattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementremoveattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttribute(name)" removes an attribute by name.
+ If the attribute has a default value, it is immediately
+ replaced. However, there is no default values in the HTML
+ compatible tests, so its value is "".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function hc_elementremoveattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_elementremoveattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(3);
+ testEmployee.removeAttribute("class");
+ attrValue = testEmployee.getAttribute("class");
+ assertEquals("attrValue","",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributeaftercreate.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributeaftercreate.html
new file mode 100644
index 0000000000..8d3e7482c1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributeaftercreate.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributeaftercreate</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementremoveattributeaftercreate'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementremoveattributeaftercreate';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method removes the
+ specified attribute.
+
+ Retrieve the last child of the third employee, add a
+ new "lang" attribute to it and then try to remove it.
+ To verify that the node was removed use the
+ "getNamedItem(name)" method from the NamedNodeMap
+ interface. It also uses the "getAttributes()" method
+ from the Node interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_elementremoveattributeaftercreate() {
+ var success;
+ if(checkInitialization(builder, "hc_elementremoveattributeaftercreate") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var attributes;
+ var districtAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("lang");
+ districtAttr = testEmployee.setAttributeNode(newAttribute);
+ districtAttr = testEmployee.removeAttributeNode(newAttribute);
+ attributes = testEmployee.attributes;
+
+ districtAttr = attributes.getNamedItem("lang");
+ assertNull("removed_item_null",districtAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributeaftercreate</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributenode.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributenode.html
new file mode 100644
index 0000000000..4883111bf9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributenode.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributenode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementremoveattributenode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementremoveattributenode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeAttributeNode(oldAttr)" method returns the
+ node that was removed.
+
+ Retrieve the last child of the third employee and
+ remove its "class" Attr node. The method should
+ return the old attribute node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198
+*/
+function hc_elementremoveattributenode() {
+ var success;
+ if(checkInitialization(builder, "hc_elementremoveattributenode") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var streetAttr;
+ var removedAttr;
+ var removedValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ streetAttr = testEmployee.getAttributeNode("class");
+ removedAttr = testEmployee.removeAttributeNode(streetAttr);
+ assertNotNull("removedAttrNotNull",removedAttr);
+removedValue = removedAttr.value;
+
+ assertEquals("elementRemoveAttributeNodeAssert","No",removedValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributenode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceattributewithself.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceattributewithself.html
new file mode 100644
index 0000000000..c939b6a755
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceattributewithself.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceattributewithself</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementreplaceattributewithself'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementreplaceattributewithself';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+This test calls setAttributeNode to replace an attribute with itself.
+Since the node is not an attribute of another Element, it would
+be inappropriate to throw an INUSE_ATTRIBUTE_ERR.
+
+This test was derived from elementinuserattributeerr which
+inadvertanly made this test.
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+*/
+function hc_elementreplaceattributewithself() {
+ var success;
+ if(checkInitialization(builder, "hc_elementreplaceattributewithself") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var streetAttr;
+ var replacedAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ streetAttr = testEmployee.getAttributeNode("class");
+ replacedAttr = testEmployee.setAttributeNode(streetAttr);
+ assertSame("replacedAttr",streetAttr,replacedAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceattributewithself</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattribute.html
new file mode 100644
index 0000000000..6f95395ba8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattribute.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementreplaceexistingattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementreplaceexistingattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method adds a new
+ attribute to the Element. If the "newAttr" Attr node is
+ already present in this element, it should replace the
+ existing one.
+
+ Retrieve the last child of the third employee and add a
+ new attribute node by invoking the "setAttributeNode(new
+ Attr)" method. The new attribute node to be added is
+ "class", which is already present in this element. The
+ method should replace the existing Attr node with the
+ new one. This test uses the "createAttribute(name)"
+ method from the Document interface.
+
+* @author Curt Arnold
+*/
+function hc_elementreplaceexistingattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_elementreplaceexistingattribute") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var strong;
+ var setAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("class");
+ setAttr = testEmployee.setAttributeNode(newAttribute);
+ strong = testEmployee.getAttribute("class");
+ assertEquals("replacedValue","",strong);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattributegevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattributegevalue.html
new file mode 100644
index 0000000000..95684dc692
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattributegevalue.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattributegevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementreplaceexistingattributegevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementreplaceexistingattributegevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+If the "setAttributeNode(newAttr)" method replaces an
+existing Attr node with the same name, then it should
+return the previously existing Attr node.
+
+Retrieve the last child of the third employee and add a
+new attribute node. The new attribute node is "class",
+which is already present in this Element. The method
+should return the existing Attr node(old "class" Attr).
+This test uses the "createAttribute(name)" method
+from the Document interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+*/
+function hc_elementreplaceexistingattributegevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_elementreplaceexistingattributegevalue") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var streetAttr;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("class");
+ streetAttr = testEmployee.setAttributeNode(newAttribute);
+ assertNotNull("previousAttrNotNull",streetAttr);
+value = streetAttr.value;
+
+ assertEquals("previousAttrValue","No",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattributegevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveallattributes.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveallattributes.html
new file mode 100644
index 0000000000..c1186ce620
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveallattributes.html
@@ -0,0 +1,160 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveallattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementretrieveallattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementretrieveallattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a list of all the attributes of the last child
+ of the first "p" element by using the "getAttributes()"
+ method.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
+*/
+function hc_elementretrieveallattributes() {
+ var success;
+ if(checkInitialization(builder, "hc_elementretrieveallattributes") != null) return;
+ var doc;
+ var addressList;
+ var testAddress;
+ var attributes;
+ var attribute;
+ var attributeName;
+ var actual = new Array();
+
+ htmlExpected = new Array();
+ htmlExpected[0] = "title";
+
+ expected = new Array();
+ expected[0] = "title";
+ expected[1] = "dir";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ addressList = doc.getElementsByTagName("acronym");
+ testAddress = addressList.item(0);
+ attributes = testAddress.attributes;
+
+ for(var indexN65643 = 0;indexN65643 < attributes.length; indexN65643++) {
+ attribute = attributes.item(indexN65643);
+ attributeName = attribute.nodeName;
+
+ actual[actual.length] = attributeName;
+
+ }
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEqualsCollection("htmlAttributeNames",toLowerArray(htmlExpected),toLowerArray(actual));
+
+ }
+
+ else {
+ assertEqualsCollection("attributeNames",toLowerArray(expected),toLowerArray(actual));
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveallattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveattrvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveattrvalue.html
new file mode 100644
index 0000000000..2afcab28f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveattrvalue.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveattrvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementretrieveattrvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementretrieveattrvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttribute(name)" method returns an attribute
+ value by name.
+
+ Retrieve the second address element, then
+ invoke the 'getAttribute("class")' method. This should
+ return the value of the attribute("No").
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9
+*/
+function hc_elementretrieveattrvalue() {
+ var success;
+ if(checkInitialization(builder, "hc_elementretrieveattrvalue") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(2);
+ attrValue = testAddress.getAttribute("class");
+ assertEquals("attrValue","No",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveattrvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementretrievetagname.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrievetagname.html
new file mode 100644
index 0000000000..11e75b0cf9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrievetagname.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrievetagname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementretrievetagname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementretrievetagname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getElementsByTagName()" method returns a NodeList
+ of all descendant elements with a given tagName.
+
+ Invoke the "getElementsByTagName()" method and create
+ a NodeList of "code" elements. Retrieve the second
+ "code" element in the list and return the NodeName.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815
+*/
+function hc_elementretrievetagname() {
+ var success;
+ if(checkInitialization(builder, "hc_elementretrievetagname") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var strong;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("code");
+ testEmployee = elementList.item(1);
+ strong = testEmployee.nodeName;
+
+ assertEqualsAutoCase("element", "nodename","code",strong);
+ strong = testEmployee.tagName;
+
+ assertEqualsAutoCase("element", "tagname","code",strong);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrievetagname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementsetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementsetattributenodenull.html
new file mode 100644
index 0000000000..42d08b0bc9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementsetattributenodenull.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementsetattributenodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementsetattributenodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementsetattributenodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method returns the
+ null value if no previously existing Attr node with the
+ same name was replaced.
+
+ Retrieve the last child of the third employee and add a
+ new attribute to it. The new attribute node added is
+ "lang", which is not part of this Element. The
+ method should return the null value.
+ This test uses the "createAttribute(name)"
+ method from the Document interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_elementsetattributenodenull() {
+ var success;
+ if(checkInitialization(builder, "hc_elementsetattributenodenull") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var newAttribute;
+ var districtAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ newAttribute = doc.createAttribute("lang");
+ districtAttr = testEmployee.setAttributeNode(newAttribute);
+ assertNull("elementSetAttributeNodeNullAssert",districtAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementsetattributenodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementwrongdocumenterr.html
new file mode 100644
index 0000000000..d293a462ed
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementwrongdocumenterr.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_elementwrongdocumenterr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "hc_staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_elementwrongdocumenterr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method raises an
+ "WRONG_DOCUMENT_ERR DOMException if the "newAttr"
+ was created from a different document than the one that
+ created this document.
+
+ Retrieve the last employee and attempt to set a new
+ attribute node for its "employee" element. The new
+ attribute was created from a document other than the
+ one that created this element, therefore a
+ WRONG_DOCUMENT_ERR DOMException should be raised.
+
+ This test uses the "createAttribute(newAttr)" method
+ from the Document interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_elementwrongdocumenterr() {
+ var success;
+ if(checkInitialization(builder, "hc_elementwrongdocumenterr") != null) return;
+ var doc1;
+ var doc2;
+ var newAttribute;
+ var addressElementList;
+ var testAddress;
+ var attrAddress;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "hc_staff");
+ newAttribute = doc2.createAttribute("newAttribute");
+ addressElementList = doc1.getElementsByTagName("acronym");
+ testAddress = addressElementList.item(4);
+
+ {
+ success = false;
+ try {
+ attrAddress = testAddress.setAttributeNode(newAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc1" src="files/hc_staff.html"></iframe>
+<br>
+<iframe name="doc2" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_entitiesremovenameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_entitiesremovenameditem1.html
new file mode 100644
index 0000000000..0393296cef
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_entitiesremovenameditem1.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiesremovenameditem1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_entitiesremovenameditem1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_entitiesremovenameditem1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An attempt to add remove an entity should result in a NO_MODIFICATION_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+*/
+function hc_entitiesremovenameditem1() {
+ var success;
+ if(checkInitialization(builder, "hc_entitiesremovenameditem1") != null) return;
+ var doc;
+ var entities;
+ var docType;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docType = doc.doctype;
+
+
+ if(
+
+ !(
+ (builder.contentType == "text/html")
+)
+
+ ) {
+ assertNotNull("docTypeNotNull",docType);
+entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+
+ {
+ success = false;
+ try {
+ retval = entities.removeNamedItem("alpha");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(builder.contentType, "text/html", "Fake default check");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiesremovenameditem1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_entitiessetnameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_entitiessetnameditem1.html
new file mode 100644
index 0000000000..72673927c8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_entitiessetnameditem1.html
@@ -0,0 +1,164 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiessetnameditem1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_entitiessetnameditem1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_entitiessetnameditem1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An attempt to add an element to the named node map returned by entities should
+result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+*/
+function hc_entitiessetnameditem1() {
+ var success;
+ if(checkInitialization(builder, "hc_entitiessetnameditem1") != null) return;
+ var doc;
+ var entities;
+ var docType;
+ var retval;
+ var elem;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docType = doc.doctype;
+
+
+ if(
+
+ !(
+ (builder.contentType == "text/html")
+)
+
+ ) {
+ assertNotNull("docTypeNotNull",docType);
+entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+elem = doc.createElement("br");
+
+ try {
+ retval = entities.setNamedItem(elem);
+ fail("throw_HIER_OR_NO_MOD_ERR");
+
+ } catch (ex) {
+ if (typeof(ex.code) != 'undefined') {
+ switch(ex.code) {
+ case /* HIERARCHY_REQUEST_ERR */ 3 :
+ break;
+ case /* NO_MODIFICATION_ALLOWED_ERR */ 7 :
+ break;
+ default:
+ throw ex;
+ }
+ } else {
+ throw ex;
+ }
+ }
+
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(builder.contentType, "text/html", "Fake default check");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiessetnameditem1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapchildnoderange.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapchildnoderange.html
new file mode 100644
index 0000000000..858f1c5242
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapchildnoderange.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapchildnoderange</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapchildnoderange'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapchildnoderange';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a NamedNodeMap object from the attributes of the
+ last child of the third "p" element and traverse the
+ list from index 0 thru length -1. All indices should
+ be valid.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250
+*/
+function hc_namednodemapchildnoderange() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapchildnoderange") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var child;
+ var strong;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ attributes = testEmployee.attributes;
+
+ length = attributes.length;
+
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEquals("htmlLength",2,length);
+
+ }
+
+ else {
+ assertEquals("length",3,length);
+ child = attributes.item(2);
+ assertNotNull("attr2",child);
+
+ }
+ child = attributes.item(0);
+ assertNotNull("attr0",child);
+child = attributes.item(1);
+ assertNotNull("attr1",child);
+child = attributes.item(3);
+ assertNull("attr3",child);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapchildnoderange</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapgetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapgetnameditem.html
new file mode 100644
index 0000000000..52466ead79
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapgetnameditem.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapgetnameditem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapgetnameditem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapgetnameditem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second "p" element and create a NamedNodeMap
+ listing of the attributes of the last child. Once the
+ list is created an invocation of the "getNamedItem(name)"
+ method is done with name="title". This should result
+ in the title Attr node being returned.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+*/
+function hc_namednodemapgetnameditem() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapgetnameditem") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var domesticAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ domesticAttr = attributes.getNamedItem("title");
+ attrName = domesticAttr.nodeName;
+
+ assertEqualsAutoCase("attribute", "nodeName","title",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapgetnameditem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapinuseattributeerr.html
new file mode 100644
index 0000000000..cfb10a5c45
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapinuseattributeerr.html
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapinuseattributeerr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapinuseattributeerr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapinuseattributeerr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "setNamedItem(arg)" method raises a
+INUSE_ATTRIBUTE_ERR DOMException if "arg" is an
+Attr that is already in an attribute of another Element.
+
+Create a NamedNodeMap object from the attributes of the
+last child of the third employee and attempt to add
+an attribute that is already being used by the first
+employee. This should raise the desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_namednodemapinuseattributeerr() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapinuseattributeerr") != null) return;
+ var doc;
+ var elementList;
+ var firstNode;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var setAttr;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ firstNode = elementList.item(0);
+ domesticAttr = doc.createAttribute("title");
+ domesticAttr.value = "Yα";
+
+ setAttr = firstNode.setAttributeNode(domesticAttr);
+ elementList = doc.getElementsByTagName("acronym");
+ testNode = elementList.item(2);
+ attributes = testNode.attributes;
+
+
+ {
+ success = false;
+ try {
+ setNode = attributes.setNamedItem(domesticAttr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("throw_INUSE_ATTRIBUTE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapinuseattributeerr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnotfounderr.html
new file mode 100644
index 0000000000..75585a0b06
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnotfounderr.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnotfounderr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapnotfounderr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapnotfounderr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeNamedItem(name)" method raises a
+ NOT_FOUND_ERR DOMException if there is not a node
+ named "strong" in the map.
+
+ Create a NamedNodeMap object from the attributes of the
+ last child of the third employee and attempt to remove
+ the "lang" attribute. There is not a node named
+ "lang" in the list and therefore the desired
+ exception should be raised.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D58B193')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_namednodemapnotfounderr() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapnotfounderr") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ attributes = testEmployee.attributes;
+
+
+ {
+ success = false;
+ try {
+ removedNode = attributes.removeNamedItem("lang");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnotfounderr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnumberofnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnumberofnodes.html
new file mode 100644
index 0000000000..ec88b4f4ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnumberofnodes.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnumberofnodes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapnumberofnodes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapnumberofnodes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second "p" element and evaluate Node.attributes.length.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250
+*/
+function hc_namednodemapnumberofnodes() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapnumberofnodes") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(2);
+ attributes = testEmployee.attributes;
+
+ length = attributes.length;
+
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEquals("htmlLength",2,length);
+
+ }
+
+ else {
+ assertEquals("length",3,length);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnumberofnodes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapremovenameditem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapremovenameditem.html
new file mode 100644
index 0000000000..142fb0e715
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapremovenameditem.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapremovenameditem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapremovenameditem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapremovenameditem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeNamedItem(name)" method removes a node
+ specified by name.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object of the attributes of the last child. Once the
+ list is created invoke the "removeNamedItem(name)"
+ method with name="class". This should result
+ in the removal of the specified attribute.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function hc_namednodemapremovenameditem() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapremovenameditem") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var streetAttr;
+ var specified;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(2);
+ attributes = testAddress.attributes;
+
+ removedNode = attributes.removeNamedItem("class");
+ streetAttr = attributes.getNamedItem("class");
+ assertNull("isnull",streetAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapremovenameditem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnattrnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnattrnode.html
new file mode 100644
index 0000000000..73c964f331
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnattrnode.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnattrnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapreturnattrnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapreturnattrnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second p element and create a NamedNodeMap
+ listing of the attributes of the last child. Once the
+ list is created an invocation of the "getNamedItem(name)"
+ method is done with name="class". This should result
+ in the method returning an Attr node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+*/
+function hc_namednodemapreturnattrnode() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapreturnattrnode") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var streetAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ streetAttr = attributes.getNamedItem("class");
+ assertInstanceOf("typeAssert","Attr",streetAttr);
+attrName = streetAttr.nodeName;
+
+ assertEqualsAutoCase("attribute", "nodeName","class",attrName);
+ attrName = streetAttr.name;
+
+ assertEqualsAutoCase("attribute", "name","class",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnattrnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnfirstitem.html
new file mode 100644
index 0000000000..1f45319324
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnfirstitem.html
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnfirstitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapreturnfirstitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapreturnfirstitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "item(index)" method returns the indexth item in
+ the map(test for first item).
+
+ Retrieve the second "acronym" get the NamedNodeMap of the attributes. Since the
+ DOM does not specify an order of these nodes the contents
+ of the FIRST node can contain either "title", "class" or "dir".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
+*/
+function hc_namednodemapreturnfirstitem() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapreturnfirstitem") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var child;
+ var nodeName;
+ htmlExpected = new Array();
+ htmlExpected[0] = "title";
+ htmlExpected[1] = "class";
+
+ expected = new Array();
+ expected[0] = "title";
+ expected[1] = "class";
+ expected[2] = "dir";
+
+ var actual = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(1);
+ attributes = testAddress.attributes;
+
+ for(var indexN65648 = 0;indexN65648 < attributes.length; indexN65648++) {
+ child = attributes.item(indexN65648);
+ nodeName = child.nodeName;
+
+ actual[actual.length] = nodeName;
+
+ }
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEqualsCollection("attrName_html",toLowerArray(htmlExpected),toLowerArray(actual));
+
+ }
+
+ else {
+ assertEqualsCollection("attrName",expected,actual);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnfirstitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnlastitem.html
new file mode 100644
index 0000000000..1492eecda9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnlastitem.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnlastitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapreturnlastitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapreturnlastitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "item(index)" method returns the indexth item in
+ the map(test for last item).
+
+ Retrieve the second "acronym" and get the attribute name. Since the
+ DOM does not specify an order of these nodes the contents
+ of the LAST node can contain either "title" or "class".
+ The test should return "true" if the LAST node is either
+ of these values.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
+*/
+function hc_namednodemapreturnlastitem() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapreturnlastitem") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var child;
+ var nodeName;
+ htmlExpected = new Array();
+ htmlExpected[0] = "title";
+ htmlExpected[1] = "class";
+
+ expected = new Array();
+ expected[0] = "title";
+ expected[1] = "class";
+ expected[2] = "dir";
+
+ var actual = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ for(var indexN65648 = 0;indexN65648 < attributes.length; indexN65648++) {
+ child = attributes.item(indexN65648);
+ nodeName = child.nodeName;
+
+ actual[actual.length] = nodeName;
+
+ }
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEqualsCollection("attrName_html",toLowerArray(htmlExpected),toLowerArray(actual));
+
+ }
+
+ else {
+ assertEqualsCollection("attrName",expected,actual);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnlastitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnnull.html
new file mode 100644
index 0000000000..b5b747f633
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnnull.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapreturnnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapreturnnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNamedItem(name)" method returns null of the
+ specified name did not identify any node in the map.
+
+ Retrieve the second employee and create a NamedNodeMap
+ listing of the attributes of the last child. Once the
+ list is created an invocation of the "getNamedItem(name)"
+ method is done with name="lang". This name does not
+ match any names in the list therefore the method should
+ return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_namednodemapreturnnull() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapreturnnull") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var districtNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ districtNode = attributes.getNamedItem("lang");
+ assertNull("langAttrNull",districtNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditem.html
new file mode 100644
index 0000000000..a8d6f858bd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditem.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapsetnameditem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapsetnameditem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second "p" element and create a NamedNodeMap
+ object from the attributes of the last child by
+ invoking the "getAttributes()" method. Once the
+ list is created an invocation of the "setNamedItem(arg)"
+ method is done with arg=newAttr, where newAttr is a
+ new Attr Node previously created. The "setNamedItem(arg)"
+ method should add then new node to the NamedNodeItem
+ object by using its "nodeName" attribute("lang').
+ This node is then retrieved using the "getNamedItem(name)"
+ method.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_namednodemapsetnameditem() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapsetnameditem") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var districtNode;
+ var attrName;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(1);
+ newAttribute = doc.createAttribute("lang");
+ attributes = testAddress.attributes;
+
+ setNode = attributes.setNamedItem(newAttribute);
+ districtNode = attributes.getNamedItem("lang");
+ attrName = districtNode.nodeName;
+
+ assertEqualsAutoCase("attribute", "nodeName","lang",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemreturnvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemreturnvalue.html
new file mode 100644
index 0000000000..8276f250be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemreturnvalue.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemreturnvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapsetnameditemreturnvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapsetnameditemreturnvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "setNamedItem(arg)" method replaces an already
+ existing node with the same name then the already
+ existing node is returned.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object from the attributes of the last child by
+ invoking the "getAttributes()" method. Once the
+ list is created an invocation of the "setNamedItem(arg)"
+ method is done with arg=newAttr, where newAttr is a
+ new Attr Node previously created and whose node name
+ already exists in the map. The "setNamedItem(arg)"
+ method should replace the already existing node with
+ the new one and return the existing node.
+ This test uses the "createAttribute(name)" method from
+ the document interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function hc_namednodemapsetnameditemreturnvalue() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapsetnameditemreturnvalue") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var newNode;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(2);
+ newAttribute = doc.createAttribute("class");
+ attributes = testAddress.attributes;
+
+ newNode = attributes.setNamedItem(newAttribute);
+ assertNotNull("previousAttrNotNull",newNode);
+attrValue = newNode.nodeValue;
+
+ assertEquals("previousAttrValue","No",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemreturnvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemthatexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemthatexists.html
new file mode 100644
index 0000000000..5746b7dcbf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemthatexists.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemthatexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapsetnameditemthatexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapsetnameditemthatexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the node to be added by the "setNamedItem(arg)" method
+ already exists in the NamedNodeMap, it is replaced by
+ the new one.
+
+ Retrieve the second employee and create a NamedNodeMap
+ object from the attributes of the last child by
+ invoking the "getAttributes()" method. Once the
+ list is created an invocation of the "setNamedItem(arg)"
+ method is done with arg=newAttr, where newAttr is a
+ new Attr Node previously created and whose node name
+ already exists in the map. The "setNamedItem(arg)"
+ method should replace the already existing node with
+ the new one.
+ This node is then retrieved using the "getNamedItem(name)"
+ method. This test uses the "createAttribute(name)"
+ method from the document interface
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function hc_namednodemapsetnameditemthatexists() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapsetnameditemthatexists") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var districtNode;
+ var attrValue;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(1);
+ newAttribute = doc.createAttribute("class");
+ attributes = testAddress.attributes;
+
+ setNode = attributes.setNamedItem(newAttribute);
+ districtNode = attributes.getNamedItem("class");
+ attrValue = districtNode.nodeValue;
+
+ assertEquals("namednodemapSetNamedItemThatExistsAssert","",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemthatexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemwithnewvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemwithnewvalue.html
new file mode 100644
index 0000000000..a8deb0e60c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemwithnewvalue.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemwithnewvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapsetnameditemwithnewvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapsetnameditemwithnewvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "setNamedItem(arg)" method does not replace an
+ existing node with the same name then it returns null.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object from the attributes of the last child.
+ Once the list is created the "setNamedItem(arg)" method
+ is invoked with arg=newAttr, where newAttr is a
+ newly created Attr Node and whose node name
+ already exists in the map. The "setNamedItem(arg)"
+ method should add the new node and return null.
+ This test uses the "createAttribute(name)" method from
+ the document interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
+*/
+function hc_namednodemapsetnameditemwithnewvalue() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapsetnameditemwithnewvalue") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var newNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddress = elementList.item(2);
+ newAttribute = doc.createAttribute("lang");
+ attributes = testAddress.attributes;
+
+ newNode = attributes.setNamedItem(newAttribute);
+ assertNull("prevValueNull",newNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemwithnewvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapwrongdocumenterr.html
new file mode 100644
index 0000000000..cbdc58bdd3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapwrongdocumenterr.html
@@ -0,0 +1,167 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapwrongdocumenterr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "hc_staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapwrongdocumenterr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNamedItem(arg)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if "arg" was created
+ from a different document than the one that created
+ the NamedNodeMap.
+
+ Create a NamedNodeMap object from the attributes of the
+ last child of the third employee and attempt to add
+ another Attr node to it that was created from a
+ different DOM document. This should raise the desired
+ exception. This method uses the "createAttribute(name)"
+ method from the Document interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_namednodemapwrongdocumenterr() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapwrongdocumenterr") != null) return;
+ var doc1;
+ var doc2;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var newAttribute;
+ var strong;
+ var setNode;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "hc_staff");
+ elementList = doc1.getElementsByTagName("acronym");
+ testAddress = elementList.item(2);
+ newAttribute = doc2.createAttribute("newAttribute");
+ attributes = testAddress.attributes;
+
+
+ {
+ success = false;
+ try {
+ setNode = attributes.setNamedItem(newAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc1" src="files/hc_staff.html"></iframe>
+<br>
+<iframe name="doc2" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchild.html
new file mode 100644
index 0000000000..1608ac4f80
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchild.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeappendchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeappendchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second "p" and append a "br" Element
+ node to the list of children. The last node in the list
+ is then retrieved and its NodeName examined. The
+ "getNodeName()" method should return "br".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeappendchild() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeappendchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var createdNode;
+ var lchild;
+ var childName;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ createdNode = doc.createElement("br");
+ appendedChild = employeeNode.appendChild(createdNode);
+ lchild = employeeNode.lastChild;
+
+ childName = lchild.nodeName;
+
+ assertEqualsAutoCase("element", "nodeName","br",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildchildexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildchildexists.html
new file mode 100644
index 0000000000..b34566d8a1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildchildexists.html
@@ -0,0 +1,176 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildchildexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeappendchildchildexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeappendchildchildexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is already in the tree, it is first
+ removed before the new one is appended.
+
+ Retrieve the "em" second employee and
+ append the first child to the end of the list. After
+ the "appendChild(newChild)" method is invoked the first
+ child should be the one that was second and the last
+ child should be the one that was first.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodeappendchildchildexists() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeappendchildchildexists") != null) return;
+ var doc;
+ var elementList;
+ var childList;
+ var childNode;
+ var newChild;
+ var memberNode;
+ var memberName;
+ var refreshedActual = new Array();
+
+ var actual = new Array();
+
+ var nodeType;
+ expected = new Array();
+ expected[0] = "strong";
+ expected[1] = "code";
+ expected[2] = "sup";
+ expected[3] = "var";
+ expected[4] = "acronym";
+ expected[5] = "em";
+
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ childNode = elementList.item(1);
+ childList = childNode.getElementsByTagName("*");
+ newChild = childList.item(0);
+ appendedChild = childNode.appendChild(newChild);
+ for(var indexN65669 = 0;indexN65669 < childList.length; indexN65669++) {
+ memberNode = childList.item(indexN65669);
+ memberName = memberNode.nodeName;
+
+ actual[actual.length] = memberName;
+
+ }
+ assertEqualsListAutoCase("element", "liveByTagName",expected,actual);
+ childList = childNode.childNodes;
+
+ for(var indexN65692 = 0;indexN65692 < childList.length; indexN65692++) {
+ memberNode = childList.item(indexN65692);
+ nodeType = memberNode.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ memberName = memberNode.nodeName;
+
+ refreshedActual[refreshedActual.length] = memberName;
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "refreshedChildNodes",expected,refreshedActual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildchildexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchilddocfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchilddocfragment.html
new file mode 100644
index 0000000000..b59a5cf98d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchilddocfragment.html
@@ -0,0 +1,174 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchilddocfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeappendchilddocfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeappendchilddocfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is a DocumentFragment object then
+ all its content is added to the child list of this node.
+
+ Create and populate a new DocumentFragment object and
+ append it to the second employee. After the
+ "appendChild(newChild)" method is invoked retrieve the
+ new nodes at the end of the list, they should be the
+ two Element nodes from the DocumentFragment.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeappendchilddocfragment() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeappendchilddocfragment") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var newdocFragment;
+ var newChild1;
+ var newChild2;
+ var child;
+ var childName;
+ var result = new Array();
+
+ var appendedChild;
+ var nodeType;
+ expected = new Array();
+ expected[0] = "em";
+ expected[1] = "strong";
+ expected[2] = "code";
+ expected[3] = "sup";
+ expected[4] = "var";
+ expected[5] = "acronym";
+ expected[6] = "br";
+ expected[7] = "b";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ newdocFragment = doc.createDocumentFragment();
+ newChild1 = doc.createElement("br");
+ newChild2 = doc.createElement("b");
+ appendedChild = newdocFragment.appendChild(newChild1);
+ appendedChild = newdocFragment.appendChild(newChild2);
+ appendedChild = employeeNode.appendChild(newdocFragment);
+ for(var indexN65698 = 0;indexN65698 < childList.length; indexN65698++) {
+ child = childList.item(indexN65698);
+ nodeType = child.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "nodeNames",expected,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchilddocfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildgetnodename.html
new file mode 100644
index 0000000000..a442688122
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildgetnodename.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildgetnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeappendchildgetnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeappendchildgetnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method returns the node
+ added.
+
+ Append a newly created node to the child list of the
+ second employee and check the NodeName returned. The
+ "getNodeName()" method should return "br".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeappendchildgetnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeappendchildgetnodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var newChild;
+ var appendNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ newChild = doc.createElement("br");
+ appendNode = employeeNode.appendChild(newChild);
+ childName = appendNode.nodeName;
+
+ assertEqualsAutoCase("element", "nodeName","br",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildgetnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildinvalidnodetype.html
new file mode 100644
index 0000000000..3856357966
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildinvalidnodetype.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildinvalidnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeappendchildinvalidnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeappendchildinvalidnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if this node is of
+ a type that does not allow children of the type "newChild"
+ to be inserted.
+
+ Retrieve the root node and attempt to append a newly
+ created Attr node. An Element node cannot have children
+ of the "Attr" type, therefore the desired exception
+ should be raised.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_nodeappendchildinvalidnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeappendchildinvalidnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var newChild;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ rootNode = doc.documentElement;
+
+ newChild = doc.createAttribute("newAttribute");
+
+ {
+ success = false;
+ try {
+ appendedChild = rootNode.appendChild(newChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildinvalidnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnewchilddiffdocument.html
new file mode 100644
index 0000000000..8a4ff79c85
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnewchilddiffdocument.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnewchilddiffdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeappendchildnewchilddiffdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "hc_staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeappendchildnewchilddiffdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if the "newChild" was
+ created from a different document than the one that
+ created this node.
+
+ Retrieve the second employee and attempt to append
+ a node created from a different document. An attempt
+ to make such a replacement should raise the desired
+ exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeappendchildnewchilddiffdocument() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeappendchildnewchilddiffdocument") != null) return;
+ var doc1;
+ var doc2;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var appendedChild;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "hc_staff");
+ newChild = doc1.createElement("br");
+ elementList = doc2.getElementsByTagName("p");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ appendedChild = elementNode.appendChild(newChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnewchilddiffdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc1" src="files/hc_staff.html"></iframe>
+<br>
+<iframe name="doc2" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnodeancestor.html
new file mode 100644
index 0000000000..ddd7e729a5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnodeancestor.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnodeancestor</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeappendchildnodeancestor'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeappendchildnodeancestor';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if the node to
+ append is one of this node's ancestors.
+
+ Retrieve the second employee and attempt to append
+ an ancestor node(root node) to it.
+ An attempt to make such an addition should raise the
+ desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function hc_nodeappendchildnodeancestor() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeappendchildnodeancestor") != null) return;
+ var doc;
+ var newChild;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newChild = doc.documentElement;
+
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ appendedChild = employeeNode.appendChild(newChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnodeancestor</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodeattribute.html
new file mode 100644
index 0000000000..03866739be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodeattribute.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodeattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeattributenodeattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeattributenodeattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getAttributes()" method invoked on an Attribute
+Node returns null.
+
+Retrieve the first attribute from the last child of the
+first employee and invoke the "getAttributes()" method
+on the Attribute Node. It should return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function hc_nodeattributenodeattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeattributenodeattribute") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrNode;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.attributes;
+
+ attrNode = addrAttr.item(0);
+ attrList = attrNode.attributes;
+
+ assertNull("nodeAttributeNodeAttributeAssert1",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodeattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodename.html
new file mode 100644
index 0000000000..0eaf79f13a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodename.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeattributenodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeattributenodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the Attribute named "title" from the last
+ child of the first p element and check the string returned
+ by the "getNodeName()" method. It should be equal to
+ "title".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+*/
+function hc_nodeattributenodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeattributenodename") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNode("title");
+ attrName = addrAttr.nodeName;
+
+ assertEqualsAutoCase("attribute", "nodeName","title",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodetype.html
new file mode 100644
index 0000000000..edb0584e93
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodetype.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeattributenodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeattributenodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getNodeType()" method for an Attribute Node
+
+ returns the constant value 2.
+
+
+
+ Retrieve the first attribute from the last child of
+
+ the first employee and invoke the "getNodeType()"
+
+ method. The method should return 2.
+
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function hc_nodeattributenodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeattributenodetype") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNode("title");
+ nodeType = addrAttr.nodeType;
+
+ assertEquals("nodeAttrNodeTypeAssert1",2,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodevalue.html
new file mode 100644
index 0000000000..1486d18888
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodevalue.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeattributenodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeattributenodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The string returned by the "getNodeValue()" method for an
+ Attribute Node is the value of the Attribute.
+
+ Retrieve the Attribute named "title" from the last
+ child of the first "p" and check the string returned
+ by the "getNodeValue()" method. It should be equal to
+ "Yes".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function hc_nodeattributenodevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeattributenodevalue") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNode("title");
+ attrValue = addrAttr.nodeValue;
+
+ assertEquals("nodeValue","Yes",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodes.html
new file mode 100644
index 0000000000..c150796d28
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodes.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodechildnodes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodechildnodes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getChildNodes()" method returns a NodeList
+ that contains all children of this node.
+
+ Retrieve the second employee and check the NodeList
+ returned by the "getChildNodes()" method. The
+ length of the list should be 13.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodechildnodes() {
+ var success;
+ if(checkInitialization(builder, "hc_nodechildnodes") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childNode;
+ var childNodes;
+ var nodeType;
+ var childName;
+ var actual = new Array();
+
+ expected = new Array();
+ expected[0] = "em";
+ expected[1] = "strong";
+ expected[2] = "code";
+ expected[3] = "sup";
+ expected[4] = "var";
+ expected[5] = "acronym";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childNodes = employeeNode.childNodes;
+
+ for(var indexN65644 = 0;indexN65644 < childNodes.length; indexN65644++) {
+ childNode = childNodes.item(indexN65644);
+ nodeType = childNode.nodeType;
+
+ childName = childNode.nodeName;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ actual[actual.length] = childName;
+
+ }
+
+ else {
+ assertEquals("textNodeType",3,nodeType);
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "elementNames",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesappendchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesappendchild.html
new file mode 100644
index 0000000000..06ce51dd23
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesappendchild.html
@@ -0,0 +1,175 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesappendchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodechildnodesappendchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodechildnodesappendchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The NodeList returned by the "getChildNodes()" method
+ is live. Changes on the node's children are immediately
+ reflected on the nodes returned in the NodeList.
+
+ Create a NodeList of the children of the second employee
+ and then add a newly created element that was created
+ by the "createElement()" method(Document Interface) to
+ the second employee by using the "appendChild()" method.
+ The length of the NodeList should reflect this new
+ addition to the child list. It should return the value 14.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodechildnodesappendchild() {
+ var success;
+ if(checkInitialization(builder, "hc_nodechildnodesappendchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var createdNode;
+ var childNode;
+ var childName;
+ var childType;
+ var textNode;
+ var actual = new Array();
+
+ expected = new Array();
+ expected[0] = "em";
+ expected[1] = "strong";
+ expected[2] = "code";
+ expected[3] = "sup";
+ expected[4] = "var";
+ expected[5] = "acronym";
+ expected[6] = "br";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ createdNode = doc.createElement("br");
+ employeeNode = employeeNode.appendChild(createdNode);
+ for(var indexN65671 = 0;indexN65671 < childList.length; indexN65671++) {
+ childNode = childList.item(indexN65671);
+ childName = childNode.nodeName;
+
+ childType = childNode.nodeType;
+
+
+ if(
+ (1 == childType)
+ ) {
+ actual[actual.length] = childName;
+
+ }
+
+ else {
+ assertEquals("textNodeType",3,childType);
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "childElements",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesappendchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesempty.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesempty.html
new file mode 100644
index 0000000000..8efe3d92fd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesempty.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesempty</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodechildnodesempty'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodechildnodesempty';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getChildNodes()" method returns a NodeList
+ that contains all children of this node. If there
+ are not any children, this is a NodeList that does not
+ contain any nodes.
+
+ Retrieve the character data of the second "em" node and
+ invoke the "getChildNodes()" method. The
+ NodeList returned should not have any nodes.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodechildnodesempty() {
+ var success;
+ if(checkInitialization(builder, "hc_nodechildnodesempty") != null) return;
+ var doc;
+ var elementList;
+ var childList;
+ var employeeNode;
+ var textNode;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("em");
+ employeeNode = elementList.item(1);
+ textNode = employeeNode.firstChild;
+
+ childList = textNode.childNodes;
+
+ length = childList.length;
+
+ assertEquals("length_zero",0,length);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesempty</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecloneattributescopied.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecloneattributescopied.html
new file mode 100644
index 0000000000..0e50b333ea
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecloneattributescopied.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecloneattributescopied</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodecloneattributescopied'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodecloneattributescopied';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second acronym element and invoke
+ the cloneNode method. The
+ duplicate node returned by the method should copy the
+ attributes associated with this node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
+*/
+function hc_nodecloneattributescopied() {
+ var success;
+ if(checkInitialization(builder, "hc_nodecloneattributescopied") != null) return;
+ var doc;
+ var elementList;
+ var addressNode;
+ var clonedNode;
+ var attributes;
+ var attributeNode;
+ var attributeName;
+ var result = new Array();
+
+ htmlExpected = new Array();
+ htmlExpected[0] = "class";
+ htmlExpected[1] = "title";
+
+ expected = new Array();
+ expected[0] = "class";
+ expected[1] = "title";
+ expected[2] = "dir";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ addressNode = elementList.item(1);
+ clonedNode = addressNode.cloneNode(false);
+ attributes = clonedNode.attributes;
+
+ for(var indexN65654 = 0;indexN65654 < attributes.length; indexN65654++) {
+ attributeNode = attributes.item(indexN65654);
+ attributeName = attributeNode.nodeName;
+
+ result[result.length] = attributeName;
+
+ }
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEqualsCollection("nodeNames_html",toLowerArray(htmlExpected),toLowerArray(result));
+
+ }
+
+ else {
+ assertEqualsCollection("nodeNames",expected,result);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecloneattributescopied</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonefalsenocopytext.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonefalsenocopytext.html
new file mode 100644
index 0000000000..190cb2e000
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonefalsenocopytext.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonefalsenocopytext</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeclonefalsenocopytext'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeclonefalsenocopytext';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "cloneNode(deep)" method does not copy text unless it
+ is deep cloned.(Test for deep=false)
+
+ Retrieve the fourth child of the second employee and
+ the "cloneNode(deep)" method with deep=false. The
+ duplicate node returned by the method should not copy
+ any text data contained in this node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function hc_nodeclonefalsenocopytext() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeclonefalsenocopytext") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var childNode;
+ var clonedNode;
+ var lastChildNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ childNode = childList.item(3);
+ clonedNode = childNode.cloneNode(false);
+ lastChildNode = clonedNode.lastChild;
+
+ assertNull("nodeCloneFalseNoCopyTextAssert1",lastChildNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonefalsenocopytext</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonegetparentnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonegetparentnull.html
new file mode 100644
index 0000000000..5b7b3218f2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonegetparentnull.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonegetparentnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeclonegetparentnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeclonegetparentnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The duplicate node returned by the "cloneNode(deep)"
+ method does not have a ParentNode.
+
+ Retrieve the second employee and invoke the
+ "cloneNode(deep)" method with deep=false. The
+ duplicate node returned should return null when the
+ "getParentNode()" is invoked.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function hc_nodeclonegetparentnull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeclonegetparentnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var clonedNode;
+ var parentNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ clonedNode = employeeNode.cloneNode(false);
+ parentNode = clonedNode.parentNode;
+
+ assertNull("nodeCloneGetParentNullAssert1",parentNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonegetparentnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodefalse.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodefalse.html
new file mode 100644
index 0000000000..c0c2980f16
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodefalse.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodefalse</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeclonenodefalse'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeclonenodefalse';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "cloneNode(deep)" method returns a copy of the node
+ only if deep=false.
+
+ Retrieve the second employee and invoke the
+ "cloneNode(deep)" method with deep=false. The
+ method should only clone this node. The NodeName and
+ length of the NodeList are checked. The "getNodeName()"
+ method should return "employee" and the "getLength()"
+ method should return 0.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function hc_nodeclonenodefalse() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeclonenodefalse") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var clonedNode;
+ var cloneName;
+ var cloneChildren;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ clonedNode = employeeNode.cloneNode(false);
+ cloneName = clonedNode.nodeName;
+
+ assertEqualsAutoCase("element", "strong","p",cloneName);
+ cloneChildren = clonedNode.childNodes;
+
+ length = cloneChildren.length;
+
+ assertEquals("length",0,length);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodefalse</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodetrue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodetrue.html
new file mode 100644
index 0000000000..ef109eb49e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodetrue.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodetrue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeclonenodetrue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeclonenodetrue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "cloneNode(deep)" method returns a copy of the node
+ and the subtree under it if deep=true.
+
+ Retrieve the second employee and invoke the
+ "cloneNode(deep)" method with deep=true. The
+ method should clone this node and the subtree under it.
+ The NodeName of each child in the returned node is
+ checked to insure the entire subtree under the second
+ employee was cloned.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodeclonenodetrue() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeclonenodetrue") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var clonedNode;
+ var clonedList;
+ var clonedChild;
+ var clonedChildName;
+ var origList;
+ var origChild;
+ var origChildName;
+ var result = new Array();
+
+ var expected = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ origList = employeeNode.childNodes;
+
+ for(var indexN65637 = 0;indexN65637 < origList.length; indexN65637++) {
+ origChild = origList.item(indexN65637);
+ origChildName = origChild.nodeName;
+
+ expected[expected.length] = origChildName;
+
+ }
+ clonedNode = employeeNode.cloneNode(true);
+ clonedList = clonedNode.childNodes;
+
+ for(var indexN65659 = 0;indexN65659 < clonedList.length; indexN65659++) {
+ clonedChild = clonedList.item(indexN65659);
+ clonedChildName = clonedChild.nodeName;
+
+ result[result.length] = clonedChildName;
+
+ }
+ assertEqualsList("clone",expected,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodetrue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonetruecopytext.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonetruecopytext.html
new file mode 100644
index 0000000000..219c832b88
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonetruecopytext.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonetruecopytext</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeclonetruecopytext'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeclonetruecopytext';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "cloneNode(deep)" method does not copy text unless it
+ is deep cloned.(Test for deep=true)
+
+ Retrieve the eighth child of the second employee and
+ the "cloneNode(deep)" method with deep=true. The
+ duplicate node returned by the method should copy
+ any text data contained in this node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodeclonetruecopytext() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeclonetruecopytext") != null) return;
+ var doc;
+ var elementList;
+ var childNode;
+ var clonedNode;
+ var lastChildNode;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("sup");
+ childNode = elementList.item(1);
+ clonedNode = childNode.cloneNode(true);
+ lastChildNode = clonedNode.lastChild;
+
+ childValue = lastChildNode.nodeValue;
+
+ assertEquals("cloneContainsText","35,000",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonetruecopytext</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodeattributes.html
new file mode 100644
index 0000000000..df2bb63cab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodeattributes.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodecommentnodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodecommentnodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributes()" method invoked on a Comment
+ Node returns null.
+
+ Find any comment that is an immediate child of the root
+ and assert that Node.attributes is null. Then create
+ a new comment node (in case they had been omitted) and
+ make the assertion.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=263
+*/
+function hc_nodecommentnodeattributes() {
+ var success;
+ if(checkInitialization(builder, "hc_nodecommentnodeattributes") != null) return;
+ var doc;
+ var commentNode;
+ var nodeList;
+ var attrList;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ nodeList = doc.childNodes;
+
+ for(var indexN65603 = 0;indexN65603 < nodeList.length; indexN65603++) {
+ commentNode = nodeList.item(indexN65603);
+ nodeType = commentNode.nodeType;
+
+
+ if(
+ (8 == nodeType)
+ ) {
+ attrList = commentNode.attributes;
+
+ assertNull("existingCommentAttributesNull",attrList);
+
+ }
+
+ }
+ commentNode = doc.createComment("This is a comment");
+ attrList = commentNode.attributes;
+
+ assertNull("createdCommentAttributesNull",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodename.html
new file mode 100644
index 0000000000..c998799835
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodename.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodecommentnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodecommentnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ Comment Node is "#comment".
+
+ Retrieve the Comment node in the XML file
+ and check the string returned by the "getNodeName()"
+ method. It should be equal to "#comment".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248
+*/
+function hc_nodecommentnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodecommentnodename") != null) return;
+ var doc;
+ var elementList;
+ var commentNode;
+ var nodeType;
+ var commentName;
+ var commentNodeName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.childNodes;
+
+ for(var indexN65604 = 0;indexN65604 < elementList.length; indexN65604++) {
+ commentNode = elementList.item(indexN65604);
+ nodeType = commentNode.nodeType;
+
+
+ if(
+ (8 == nodeType)
+ ) {
+ commentNodeName = commentNode.nodeName;
+
+ assertEquals("existingNodeName","#comment",commentNodeName);
+
+ }
+
+ }
+ commentNode = doc.createComment("This is a comment");
+ commentNodeName = commentNode.nodeName;
+
+ assertEquals("createdNodeName","#comment",commentNodeName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodetype.html
new file mode 100644
index 0000000000..e8bbc72a05
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodetype.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodecommentnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodecommentnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for a Comment Node
+ returns the constant value 8.
+
+ Retrieve the nodes from the document and check for
+ a comment node and invoke the "getNodeType()" method. This should
+ return 8.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248
+*/
+function hc_nodecommentnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodecommentnodetype") != null) return;
+ var doc;
+ var testList;
+ var commentNode;
+ var commentNodeName;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ testList = doc.childNodes;
+
+ for(var indexN65600 = 0;indexN65600 < testList.length; indexN65600++) {
+ commentNode = testList.item(indexN65600);
+ commentNodeName = commentNode.nodeName;
+
+
+ if(
+ ("#comment" == commentNodeName)
+ ) {
+ nodeType = commentNode.nodeType;
+
+ assertEquals("existingCommentNodeType",8,nodeType);
+
+ }
+
+ }
+ commentNode = doc.createComment("This is a comment");
+ nodeType = commentNode.nodeType;
+
+ assertEquals("createdCommentNodeType",8,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodevalue.html
new file mode 100644
index 0000000000..6b94e119af
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodevalue.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodecommentnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodecommentnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Comment Node is the content of the comment.
+
+ Retrieve the comment in the XML file and
+ check the string returned by the "getNodeValue()" method.
+ It should be equal to "This is comment number 1".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248
+*/
+function hc_nodecommentnodevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_nodecommentnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var commentNode;
+ var commentName;
+ var commentValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.childNodes;
+
+ for(var indexN65600 = 0;indexN65600 < elementList.length; indexN65600++) {
+ commentNode = elementList.item(indexN65600);
+ commentName = commentNode.nodeName;
+
+
+ if(
+ ("#comment" == commentName)
+ ) {
+ commentValue = commentNode.nodeValue;
+
+ assertEquals("value"," This is comment number 1.",commentValue);
+
+ }
+
+ }
+ commentNode = doc.createComment(" This is a comment");
+ commentValue = commentNode.nodeValue;
+
+ assertEquals("createdCommentNodeValue"," This is a comment",commentValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodename.html
new file mode 100644
index 0000000000..30a0bed036
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodename.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentfragmentnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentfragmentnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ DocumentFragment Node is "#document-frament".
+
+ Retrieve the DOM document and invoke the
+ "createDocumentFragment()" method and check the string
+ returned by the "getNodeName()" method. It should be
+ equal to "#document-fragment".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+*/
+function hc_nodedocumentfragmentnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentfragmentnodename") != null) return;
+ var doc;
+ var docFragment;
+ var documentFragmentName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docFragment = doc.createDocumentFragment();
+ documentFragmentName = docFragment.nodeName;
+
+ assertEquals("nodeDocumentFragmentNodeNameAssert1","#document-fragment",documentFragmentName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodetype.html
new file mode 100644
index 0000000000..bc1ca4c38f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodetype.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentfragmentnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentfragmentnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for a DocumentFragment Node
+ returns the constant value 11.
+
+ Invoke the "createDocumentFragment()" method and
+ examine the NodeType of the document fragment
+ returned by the "getNodeType()" method. The method
+ should return 11.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+*/
+function hc_nodedocumentfragmentnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentfragmentnodetype") != null) return;
+ var doc;
+ var documentFragmentNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ documentFragmentNode = doc.createDocumentFragment();
+ nodeType = documentFragmentNode.nodeType;
+
+ assertEquals("nodeDocumentFragmentNodeTypeAssert1",11,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodevalue.html
new file mode 100644
index 0000000000..9855a3dc9d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodevalue.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentfragmentnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentfragmentnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ DocumentFragment Node is null.
+
+ Retrieve the DOM document and invoke the
+ "createDocumentFragment()" method and check the string
+ returned by the "getNodeValue()" method. It should be
+ equal to null.
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function hc_nodedocumentfragmentnodevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentfragmentnodevalue") != null) return;
+ var doc;
+ var docFragment;
+ var attrList;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docFragment = doc.createDocumentFragment();
+ attrList = docFragment.attributes;
+
+ assertNull("attributesNull",attrList);
+ value = docFragment.nodeValue;
+
+ assertNull("initiallyNull",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodeattribute.html
new file mode 100644
index 0000000000..da4e369e52
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodeattribute.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodeattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentnodeattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentnodeattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getAttributes()" method invoked on a Document
+Node returns null.
+
+Retrieve the DOM Document and invoke the
+"getAttributes()" method on the Document Node.
+It should return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+*/
+function hc_nodedocumentnodeattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentnodeattribute") != null) return;
+ var doc;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ attrList = doc.attributes;
+
+ assertNull("doc_attributes_is_null",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodeattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodename.html
new file mode 100644
index 0000000000..23997204bf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodename.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ Document Node is "#document".
+
+ Retrieve the DOM document and check the string returned
+ by the "getNodeName()" method. It should be equal to
+ "#document".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function hc_nodedocumentnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentnodename") != null) return;
+ var doc;
+ var documentName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ documentName = doc.nodeName;
+
+ assertEquals("documentNodeName","#document",documentName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodetype.html
new file mode 100644
index 0000000000..e1f31e53ee
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodetype.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getNodeType()" method for a Document Node
+returns the constant value 9.
+
+Retrieve the document and invoke the "getNodeType()"
+method. The method should return 9.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function hc_nodedocumentnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentnodetype") != null) return;
+ var doc;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ nodeType = doc.nodeType;
+
+ assertEquals("nodeDocumentNodeTypeAssert1",9,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodevalue.html
new file mode 100644
index 0000000000..c4b2f16af3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodevalue.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Document Node is null.
+
+ Retrieve the DOM Document and check the string returned
+ by the "getNodeValue()" method. It should be equal to
+ null.
+
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function hc_nodedocumentnodevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentnodevalue") != null) return;
+ var doc;
+ var documentValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ documentValue = doc.nodeValue;
+
+ assertNull("documentNodeValue",documentValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodeattributes.html
new file mode 100644
index 0000000000..88b7a93b03
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodeattributes.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeelementnodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeelementnodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the third "acronym" element and evaluate Node.attributes.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
+*/
+function hc_nodeelementnodeattributes() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeelementnodeattributes") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrNode;
+ var attrName;
+ var attrList = new Array();
+
+ htmlExpected = new Array();
+ htmlExpected[0] = "title";
+ htmlExpected[1] = "class";
+
+ expected = new Array();
+ expected[0] = "title";
+ expected[1] = "class";
+ expected[2] = "dir";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(2);
+ addrAttr = testAddr.attributes;
+
+ for(var indexN65648 = 0;indexN65648 < addrAttr.length; indexN65648++) {
+ attrNode = addrAttr.item(indexN65648);
+ attrName = attrNode.nodeName;
+
+ attrList[attrList.length] = attrName;
+
+ }
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEqualsCollection("attrNames_html",toLowerArray(htmlExpected),toLowerArray(attrList));
+
+ }
+
+ else {
+ assertEqualsCollection("attrNames",expected,attrList);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodename.html
new file mode 100644
index 0000000000..4f59341390
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodename.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeelementnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeelementnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the first Element Node(Root Node) of the
+ DOM object and check the string returned by the
+ "getNodeName()" method. It should be equal to its
+ tagName.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function hc_nodeelementnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeelementnodename") != null) return;
+ var doc;
+ var elementNode;
+ var elementName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementNode = doc.documentElement;
+
+ elementName = elementNode.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgNodeName","svg",elementName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "nodeName","html",elementName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodetype.html
new file mode 100644
index 0000000000..27246a3c19
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodetype.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeelementnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeelementnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for an Element Node
+ returns the constant value 1.
+
+ Retrieve the root node and invoke the "getNodeType()"
+ method. The method should return 1.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function hc_nodeelementnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeelementnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ rootNode = doc.documentElement;
+
+ nodeType = rootNode.nodeType;
+
+ assertEquals("nodeElementNodeTypeAssert1",1,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodevalue.html
new file mode 100644
index 0000000000..1be40633a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodevalue.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeelementnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeelementnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for an
+ Element Node is null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function hc_nodeelementnodevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeelementnodevalue") != null) return;
+ var doc;
+ var elementNode;
+ var elementValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementNode = doc.documentElement;
+
+ elementValue = elementNode.nodeValue;
+
+ assertNull("elementNodeValue",elementValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchild.html
new file mode 100644
index 0000000000..7ff30dca3d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchild.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetfirstchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetfirstchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getFirstChild()" method returns the first child
+ of this node.
+
+ Retrieve the second employee and invoke the
+ "getFirstChild()" method. The NodeName returned
+ should be "#text" or "EM".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodegetfirstchild() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetfirstchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var fchildNode;
+ var childName;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ fchildNode = employeeNode.firstChild;
+
+ childName = fchildNode.nodeName;
+
+
+ if(
+ ("#text" == childName)
+ ) {
+ assertEquals("firstChild_w_whitespace","#text",childName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "firstChild_wo_whitespace","em",childName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchildnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchildnull.html
new file mode 100644
index 0000000000..cb34690c64
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchildnull.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchildnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetfirstchildnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetfirstchildnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If there is not a first child then the "getFirstChild()"
+ method returns null.
+
+ Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It
+ should return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodegetfirstchildnull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetfirstchildnull") != null) return;
+ var doc;
+ var emList;
+ var emNode;
+ var emText;
+ var nullChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ emList = doc.getElementsByTagName("em");
+ emNode = emList.item(0);
+ emText = emNode.firstChild;
+
+ nullChild = emText.firstChild;
+
+ assertNull("nullChild",nullChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchildnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchild.html
new file mode 100644
index 0000000000..fdf42c3b48
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchild.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetlastchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetlastchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLastChild()" method returns the last child
+ of this node.
+
+ Retrieve the second employee and invoke the
+ "getLastChild()" method. The NodeName returned
+ should be "#text".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB
+*/
+function hc_nodegetlastchild() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetlastchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var lchildNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ lchildNode = employeeNode.lastChild;
+
+ childName = lchildNode.nodeName;
+
+ assertEquals("whitespace","#text",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchildnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchildnull.html
new file mode 100644
index 0000000000..5b07c81dd2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchildnull.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchildnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetlastchildnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetlastchildnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ If there is not a last child then the "getLastChild()"
+ method returns null.
+
+ Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It
+ should return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodegetlastchildnull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetlastchildnull") != null) return;
+ var doc;
+ var emList;
+ var emNode;
+ var emText;
+ var nullChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ emList = doc.getElementsByTagName("em");
+ emNode = emList.item(0);
+ emText = emNode.firstChild;
+
+ nullChild = emText.lastChild;
+
+ assertNull("nullChild",nullChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchildnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsibling.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsibling.html
new file mode 100644
index 0000000000..d783a89d4a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsibling.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsibling</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetnextsibling'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetnextsibling';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNextSibling()" method returns the node immediately
+ following this node.
+
+ Retrieve the first child of the second employee and
+ invoke the "getNextSibling()" method. It should return
+ a node with the NodeName of "#text".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F
+*/
+function hc_nodegetnextsibling() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetnextsibling") != null) return;
+ var doc;
+ var elementList;
+ var emNode;
+ var nsNode;
+ var nsName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("em");
+ emNode = elementList.item(1);
+ nsNode = emNode.nextSibling;
+
+ nsName = nsNode.nodeName;
+
+ assertEquals("whitespace","#text",nsName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsibling</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsiblingnull.html
new file mode 100644
index 0000000000..ac1b56eb05
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsiblingnull.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetnextsiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetnextsiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ If there is not a node immediately following this node the
+
+ "getNextSibling()" method returns null.
+
+
+
+ Retrieve the first child of the second employee and
+
+ invoke the "getNextSibling()" method. It should
+
+ be set to null.
+
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F
+*/
+function hc_nodegetnextsiblingnull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetnextsiblingnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var lcNode;
+ var nsNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ lcNode = employeeNode.lastChild;
+
+ nsNode = lcNode.nextSibling;
+
+ assertNull("nodeGetNextSiblingNullAssert1",nsNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocument.html
new file mode 100644
index 0000000000..6915820a37
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocument.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetownerdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetownerdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Evaluate Node.ownerDocument on the second "p" element.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function hc_nodegetownerdocument() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetownerdocument") != null) return;
+ var doc;
+ var elementList;
+ var docNode;
+ var ownerDocument;
+ var docElement;
+ var elementName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ docNode = elementList.item(1);
+ ownerDocument = docNode.ownerDocument;
+
+ docElement = ownerDocument.documentElement;
+
+ elementName = docElement.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgNodeName","svg",elementName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "ownerDocElemTagName","html",elementName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocumentnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocumentnull.html
new file mode 100644
index 0000000000..560963c927
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocumentnull.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocumentnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetownerdocumentnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetownerdocumentnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getOwnerDocument()" method returns null if the target
+
+ node itself is a document.
+
+
+
+ Invoke the "getOwnerDocument()" method on the master
+
+ document. The Document returned should be null.
+
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc
+*/
+function hc_nodegetownerdocumentnull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetownerdocumentnull") != null) return;
+ var doc;
+ var ownerDocument;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ ownerDocument = doc.ownerDocument;
+
+ assertNull("nodeGetOwnerDocumentNullAssert1",ownerDocument);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocumentnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussibling.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussibling.html
new file mode 100644
index 0000000000..e7a9e06c89
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussibling.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussibling</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetprevioussibling'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetprevioussibling';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getPreviousSibling()" method returns the node
+ immediately preceding this node.
+
+ Retrieve the second child of the second employee and
+ invoke the "getPreviousSibling()" method. It should
+ return a node with a NodeName of "#text".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8
+*/
+function hc_nodegetprevioussibling() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetprevioussibling") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var psNode;
+ var psName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(1);
+ psNode = nameNode.previousSibling;
+
+ psName = psNode.nodeName;
+
+ assertEquals("whitespace","#text",psName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussibling</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussiblingnull.html
new file mode 100644
index 0000000000..6927eadbcf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussiblingnull.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodegetprevioussiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodegetprevioussiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ If there is not a node immediately preceding this node the
+
+ "getPreviousSibling()" method returns null.
+
+
+
+ Retrieve the first child of the second employee and
+
+ invoke the "getPreviousSibling()" method. It should
+
+ be set to null.
+
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8
+*/
+function hc_nodegetprevioussiblingnull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodegetprevioussiblingnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var fcNode;
+ var psNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(2);
+ fcNode = employeeNode.firstChild;
+
+ psNode = fcNode.previousSibling;
+
+ assertNull("nodeGetPreviousSiblingNullAssert1",psNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodes.html
new file mode 100644
index 0000000000..5334c085be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodes.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodehaschildnodes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodehaschildnodes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "hasChildNodes()" method returns true if the node
+ has children.
+
+ Retrieve the root node("staff") and invoke the
+ "hasChildNodes()" method. It should return the boolean
+ value "true".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187
+*/
+function hc_nodehaschildnodes() {
+ var success;
+ if(checkInitialization(builder, "hc_nodehaschildnodes") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ state = employeeNode.hasChildNodes();
+ assertTrue("nodeHasChildAssert1",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodesfalse.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodesfalse.html
new file mode 100644
index 0000000000..ac8fcdedbd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodesfalse.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodesfalse</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodehaschildnodesfalse'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodehaschildnodesfalse';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "hasChildNodes()" method returns false if the node
+ does not have any children.
+
+ Retrieve the text of the first "em" element and invoke the "hasChildNodes()" method. It
+ should return false.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodehaschildnodesfalse() {
+ var success;
+ if(checkInitialization(builder, "hc_nodehaschildnodesfalse") != null) return;
+ var doc;
+ var emList;
+ var emNode;
+ var emText;
+ var hasChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ emList = doc.getElementsByTagName("em");
+ emNode = emList.item(0);
+ emText = emNode.firstChild;
+
+ hasChild = emText.hasChildNodes();
+ assertFalse("hasChild",hasChild);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodesfalse</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbefore.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbefore.html
new file mode 100644
index 0000000000..37bce31f2b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbefore.html
@@ -0,0 +1,169 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbefore</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbefore'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbefore';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method inserts the
+ node "newChild" before the node "refChild".
+
+ Insert a newly created Element node before the second
+ sup element in the document and check the "newChild"
+ and "refChild" after insertion for correct placement.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=261
+*/
+function hc_nodeinsertbefore() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbefore") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newChild;
+ var child;
+ var childName;
+ var insertedNode;
+ var actual = new Array();
+
+ expected = new Array();
+ expected[0] = "em";
+ expected[1] = "strong";
+ expected[2] = "code";
+ expected[3] = "br";
+ expected[4] = "sup";
+ expected[5] = "var";
+ expected[6] = "acronym";
+
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("sup");
+ refChild = elementList.item(2);
+ employeeNode = refChild.parentNode;
+
+ childList = employeeNode.childNodes;
+
+ newChild = doc.createElement("br");
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ for(var indexN65681 = 0;indexN65681 < childList.length; indexN65681++) {
+ child = childList.item(indexN65681);
+ nodeType = child.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ childName = child.nodeName;
+
+ actual[actual.length] = childName;
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "nodeNames",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbefore</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforedocfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforedocfragment.html
new file mode 100644
index 0000000000..b5fae9e6ed
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforedocfragment.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforedocfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforedocfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforedocfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is a DocumentFragment object then all
+ its children are inserted in the same order before the
+ the "refChild".
+
+ Create a DocumentFragment object and populate it with
+ two Element nodes. Retrieve the second employee and
+ insert the newly created DocumentFragment before its
+ fourth child. The second employee should now have two
+ extra children("newChild1" and "newChild2") at
+ positions fourth and fifth respectively.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeinsertbeforedocfragment() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforedocfragment") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newdocFragment;
+ var newChild1;
+ var newChild2;
+ var child;
+ var childName;
+ var appendedChild;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ refChild = childList.item(3);
+ newdocFragment = doc.createDocumentFragment();
+ newChild1 = doc.createElement("br");
+ newChild2 = doc.createElement("b");
+ appendedChild = newdocFragment.appendChild(newChild1);
+ appendedChild = newdocFragment.appendChild(newChild2);
+ insertedNode = employeeNode.insertBefore(newdocFragment,refChild);
+ child = childList.item(3);
+ childName = child.nodeName;
+
+ assertEqualsAutoCase("element", "childName3","br",childName);
+ child = childList.item(4);
+ childName = child.nodeName;
+
+ assertEqualsAutoCase("element", "childName4","b",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforedocfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforeinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforeinvalidnodetype.html
new file mode 100644
index 0000000000..e5519b30d4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforeinvalidnodetype.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforeinvalidnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforeinvalidnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforeinvalidnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if this node is of
+ a type that does not allow children of the type "newChild"
+ to be inserted.
+
+ Retrieve the root node and attempt to insert a newly
+ created Attr node. An Element node cannot have children
+ of the "Attr" type, therefore the desired exception
+ should be raised.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=406
+*/
+function hc_nodeinsertbeforeinvalidnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforeinvalidnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var newChild;
+ var elementList;
+ var refChild;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newChild = doc.createAttribute("title");
+ elementList = doc.getElementsByTagName("p");
+ refChild = elementList.item(1);
+ rootNode = refChild.parentNode;
+
+
+ {
+ success = false;
+ try {
+ insertedNode = rootNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforeinvalidnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchilddiffdocument.html
new file mode 100644
index 0000000000..767ab0dc28
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchilddiffdocument.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchilddiffdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforenewchilddiffdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "hc_staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforenewchilddiffdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if the "newChild" was
+ created from a different document than the one that
+ created this node.
+
+ Retrieve the second employee and attempt to insert a new
+ child that was created from a different document than the
+ one that created the second employee. An attempt to
+ insert such a child should raise the desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeinsertbeforenewchilddiffdocument() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforenewchilddiffdocument") != null) return;
+ var doc1;
+ var doc2;
+ var refChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var insertedNode;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "hc_staff");
+ newChild = doc1.createElement("br");
+ elementList = doc2.getElementsByTagName("p");
+ elementNode = elementList.item(1);
+ refChild = elementNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ insertedNode = elementNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchilddiffdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc1" src="files/hc_staff.html"></iframe>
+<br>
+<iframe name="doc2" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchildexists.html
new file mode 100644
index 0000000000..c4baeb0ba9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchildexists.html
@@ -0,0 +1,167 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchildexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforenewchildexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforenewchildexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is already in the tree, the
+ "insertBefore(newChild,refChild)" method must first
+ remove it before the insertion takes place.
+
+ Insert a node Element ("em") that is already
+ present in the tree. The existing node should be
+ removed first and the new one inserted. The node is
+ inserted at a different position in the tree to assure
+ that it was indeed inserted.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodeinsertbeforenewchildexists() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforenewchildexists") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newChild;
+ var child;
+ var childName;
+ var insertedNode;
+ expected = new Array();
+ expected[0] = "strong";
+ expected[1] = "code";
+ expected[2] = "sup";
+ expected[3] = "var";
+ expected[4] = "em";
+ expected[5] = "acronym";
+
+ var result = new Array();
+
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.getElementsByTagName("*");
+ refChild = childList.item(5);
+ newChild = childList.item(0);
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ for(var indexN65676 = 0;indexN65676 < childList.length; indexN65676++) {
+ child = childList.item(indexN65676);
+ nodeType = child.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "childNames",expected,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchildexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodeancestor.html
new file mode 100644
index 0000000000..0479ada809
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodeancestor.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodeancestor</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforenodeancestor'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforenodeancestor';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if the node to be
+ inserted is one of this nodes ancestors.
+
+ Retrieve the second employee and attempt to insert a
+ node that is one of its ancestors(root node). An
+ attempt to insert such a node should raise the
+ desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function hc_nodeinsertbeforenodeancestor() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforenodeancestor") != null) return;
+ var doc;
+ var newChild;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newChild = doc.documentElement;
+
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ refChild = childList.item(0);
+
+ {
+ success = false;
+ try {
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodeancestor</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodename.html
new file mode 100644
index 0000000000..3eda9ad815
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodename.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforenodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforenodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refchild)" method returns
+ the node being inserted.
+
+ Insert an Element node before the fourth
+ child of the second employee and check the node
+ returned from the "insertBefore(newChild,refChild)"
+ method. The node returned should be "newChild".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeinsertbeforenodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforenodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newChild;
+ var insertedNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ refChild = childList.item(3);
+ newChild = doc.createElement("br");
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ childName = insertedNode.nodeName;
+
+ assertEqualsAutoCase("element", "nodeName","br",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnonexistent.html
new file mode 100644
index 0000000000..2d62ddecc1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnonexistent.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnonexistent</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforerefchildnonexistent'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforerefchildnonexistent';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ NOT_FOUND_ERR DOMException if the reference child is
+ not a child of this node.
+
+ Retrieve the second employee and attempt to insert a
+ new node before a reference node that is not a child
+ of this node. An attempt to insert before a non child
+ node should raise the desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_nodeinsertbeforerefchildnonexistent() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforerefchildnonexistent") != null) return;
+ var doc;
+ var refChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newChild = doc.createElement("br");
+ refChild = doc.createElement("b");
+ elementList = doc.getElementsByTagName("p");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ insertedNode = elementNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnonexistent</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnull.html
new file mode 100644
index 0000000000..1e426771a4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnull.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeinsertbeforerefchildnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeinsertbeforerefchildnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "refChild" is null then the
+ "insertBefore(newChild,refChild)" method inserts the
+ node "newChild" at the end of the list of children.
+
+ Retrieve the second employee and invoke the
+ "insertBefore(newChild,refChild)" method with
+ refChild=null. Since "refChild" is null the "newChild"
+ should be added to the end of the list. The last item
+ in the list is checked after insertion. The last Element
+ node of the list should be "newChild".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeinsertbeforerefchildnull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeinsertbeforerefchildnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild = null;
+
+ var newChild;
+ var child;
+ var childName;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ newChild = doc.createElement("br");
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ child = employeeNode.lastChild;
+
+ childName = child.nodeName;
+
+ assertEqualsAutoCase("element", "nodeName","br",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexequalzero.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexequalzero.html
new file mode 100644
index 0000000000..6a62a3c148
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexequalzero.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexequalzero</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodelistindexequalzero'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodelistindexequalzero';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a list of all the children elements of the third
+ employee and access its first child by using an index
+ of 0. This should result in the whitspace before "em" being
+ selected (em when ignoring whitespace).
+ Further we evaluate its content(by using
+ the "getNodeName()" method) to ensure the proper
+ element was accessed.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodelistindexequalzero() {
+ var success;
+ if(checkInitialization(builder, "hc_nodelistindexequalzero") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ length = employeeList.length;
+
+ child = employeeList.item(0);
+ childName = child.nodeName;
+
+
+ if(
+ (13 == length)
+ ) {
+ assertEquals("childName_w_whitespace","#text",childName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "childName_wo_whitespace","em",childName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexequalzero</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlength.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlength.html
new file mode 100644
index 0000000000..4e9e2637e5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlength.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodelistindexgetlength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodelistindexgetlength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLength()" method returns the number of nodes
+ in the list.
+
+ Create a list of all the children elements of the third
+ employee and invoke the "getLength()" method.
+ It should contain the value 13.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodelistindexgetlength() {
+ var success;
+ if(checkInitialization(builder, "hc_nodelistindexgetlength") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ length = employeeList.length;
+
+
+ if(
+ (6 == length)
+ ) {
+ assertEquals("length_wo_space",6,length);
+
+ }
+
+ else {
+ assertEquals("length_w_space",13,length);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlengthofemptylist.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlengthofemptylist.html
new file mode 100644
index 0000000000..479d8aa475
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlengthofemptylist.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlengthofemptylist</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodelistindexgetlengthofemptylist'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodelistindexgetlengthofemptylist';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLength()" method returns the number of nodes
+ in the list.(Test for EMPTY list)
+
+ Create a list of all the children of the Text node
+ inside the first child of the third employee and
+ invoke the "getLength()" method. It should contain
+ the value 0.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodelistindexgetlengthofemptylist() {
+ var success;
+ if(checkInitialization(builder, "hc_nodelistindexgetlengthofemptylist") != null) return;
+ var doc;
+ var emList;
+ var emNode;
+ var textNode;
+ var textList;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ emList = doc.getElementsByTagName("em");
+ emNode = emList.item(2);
+ textNode = emNode.firstChild;
+
+ textList = textNode.childNodes;
+
+ length = textList.length;
+
+ assertEquals("length",0,length);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlengthofemptylist</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexnotzero.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexnotzero.html
new file mode 100644
index 0000000000..785b264459
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexnotzero.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexnotzero</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodelistindexnotzero'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodelistindexnotzero';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The items in the list are accessible via an integral
+ index starting from zero.
+ (Index not equal 0)
+
+ Create a list of all the children elements of the third
+ employee and access its fourth child by using an index
+ of 3 and calling getNodeName() which should return
+ "strong" (no whitespace) or "#text" (with whitespace).
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodelistindexnotzero() {
+ var success;
+ if(checkInitialization(builder, "hc_nodelistindexnotzero") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ child = employeeList.item(3);
+ childName = child.nodeName;
+
+
+ if(
+ ("#text" == childName)
+ ) {
+ assertEquals("childName_space","#text",childName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "childName_strong","strong",childName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexnotzero</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnfirstitem.html
new file mode 100644
index 0000000000..d292915501
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnfirstitem.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnfirstitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodelistreturnfirstitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodelistreturnfirstitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a list of all the children elements of the third
+ employee and access its first child by invoking the
+ "item(index)" method with an index=0. This should
+ result in node with a nodeName of "#text" or "em".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodelistreturnfirstitem() {
+ var success;
+ if(checkInitialization(builder, "hc_nodelistreturnfirstitem") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ child = employeeList.item(0);
+ childName = child.nodeName;
+
+
+ if(
+ ("#text" == childName)
+ ) {
+ assertEquals("nodeName_w_space","#text",childName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "nodeName_wo_space","em",childName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnfirstitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnlastitem.html
new file mode 100644
index 0000000000..4a86eb2086
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnlastitem.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnlastitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodelistreturnlastitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodelistreturnlastitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a list of all the children elements of the third
+ employee and access its last child by invoking the
+ "item(index)" method with an index=length-1. This should
+ result in node with nodeName="#text" or acronym.
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodelistreturnlastitem() {
+ var success;
+ if(checkInitialization(builder, "hc_nodelistreturnlastitem") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+ var index;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ index = employeeList.length;
+
+ index -= 1;
+child = employeeList.item(index);
+ childName = child.nodeName;
+
+
+ if(
+ (12 == index)
+ ) {
+ assertEquals("lastNodeName_w_whitespace","#text",childName);
+
+ }
+
+ else {
+ assertEqualsAutoCase("element", "lastNodeName","acronym",childName);
+ assertEquals("index",5,index);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnlastitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelisttraverselist.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelisttraverselist.html
new file mode 100644
index 0000000000..206bde8130
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelisttraverselist.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelisttraverselist</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodelisttraverselist'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodelisttraverselist';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The range of valid child node indices is 0 thru length -1
+
+ Create a list of all the children elements of the third
+ employee and traverse the list from index=0 thru
+ length -1.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodelisttraverselist() {
+ var success;
+ if(checkInitialization(builder, "hc_nodelisttraverselist") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+ var nodeType;
+ var result = new Array();
+
+ expected = new Array();
+ expected[0] = "em";
+ expected[1] = "strong";
+ expected[2] = "code";
+ expected[3] = "sup";
+ expected[4] = "var";
+ expected[5] = "acronym";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ for(var indexN65651 = 0;indexN65651 < employeeList.length; indexN65651++) {
+ child = employeeList.item(indexN65651);
+ nodeType = child.nodeType;
+
+ childName = child.nodeName;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ result[result.length] = childName;
+
+ }
+
+ else {
+ assertEquals("textNodeType",3,nodeType);
+ assertEquals("textNodeName","#text",childName);
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "nodeNames",expected,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelisttraverselist</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnode.html
new file mode 100644
index 0000000000..62b16bafcd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnode.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeparentnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeparentnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getParentNode()" method returns the parent
+ of this node.
+
+ Retrieve the second employee and invoke the
+ "getParentNode()" method on this node. It should
+ be set to "body".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317
+*/
+function hc_nodeparentnode() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeparentnode") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var parentNode;
+ var parentName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ parentNode = employeeNode.parentNode;
+
+ parentName = parentNode.nodeName;
+
+ assertEqualsAutoCase("element", "parentNodeName","body",parentName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnodenull.html
new file mode 100644
index 0000000000..1182b3eb12
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnodenull.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodeparentnodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodeparentnodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getParentNode()" method invoked on a node that has
+ just been created and not yet added to the tree is null.
+
+ Create a new "employee" Element node using the
+ "createElement(name)" method from the Document interface.
+ Since this new node has not yet been added to the tree,
+ the "getParentNode()" method will return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodeparentnodenull() {
+ var success;
+ if(checkInitialization(builder, "hc_nodeparentnodenull") != null) return;
+ var doc;
+ var createdNode;
+ var parentNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ createdNode = doc.createElement("br");
+ parentNode = createdNode.parentNode;
+
+ assertNull("parentNode",parentNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechild.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechild.html
new file mode 100644
index 0000000000..ab60a3115b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechild.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_noderemovechild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_noderemovechild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method removes the child node
+ indicated by "oldChild" from the list of children and
+ returns it.
+
+ Remove the first employee by invoking the
+ "removeChild(oldChild)" method an checking the
+ node returned by the "getParentNode()" method. It
+ should be set to null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_noderemovechild() {
+ var success;
+ if(checkInitialization(builder, "hc_noderemovechild") != null) return;
+ var doc;
+ var rootNode;
+ var childList;
+ var childToRemove;
+ var removedChild;
+ var parentNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ rootNode = doc.documentElement;
+
+ childList = rootNode.childNodes;
+
+ childToRemove = childList.item(1);
+ removedChild = rootNode.removeChild(childToRemove);
+ parentNode = removedChild.parentNode;
+
+ assertNull("parentNodeNull",parentNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildgetnodename.html
new file mode 100644
index 0000000000..cc5776a9d5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildgetnodename.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildgetnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_noderemovechildgetnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_noderemovechildgetnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method returns
+ the node being removed.
+
+ Remove the first child of the second employee
+ and check the NodeName returned by the
+ "removeChild(oldChild)" method. The returned node
+ should have a NodeName equal to "#text".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_noderemovechildgetnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_noderemovechildgetnodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var removedChild;
+ var childName;
+ var oldName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ oldChild = childList.item(0);
+ oldName = oldChild.nodeName;
+
+ removedChild = employeeNode.removeChild(oldChild);
+ assertNotNull("notnull",removedChild);
+childName = removedChild.nodeName;
+
+ assertEquals("nodeName",oldName,childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildgetnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildnode.html
new file mode 100644
index 0000000000..cc2c7864ce
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildnode.html
@@ -0,0 +1,176 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_noderemovechildnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_noderemovechildnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method removes the node
+ indicated by "oldChild".
+
+ Retrieve the second p element and remove its first child.
+ After the removal, the second p element should have 5 element
+ children and the first child should now be the child
+ that used to be at the second position in the list.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_noderemovechildnode() {
+ var success;
+ if(checkInitialization(builder, "hc_noderemovechildnode") != null) return;
+ var doc;
+ var elementList;
+ var emList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var child;
+ var childName;
+ var length;
+ var removedChild;
+ var removedName;
+ var nodeType;
+ expected = new Array();
+ expected[0] = "strong";
+ expected[1] = "code";
+ expected[2] = "sup";
+ expected[3] = "var";
+ expected[4] = "acronym";
+
+ var actual = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ emList = employeeNode.getElementsByTagName("em");
+ oldChild = emList.item(0);
+ removedChild = employeeNode.removeChild(oldChild);
+ removedName = removedChild.nodeName;
+
+ assertEqualsAutoCase("element", "removedName","em",removedName);
+ for(var indexN65688 = 0;indexN65688 < childList.length; indexN65688++) {
+ child = childList.item(indexN65688);
+ nodeType = child.nodeType;
+
+ childName = child.nodeName;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ actual[actual.length] = childName;
+
+ }
+
+ else {
+ assertEquals("textNodeType",3,nodeType);
+ assertEquals("textNodeName","#text",childName);
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "childNames",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildoldchildnonexistent.html
new file mode 100644
index 0000000000..18e1c0fa59
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildoldchildnonexistent.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildoldchildnonexistent</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_noderemovechildoldchildnonexistent'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_noderemovechildoldchildnonexistent';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method raises a
+ NOT_FOUND_ERR DOMException if the old child is
+ not a child of this node.
+
+ Retrieve the second employee and attempt to remove a
+ node that is not one of its children. An attempt to
+ remove such a node should raise the desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_noderemovechildoldchildnonexistent() {
+ var success;
+ if(checkInitialization(builder, "hc_noderemovechildoldchildnonexistent") != null) return;
+ var doc;
+ var oldChild;
+ var elementList;
+ var elementNode;
+ var removedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ oldChild = doc.createElement("br");
+ elementList = doc.getElementsByTagName("p");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ removedChild = elementNode.removeChild(oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildoldchildnonexistent</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechild.html
new file mode 100644
index 0000000000..cfa08fcd69
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechild.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodereplacechild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodereplacechild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method replaces
+ the node "oldChild" with the node "newChild".
+
+ Replace the first element of the second employee with
+ a newly created Element node. Check the first position
+ after the replacement operation is completed. The new
+ Element should be "newChild".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodereplacechild() {
+ var success;
+ if(checkInitialization(builder, "hc_nodereplacechild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var newChild;
+ var child;
+ var childName;
+ var replacedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ oldChild = childList.item(0);
+ newChild = doc.createElement("br");
+ replacedNode = employeeNode.replaceChild(newChild,oldChild);
+ child = childList.item(0);
+ childName = child.nodeName;
+
+ assertEqualsAutoCase("element", "nodeName","br",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildinvalidnodetype.html
new file mode 100644
index 0000000000..5db6d8f9ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildinvalidnodetype.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildinvalidnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodereplacechildinvalidnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodereplacechildinvalidnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if this node is of
+ a type that does not allow children of the type "newChild"
+ to be inserted.
+
+ Retrieve the root node and attempt to replace
+ one of its children with a newly created Attr node.
+ An Element node cannot have children of the "Attr"
+ type, therefore the desired exception should be raised.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=406
+*/
+function hc_nodereplacechildinvalidnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodereplacechildinvalidnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var newChild;
+ var elementList;
+ var oldChild;
+ var replacedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newChild = doc.createAttribute("lang");
+ elementList = doc.getElementsByTagName("p");
+ oldChild = elementList.item(1);
+ rootNode = oldChild.parentNode;
+
+
+ {
+ success = false;
+ try {
+ replacedChild = rootNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildinvalidnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchilddiffdocument.html
new file mode 100644
index 0000000000..9d0e93fbbc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchilddiffdocument.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchilddiffdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodereplacechildnewchilddiffdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "hc_staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodereplacechildnewchilddiffdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if the "newChild" was
+ created from a different document than the one that
+ created this node.
+
+ Retrieve the second employee and attempt to replace one
+ of its children with a node created from a different
+ document. An attempt to make such a replacement
+ should raise the desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodereplacechildnewchilddiffdocument() {
+ var success;
+ if(checkInitialization(builder, "hc_nodereplacechildnewchilddiffdocument") != null) return;
+ var doc1;
+ var doc2;
+ var oldChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var replacedChild;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "hc_staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "hc_staff");
+ newChild = doc1.createElement("br");
+ elementList = doc2.getElementsByTagName("p");
+ elementNode = elementList.item(1);
+ oldChild = elementNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ replacedChild = elementNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchilddiffdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc1" src="files/hc_staff.html"></iframe>
+<br>
+<iframe name="doc2" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchildexists.html
new file mode 100644
index 0000000000..826d79ce3e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchildexists.html
@@ -0,0 +1,171 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchildexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodereplacechildnewchildexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodereplacechildnewchildexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is already in the tree, it is first
+ removed before the new one is added.
+
+ Retrieve the second "p" and replace "acronym" with its "em".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
+*/
+function hc_nodereplacechildnewchildexists() {
+ var success;
+ if(checkInitialization(builder, "hc_nodereplacechildnewchildexists") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild = null;
+
+ var newChild = null;
+
+ var child;
+ var childName;
+ var childNode;
+ var actual = new Array();
+
+ expected = new Array();
+ expected[0] = "strong";
+ expected[1] = "code";
+ expected[2] = "sup";
+ expected[3] = "var";
+ expected[4] = "em";
+
+ var replacedChild;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.getElementsByTagName("*");
+ newChild = childList.item(0);
+ oldChild = childList.item(5);
+ replacedChild = employeeNode.replaceChild(newChild,oldChild);
+ assertSame("return_value_same",oldChild,replacedChild);
+for(var indexN65684 = 0;indexN65684 < childList.length; indexN65684++) {
+ childNode = childList.item(indexN65684);
+ childName = childNode.nodeName;
+
+ nodeType = childNode.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ actual[actual.length] = childName;
+
+ }
+
+ else {
+ assertEquals("textNodeType",3,nodeType);
+ assertEquals("textNodeName","#text",childName);
+
+ }
+
+ }
+ assertEqualsListAutoCase("element", "childNames",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchildexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodeancestor.html
new file mode 100644
index 0000000000..506b5912b7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodeancestor.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodeancestor</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodereplacechildnodeancestor'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodereplacechildnodeancestor';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if the node to put
+ in is one of this node's ancestors.
+
+ Retrieve the second employee and attempt to replace
+ one of its children with an ancestor node(root node).
+ An attempt to make such a replacement should raise the
+ desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function hc_nodereplacechildnodeancestor() {
+ var success;
+ if(checkInitialization(builder, "hc_nodereplacechildnodeancestor") != null) return;
+ var doc;
+ var newChild;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var replacedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newChild = doc.documentElement;
+
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ oldChild = childList.item(0);
+
+ {
+ success = false;
+ try {
+ replacedNode = employeeNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodeancestor</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodename.html
new file mode 100644
index 0000000000..63c71df9b2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodename.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodereplacechildnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodereplacechildnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method returns
+ the node being replaced.
+
+ Replace the second Element of the second employee with
+ a newly created node Element and check the NodeName
+ returned by the "replaceChild(newChild,oldChild)"
+ method. The returned node should have a NodeName equal
+ to "em".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodereplacechildnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodereplacechildnodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var newChild;
+ var replacedNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("p");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.getElementsByTagName("em");
+ oldChild = childList.item(0);
+ newChild = doc.createElement("br");
+ replacedNode = employeeNode.replaceChild(newChild,oldChild);
+ childName = replacedNode.nodeName;
+
+ assertEqualsAutoCase("element", "replacedNodeName","em",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildoldchildnonexistent.html
new file mode 100644
index 0000000000..e31b4b4949
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildoldchildnonexistent.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildoldchildnonexistent</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodereplacechildoldchildnonexistent'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodereplacechildoldchildnonexistent';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ NOT_FOUND_ERR DOMException if the old child is
+ not a child of this node.
+
+ Retrieve the second employee and attempt to replace a
+ node that is not one of its children. An attempt to
+ replace such a node should raise the desired exception.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
+*/
+function hc_nodereplacechildoldchildnonexistent() {
+ var success;
+ if(checkInitialization(builder, "hc_nodereplacechildoldchildnonexistent") != null) return;
+ var doc;
+ var oldChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var replacedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newChild = doc.createElement("br");
+ oldChild = doc.createElement("b");
+ elementList = doc.getElementsByTagName("p");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ replacedNode = elementNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildoldchildnonexistent</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodeattribute.html
new file mode 100644
index 0000000000..b34c477d84
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodeattribute.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodeattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodetextnodeattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodetextnodeattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getAttributes()" method invoked on a Text
+Node returns null.
+
+Retrieve the Text node from the last child of the
+first employee and invoke the "getAttributes()" method
+on the Text Node. It should return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772
+*/
+function hc_nodetextnodeattribute() {
+ var success;
+ if(checkInitialization(builder, "hc_nodetextnodeattribute") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ attrList = textNode.attributes;
+
+ assertNull("text_attributes_is_null",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodeattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodename.html
new file mode 100644
index 0000000000..ad82a90098
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodename.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodetextnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodetextnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ Text Node is "#text".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function hc_nodetextnodename() {
+ var success;
+ if(checkInitialization(builder, "hc_nodetextnodename") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var textName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ textName = textNode.nodeName;
+
+ assertEquals("textNodeName","#text",textName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodetype.html
new file mode 100644
index 0000000000..6972e75d85
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodetype.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodetextnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodetextnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getNodeType()" method for a Text Node
+
+ returns the constant value 3.
+
+
+
+ Retrieve the Text node from the last child of
+
+ the first employee and invoke the "getNodeType()"
+
+ method. The method should return 3.
+
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function hc_nodetextnodetype() {
+ var success;
+ if(checkInitialization(builder, "hc_nodetextnodetype") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ nodeType = textNode.nodeType;
+
+ assertEquals("nodeTextNodeTypeAssert1",3,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodevalue.html
new file mode 100644
index 0000000000..2d3fceaad8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodevalue.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodetextnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodetextnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Text Node is the content of the Text node.
+
+ Retrieve the Text node from the last child of the first
+ employee and check the string returned by the
+ "getNodeValue()" method. It should be equal to
+ "1230 North Ave. Dallas, Texas 98551".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function hc_nodetextnodevalue() {
+ var success;
+ if(checkInitialization(builder, "hc_nodetextnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var textValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ textValue = textNode.nodeValue;
+
+ assertEquals("textNodeValue","1230 North Ave. Dallas, Texas 98551",textValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue01.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue01.html
new file mode 100644
index 0000000000..5514287b2f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue01.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue01</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue01';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An element is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+*/
+function hc_nodevalue01() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue01") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newNode = doc.createElement("acronym");
+ newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue02.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue02.html
new file mode 100644
index 0000000000..4e48ceca84
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue02.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue02</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue02';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An comment is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+*/
+function hc_nodevalue02() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue02") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newNode = doc.createComment("This is a new Comment node");
+ newValue = newNode.nodeValue;
+
+ assertEquals("initial","This is a new Comment node",newValue);
+ newNode.nodeValue = "This should have an effect";
+
+ newValue = newNode.nodeValue;
+
+ assertEquals("afterChange","This should have an effect",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue03.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue03.html
new file mode 100644
index 0000000000..a661fd95f4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue03.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue03</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue03';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An entity reference is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490
+*/
+function hc_nodevalue03() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue03") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+
+ {
+ success = false;
+ try {
+ newNode = doc.createEntityReference("ent1");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+ }
+
+ else {
+ newNode = doc.createEntityReference("ent1");
+ assertNotNull("createdEntRefNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue04.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue04.html
new file mode 100644
index 0000000000..a921d8e1b4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue04.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue04</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue04';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An document type accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
+*/
+function hc_nodevalue04() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue04") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newNode = doc.doctype;
+
+ assertTrue("docTypeNotNullOrDocIsHTML",
+
+ (
+ (newNode != null)
+ ||
+ (builder.contentType == "text/html")
+)
+);
+
+ if(
+
+ (newNode != null)
+
+ ) {
+ assertNotNull("docTypeNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue05.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue05.html
new file mode 100644
index 0000000000..8cb3e511d8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue05.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue05</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue05';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+A document fragment is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+*/
+function hc_nodevalue05() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue05") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ newNode = doc.createDocumentFragment();
+ newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue06.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue06.html
new file mode 100644
index 0000000000..ad9454846e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue06.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue06</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var newNodeRef = null;
+ if (typeof(this.newNode) != 'undefined') {
+ newNodeRef = this.newNode;
+ }
+ docsLoaded += preload(newNodeRef, "newNode", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue06';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An document is accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+*/
+function hc_nodevalue06() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue06") != null) return;
+ var newNode;
+ var newValue;
+
+ var newNodeRef = null;
+ if (typeof(this.newNode) != 'undefined') {
+ newNodeRef = this.newNode;
+ }
+ newNode = load(newNodeRef, "newNode", "hc_staff");
+ newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="newNode" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue07.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue07.html
new file mode 100644
index 0000000000..7aa6d5baf5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue07.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue07</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue07';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An Entity is accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2
+*/
+function hc_nodevalue07() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue07") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+ var nodeMap;
+ var docType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docType = doc.doctype;
+
+
+ if(
+
+ !(
+ (builder.contentType == "text/html")
+)
+
+ ) {
+ assertNotNull("docTypeNotNull",docType);
+nodeMap = docType.entities;
+
+ assertNotNull("entitiesNotNull",nodeMap);
+newNode = nodeMap.getNamedItem("alpha");
+ assertNotNull("entityNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(builder.contentType, "text/html", "Fake default check");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue08.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue08.html
new file mode 100644
index 0000000000..82b3ab458a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue08.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue08</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodevalue08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodevalue08';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An notation is accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5431D1B9
+*/
+function hc_nodevalue08() {
+ var success;
+ if(checkInitialization(builder, "hc_nodevalue08") != null) return;
+ var doc;
+ var docType;
+ var newNode;
+ var newValue;
+ var nodeMap;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docType = doc.doctype;
+
+
+ if(
+
+ !(
+ (builder.contentType == "text/html")
+)
+
+ ) {
+ assertNotNull("docTypeNotNull",docType);
+nodeMap = docType.notations;
+
+ assertNotNull("notationsNotNull",nodeMap);
+newNode = nodeMap.getNamedItem("notation1");
+ assertNotNull("notationNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(builder.contentType, "text/html", "Fake default check");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_notationsremovenameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_notationsremovenameditem1.html
new file mode 100644
index 0000000000..5a7004f030
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_notationsremovenameditem1.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationsremovenameditem1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_notationsremovenameditem1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_notationsremovenameditem1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An attempt to add remove an notation should result in a NO_MODIFICATION_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+*/
+function hc_notationsremovenameditem1() {
+ var success;
+ if(checkInitialization(builder, "hc_notationsremovenameditem1") != null) return;
+ var doc;
+ var notations;
+ var docType;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docType = doc.doctype;
+
+
+ if(
+
+ !(
+ (builder.contentType == "text/html")
+)
+
+ ) {
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+
+ {
+ success = false;
+ try {
+ retval = notations.removeNamedItem("notation1");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(builder.contentType, "text/html", "Fake default check");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationsremovenameditem1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_notationssetnameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_notationssetnameditem1.html
new file mode 100644
index 0000000000..0cce1240eb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_notationssetnameditem1.html
@@ -0,0 +1,164 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationssetnameditem1</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_notationssetnameditem1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ checkFeature("XML", null);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_notationssetnameditem1';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An attempt to add an element to the named node map returned by notations should
+result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+*/
+function hc_notationssetnameditem1() {
+ var success;
+ if(checkInitialization(builder, "hc_notationssetnameditem1") != null) return;
+ var doc;
+ var notations;
+ var docType;
+ var retval;
+ var elem;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docType = doc.doctype;
+
+
+ if(
+
+ !(
+ (builder.contentType == "text/html")
+)
+
+ ) {
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+elem = doc.createElement("br");
+
+ try {
+ retval = notations.setNamedItem(elem);
+ fail("throw_HIER_OR_NO_MOD_ERR");
+
+ } catch (ex) {
+ if (typeof(ex.code) != 'undefined') {
+ switch(ex.code) {
+ case /* HIERARCHY_REQUEST_ERR */ 3 :
+ break;
+ case /* NO_MODIFICATION_ALLOWED_ERR */ 7 :
+ break;
+ default:
+ throw ex;
+ }
+ } else {
+ throw ex;
+ }
+ }
+
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(builder.contentType, "text/html", "Fake default check");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationssetnameditem1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerrnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerrnegativeoffset.html
new file mode 100644
index 0000000000..1eab284fb1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerrnegativeoffset.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerrnegativeoffset</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textindexsizeerrnegativeoffset'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textindexsizeerrnegativeoffset';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset is
+ negative.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The desired exception should be raised since the offset
+ is a negative number.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function hc_textindexsizeerrnegativeoffset() {
+ var success;
+ if(checkInitialization(builder, "hc_textindexsizeerrnegativeoffset") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ splitNode = textNode.splitText(-69);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerrnegativeoffset</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerroffsetoutofbounds.html b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerroffsetoutofbounds.html
new file mode 100644
index 0000000000..b5971eb8be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerroffsetoutofbounds.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerroffsetoutofbounds</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textindexsizeerroffsetoutofbounds'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textindexsizeerroffsetoutofbounds';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset is
+ greater than the number of characters in the Text node.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The desired exception should be raised since the offset
+ is a greater than the number of characters in the Text
+ node.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function hc_textindexsizeerroffsetoutofbounds() {
+ var success;
+ if(checkInitialization(builder, "hc_textindexsizeerroffsetoutofbounds") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ splitNode = textNode.splitText(300);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerroffsetoutofbounds</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textparseintolistofelements.html b/dom/tests/mochitest/dom-level1-core/test_hc_textparseintolistofelements.html
new file mode 100644
index 0000000000..01bfcc43f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textparseintolistofelements.html
@@ -0,0 +1,185 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textparseintolistofelements</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textparseintolistofelements'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textparseintolistofelements';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the textual data from the last child of the
+ second employee. That node is composed of two
+ EntityReference nodes and two Text nodes. After
+ the content node is parsed, the "acronym" Element
+ should contain four children with each one of the
+ EntityReferences containing one child.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-745549614
+*/
+function hc_textparseintolistofelements() {
+ var success;
+ if(checkInitialization(builder, "hc_textparseintolistofelements") != null) return;
+ var doc;
+ var elementList;
+ var addressNode;
+ var childList;
+ var child;
+ var value;
+ var grandChild;
+ var length;
+ var result = new Array();
+
+ expectedNormal = new Array();
+ expectedNormal[0] = "β";
+ expectedNormal[1] = " Dallas, ";
+ expectedNormal[2] = "γ";
+ expectedNormal[3] = "\n 98554";
+
+ expectedExpanded = new Array();
+ expectedExpanded[0] = "β Dallas, γ\n 98554";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ addressNode = elementList.item(1);
+ childList = addressNode.childNodes;
+
+ length = childList.length;
+
+ for(var indexN65660 = 0;indexN65660 < childList.length; indexN65660++) {
+ child = childList.item(indexN65660);
+ value = child.nodeValue;
+
+
+ if(
+
+ (value == null)
+
+ ) {
+ grandChild = child.firstChild;
+
+ assertNotNull("grandChildNotNull",grandChild);
+value = grandChild.nodeValue;
+
+ result[result.length] = value;
+
+ }
+
+ else {
+ result[result.length] = value;
+
+ }
+
+ }
+
+ if(
+ (1 == length)
+ ) {
+ assertEqualsList("assertEqCoalescing",expectedExpanded,result);
+
+ }
+
+ else {
+ assertEqualsList("assertEqNormal",expectedNormal,result);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textparseintolistofelements</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextfour.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextfour.html
new file mode 100644
index 0000000000..1e951a4834
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextfour.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextfour</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textsplittextfour'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textsplittextfour';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method returns the new Text node.
+
+ Retrieve the textual data from the last child of the
+ first employee and invoke the "splitText(offset)" method.
+ The method should return the new Text node. The offset
+ value used for this test is 30. The "getNodeValue()"
+ method is called to check that the new node now contains
+ the characters at and after position 30.
+ (Starting count at 0)
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function hc_textsplittextfour() {
+ var success;
+ if(checkInitialization(builder, "hc_textsplittextfour") != null) return;
+ var doc;
+ var elementList;
+ var addressNode;
+ var textNode;
+ var splitNode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("acronym");
+ addressNode = elementList.item(0);
+ textNode = addressNode.firstChild;
+
+ splitNode = textNode.splitText(30);
+ value = splitNode.nodeValue;
+
+ assertEquals("textSplitTextFourAssert","98551",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextfour</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextone.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextone.html
new file mode 100644
index 0000000000..05012317ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextone.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextone</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textsplittextone'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textsplittextone';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method breaks the Text node into
+ two Text nodes at the specified offset keeping each node
+ as siblings in the tree.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The method splits the Text node into two new sibling
+ Text nodes keeping both of them in the tree. This test
+ checks the "nextSibling()" method of the original node
+ to ensure that the two nodes are indeed siblings.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function hc_textsplittextone() {
+ var success;
+ if(checkInitialization(builder, "hc_textsplittextone") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+ var secondPart;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+ splitNode = textNode.splitText(7);
+ secondPart = textNode.nextSibling;
+
+ value = secondPart.nodeValue;
+
+ assertEquals("textSplitTextOneAssert","Jones",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextone</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextthree.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextthree.html
new file mode 100644
index 0000000000..f64334b3c1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextthree.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextthree</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textsplittextthree'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textsplittextthree';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ After the "splitText(offset)" method breaks the Text node
+ into two Text nodes, the new Text node contains all the
+ content at and after the offset point.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The new Text node should contain all the content
+ at and after the offset point. The "getNodeValue()"
+ method is called to check that the new node now contains
+ the characters at and after position seven.
+ (Starting count at 0)
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function hc_textsplittextthree() {
+ var success;
+ if(checkInitialization(builder, "hc_textsplittextthree") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+ splitNode = textNode.splitText(6);
+ value = splitNode.nodeValue;
+
+ assertEquals("textSplitTextThreeAssert"," Jones",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextthree</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittexttwo.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittexttwo.html
new file mode 100644
index 0000000000..ae7dc299e5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittexttwo.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittexttwo</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textsplittexttwo'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textsplittexttwo';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ After the "splitText(offset)" method breaks the Text node
+ into two Text nodes, the original node contains all the
+ content up to the offset point.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The original Text node should contain all the content
+ up to the offset point. The "getNodeValue()" method
+ is called to check that the original node now contains
+ the first five characters.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function hc_textsplittexttwo() {
+ var success;
+ if(checkInitialization(builder, "hc_textsplittexttwo") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+ splitNode = textNode.splitText(5);
+ value = textNode.nodeValue;
+
+ assertEquals("textSplitTextTwoAssert","Roger",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittexttwo</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textwithnomarkup.html b/dom/tests/mochitest/dom-level1-core/test_hc_textwithnomarkup.html
new file mode 100644
index 0000000000..5c4aa7b299
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_hc_textwithnomarkup.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textwithnomarkup</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_textwithnomarkup'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_textwithnomarkup';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If there is not any markup inside an Element or Attr node
+ content, then the text is contained in a single object
+ implementing the Text interface that is the only child
+ of the element.
+
+ Retrieve the textual data from the second child of the
+ third employee. That Text node contains a block of
+ multiple text lines without markup, so they should be
+ treated as a single Text node. The "getNodeValue()"
+ method should contain the combination of the two lines.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function hc_textwithnomarkup() {
+ var success;
+ if(checkInitialization(builder, "hc_textwithnomarkup") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var nodeV;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("strong");
+ nameNode = elementList.item(2);
+ nodeV = nameNode.firstChild;
+
+ value = nodeV.nodeValue;
+
+ assertEquals("textWithNoMarkupAssert","Roger\n Jones",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textwithnomarkup</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapchildnoderange.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapchildnoderange.html
new file mode 100644
index 0000000000..f3d1fb6ed7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapchildnoderange.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapchildnoderange</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapchildnoderange'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapchildnoderange';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The range of valid child node indices is 0 to Length -1.
+
+ Create a NamedNodeMap object from the attributes of the
+ last child of the third employee and traverse the
+ list from index 0 thru length -1. All indices should
+ be valid.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E
+*/
+function namednodemapchildnoderange() {
+ var success;
+ if(checkInitialization(builder, "namednodemapchildnoderange") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var child;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ attributes = testEmployee.attributes;
+
+ length = attributes.length;
+
+ assertEquals("length",2,length);
+ child = attributes.item(0);
+ child = attributes.item(1);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapchildnoderange</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapgetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapgetnameditem.html
new file mode 100644
index 0000000000..71764c14d2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapgetnameditem.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapgetnameditem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapgetnameditem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapgetnameditem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNamedItem(name)" method retrieves a node
+ specified by name.
+
+ Retrieve the second employee and create a NamedNodeMap
+ listing of the attributes of the last child. Once the
+ list is created an invocation of the "getNamedItem(name)"
+ method is done with name="domestic". This should result
+ in the domestic Attr node being returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapgetnameditem() {
+ var success;
+ if(checkInitialization(builder, "namednodemapgetnameditem") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var domesticAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ attrName = domesticAttr.nodeName;
+
+ assertEquals("namednodemapGetNamedItemAssert","domestic",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapgetnameditem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapinuseattributeerr.html
new file mode 100644
index 0000000000..b98d763ba1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapinuseattributeerr.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapinuseattributeerr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapinuseattributeerr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapinuseattributeerr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "setNamedItem(arg)" method raises a
+INUSE_ATTRIBUTE_ERR DOMException if "arg" is an
+Attr that is already in an attribute of another Element.
+
+Create a NamedNodeMap object from the attributes of the
+last child of the third employee and attempt to add
+an attribute that is already being used by the first
+employee. This should raise the desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function namednodemapinuseattributeerr() {
+ var success;
+ if(checkInitialization(builder, "namednodemapinuseattributeerr") != null) return;
+ var doc;
+ var elementList;
+ var firstNode;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var setAttr;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ firstNode = elementList.item(0);
+ domesticAttr = doc.createAttribute("domestic");
+ domesticAttr.value = "Yes";
+
+ setAttr = firstNode.setAttributeNode(domesticAttr);
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(2);
+ attributes = testNode.attributes;
+
+
+ {
+ success = false;
+ try {
+ setNode = attributes.setNamedItem(domesticAttr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("throw_INUSE_ATTRIBUTE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapinuseattributeerr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapnotfounderr.html
new file mode 100644
index 0000000000..cd6a4a4c7b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapnotfounderr.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnotfounderr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapnotfounderr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapnotfounderr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeNamedItem(name)" method raises a
+ NOT_FOUND_ERR DOMException if there is not a node
+ named "name" in the map.
+
+ Create a NamedNodeMap object from the attributes of the
+ last child of the third employee and attempt to remove
+ the "district" attribute. There is not a node named
+ "district" in the list and therefore the desired
+ exception should be raised.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D58B193')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+*/
+function namednodemapnotfounderr() {
+ var success;
+ if(checkInitialization(builder, "namednodemapnotfounderr") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ attributes = testEmployee.attributes;
+
+
+ {
+ success = false;
+ try {
+ removedNode = attributes.removeNamedItem("district");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnotfounderr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapnumberofnodes.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapnumberofnodes.html
new file mode 100644
index 0000000000..883d9b213e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapnumberofnodes.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnumberofnodes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapnumberofnodes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapnumberofnodes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLength()" method returns the number of nodes
+ in the map.
+
+ Retrieve the second employee and create a NamedNodeMap
+ listing of the attributes of the last child. Once the
+ list is created an invocation of the "getLength()"
+ method is executed. The number of nodes should be 2.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E
+*/
+function namednodemapnumberofnodes() {
+ var success;
+ if(checkInitialization(builder, "namednodemapnumberofnodes") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ attributes = testEmployee.attributes;
+
+ length = attributes.length;
+
+ assertEquals("length",2,length);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnumberofnodes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditem.html
new file mode 100644
index 0000000000..72234b87fc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditem.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeNamedItem(name)" method removes a node
+ specified by name.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object of the attributes of the last child. Once the
+ list is created invoke the "removeNamedItem(name)"
+ method with name="street". This should result
+ in the removal of the specified attribute and
+ the "getSpecified()" method should return false.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function namednodemapremovenameditem() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditem") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var streetAttr;
+ var specified;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(2);
+ attributes = testAddress.attributes;
+
+ assertNotNull("attributesNotNull",attributes);
+removedNode = attributes.removeNamedItem("street");
+ streetAttr = attributes.getNamedItem("street");
+ assertNotNull("streetAttrNotNull",streetAttr);
+specified = streetAttr.specified;
+
+ assertFalse("attrNotSpecified",specified);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemgetvalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemgetvalue.html
new file mode 100644
index 0000000000..565ad92c1b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemgetvalue.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemgetvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemgetvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemgetvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the node removed by the "removeNamedItem(name)" method
+ is an Attr node with a default value it is immediately
+ replaced.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object of the attributes of the last child. Once the
+ list is created invoke the "removeNamedItem(name)"
+ method with name="street". The "removeNamedItem(name)"
+ method should remove the "street" attribute and since
+ it has a default value of "Yes", that value should
+ immediately be the attributes value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
+*/
+function namednodemapremovenameditemgetvalue() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemgetvalue") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var streetAttr;
+ var value;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(2);
+ attributes = testEmployee.attributes;
+
+ assertNotNull("attributesNotNull",attributes);
+removedNode = attributes.removeNamedItem("street");
+ streetAttr = attributes.getNamedItem("street");
+ assertNotNull("streetAttrNotNull",streetAttr);
+value = streetAttr.value;
+
+ assertEquals("namednodemapRemoveNamedItemGetValueAssert","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemgetvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemreturnnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemreturnnodevalue.html
new file mode 100644
index 0000000000..11a51c8bd1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemreturnnodevalue.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemreturnnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemreturnnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemreturnnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeNamedItem(name)" method returns the node
+ removed from the map.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object of the attributes of the last child. Once the
+ list is created invoke the "removeNamedItem(name)"
+ method with name="street". The "removeNamedItem(name)"
+ method should remove the existing "street" attribute
+ and return it.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapremovenameditemreturnnodevalue() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemreturnnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var removedNode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(2);
+ attributes = testAddress.attributes;
+
+ removedNode = attributes.removeNamedItem("street");
+ value = removedNode.nodeValue;
+
+ assertEquals("namednodemapRemoveNamedItemReturnNodeValueAssert","No",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemreturnnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnattrnode.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnattrnode.html
new file mode 100644
index 0000000000..45e1ae7d2c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnattrnode.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnattrnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapreturnattrnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapreturnattrnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNamedItem(name)" method returns a node of any
+ type specified by name.
+
+ Retrieve the second employee and create a NamedNodeMap
+ listing of the attributes of the last child. Once the
+ list is created an invocation of the "getNamedItem(name)"
+ method is done with name="street". This should result
+ in the method returning an Attr node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403
+*/
+function namednodemapreturnattrnode() {
+ var success;
+ if(checkInitialization(builder, "namednodemapreturnattrnode") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var streetAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ streetAttr = attributes.getNamedItem("street");
+ assertInstanceOf("typeAssert","Attr",streetAttr);
+attrName = streetAttr.nodeName;
+
+ assertEquals("nodeName","street",attrName);
+ attrName = streetAttr.name;
+
+ assertEquals("attrName","street",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnattrnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnfirstitem.html
new file mode 100644
index 0000000000..d147a0725c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnfirstitem.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnfirstitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapreturnfirstitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapreturnfirstitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "item(index)" method returns the indexth item in
+ the map(test for first item).
+
+ Retrieve the second employee and create a NamedNodeMap
+ listing of the attributes of the last child. Since the
+ DOM does not specify an order of these nodes the contents
+ of the FIRST node can contain either "domestic" or "street".
+ The test should return "true" if the FIRST node is either
+ of these values.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapreturnfirstitem() {
+ var success;
+ if(checkInitialization(builder, "namednodemapreturnfirstitem") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var child;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(1);
+ attributes = testAddress.attributes;
+
+ child = attributes.item(0);
+ name = child.nodeName;
+
+ assertTrue("namednodemapReturnFirstItemAssert",
+
+ (("domestic" == name) || ("street" == name))
+);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnfirstitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnlastitem.html
new file mode 100644
index 0000000000..2bae176c3c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnlastitem.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnlastitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapreturnlastitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapreturnlastitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "item(index)" method returns the indexth item in
+ the map(test for last item).
+
+ Retrieve the second employee and create a NamedNodeMap
+ listing of the attributes of the last child. Since the
+ DOM does not specify an order of these nodes the contents
+ of the LAST node can contain either "domestic" or "street".
+ The test should return "true" if the LAST node is either
+ of these values.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapreturnlastitem() {
+ var success;
+ if(checkInitialization(builder, "namednodemapreturnlastitem") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var child;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ child = attributes.item(1);
+ name = child.nodeName;
+
+ assertTrue("namednodemapReturnLastItemAssert",
+
+ (("domestic" == name) || ("street" == name))
+);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnlastitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnnull.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnnull.html
new file mode 100644
index 0000000000..5150dc5a21
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnnull.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapreturnnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapreturnnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNamedItem(name)" method returns null of the
+ specified name did not identify any node in the map.
+
+ Retrieve the second employee and create a NamedNodeMap
+ listing of the attributes of the last child. Once the
+ list is created an invocation of the "getNamedItem(name)"
+ method is done with name="district". This name does not
+ match any names in the list therefore the method should
+ return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549
+*/
+function namednodemapreturnnull() {
+ var success;
+ if(checkInitialization(builder, "namednodemapreturnnull") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var districtNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ districtNode = attributes.getNamedItem("district");
+ assertNull("namednodemapReturnNullAssert",districtNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditem.html
new file mode 100644
index 0000000000..e0be9d0935
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditem.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNamedItem(arg)" method adds a node using its
+ nodeName attribute.
+
+ Retrieve the second employee and create a NamedNodeMap
+ object from the attributes of the last child by
+ invoking the "getAttributes()" method. Once the
+ list is created an invocation of the "setNamedItem(arg)"
+ method is done with arg=newAttr, where newAttr is a
+ new Attr Node previously created. The "setNamedItem(arg)"
+ method should add then new node to the NamedNodeItem
+ object by using its "nodeName" attribute("district').
+ This node is then retrieved using the "getNamedItem(name)"
+ method. This test uses the "createAttribute(name)"
+ method from the document interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapsetnameditem() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditem") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var districtNode;
+ var attrName;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(1);
+ newAttribute = doc.createAttribute("district");
+ attributes = testAddress.attributes;
+
+ setNode = attributes.setNamedItem(newAttribute);
+ districtNode = attributes.getNamedItem("district");
+ attrName = districtNode.nodeName;
+
+ assertEquals("namednodemapSetNamedItemAssert","district",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemreturnvalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemreturnvalue.html
new file mode 100644
index 0000000000..5f4c5d6b04
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemreturnvalue.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemreturnvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemreturnvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemreturnvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "setNamedItem(arg)" method replaces an already
+ existing node with the same name then the already
+ existing node is returned.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object from the attributes of the last child by
+ invoking the "getAttributes()" method. Once the
+ list is created an invocation of the "setNamedItem(arg)"
+ method is done with arg=newAttr, where newAttr is a
+ new Attr Node previously created and whose node name
+ already exists in the map. The "setNamedItem(arg)"
+ method should replace the already existing node with
+ the new one and return the existing node.
+ This test uses the "createAttribute(name)" method from
+ the document interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapsetnameditemreturnvalue() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemreturnvalue") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var newNode;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(2);
+ newAttribute = doc.createAttribute("street");
+ attributes = testAddress.attributes;
+
+ newNode = attributes.setNamedItem(newAttribute);
+ attrValue = newNode.nodeValue;
+
+ assertEquals("returnedNodeValue","No",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemreturnvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemthatexists.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemthatexists.html
new file mode 100644
index 0000000000..4b41834d2e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemthatexists.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemthatexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemthatexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemthatexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the node to be added by the "setNamedItem(arg)" method
+ already exists in the NamedNodeMap, it is replaced by
+ the new one.
+
+ Retrieve the second employee and create a NamedNodeMap
+ object from the attributes of the last child by
+ invoking the "getAttributes()" method. Once the
+ list is created an invocation of the "setNamedItem(arg)"
+ method is done with arg=newAttr, where newAttr is a
+ new Attr Node previously created and whose node name
+ already exists in the map. The "setNamedItem(arg)"
+ method should replace the already existing node with
+ the new one.
+ This node is then retrieved using the "getNamedItem(name)"
+ method. This test uses the "createAttribute(name)"
+ method from the document interface
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapsetnameditemthatexists() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemthatexists") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var districtNode;
+ var attrValue;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(1);
+ newAttribute = doc.createAttribute("street");
+ attributes = testAddress.attributes;
+
+ setNode = attributes.setNamedItem(newAttribute);
+ districtNode = attributes.getNamedItem("street");
+ attrValue = districtNode.nodeValue;
+
+ assertEquals("streetValue","",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemthatexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemwithnewvalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemwithnewvalue.html
new file mode 100644
index 0000000000..c8ecc479b3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemwithnewvalue.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemwithnewvalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemwithnewvalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemwithnewvalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "setNamedItem(arg)" method does not replace an
+ existing node with the same name then it returns null.
+
+ Retrieve the third employee and create a NamedNodeMap
+ object from the attributes of the last child.
+ Once the list is created the "setNamedItem(arg)" method
+ is invoked with arg=newAttr, where newAttr is a
+ newly created Attr Node and whose node name
+ already exists in the map. The "setNamedItem(arg)"
+ method should add the new node and return null.
+ This test uses the "createAttribute(name)" method from
+ the document interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
+*/
+function namednodemapsetnameditemwithnewvalue() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemwithnewvalue") != null) return;
+ var doc;
+ var elementList;
+ var newAttribute;
+ var testAddress;
+ var attributes;
+ var newNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(2);
+ newAttribute = doc.createAttribute("district");
+ attributes = testAddress.attributes;
+
+ newNode = attributes.setNamedItem(newAttribute);
+ assertNull("returnedNodeNull",newNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemwithnewvalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapwrongdocumenterr.html
new file mode 100644
index 0000000000..7fe35dc8b1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapwrongdocumenterr.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapwrongdocumenterr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapwrongdocumenterr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapwrongdocumenterr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNamedItem(arg)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if "arg" was created
+ from a different document than the one that created
+ the NamedNodeMap.
+
+ Create a NamedNodeMap object from the attributes of the
+ last child of the third employee and attempt to add
+ another Attr node to it that was created from a
+ different DOM document. This should raise the desired
+ exception. This method uses the "createAttribute(name)"
+ method from the Document interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function namednodemapwrongdocumenterr() {
+ var success;
+ if(checkInitialization(builder, "namednodemapwrongdocumenterr") != null) return;
+ var doc1;
+ var doc2;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var newAttribute;
+ var setNode;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "staff");
+ elementList = doc1.getElementsByTagName("address");
+ testAddress = elementList.item(2);
+ newAttribute = doc2.createAttribute("newAttribute");
+ attributes = testAddress.attributes;
+
+
+ {
+ success = false;
+ try {
+ setNode = attributes.setNamedItem(newAttribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapwrongdocumenterr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchild.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchild.html
new file mode 100644
index 0000000000..6a92521926
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchild.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method adds the node
+ "newChild" to the end of the list of children of the
+ node.
+
+ Retrieve the second employee and append a new Element
+ node to the list of children. The last node in the list
+ is then retrieved and its NodeName examined. The
+ "getNodeName()" method should return "newChild".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function nodeappendchild() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var createdNode;
+ var lchild;
+ var childName;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ createdNode = doc.createElement("newChild");
+ appendedChild = employeeNode.appendChild(createdNode);
+ lchild = employeeNode.lastChild;
+
+ childName = lchild.nodeName;
+
+ assertEquals("nodeAppendChildAssert1","newChild",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildchildexists.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildchildexists.html
new file mode 100644
index 0000000000..0f18a1ac38
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildchildexists.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildchildexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchildchildexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchildchildexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is already in the tree, it is first
+ removed before the new one is appended.
+
+ Retrieve the first child of the second employee and
+ append the first child to the end of the list. After
+ the "appendChild(newChild)" method is invoked the first
+ child should be the one that was second and the last
+ child should be the one that was first.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function nodeappendchildchildexists() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchildchildexists") != null) return;
+ var doc;
+ var elementList;
+ var childNode;
+ var newChild;
+ var lchild;
+ var fchild;
+ var lchildName;
+ var fchildName;
+ var appendedChild;
+ var initialName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ childNode = elementList.item(1);
+ newChild = childNode.firstChild;
+
+ initialName = newChild.nodeName;
+
+ appendedChild = childNode.appendChild(newChild);
+ fchild = childNode.firstChild;
+
+ fchildName = fchild.nodeName;
+
+ lchild = childNode.lastChild;
+
+ lchildName = lchild.nodeName;
+
+
+ if(
+ ("employeeId" == initialName)
+ ) {
+ assertEquals("assert1_nowhitespace","name",fchildName);
+ assertEquals("assert2_nowhitespace","employeeId",lchildName);
+
+ }
+
+ else {
+ assertEquals("assert1","employeeId",fchildName);
+ assertEquals("assert2","#text",lchildName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildchildexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchilddocfragment.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchilddocfragment.html
new file mode 100644
index 0000000000..f7ece16017
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchilddocfragment.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchilddocfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchilddocfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchilddocfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create and populate a new DocumentFragment object and
+ append it to the second employee. After the
+ "appendChild(newChild)" method is invoked retrieve the
+ new nodes at the end of the list, they should be the
+ two Element nodes from the DocumentFragment.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function nodeappendchilddocfragment() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchilddocfragment") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var newdocFragment;
+ var newChild1;
+ var newChild2;
+ var child;
+ var childName;
+ var result = new Array();
+
+ var nodeType;
+ var appendedChild;
+ expected = new Array();
+ expected[0] = "employeeId";
+ expected[1] = "name";
+ expected[2] = "position";
+ expected[3] = "salary";
+ expected[4] = "gender";
+ expected[5] = "address";
+ expected[6] = "newChild1";
+ expected[7] = "newChild2";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ newdocFragment = doc.createDocumentFragment();
+ newChild1 = doc.createElement("newChild1");
+ newChild2 = doc.createElement("newChild2");
+ appendedChild = newdocFragment.appendChild(newChild1);
+ appendedChild = newdocFragment.appendChild(newChild2);
+ appendedChild = employeeNode.appendChild(newdocFragment);
+ for(var indexN65695 = 0;indexN65695 < childList.length; indexN65695++) {
+ child = childList.item(indexN65695);
+ nodeType = child.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+
+ }
+ assertEqualsList("elementNames",expected,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchilddocfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildgetnodename.html
new file mode 100644
index 0000000000..3b0a3e3a93
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildgetnodename.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildgetnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchildgetnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchildgetnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method returns the node
+ added.
+
+ Append a newly created node to the child list of the
+ second employee and check the NodeName returned. The
+ "getNodeName()" method should return "newChild".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function nodeappendchildgetnodename() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchildgetnodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var newChild;
+ var appendNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ newChild = doc.createElement("newChild");
+ appendNode = employeeNode.appendChild(newChild);
+ childName = appendNode.nodeName;
+
+ assertEquals("nodeAppendChildGetNodeNameAssert1","newChild",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildgetnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildinvalidnodetype.html
new file mode 100644
index 0000000000..a044492082
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildinvalidnodetype.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildinvalidnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchildinvalidnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchildinvalidnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if this node is of
+ a type that does not allow children of the type "newChild"
+ to be inserted.
+
+ Retrieve the root node and attempt to append a newly
+ created Attr node. An Element node cannot have children
+ of the "Attr" type, therefore the desired exception
+ should be raised.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodeappendchildinvalidnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchildinvalidnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var newChild;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ rootNode = doc.documentElement;
+
+ newChild = doc.createAttribute("newAttribute");
+
+ {
+ success = false;
+ try {
+ appendedChild = rootNode.appendChild(newChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildinvalidnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnewchilddiffdocument.html
new file mode 100644
index 0000000000..402fdc32c5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnewchilddiffdocument.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnewchilddiffdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchildnewchilddiffdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchildnewchilddiffdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if the "newChild" was
+ created from a different document than the one that
+ created this node.
+
+ Retrieve the second employee and attempt to append
+ a node created from a different document. An attempt
+ to make such a replacement should raise the desired
+ exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodeappendchildnewchilddiffdocument() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchildnewchilddiffdocument") != null) return;
+ var doc1;
+ var doc2;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var appendedChild;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "staff");
+ newChild = doc1.createElement("newChild");
+ elementList = doc2.getElementsByTagName("employee");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ appendedChild = elementNode.appendChild(newChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnewchilddiffdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnodeancestor.html
new file mode 100644
index 0000000000..350ff083fa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnodeancestor.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnodeancestor</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchildnodeancestor'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchildnodeancestor';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if the node to
+ append is one of this node's ancestors.
+
+ Retrieve the second employee and attempt to append
+ an ancestor node(root node) to it.
+ An attempt to make such an addition should raise the
+ desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodeappendchildnodeancestor() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchildnodeancestor") != null) return;
+ var doc;
+ var newChild;
+ var elementList;
+ var employeeNode;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newChild = doc.documentElement;
+
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ appendedChild = employeeNode.appendChild(newChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnodeancestor</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederr.html
new file mode 100644
index 0000000000..1e6d34cbd6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederr.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchildnomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchildnomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "appendChild(newChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function nodeappendchildnomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchildnomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entRef;
+ var entElement;
+ var createdNode;
+ var appendedNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entRef = genderNode.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+nodeType = entRef.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+
+ }
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+createdNode = doc.createElement("text3");
+
+ {
+ success = false;
+ try {
+ appendedNode = entElement.appendChild(createdNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederrEE.html
new file mode 100644
index 0000000000..57f1730eba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederrEE.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeappendchildnomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeappendchildnomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "appendChild(newChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an ent4 entity reference and the "appendChild(newChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederr.xml
+*/
+function nodeappendchildnomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "nodeappendchildnomodificationallowederrEE") != null) return;
+ var doc;
+ var entRef;
+ var createdNode;
+ var appendedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+createdNode = doc.createElement("text3");
+
+ {
+ success = false;
+ try {
+ appendedNode = entRef.appendChild(createdNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodeattribute.html
new file mode 100644
index 0000000000..3a35eaef28
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodeattribute.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodeattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeattributenodeattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeattributenodeattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getAttributes()" method invoked on an Attribute
+Node returns null.
+
+Retrieve the first attribute from the last child of the
+first employee and invoke the "getAttributes()" method
+on the Attribute Node. It should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
+*/
+function nodeattributenodeattribute() {
+ var success;
+ if(checkInitialization(builder, "nodeattributenodeattribute") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrNode;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.attributes;
+
+ attrNode = addrAttr.item(0);
+ attrList = attrNode.attributes;
+
+ assertNull("nodeAttributeNodeAttributeAssert1",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodeattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodename.html
new file mode 100644
index 0000000000..f62adb4f17
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodename.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeattributenodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeattributenodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The string returned by the "getNodeName()" method for an
+
+ Attribute Node is the name of the Attribute.
+
+
+
+ Retrieve the Attribute named "domestic" from the last
+
+ child of the first employee and check the string returned
+
+ by the "getNodeName()" method. It should be equal to
+
+ "domestic".
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodeattributenodename() {
+ var success;
+ if(checkInitialization(builder, "nodeattributenodename") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNode("domestic");
+ attrName = addrAttr.nodeName;
+
+ assertEquals("nodeAttributeNodeNameAssert1","domestic",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodetype.html
new file mode 100644
index 0000000000..3b5b4e492b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodetype.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeattributenodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeattributenodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getNodeType()" method for an Attribute Node
+
+ returns the constant value 2.
+
+
+
+ Retrieve the first attribute from the last child of
+
+ the first employee and invoke the "getNodeType()"
+
+ method. The method should return 2.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodeattributenodetype() {
+ var success;
+ if(checkInitialization(builder, "nodeattributenodetype") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNode("domestic");
+ nodeType = addrAttr.nodeType;
+
+ assertEquals("nodeAttrNodeTypeAssert1",2,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodevalue.html
new file mode 100644
index 0000000000..9a90ed90c3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodevalue.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeattributenodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeattributenodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The string returned by the "getNodeValue()" method for an
+
+ Attribute Node is the value of the Attribute.
+
+
+
+ Retrieve the Attribute named "domestic" from the last
+
+ child of the first employee and check the string returned
+
+ by the "getNodeValue()" method. It should be equal to
+
+ "Yes".
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodeattributenodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodeattributenodevalue") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNode("domestic");
+ attrValue = addrAttr.nodeValue;
+
+ assertEquals("nodeAttributeNodeValueAssert1","Yes",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodeattribute.html
new file mode 100644
index 0000000000..da9d1323b9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodeattribute.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodeattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecdatasectionnodeattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecdatasectionnodeattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getAttributes()" method invoked on a CDATASection
+Node returns null.
+
+Retrieve the CDATASection node contained inside the
+second child of the second employee and invoke the
+"getAttributes()" method on the CDATASection node.
+It should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212
+*/
+function nodecdatasectionnodeattribute() {
+ var success;
+ if(checkInitialization(builder, "nodecdatasectionnodeattribute") != null) return;
+ var doc;
+ var elementList;
+ var cdataName;
+ var cdataNode;
+ var attrList;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ cdataName = elementList.item(1);
+ cdataNode = cdataName.lastChild;
+
+ nodeType = cdataNode.nodeType;
+
+
+ if(
+ !(4 == nodeType)
+ ) {
+ cdataNode = doc.createCDATASection("");
+
+ }
+ attrList = cdataNode.attributes;
+
+ assertNull("cdataSection",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodeattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodename.html
new file mode 100644
index 0000000000..d339553d8c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodename.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecdatasectionnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecdatasectionnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ CDATASection Node is #cdata-section".
+
+ Retrieve the CDATASection node inside the second child
+ of the second employee and check the string returned
+ by the "getNodeName()" method. It should be equal to
+ "#cdata-section".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212
+*/
+function nodecdatasectionnodename() {
+ var success;
+ if(checkInitialization(builder, "nodecdatasectionnodename") != null) return;
+ var doc;
+ var elementList;
+ var cdataName;
+ var cdataNode;
+ var nodeType;
+ var cdataNodeName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ cdataName = elementList.item(1);
+ cdataNode = cdataName.lastChild;
+
+ nodeType = cdataNode.nodeType;
+
+
+ if(
+ !(4 == nodeType)
+ ) {
+ cdataNode = doc.createCDATASection("");
+
+ }
+ cdataNodeName = cdataNode.nodeName;
+
+ assertEquals("cdataNodeName","#cdata-section",cdataNodeName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodetype.html
new file mode 100644
index 0000000000..3b0b799607
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodetype.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecdatasectionnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("coalescing", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecdatasectionnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for a CDATASection Node
+ returns the constant value 4.
+
+ Retrieve the CDATASection node contained inside the
+ second child of the second employee and invoke the
+ "getNodeType()" method. The method should return 4.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212
+*/
+function nodecdatasectionnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodecdatasectionnodetype") != null) return;
+ var doc;
+ var elementList;
+ var testName;
+ var cdataNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ testName = elementList.item(1);
+ cdataNode = testName.lastChild;
+
+ nodeType = cdataNode.nodeType;
+
+
+ if(
+ (3 == nodeType)
+ ) {
+ cdataNode = doc.createCDATASection("");
+ nodeType = cdataNode.nodeType;
+
+
+ }
+ assertEquals("nodeTypeCDATA",4,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodevalue.html
new file mode 100644
index 0000000000..5cec6dc002
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodevalue.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecdatasectionnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("coalescing", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecdatasectionnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ CDATASection Node is the content of the CDATASection.
+
+ Retrieve the CDATASection node inside the second child
+ of the second employee and check the string returned
+ by the "getNodeValue()" method. It should be equal to
+ "This is a CDATA Section with EntityReference number 2
+ &ent2;".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212
+*/
+function nodecdatasectionnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodecdatasectionnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var cdataName;
+ var childList;
+ var child;
+ var cdataNodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ cdataName = elementList.item(1);
+ childList = cdataName.childNodes;
+
+ child = childList.item(1);
+
+ if(
+
+ (child == null)
+
+ ) {
+ child = doc.createCDATASection("This is a CDATASection with EntityReference number 2 &ent2;");
+
+ }
+ cdataNodeValue = child.nodeValue;
+
+ assertEquals("value","This is a CDATASection with EntityReference number 2 &ent2;",cdataNodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodechildnodes.html b/dom/tests/mochitest/dom-level1-core/test_nodechildnodes.html
new file mode 100644
index 0000000000..66a9fe8101
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodechildnodes.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodechildnodes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodechildnodes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Collect the element names from Node.childNodes and check against expectations.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+*/
+function nodechildnodes() {
+ var success;
+ if(checkInitialization(builder, "nodechildnodes") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childNodes;
+ var childNode;
+ var childType;
+ var childName;
+ var elementNames = new Array();
+
+ expectedElementNames = new Array();
+ expectedElementNames[0] = "employeeId";
+ expectedElementNames[1] = "name";
+ expectedElementNames[2] = "position";
+ expectedElementNames[3] = "salary";
+ expectedElementNames[4] = "gender";
+ expectedElementNames[5] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childNodes = employeeNode.childNodes;
+
+ for(var indexN65644 = 0;indexN65644 < childNodes.length; indexN65644++) {
+ childNode = childNodes.item(indexN65644);
+ childType = childNode.nodeType;
+
+
+ if(
+ (1 == childType)
+ ) {
+ childName = childNode.nodeName;
+
+ elementNames[elementNames.length] = childName;
+
+ }
+
+ }
+ assertEqualsList("elementNames",expectedElementNames,elementNames);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodechildnodesappendchild.html b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesappendchild.html
new file mode 100644
index 0000000000..53d00b5aa3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesappendchild.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesappendchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodechildnodesappendchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodechildnodesappendchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Add an element and check that the previously retrieved childNodes NodeList
+is live.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
+*/
+function nodechildnodesappendchild() {
+ var success;
+ if(checkInitialization(builder, "nodechildnodesappendchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var createdNode;
+ var expectedLength;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ expectedLength = childList.length;
+
+ expectedLength += 1;
+createdNode = doc.createElement("text3");
+ employeeNode = employeeNode.appendChild(createdNode);
+ length = childList.length;
+
+ assertEquals("childNodeLength",expectedLength,length);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesappendchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodechildnodesempty.html b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesempty.html
new file mode 100644
index 0000000000..81214fd47e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesempty.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesempty</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodechildnodesempty'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodechildnodesempty';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getChildNodes()" method returns a NodeList
+ that contains all children of this node. If there
+ are not any children, this is a NodeList that does not
+ contain any nodes.
+
+ Retrieve the Text node from the second child of the second
+ employee and invoke the "getChildNodes()" method. The
+ NodeList returned should not have any nodes.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+*/
+function nodechildnodesempty() {
+ var success;
+ if(checkInitialization(builder, "nodechildnodesempty") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var secondCNode;
+ var textNode;
+ var childNodesList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ secondCNode = childList.item(1);
+ textNode = secondCNode.firstChild;
+
+ childNodesList = textNode.childNodes;
+
+ assertSize("nodeChildNodesEmptyAssert1",0,childNodesList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesempty</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecloneattributescopied.html b/dom/tests/mochitest/dom-level1-core/test_nodecloneattributescopied.html
new file mode 100644
index 0000000000..1f20d47bd1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecloneattributescopied.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecloneattributescopied</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecloneattributescopied'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecloneattributescopied';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the cloneNode method is used to clone an
+ Element node, all the attributes of the Element are
+ copied along with their values.
+
+ Retrieve the last child of the second employee and invoke
+ the cloneNode method. The
+ duplicate node returned by the method should copy the
+ attributes associated with this node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function nodecloneattributescopied() {
+ var success;
+ if(checkInitialization(builder, "nodecloneattributescopied") != null) return;
+ var doc;
+ var elementList;
+ var addressNode;
+ var clonedNode;
+ var attributes;
+ var attributeNode;
+ var attributeName;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "domestic";
+ expectedResult[1] = "street";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ addressNode = elementList.item(1);
+ clonedNode = addressNode.cloneNode(false);
+ attributes = clonedNode.attributes;
+
+ for(var indexN65637 = 0;indexN65637 < attributes.length; indexN65637++) {
+ attributeNode = attributes.item(indexN65637);
+ attributeName = attributeNode.nodeName;
+
+ result[result.length] = attributeName;
+
+ }
+ assertEqualsCollection("nodeCloneAttributesCopiedAssert1",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecloneattributescopied</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonefalsenocopytext.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonefalsenocopytext.html
new file mode 100644
index 0000000000..1d5d510d61
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonefalsenocopytext.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonefalsenocopytext</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeclonefalsenocopytext'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeclonefalsenocopytext';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "cloneNode(deep)" method does not copy text unless it
+ is deep cloned.(Test for deep=false)
+
+ Retrieve the fourth child of the second employee and
+ the "cloneNode(deep)" method with deep=false. The
+ duplicate node returned by the method should not copy
+ any text data contained in this node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function nodeclonefalsenocopytext() {
+ var success;
+ if(checkInitialization(builder, "nodeclonefalsenocopytext") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var childNode;
+ var clonedNode;
+ var lastChildNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ childNode = childList.item(3);
+ clonedNode = childNode.cloneNode(false);
+ lastChildNode = clonedNode.lastChild;
+
+ assertNull("noTextNodes",lastChildNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonefalsenocopytext</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonegetparentnull.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonegetparentnull.html
new file mode 100644
index 0000000000..f9b78e1d32
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonegetparentnull.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonegetparentnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeclonegetparentnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeclonegetparentnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The duplicate node returned by the "cloneNode(deep)"
+ method does not have a ParentNode.
+
+ Retrieve the second employee and invoke the
+ "cloneNode(deep)" method with deep=false. The
+ duplicate node returned should return null when the
+ "getParentNode()" is invoked.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function nodeclonegetparentnull() {
+ var success;
+ if(checkInitialization(builder, "nodeclonegetparentnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var clonedNode;
+ var parentNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ clonedNode = employeeNode.cloneNode(false);
+ parentNode = clonedNode.parentNode;
+
+ assertNull("nodeCloneGetParentNullAssert1",parentNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonegetparentnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonenodefalse.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodefalse.html
new file mode 100644
index 0000000000..09c3994559
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodefalse.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodefalse</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeclonenodefalse'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeclonenodefalse';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "cloneNode(deep)" method returns a copy of the node
+ only if deep=false.
+
+ Retrieve the second employee and invoke the
+ "cloneNode(deep)" method with deep=false. The
+ method should only clone this node. The NodeName and
+ length of the NodeList are checked. The "getNodeName()"
+ method should return "employee" and the "getLength()"
+ method should return 0.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function nodeclonenodefalse() {
+ var success;
+ if(checkInitialization(builder, "nodeclonenodefalse") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var clonedNode;
+ var cloneName;
+ var cloneChildren;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ clonedNode = employeeNode.cloneNode(false);
+ cloneName = clonedNode.nodeName;
+
+ assertEquals("name","employee",cloneName);
+ cloneChildren = clonedNode.childNodes;
+
+ length = cloneChildren.length;
+
+ assertEquals("length",0,length);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodefalse</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonenodetrue.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodetrue.html
new file mode 100644
index 0000000000..6a66b1f5b9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodetrue.html
@@ -0,0 +1,185 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodetrue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeclonenodetrue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeclonenodetrue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "cloneNode(deep)" method returns a copy of the node
+ and the subtree under it if deep=true.
+
+ Retrieve the second employee and invoke the
+ "cloneNode(deep)" method with deep=true. The
+ method should clone this node and the subtree under it.
+ The NodeName of each child in the returned node is
+ checked to insure the entire subtree under the second
+ employee was cloned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function nodeclonenodetrue() {
+ var success;
+ if(checkInitialization(builder, "nodeclonenodetrue") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var clonedNode;
+ var clonedList;
+ var clonedChild;
+ var clonedChildName;
+ var length;
+ var result = new Array();
+
+ expectedWhitespace = new Array();
+ expectedWhitespace[0] = "#text";
+ expectedWhitespace[1] = "employeeId";
+ expectedWhitespace[2] = "#text";
+ expectedWhitespace[3] = "name";
+ expectedWhitespace[4] = "#text";
+ expectedWhitespace[5] = "position";
+ expectedWhitespace[6] = "#text";
+ expectedWhitespace[7] = "salary";
+ expectedWhitespace[8] = "#text";
+ expectedWhitespace[9] = "gender";
+ expectedWhitespace[10] = "#text";
+ expectedWhitespace[11] = "address";
+ expectedWhitespace[12] = "#text";
+
+ expectedNoWhitespace = new Array();
+ expectedNoWhitespace[0] = "employeeId";
+ expectedNoWhitespace[1] = "name";
+ expectedNoWhitespace[2] = "position";
+ expectedNoWhitespace[3] = "salary";
+ expectedNoWhitespace[4] = "gender";
+ expectedNoWhitespace[5] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ length = childList.length;
+
+ clonedNode = employeeNode.cloneNode(true);
+ clonedList = clonedNode.childNodes;
+
+ for(var indexN65710 = 0;indexN65710 < clonedList.length; indexN65710++) {
+ clonedChild = clonedList.item(indexN65710);
+ clonedChildName = clonedChild.nodeName;
+
+ result[result.length] = clonedChildName;
+
+ }
+
+ if(
+ (6 == length)
+ ) {
+ assertEqualsList("nowhitespace",expectedNoWhitespace,result);
+
+ }
+
+ else {
+ assertEqualsList("whitespace",expectedWhitespace,result);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodetrue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonetruecopytext.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonetruecopytext.html
new file mode 100644
index 0000000000..defb3c8b39
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonetruecopytext.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonetruecopytext</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeclonetruecopytext'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeclonetruecopytext';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second salary and
+ the "cloneNode(deep)" method with deep=true. The
+ duplicate node returned by the method should copy
+ any text data contained in this node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
+*/
+function nodeclonetruecopytext() {
+ var success;
+ if(checkInitialization(builder, "nodeclonetruecopytext") != null) return;
+ var doc;
+ var elementList;
+ var childList;
+ var childNode;
+ var clonedNode;
+ var lastChildNode;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("salary");
+ childNode = elementList.item(1);
+ clonedNode = childNode.cloneNode(true);
+ lastChildNode = clonedNode.lastChild;
+
+ childValue = lastChildNode.nodeValue;
+
+ assertEquals("nodeCloneTrueCopyTextAssert1","35,000",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonetruecopytext</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodeattributes.html
new file mode 100644
index 0000000000..b4030d6854
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodeattributes.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecommentnodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecommentnodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributes()" method invoked on a Comment
+ Node returns null.
+
+ Find any comment that is an immediate child of the root
+ and assert that Node.attributes is null. Then create
+ a new comment node (in case they had been omitted) and
+ make the assertion.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248
+*/
+function nodecommentnodeattributes() {
+ var success;
+ if(checkInitialization(builder, "nodecommentnodeattributes") != null) return;
+ var doc;
+ var childList;
+ var childNode;
+ var attrList;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ childList = doc.childNodes;
+
+ for(var indexN65603 = 0;indexN65603 < childList.length; indexN65603++) {
+ childNode = childList.item(indexN65603);
+ nodeType = childNode.nodeType;
+
+
+ if(
+ (8 == nodeType)
+ ) {
+ attrList = childNode.attributes;
+
+ assertNull("attributesNull",attrList);
+
+ }
+
+ }
+ childNode = doc.createComment("This is a comment");
+ attrList = childNode.attributes;
+
+ assertNull("createdAttributesNull",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodename.html
new file mode 100644
index 0000000000..062c3a989d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodename.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecommentnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecommentnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ Comment Node is "#comment".
+
+ Retrieve the Comment node in the XML file
+ and check the string returned by the "getNodeName()"
+ method. It should be equal to "#comment".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+*/
+function nodecommentnodename() {
+ var success;
+ if(checkInitialization(builder, "nodecommentnodename") != null) return;
+ var doc;
+ var elementList;
+ var commentNode;
+ var nodeType;
+ var commentNodeName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.childNodes;
+
+ for(var indexN65600 = 0;indexN65600 < elementList.length; indexN65600++) {
+ commentNode = elementList.item(indexN65600);
+ nodeType = commentNode.nodeType;
+
+
+ if(
+ (8 == nodeType)
+ ) {
+ commentNodeName = commentNode.nodeName;
+
+ assertEquals("commentNodeName","#comment",commentNodeName);
+
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodetype.html
new file mode 100644
index 0000000000..4455d4e219
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodetype.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecommentnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecommentnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for a Comment Node
+ returns the constant value 8.
+
+ Retrieve the nodes from the document and check for
+ a comment node and invoke the "getNodeType()" method. This should
+ return 8.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+*/
+function nodecommentnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodecommentnodetype") != null) return;
+ var doc;
+ var testList;
+ var commentNode;
+ var commentNodeName;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ testList = doc.childNodes;
+
+ for(var indexN65600 = 0;indexN65600 < testList.length; indexN65600++) {
+ commentNode = testList.item(indexN65600);
+ commentNodeName = commentNode.nodeName;
+
+
+ if(
+ ("#comment" == commentNodeName)
+ ) {
+ nodeType = commentNode.nodeType;
+
+ assertEquals("nodeCommentNodeTypeAssert1",8,nodeType);
+
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodevalue.html
new file mode 100644
index 0000000000..c99474b071
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodevalue.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodecommentnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodecommentnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Comment Node is the content of the comment.
+
+ Retrieve the comment in the XML file and
+ check the string returned by the "getNodeValue()" method.
+ It should be equal to "This is comment number 1".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+*/
+function nodecommentnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodecommentnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var commentNode;
+ var commentName;
+ var commentValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.childNodes;
+
+ for(var indexN65600 = 0;indexN65600 < elementList.length; indexN65600++) {
+ commentNode = elementList.item(indexN65600);
+ commentName = commentNode.nodeName;
+
+
+ if(
+ ("#comment" == commentName)
+ ) {
+ commentValue = commentNode.nodeValue;
+
+ assertEquals("value"," This is comment number 1.",commentValue);
+
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodename.html
new file mode 100644
index 0000000000..8914268b84
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodename.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumentfragmentnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumentfragmentnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ DocumentFragment Node is "#document-frament".
+
+ Retrieve the DOM document and invoke the
+ "createDocumentFragment()" method and check the string
+ returned by the "getNodeName()" method. It should be
+ equal to "#document-fragment".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+*/
+function nodedocumentfragmentnodename() {
+ var success;
+ if(checkInitialization(builder, "nodedocumentfragmentnodename") != null) return;
+ var doc;
+ var docFragment;
+ var documentFragmentName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docFragment = doc.createDocumentFragment();
+ documentFragmentName = docFragment.nodeName;
+
+ assertEquals("nodeDocumentFragmentNodeNameAssert1","#document-fragment",documentFragmentName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodetype.html
new file mode 100644
index 0000000000..0b23789595
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodetype.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumentfragmentnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumentfragmentnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for a DocumentFragment Node
+ returns the constant value 11.
+
+ Invoke the "createDocumentFragment()" method and
+ examine the NodeType of the document fragment
+ returned by the "getNodeType()" method. The method
+ should return 11.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+*/
+function nodedocumentfragmentnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodedocumentfragmentnodetype") != null) return;
+ var doc;
+ var documentFragmentNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ documentFragmentNode = doc.createDocumentFragment();
+ nodeType = documentFragmentNode.nodeType;
+
+ assertEquals("nodeDocumentFragmentNodeTypeAssert1",11,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodevalue.html
new file mode 100644
index 0000000000..b3408632fe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodevalue.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumentfragmentnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumentfragmentnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ DocumentFragment Node is null.
+
+ Retrieve the DOM document and invoke the
+ "createDocumentFragment()" method and check the string
+ returned by the "getNodeValue()" method. It should be
+ equal to null.
+
+* @author NIST
+* @author Mary Brady
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function nodedocumentfragmentnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodedocumentfragmentnodevalue") != null) return;
+ var doc;
+ var docFragment;
+ var attrList;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docFragment = doc.createDocumentFragment();
+ attrList = docFragment.attributes;
+
+ assertNull("attributesNull",attrList);
+ value = docFragment.nodeValue;
+
+ assertNull("initiallyNull",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodeattribute.html
new file mode 100644
index 0000000000..afa8baad29
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodeattribute.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodeattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumentnodeattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumentnodeattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getAttributes()" method invoked on a Document
+Node returns null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+*/
+function nodedocumentnodeattribute() {
+ var success;
+ if(checkInitialization(builder, "nodedocumentnodeattribute") != null) return;
+ var doc;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ attrList = doc.attributes;
+
+ assertNull("documentAttributesNull",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodeattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodename.html
new file mode 100644
index 0000000000..e2084935bd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodename.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumentnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumentnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ Document Node is "#document".
+
+ Retrieve the DOM document and check the string returned
+ by the "getNodeName()" method. It should be equal to
+ "#document".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodedocumentnodename() {
+ var success;
+ if(checkInitialization(builder, "nodedocumentnodename") != null) return;
+ var doc;
+ var documentName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ documentName = doc.nodeName;
+
+ assertEquals("documentNodeName","#document",documentName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodetype.html
new file mode 100644
index 0000000000..e6a6548358
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodetype.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumentnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumentnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getNodeType()" method for a Document Node
+returns the constant value 9.
+
+Retrieve the document and invoke the "getNodeType()"
+method. The method should return 9.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodedocumentnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodedocumentnodetype") != null) return;
+ var doc;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ nodeType = doc.nodeType;
+
+ assertEquals("nodeDocumentNodeTypeAssert1",9,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodevalue.html
new file mode 100644
index 0000000000..783847ecfd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodevalue.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumentnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumentnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Document Node is null.
+
+ Retrieve the DOM Document and check the string returned
+ by the "getNodeValue()" method. It should be equal to
+ null.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodedocumentnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodedocumentnodevalue") != null) return;
+ var doc;
+ var documentValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ documentValue = doc.nodeValue;
+
+ assertNull("documentNodeValueNull",documentValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodename.html
new file mode 100644
index 0000000000..0346fce8bc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodename.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumenttypenodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumenttypenodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the DOCTYPE declaration from the XML file and
+ check the string returned by the "getNodeName()"
+ method. It should be equal to "staff" or "svg".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodedocumenttypenodename() {
+ var success;
+ if(checkInitialization(builder, "nodedocumenttypenodename") != null) return;
+ var doc;
+ var docType;
+ var documentTypeName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+documentTypeName = docType.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("doctypeNameSVG","svg",documentTypeName);
+
+ }
+
+ else {
+ assertEquals("documentName","staff",documentTypeName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodetype.html
new file mode 100644
index 0000000000..914e2ee8ae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodetype.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumenttypenodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumenttypenodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for a DocumentType Node
+ returns the constant value 10.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodedocumenttypenodetype() {
+ var success;
+ if(checkInitialization(builder, "nodedocumenttypenodetype") != null) return;
+ var doc;
+ var documentTypeNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ documentTypeNode = doc.doctype;
+
+ assertNotNull("doctypeNotNull",documentTypeNode);
+nodeType = documentTypeNode.nodeType;
+
+ assertEquals("nodeType",10,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodevalue.html
new file mode 100644
index 0000000000..021dc8e59c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodevalue.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodedocumenttypenodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodedocumenttypenodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ DocumentType Node is null.
+
+* @author NIST
+* @author Mary Brady
+*/
+function nodedocumenttypenodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodedocumenttypenodevalue") != null) return;
+ var doc;
+ var docType;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+attrList = docType.attributes;
+
+ assertNull("doctypeAttributesNull",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodeattributes.html
new file mode 100644
index 0000000000..4cd9bbc39d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodeattributes.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeelementnodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeelementnodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributes()" method invoked on an Element
+ Node returns a NamedNodeMap containing the attributes
+ of this node.
+
+ Retrieve the last child of the third employee and
+ invoke the "getAttributes()" method. It should return
+ a NamedNodeMap containing the attributes of the Element
+ node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function nodeelementnodeattributes() {
+ var success;
+ if(checkInitialization(builder, "nodeelementnodeattributes") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrNode;
+ var attrName;
+ var attrList = new Array();
+
+ expected = new Array();
+ expected[0] = "domestic";
+ expected[1] = "street";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(2);
+ addrAttr = testAddr.attributes;
+
+ for(var indexN65628 = 0;indexN65628 < addrAttr.length; indexN65628++) {
+ attrNode = addrAttr.item(indexN65628);
+ attrName = attrNode.nodeName;
+
+ attrList[attrList.length] = attrName;
+
+ }
+ assertEqualsCollection("nodeElementNodeValueAssert1",expected,attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodename.html
new file mode 100644
index 0000000000..6f8aefa612
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodename.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeelementnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeelementnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The string returned by the "getNodeName()" method for an
+
+ Element Node is its tagName.
+
+
+
+ Retrieve the first Element Node(Root Node) of the
+
+ DOM object and check the string returned by the
+
+ "getNodeName()" method. It should be equal to its
+
+ tagName.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function nodeelementnodename() {
+ var success;
+ if(checkInitialization(builder, "nodeelementnodename") != null) return;
+ var doc;
+ var elementNode;
+ var elementName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementNode = doc.documentElement;
+
+ elementName = elementNode.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgNodeName","svg",elementName);
+
+ }
+
+ else {
+ assertEquals("nodeElementNodeNameAssert1","staff",elementName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodetype.html
new file mode 100644
index 0000000000..8b4b5f2513
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodetype.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeelementnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeelementnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for an Element Node
+ returns the constant value 1.
+
+ Retrieve the root node and invoke the "getNodeType()"
+ method. The method should return 1.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodeelementnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodeelementnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ rootNode = doc.documentElement;
+
+ nodeType = rootNode.nodeType;
+
+ assertEquals("nodeElementNodeTypeAssert1",1,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodevalue.html
new file mode 100644
index 0000000000..16a386b9d5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodevalue.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeelementnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeelementnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for an
+ Element Node is null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodeelementnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodeelementnodevalue") != null) return;
+ var doc;
+ var elementNode;
+ var elementValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementNode = doc.documentElement;
+
+ elementValue = elementNode.nodeValue;
+
+ assertNull("elementNodeValueNull",elementValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodeattributes.html
new file mode 100644
index 0000000000..67da4862eb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodeattributes.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentitynodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentitynodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributes()" method invoked on an Entity
+ Node returns null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function nodeentitynodeattributes() {
+ var success;
+ if(checkInitialization(builder, "nodeentitynodeattributes") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var entityNode;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+entityNode = entities.getNamedItem("ent1");
+ assertNotNull("ent1NotNull",entityNode);
+attrList = entityNode.attributes;
+
+ assertNull("entityAttributesNull",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodename.html
new file mode 100644
index 0000000000..41ca8950a1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodename.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentitynodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentitynodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Check the nodeName of the entity returned by DocumentType.entities.getNamedItem("ent1").
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodeentitynodename() {
+ var success;
+ if(checkInitialization(builder, "nodeentitynodename") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var entityNode;
+ var entityName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+entityNode = entities.getNamedItem("ent1");
+ assertNotNull("entityNodeNotNull",entityNode);
+entityName = entityNode.nodeName;
+
+ assertEquals("entityNodeName","ent1",entityName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodetype.html
new file mode 100644
index 0000000000..14add6004f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodetype.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentitynodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentitynodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for an Entity Node
+ returns the constant value 6.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodeentitynodetype() {
+ var success;
+ if(checkInitialization(builder, "nodeentitynodetype") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var entityNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+entityNode = entities.getNamedItem("ent1");
+ assertNotNull("ent1NotNull",entityNode);
+nodeType = entityNode.nodeType;
+
+ assertEquals("entityNodeType",6,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodevalue.html
new file mode 100644
index 0000000000..c72ee54257
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodevalue.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentitynodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentitynodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for an
+ Entity Node is null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodeentitynodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodeentitynodevalue") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var entityNode;
+ var entityValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+entityNode = entities.getNamedItem("ent1");
+ assertNotNull("ent1NotNull",entityNode);
+entityValue = entityNode.nodeValue;
+
+ assertNull("entityNodeValue",entityValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodeattributes.html
new file mode 100644
index 0000000000..8f3e45e7cf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodeattributes.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentityreferencenodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentityreferencenodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributes()" method invoked on an EntityReference
+ Node returns null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function nodeentityreferencenodeattributes() {
+ var success;
+ if(checkInitialization(builder, "nodeentityreferencenodeattributes") != null) return;
+ var doc;
+ var elementList;
+ var entRefAddr;
+ var entRefNode;
+ var attrList;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ entRefAddr = elementList.item(1);
+ entRefNode = entRefAddr.firstChild;
+
+ nodeType = entRefNode.nodeType;
+
+
+ if(
+ !(5 == nodeType)
+ ) {
+ entRefNode = doc.createEntityReference("ent2");
+ assertNotNull("createdEntRefNotNull",entRefNode);
+
+ }
+ attrList = entRefNode.attributes;
+
+ assertNull("attrList",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodename.html
new file mode 100644
index 0000000000..a1c3318e6f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodename.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentityreferencenodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentityreferencenodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for an
+ EntityReference Node is the name of the entity referenced.
+
+ Retrieve the first Entity Reference node from the last
+ child of the second employee and check the string
+ returned by the "getNodeName()" method. It should be
+ equal to "ent2".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodeentityreferencenodename() {
+ var success;
+ if(checkInitialization(builder, "nodeentityreferencenodename") != null) return;
+ var doc;
+ var elementList;
+ var entRefAddr;
+ var entRefNode;
+ var entRefName;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ entRefAddr = elementList.item(1);
+ entRefNode = entRefAddr.firstChild;
+
+ nodeType = entRefNode.nodeType;
+
+
+ if(
+ !(5 == nodeType)
+ ) {
+ entRefNode = doc.createEntityReference("ent2");
+ assertNotNull("createdEntRefNotNull",entRefNode);
+
+ }
+ entRefName = entRefNode.nodeName;
+
+ assertEquals("nodeEntityReferenceNodeNameAssert1","ent2",entRefName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodetype.html
new file mode 100644
index 0000000000..6d8fccc53f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodetype.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentityreferencenodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentityreferencenodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for an EntityReference Node
+ returns the constant value 5.
+
+ Retrieve the EntityReference node from the last child
+ of the second employee and invoke the "getNodeType()"
+ method. The method should return 5.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodeentityreferencenodetype() {
+ var success;
+ if(checkInitialization(builder, "nodeentityreferencenodetype") != null) return;
+ var doc;
+ var elementList;
+ var entRefAddr;
+ var entRefNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ entRefAddr = elementList.item(1);
+ entRefNode = entRefAddr.firstChild;
+
+ nodeType = entRefNode.nodeType;
+
+
+ if(
+ (3 == nodeType)
+ ) {
+ entRefNode = doc.createEntityReference("ent2");
+ assertNotNull("createdEntRefNotNull",entRefNode);
+nodeType = entRefNode.nodeType;
+
+
+ }
+ assertEquals("entityNodeType",5,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodevalue.html
new file mode 100644
index 0000000000..47611df024
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodevalue.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentityreferencenodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentityreferencenodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for an
+ EntityReference Node is null.
+
+ Retrieve the first Entity Reference node from the last
+ child of the second employee and check the string
+ returned by the "getNodeValue()" method. It should be
+ equal to null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodeentityreferencenodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodeentityreferencenodevalue") != null) return;
+ var doc;
+ var elementList;
+ var entRefAddr;
+ var entRefNode;
+ var entRefValue;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ entRefAddr = elementList.item(1);
+ entRefNode = entRefAddr.firstChild;
+
+ nodeType = entRefNode.nodeType;
+
+
+ if(
+ (3 == nodeType)
+ ) {
+ entRefNode = doc.createEntityReference("ent2");
+ assertNotNull("createdEntRefNotNull",entRefNode);
+
+ }
+ entRefValue = entRefNode.nodeValue;
+
+ assertNull("entRefNodeValue",entRefValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitysetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitysetnodevalue.html
new file mode 100644
index 0000000000..3bbec6d527
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitysetnodevalue.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitysetnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeentitysetnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeentitysetnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for an
+ Entity Node is always null and "setNodeValue" should have no effect.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2
+*/
+function nodeentitysetnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodeentitysetnodevalue") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var entityNode;
+ var entityValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+entityNode = entities.getNamedItem("ent1");
+ assertNotNull("ent1NotNull",entityNode);
+entityNode.nodeValue = "This should have no effect";
+
+ entityValue = entityNode.nodeValue;
+
+ assertNull("nodeValueNull",entityValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitysetnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchild.html b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchild.html
new file mode 100644
index 0000000000..dc6468fe59
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchild.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetfirstchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetfirstchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getFirstChild()" method returns the first child
+ of this node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388
+*/
+function nodegetfirstchild() {
+ var success;
+ if(checkInitialization(builder, "nodegetfirstchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var fchildNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ fchildNode = employeeNode.firstChild;
+
+ childName = fchildNode.nodeName;
+
+
+ if(
+ ("#text" == childName)
+ ) {
+ fchildNode = fchildNode.nextSibling;
+
+ childName = fchildNode.nodeName;
+
+
+ }
+ assertEquals("nodeName","employeeId",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchildnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchildnull.html
new file mode 100644
index 0000000000..e2d6d60309
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchildnull.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchildnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetfirstchildnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetfirstchildnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ If there is not a first child then the "getFirstChild()"
+
+ method returns null.
+
+
+
+ Retrieve the Text node form the second child of the first
+
+ employee and invoke the "getFirstChild()" method. It
+
+ should return null.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388
+*/
+function nodegetfirstchildnull() {
+ var success;
+ if(checkInitialization(builder, "nodegetfirstchildnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var secondChildNode;
+ var textNode;
+ var noChildNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(0);
+ employeeList = employeeNode.childNodes;
+
+ secondChildNode = employeeList.item(1);
+ textNode = secondChildNode.firstChild;
+
+ noChildNode = textNode.firstChild;
+
+ assertNull("nodeGetFirstChildNullAssert1",noChildNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchildnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetlastchild.html b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchild.html
new file mode 100644
index 0000000000..04621db853
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchild.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetlastchild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetlastchild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLastChild()" method returns the last child
+ of this node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB
+*/
+function nodegetlastchild() {
+ var success;
+ if(checkInitialization(builder, "nodegetlastchild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var lchildNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ lchildNode = employeeNode.lastChild;
+
+ childName = lchildNode.nodeName;
+
+
+ if(
+ ("#text" == childName)
+ ) {
+ lchildNode = lchildNode.previousSibling;
+
+ childName = lchildNode.nodeName;
+
+
+ }
+ assertEquals("nodeName","address",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetlastchildnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchildnull.html
new file mode 100644
index 0000000000..2050f769dd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchildnull.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchildnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetlastchildnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetlastchildnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ If there is not a last child then the "getLastChild()"
+
+ method returns null.
+
+
+
+ Retrieve the Text node from the second child of the first
+
+ employee and invoke the "getLastChild()" method. It
+
+ should return null.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB
+*/
+function nodegetlastchildnull() {
+ var success;
+ if(checkInitialization(builder, "nodegetlastchildnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var secondChildNode;
+ var textNode;
+ var noChildNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(0);
+ employeeList = employeeNode.childNodes;
+
+ secondChildNode = employeeList.item(1);
+ textNode = secondChildNode.firstChild;
+
+ noChildNode = textNode.lastChild;
+
+ assertNull("nodeGetLastChildNullAssert1",noChildNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchildnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetnextsibling.html b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsibling.html
new file mode 100644
index 0000000000..a174ece9c0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsibling.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsibling</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetnextsibling'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetnextsibling';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNextSibling()" method returns the node immediately
+ following this node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F
+*/
+function nodegetnextsibling() {
+ var success;
+ if(checkInitialization(builder, "nodegetnextsibling") != null) return;
+ var doc;
+ var elementList;
+ var employeeIdNode;
+ var nsNode;
+ var nsName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employeeId");
+ employeeIdNode = elementList.item(1);
+ nsNode = employeeIdNode.nextSibling;
+
+ nsName = nsNode.nodeName;
+
+
+ if(
+ ("#text" == nsName)
+ ) {
+ nsNode = nsNode.nextSibling;
+
+ nsName = nsNode.nodeName;
+
+
+ }
+ assertEquals("nodeName","name",nsName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsibling</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsiblingnull.html
new file mode 100644
index 0000000000..eb243b43f1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsiblingnull.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetnextsiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetnextsiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ If there is not a node immediately following this node the
+
+ "getNextSibling()" method returns null.
+
+
+
+ Retrieve the first child of the second employee and
+
+ invoke the "getNextSibling()" method. It should
+
+ be set to null.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F
+*/
+function nodegetnextsiblingnull() {
+ var success;
+ if(checkInitialization(builder, "nodegetnextsiblingnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var lcNode;
+ var nsNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ lcNode = employeeNode.lastChild;
+
+ nsNode = lcNode.nextSibling;
+
+ assertNull("nodeGetNextSiblingNullAssert1",nsNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocument.html
new file mode 100644
index 0000000000..4a571e6dc0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocument.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetownerdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetownerdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getOwnerDocument()" method returns the Document
+ object associated with this node.
+
+ Retrieve the second employee and examine Document
+ returned by the "getOwnerDocument()" method. Invoke
+ the "getDocumentElement()" on the Document which will
+ return an Element that is equal to "staff".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function nodegetownerdocument() {
+ var success;
+ if(checkInitialization(builder, "nodegetownerdocument") != null) return;
+ var doc;
+ var elementList;
+ var docNode;
+ var ownerDocument;
+ var docElement;
+ var elementName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ docNode = elementList.item(1);
+ ownerDocument = docNode.ownerDocument;
+
+ docElement = ownerDocument.documentElement;
+
+ elementName = docElement.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgTagName","svg",elementName);
+
+ }
+
+ else {
+ assertEquals("nodeGetOwnerDocumentAssert1","staff",elementName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocumentnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocumentnull.html
new file mode 100644
index 0000000000..b53d50c222
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocumentnull.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocumentnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetownerdocumentnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetownerdocumentnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getOwnerDocument()" method returns null if the target
+ node itself is a document.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc
+*/
+function nodegetownerdocumentnull() {
+ var success;
+ if(checkInitialization(builder, "nodegetownerdocumentnull") != null) return;
+ var doc;
+ var ownerDocument;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ ownerDocument = doc.ownerDocument;
+
+ assertNull("documentOwnerDocumentNull",ownerDocument);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocumentnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussibling.html b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussibling.html
new file mode 100644
index 0000000000..34189177b4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussibling.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussibling</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetprevioussibling'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetprevioussibling';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getPreviousSibling()" method returns the node
+ immediately preceding this node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8
+*/
+function nodegetprevioussibling() {
+ var success;
+ if(checkInitialization(builder, "nodegetprevioussibling") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var psNode;
+ var psName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(1);
+ psNode = nameNode.previousSibling;
+
+ psName = psNode.nodeName;
+
+
+ if(
+ ("#text" == psName)
+ ) {
+ psNode = psNode.previousSibling;
+
+ psName = psNode.nodeName;
+
+
+ }
+ assertEquals("nodeName","employeeId",psName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussibling</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussiblingnull.html
new file mode 100644
index 0000000000..df81223251
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussiblingnull.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussiblingnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetprevioussiblingnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetprevioussiblingnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ If there is not a node immediately preceding this node the
+
+ "getPreviousSibling()" method returns null.
+
+
+
+ Retrieve the first child of the second employee and
+
+ invoke the "getPreviousSibling()" method. It should
+
+ be set to null.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8
+*/
+function nodegetprevioussiblingnull() {
+ var success;
+ if(checkInitialization(builder, "nodegetprevioussiblingnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var fcNode;
+ var psNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ fcNode = employeeNode.firstChild;
+
+ psNode = fcNode.previousSibling;
+
+ assertNull("nodeGetPreviousSiblingNullAssert1",psNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussiblingnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodes.html b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodes.html
new file mode 100644
index 0000000000..546c381fa1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodes.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodehaschildnodes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodehaschildnodes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "hasChildNodes()" method returns true if the node
+ has children.
+
+ Retrieve the root node("staff") and invoke the
+ "hasChildNodes()" method. It should return the boolean
+ value "true".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187
+*/
+function nodehaschildnodes() {
+ var success;
+ if(checkInitialization(builder, "nodehaschildnodes") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ state = employeeNode.hasChildNodes();
+ assertTrue("nodeHasChildAssert1",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodesfalse.html b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodesfalse.html
new file mode 100644
index 0000000000..d597fb104a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodesfalse.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodesfalse</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodehaschildnodesfalse'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodehaschildnodesfalse';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "hasChildNodes()" method returns false if the node
+ does not have any children.
+
+ Retrieve the Text node inside the first child of the
+ second employee and invoke the "hasChildNodes()" method.
+ It should return the boolean value "false".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187
+*/
+function nodehaschildnodesfalse() {
+ var success;
+ if(checkInitialization(builder, "nodehaschildnodesfalse") != null) return;
+ var doc;
+ var elementList;
+ var child;
+ var employeeIdList;
+ var employeeNode;
+ var textNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ child = elementList.item(1);
+ employeeIdList = child.childNodes;
+
+ employeeNode = employeeIdList.item(1);
+ textNode = employeeNode.firstChild;
+
+ state = textNode.hasChildNodes();
+ assertFalse("nodeHasChildFalseAssert1",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodesfalse</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbefore.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbefore.html
new file mode 100644
index 0000000000..f46e30ee9c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbefore.html
@@ -0,0 +1,189 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbefore</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbefore'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbefore';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method inserts the
+ node "newChild" before the node "refChild".
+
+ Insert a newly created Element node before the eigth
+ child of the second employee and check the "newChild"
+ and "refChild" after insertion for correct placement.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function nodeinsertbefore() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbefore") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newChild;
+ var child;
+ var childName;
+ var length;
+ var insertedNode;
+ var actual = new Array();
+
+ expectedWithWhitespace = new Array();
+ expectedWithWhitespace[0] = "#text";
+ expectedWithWhitespace[1] = "employeeId";
+ expectedWithWhitespace[2] = "#text";
+ expectedWithWhitespace[3] = "name";
+ expectedWithWhitespace[4] = "#text";
+ expectedWithWhitespace[5] = "position";
+ expectedWithWhitespace[6] = "#text";
+ expectedWithWhitespace[7] = "newChild";
+ expectedWithWhitespace[8] = "salary";
+ expectedWithWhitespace[9] = "#text";
+ expectedWithWhitespace[10] = "gender";
+ expectedWithWhitespace[11] = "#text";
+ expectedWithWhitespace[12] = "address";
+ expectedWithWhitespace[13] = "#text";
+
+ expectedWithoutWhitespace = new Array();
+ expectedWithoutWhitespace[0] = "employeeId";
+ expectedWithoutWhitespace[1] = "name";
+ expectedWithoutWhitespace[2] = "position";
+ expectedWithoutWhitespace[3] = "newChild";
+ expectedWithoutWhitespace[4] = "salary";
+ expectedWithoutWhitespace[5] = "gender";
+ expectedWithoutWhitespace[6] = "address";
+
+ var expected = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ length = childList.length;
+
+
+ if(
+ (6 == length)
+ ) {
+ refChild = childList.item(3);
+ expected = expectedWithoutWhitespace;
+
+ }
+
+ else {
+ refChild = childList.item(7);
+ expected = expectedWithWhitespace;
+
+ }
+ newChild = doc.createElement("newChild");
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ for(var indexN65756 = 0;indexN65756 < childList.length; indexN65756++) {
+ child = childList.item(indexN65756);
+ childName = child.nodeName;
+
+ actual[actual.length] = childName;
+
+ }
+ assertEqualsList("nodeNames",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbefore</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforedocfragment.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforedocfragment.html
new file mode 100644
index 0000000000..83fc318948
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforedocfragment.html
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforedocfragment</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforedocfragment'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforedocfragment';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is a DocumentFragment object then all
+ its children are inserted in the same order before the
+ the "refChild".
+
+ Create a DocumentFragment object and populate it with
+ two Element nodes. Retrieve the second employee and
+ insert the newly created DocumentFragment before its
+ fourth child. The second employee should now have two
+ extra children("newChild1" and "newChild2") at
+ positions fourth and fifth respectively.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function nodeinsertbeforedocfragment() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforedocfragment") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newdocFragment;
+ var newChild1;
+ var newChild2;
+ var child;
+ var childName;
+ var appendedChild;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ refChild = childList.item(3);
+ newdocFragment = doc.createDocumentFragment();
+ newChild1 = doc.createElement("newChild1");
+ newChild2 = doc.createElement("newChild2");
+ appendedChild = newdocFragment.appendChild(newChild1);
+ appendedChild = newdocFragment.appendChild(newChild2);
+ insertedNode = employeeNode.insertBefore(newdocFragment,refChild);
+ child = childList.item(3);
+ childName = child.nodeName;
+
+ assertEquals("childName3","newChild1",childName);
+ child = childList.item(4);
+ childName = child.nodeName;
+
+ assertEquals("childName4","newChild2",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforedocfragment</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforeinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforeinvalidnodetype.html
new file mode 100644
index 0000000000..b43ceabeb0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforeinvalidnodetype.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforeinvalidnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforeinvalidnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforeinvalidnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if this node is of
+ a type that does not allow children of the type "newChild"
+ to be inserted.
+
+ Retrieve the root node and attempt to insert a newly
+ created Attr node. An Element node cannot have children
+ of the "Attr" type, therefore the desired exception
+ should be raised.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodeinsertbeforeinvalidnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforeinvalidnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var newChild;
+ var elementList;
+ var refChild;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ rootNode = doc.documentElement;
+
+ newChild = doc.createAttribute("newAttribute");
+ elementList = doc.getElementsByTagName("employee");
+ refChild = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ insertedNode = rootNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforeinvalidnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchilddiffdocument.html
new file mode 100644
index 0000000000..5c55425f90
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchilddiffdocument.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchilddiffdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforenewchilddiffdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforenewchilddiffdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if the "newChild" was
+ created from a different document than the one that
+ created this node.
+
+ Retrieve the second employee and attempt to insert a new
+ child that was created from a different document than the
+ one that created the second employee. An attempt to
+ insert such a child should raise the desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function nodeinsertbeforenewchilddiffdocument() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforenewchilddiffdocument") != null) return;
+ var doc1;
+ var doc2;
+ var refChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var insertedNode;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "staff");
+ newChild = doc1.createElement("newChild");
+ elementList = doc2.getElementsByTagName("employee");
+ elementNode = elementList.item(1);
+ refChild = elementNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ insertedNode = elementNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchilddiffdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchildexists.html
new file mode 100644
index 0000000000..c60cd8a9d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchildexists.html
@@ -0,0 +1,191 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchildexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforenewchildexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforenewchildexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "newChild" is already in the tree, the
+ "insertBefore(newChild,refChild)" method must first
+ remove it before the insertion takes place.
+
+ Insert a node Element ("employeeId") that is already
+ present in the tree. The existing node should be
+ removed first and the new one inserted. The node is
+ inserted at a different position in the tree to assure
+ that it was indeed inserted.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function nodeinsertbeforenewchildexists() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforenewchildexists") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newChild;
+ var child;
+ var length;
+ var childName;
+ var insertedNode;
+ expectedWhitespace = new Array();
+ expectedWhitespace[0] = "#text";
+ expectedWhitespace[1] = "#text";
+ expectedWhitespace[2] = "name";
+ expectedWhitespace[3] = "#text";
+ expectedWhitespace[4] = "position";
+ expectedWhitespace[5] = "#text";
+ expectedWhitespace[6] = "salary";
+ expectedWhitespace[7] = "#text";
+ expectedWhitespace[8] = "gender";
+ expectedWhitespace[9] = "#text";
+ expectedWhitespace[10] = "employeeId";
+ expectedWhitespace[11] = "address";
+ expectedWhitespace[12] = "#text";
+
+ expectedNoWhitespace = new Array();
+ expectedNoWhitespace[0] = "name";
+ expectedNoWhitespace[1] = "position";
+ expectedNoWhitespace[2] = "salary";
+ expectedNoWhitespace[3] = "gender";
+ expectedNoWhitespace[4] = "employeeId";
+ expectedNoWhitespace[5] = "address";
+
+ var expected = new Array();
+
+ var result = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ length = childList.length;
+
+
+ if(
+ (6 == length)
+ ) {
+ expected = expectedNoWhitespace;
+refChild = childList.item(5);
+ newChild = childList.item(0);
+
+ }
+
+ else {
+ expected = expectedWhitespace;
+refChild = childList.item(11);
+ newChild = childList.item(1);
+
+ }
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ for(var indexN65757 = 0;indexN65757 < childList.length; indexN65757++) {
+ child = childList.item(indexN65757);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+ assertEqualsList("childNames",expected,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchildexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodeancestor.html
new file mode 100644
index 0000000000..35be8ffb61
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodeancestor.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodeancestor</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforenodeancestor'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforenodeancestor';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if the node to be
+ inserted is one of this nodes ancestors.
+
+ Retrieve the second employee and attempt to insert a
+ node that is one of its ancestors(root node). An
+ attempt to insert such a node should raise the
+ desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodeinsertbeforenodeancestor() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforenodeancestor") != null) return;
+ var doc;
+ var newChild;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newChild = doc.documentElement;
+
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ refChild = childList.item(0);
+
+ {
+ success = false;
+ try {
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodeancestor</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodename.html
new file mode 100644
index 0000000000..3ba6abae44
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodename.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforenodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforenodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refchild)" method returns
+ the node being inserted.
+
+ Insert an Element node before the fourth
+ child of the second employee and check the node
+ returned from the "insertBefore(newChild,refChild)"
+ method. The node returned should be "newChild".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function nodeinsertbeforenodename() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforenodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild;
+ var newChild;
+ var insertedNode;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ refChild = childList.item(3);
+ newChild = doc.createElement("newChild");
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ childName = insertedNode.nodeName;
+
+ assertEquals("nodeInsertBeforeNodeNameAssert1","newChild",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederr.html
new file mode 100644
index 0000000000..8d093a0030
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederr.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforenomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforenomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "insertBefore(newChild,refChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function nodeinsertbeforenomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforenomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entRef;
+ var entElement;
+ var createdNode;
+ var insertedNode;
+ var refChild = null;
+
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entRef = genderNode.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+nodeType = entRef.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+
+ }
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+createdNode = doc.createElement("text3");
+
+ {
+ success = false;
+ try {
+ insertedNode = entElement.insertBefore(createdNode,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NOT_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederrEE.html
new file mode 100644
index 0000000000..1de48d0458
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederrEE.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforenomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforenomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an ent4 entity reference and and execute the "insertBefore(newChild,refChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederr.xml
+*/
+function nodeinsertbeforenomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforenomodificationallowederrEE") != null) return;
+ var doc;
+ var entRef;
+ var createdNode;
+ var insertedNode;
+ var refChild = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+createdNode = doc.createElement("text3");
+
+ {
+ success = false;
+ try {
+ insertedNode = entRef.insertBefore(createdNode,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnonexistent.html
new file mode 100644
index 0000000000..db86ba3ed7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnonexistent.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnonexistent</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforerefchildnonexistent'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforerefchildnonexistent';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "insertBefore(newChild,refChild)" method raises a
+ NOT_FOUND_ERR DOMException if the reference child is
+ not a child of this node.
+
+ Retrieve the second employee and attempt to insert a
+ new node before a reference node that is not a child
+ of this node. An attempt to insert before a non child
+ node should raise the desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodeinsertbeforerefchildnonexistent() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforerefchildnonexistent") != null) return;
+ var doc;
+ var refChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newChild = doc.createElement("newChild");
+ refChild = doc.createElement("refChild");
+ elementList = doc.getElementsByTagName("employee");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ insertedNode = elementNode.insertBefore(newChild,refChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnonexistent</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnull.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnull.html
new file mode 100644
index 0000000000..005df52fcb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnull.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeinsertbeforerefchildnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeinsertbeforerefchildnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If the "refChild" is null then the
+ "insertBefore(newChild,refChild)" method inserts the
+ node "newChild" at the end of the list of children.
+
+ Retrieve the second employee and invoke the
+ "insertBefore(newChild,refChild)" method with
+ refChild=null. Since "refChild" is null the "newChild"
+ should be added to the end of the list. The last item
+ in the list is checked after insertion. The last Element
+ node of the list should be "newChild".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727
+*/
+function nodeinsertbeforerefchildnull() {
+ var success;
+ if(checkInitialization(builder, "nodeinsertbeforerefchildnull") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var refChild = null;
+
+ var newChild;
+ var child;
+ var childName;
+ var insertedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ newChild = doc.createElement("newChild");
+ insertedNode = employeeNode.insertBefore(newChild,refChild);
+ child = employeeNode.lastChild;
+
+ childName = child.nodeName;
+
+ assertEquals("nodeInsertBeforeRefChildNullAssert1","newChild",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexequalzero.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexequalzero.html
new file mode 100644
index 0000000000..d3e846ac50
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexequalzero.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexequalzero</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodelistindexequalzero'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodelistindexequalzero';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a list of all the children elements of the third
+ employee and access its first child by using an index
+ of 0.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+*/
+function nodelistindexequalzero() {
+ var success;
+ if(checkInitialization(builder, "nodelistindexequalzero") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ child = employeeList.item(0);
+ childName = child.nodeName;
+
+
+ if(
+ !("#text" == childName)
+ ) {
+ assertEquals("childName","employeeId",childName);
+
+ }
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(childName, "#text", "Fake default check");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexequalzero</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlength.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlength.html
new file mode 100644
index 0000000000..0facd2d795
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlength.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlength</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodelistindexgetlength'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodelistindexgetlength';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLength()" method returns the number of nodes
+ in the list should be 6 (no whitespace) or 13.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337
+*/
+function nodelistindexgetlength() {
+ var success;
+ if(checkInitialization(builder, "nodelistindexgetlength") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var length;
+ var expectedCount = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ length = employeeList.length;
+
+ assertTrue("lengthIs6or13",
+
+ ((6 == length) || (13 == length))
+);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlength</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlengthofemptylist.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlengthofemptylist.html
new file mode 100644
index 0000000000..8eaa7f002c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlengthofemptylist.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlengthofemptylist</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodelistindexgetlengthofemptylist'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodelistindexgetlengthofemptylist';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getLength()" method returns the number of nodes
+ in the list.(Test for EMPTY list)
+
+ Create a list of all the children of the Text node
+ inside the first child of the third employee and
+ invoke the "getLength()" method. It should contain
+ the value 0.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337
+*/
+function nodelistindexgetlengthofemptylist() {
+ var success;
+ if(checkInitialization(builder, "nodelistindexgetlengthofemptylist") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var childNode;
+ var textNode;
+ var textList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ childNode = employeeList.item(1);
+ textNode = childNode.firstChild;
+
+ textList = textNode.childNodes;
+
+ assertSize("nodelistIndexGetLengthOfEmptyListAssert",0,textList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlengthofemptylist</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexnotzero.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexnotzero.html
new file mode 100644
index 0000000000..22c3a8edbd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexnotzero.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexnotzero</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodelistindexnotzero'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodelistindexnotzero';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create a list of all the children elements of the third
+ employee and access its fourth child by using an index
+ of 3. This should result in "name" being
+ selected. Further we evaluate its content(by using
+ the "getNodeName()" method) to ensure the proper
+ element was accessed.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+*/
+function nodelistindexnotzero() {
+ var success;
+ if(checkInitialization(builder, "nodelistindexnotzero") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var length;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ length = employeeList.length;
+
+
+ if(
+ (6 == length)
+ ) {
+ child = employeeList.item(1);
+
+ }
+
+ else {
+ child = employeeList.item(3);
+
+ }
+ childName = child.nodeName;
+
+ assertEquals("nodeName","name",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexnotzero</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnfirstitem.html
new file mode 100644
index 0000000000..a1ba7597d6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnfirstitem.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnfirstitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodelistreturnfirstitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodelistreturnfirstitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Get the first child of the third employee using NodeList.item(0)
+which will either be a Text node (whitespace) or employeeId element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+*/
+function nodelistreturnfirstitem() {
+ var success;
+ if(checkInitialization(builder, "nodelistreturnfirstitem") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ child = employeeList.item(0);
+ childName = child.nodeName;
+
+ length = employeeList.length;
+
+
+ if(
+ (6 == length)
+ ) {
+ assertEquals("firstChildNoWhitespace","employeeId".toLowerCase(),childName.toLowerCase());
+
+ }
+
+ else {
+ assertEquals("firstChildWithWhitespace","#text".toLowerCase(),childName.toLowerCase());
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnfirstitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnlastitem.html
new file mode 100644
index 0000000000..23eb82968b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnlastitem.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnlastitem</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodelistreturnlastitem'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodelistreturnlastitem';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+Get this last child of the third employee using NodeList.item(NodeList.length - 1)
+and check that it is either a Text element (with whitespace) or an address element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+*/
+function nodelistreturnlastitem() {
+ var success;
+ if(checkInitialization(builder, "nodelistreturnlastitem") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ length = employeeList.length;
+
+
+ if(
+ (6 == length)
+ ) {
+ child = employeeList.item(5);
+ childName = child.nodeName;
+
+ assertEquals("nodeName1","address",childName);
+
+ }
+
+ else {
+ child = employeeList.item(12);
+ childName = child.nodeName;
+
+ assertEquals("nodeName2","#text",childName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnlastitem</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelisttraverselist.html b/dom/tests/mochitest/dom-level1-core/test_nodelisttraverselist.html
new file mode 100644
index 0000000000..47807794bb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodelisttraverselist.html
@@ -0,0 +1,177 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelisttraverselist</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodelisttraverselist'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodelisttraverselist';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The range of valid child node indices is 0 thru length -1
+
+ Create a list of all the children elements of the third
+ employee and traverse the list from index=0 thru
+ length -1.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136
+*/
+function nodelisttraverselist() {
+ var success;
+ if(checkInitialization(builder, "nodelisttraverselist") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var employeeList;
+ var child;
+ var childName;
+ var result = new Array();
+
+ var length;
+ expectedWhitespace = new Array();
+ expectedWhitespace[0] = "#text";
+ expectedWhitespace[1] = "employeeId";
+ expectedWhitespace[2] = "#text";
+ expectedWhitespace[3] = "name";
+ expectedWhitespace[4] = "#text";
+ expectedWhitespace[5] = "position";
+ expectedWhitespace[6] = "#text";
+ expectedWhitespace[7] = "salary";
+ expectedWhitespace[8] = "#text";
+ expectedWhitespace[9] = "gender";
+ expectedWhitespace[10] = "#text";
+ expectedWhitespace[11] = "address";
+ expectedWhitespace[12] = "#text";
+
+ expectedNoWhitespace = new Array();
+ expectedNoWhitespace[0] = "employeeId";
+ expectedNoWhitespace[1] = "name";
+ expectedNoWhitespace[2] = "position";
+ expectedNoWhitespace[3] = "salary";
+ expectedNoWhitespace[4] = "gender";
+ expectedNoWhitespace[5] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(2);
+ employeeList = employeeNode.childNodes;
+
+ length = employeeList.length;
+
+ for(var indexN65700 = 0;indexN65700 < employeeList.length; indexN65700++) {
+ child = employeeList.item(indexN65700);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+
+ if(
+ (6 == length)
+ ) {
+ assertEqualsList("nowhitespace",expectedNoWhitespace,result);
+
+ }
+
+ else {
+ assertEqualsList("whitespace",expectedWhitespace,result);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelisttraverselist</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodeattributes.html
new file mode 100644
index 0000000000..143ce069c8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodeattributes.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodenotationnodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodenotationnodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getAttributes()" method invoked on a Notation
+ Node returns null.
+
+ Retrieve the Notation declaration inside the DocumentType
+ node and invoke the "getAttributes()" method on the
+ Notation Node. It should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function nodenotationnodeattributes() {
+ var success;
+ if(checkInitialization(builder, "nodenotationnodeattributes") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation1");
+ assertNotNull("notationNotNull",notationNode);
+attrList = notationNode.attributes;
+
+ assertNull("nodeNotationNodeAttributesAssert1",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodename.html
new file mode 100644
index 0000000000..0fa526fbe7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodename.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodenotationnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodenotationnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeName()" method for a
+ Notation Node is the name of the notation.
+
+ Retrieve the Notation declaration inside the
+ DocumentType node and check the string returned
+ by the "getNodeName()" method. It should be equal to
+ "notation1".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodenotationnodename() {
+ var success;
+ if(checkInitialization(builder, "nodenotationnodename") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var notationName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation1");
+ assertNotNull("notationNotNull",notationNode);
+notationName = notationNode.nodeName;
+
+ assertEquals("nodeName","notation1",notationName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodetype.html
new file mode 100644
index 0000000000..479aa6b68d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodetype.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodenotationnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodenotationnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getNodeType()" method for an Notation Node
+ returns the constant value 12.
+
+ Retrieve the Notation declaration in the DocumentType
+ node and invoke the "getNodeType()" method. The method
+ should return 12.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodenotationnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodenotationnodetype") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation1");
+ assertNotNull("notationNotNull",notationNode);
+nodeType = notationNode.nodeType;
+
+ assertEquals("nodeNotationNodeTypeAssert1",12,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodevalue.html
new file mode 100644
index 0000000000..72d1ec45d1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodevalue.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodenotationnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodenotationnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Notation Node is null.
+
+ Retrieve the Notation declaration inside the
+ DocumentType node and check the string returned
+ by the "getNodeValue()" method. It should be equal to
+ null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodenotationnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodenotationnodevalue") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var notationValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation1");
+ assertNotNull("notationNotNull",notationNode);
+notationValue = notationNode.nodeValue;
+
+ assertNull("nodeValue",notationValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeparentnode.html b/dom/tests/mochitest/dom-level1-core/test_nodeparentnode.html
new file mode 100644
index 0000000000..917e3e01d3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeparentnode.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeparentnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeparentnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getParentNode()" method returns the parent
+ of this node.
+
+ Retrieve the second employee and invoke the
+ "getParentNode()" method on this node. It should
+ be set to "staff".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
+*/
+function nodeparentnode() {
+ var success;
+ if(checkInitialization(builder, "nodeparentnode") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var parentNode;
+ var parentName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ parentNode = employeeNode.parentNode;
+
+ parentName = parentNode.nodeName;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertEquals("svgTagName","svg",parentName);
+
+ }
+
+ else {
+ assertEquals("nodeParentNodeAssert1","staff",parentName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_nodeparentnodenull.html
new file mode 100644
index 0000000000..14efc6f7aa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeparentnodenull.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnodenull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeparentnodenull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeparentnodenull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getParentNode()" method invoked on a node that has
+ just been created and not yet added to the tree is null.
+
+ Create a new "employee" Element node using the
+ "createElement(name)" method from the Document interface.
+ Since this new node has not yet been added to the tree,
+ the "getParentNode()" method will return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317
+*/
+function nodeparentnodenull() {
+ var success;
+ if(checkInitialization(builder, "nodeparentnodenull") != null) return;
+ var doc;
+ var createdNode;
+ var parentNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ createdNode = doc.createElement("employee");
+ parentNode = createdNode.parentNode;
+
+ assertNull("parentNode",parentNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnodenull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodeattributes.html
new file mode 100644
index 0000000000..01073acdbb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodeattributes.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodeattributes</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeprocessinginstructionnodeattributes'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeprocessinginstructionnodeattributes';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getAttributes()" method invoked on a Processing
+
+ Instruction Node returns null.
+
+
+
+ Retrieve the Processing Instruction node and invoke
+
+ the "getAttributes()" method. It should return null.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+*/
+function nodeprocessinginstructionnodeattributes() {
+ var success;
+ if(checkInitialization(builder, "nodeprocessinginstructionnodeattributes") != null) return;
+ var doc;
+ var testList;
+ var piNode;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ testList = doc.childNodes;
+
+ piNode = testList.item(0);
+ attrList = piNode.attributes;
+
+ assertNull("nodeProcessingInstructionNodeAttrAssert1",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodeattributes</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodename.html
new file mode 100644
index 0000000000..5bf485882e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodename.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeprocessinginstructionnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeprocessinginstructionnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The string returned by the "getNodeName()" method for a
+
+ Processing Instruction Node is the target.
+
+
+
+ Retrieve the Processing Instruction Node in the XML file
+
+ and check the string returned by the "getNodeName()"
+
+ method. It should be equal to "XML-STYLE".
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodeprocessinginstructionnodename() {
+ var success;
+ if(checkInitialization(builder, "nodeprocessinginstructionnodename") != null) return;
+ var doc;
+ var testList;
+ var piNode;
+ var piName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ testList = doc.childNodes;
+
+ piNode = testList.item(0);
+ piName = piNode.nodeName;
+
+ assertEquals("nodeProcessingInstructionNodeNameAssert1","TEST-STYLE",piName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodetype.html
new file mode 100644
index 0000000000..f619b86d3f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodetype.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeprocessinginstructionnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeprocessinginstructionnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getNodeType()" method for a Processing Instruction
+
+ node returns the constant value 7.
+
+
+
+ Retrieve a NodeList of child elements from the document.
+
+ Retrieve the first child and invoke the "getNodeType()"
+
+ method. The method should return 7.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodeprocessinginstructionnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodeprocessinginstructionnodetype") != null) return;
+ var doc;
+ var testList;
+ var piNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ testList = doc.childNodes;
+
+ piNode = testList.item(0);
+ nodeType = piNode.nodeType;
+
+ assertEquals("nodeProcessingInstructionNodeTypeAssert1",7,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodevalue.html
new file mode 100644
index 0000000000..8e8e617d13
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodevalue.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeprocessinginstructionnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeprocessinginstructionnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Processing Instruction Node is the content of the
+ Processing Instruction(exclude the target).
+
+ Retrieve the Processing Instruction node in the XML file
+ and check the string returned by the "getNodeValue()"
+ method. It should be equal to "PIDATA".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodeprocessinginstructionnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodeprocessinginstructionnodevalue") != null) return;
+ var doc;
+ var testList;
+ var piNode;
+ var piValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ testList = doc.childNodes;
+
+ piNode = testList.item(0);
+ piValue = piNode.nodeValue;
+
+ assertEquals("value","PIDATA",piValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionsetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionsetnodevalue.html
new file mode 100644
index 0000000000..7e397046d8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionsetnodevalue.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionsetnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodeprocessinginstructionsetnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodeprocessinginstructionsetnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Setting the nodeValue should change the value returned by
+ nodeValue and ProcessingInstruction.getData.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1004215813
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=181
+*/
+function nodeprocessinginstructionsetnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodeprocessinginstructionsetnodevalue") != null) return;
+ var doc;
+ var testList;
+ var piNode;
+ var piValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ testList = doc.childNodes;
+
+ piNode = testList.item(0);
+ piNode.nodeValue = "Something different";
+
+ piValue = piNode.nodeValue;
+
+ assertEquals("nodeValue","Something different",piValue);
+ piValue = piNode.data;
+
+ assertEquals("data","Something different",piValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionsetnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechild.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechild.html
new file mode 100644
index 0000000000..82a5e242ed
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechild.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['noderemovechild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'noderemovechild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method removes the child node
+ indicated by "oldChild" from the list of children and
+ returns it.
+
+ Remove the first employee by invoking the
+ "removeChild(oldChild)" method an checking the
+ node returned by the "getParentNode()" method. It
+ should be set to null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+*/
+function noderemovechild() {
+ var success;
+ if(checkInitialization(builder, "noderemovechild") != null) return;
+ var doc;
+ var rootNode;
+ var childList;
+ var childToRemove;
+ var removedChild;
+ var parentNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ rootNode = doc.documentElement;
+
+ childList = rootNode.childNodes;
+
+ childToRemove = childList.item(1);
+ removedChild = rootNode.removeChild(childToRemove);
+ parentNode = removedChild.parentNode;
+
+ assertNull("nodeRemoveChildAssert1",parentNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildgetnodename.html
new file mode 100644
index 0000000000..7ba6577bb4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildgetnodename.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildgetnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['noderemovechildgetnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'noderemovechildgetnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Remove the first child of the second employee
+ and check the NodeName returned by the
+ "removeChild(oldChild)" method. The returned node
+ should have a NodeName equal to "#text" or employeeId depending on whitespace.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+*/
+function noderemovechildgetnodename() {
+ var success;
+ if(checkInitialization(builder, "noderemovechildgetnodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var removedChild;
+ var childName;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ length = childList.length;
+
+ oldChild = childList.item(0);
+ removedChild = employeeNode.removeChild(oldChild);
+ childName = removedChild.nodeName;
+
+
+ if(
+ (6 == length)
+ ) {
+ assertEquals("nowhitespace","employeeId",childName);
+
+ }
+
+ else {
+ assertEquals("whitespace","#text",childName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildgetnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildnode.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnode.html
new file mode 100644
index 0000000000..d7d88d0c9a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnode.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnode</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['noderemovechildnode'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'noderemovechildnode';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second employee and remove its first child.
+ After the removal, the second employee should have five or twelve
+ children and the first child should now be the child
+ that used to be at the second position in the list.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+*/
+function noderemovechildnode() {
+ var success;
+ if(checkInitialization(builder, "noderemovechildnode") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var child;
+ var childName;
+ var length;
+ var removedChild;
+ var removedName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ oldChild = childList.item(0);
+ removedChild = employeeNode.removeChild(oldChild);
+ removedName = removedChild.nodeName;
+
+ child = childList.item(0);
+ childName = child.nodeName;
+
+ length = childList.length;
+
+
+ if(
+ (5 == length)
+ ) {
+ assertEquals("removedNameNoWhitespace","employeeId",removedName);
+ assertEquals("childNameNoWhitespace","name",childName);
+
+ }
+
+ else {
+ assertEquals("removedName","#text",removedName);
+ assertEquals("childName","employeeId",childName);
+ assertEquals("length",12,length);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnode</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederr.html
new file mode 100644
index 0000000000..232b22d4a8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederr.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['noderemovechildnomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'noderemovechildnomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "removeChild(oldChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+*/
+function noderemovechildnomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "noderemovechildnomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entRef;
+ var entElement;
+ var removedNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entRef = genderNode.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+nodeType = entRef.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+
+ }
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+
+ {
+ success = false;
+ try {
+ removedNode = entRef.removeChild(entElement);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederrEE.html
new file mode 100644
index 0000000000..6c53a6e688
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederrEE.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['noderemovechildnomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'noderemovechildnomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an entity reference and execute the "removeChild(oldChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederr.xml
+*/
+function noderemovechildnomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "noderemovechildnomodificationallowederrEE") != null) return;
+ var doc;
+ var entRef;
+ var entText;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+entText = entRef.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ removedNode = entRef.removeChild(entText);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildoldchildnonexistent.html
new file mode 100644
index 0000000000..7d465ff95f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildoldchildnonexistent.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildoldchildnonexistent</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['noderemovechildoldchildnonexistent'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'noderemovechildoldchildnonexistent';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "removeChild(oldChild)" method raises a
+ NOT_FOUND_ERR DOMException if the old child is
+ not a child of this node.
+
+ Retrieve the second employee and attempt to remove a
+ node that is not one of its children. An attempt to
+ remove such a node should raise the desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function noderemovechildoldchildnonexistent() {
+ var success;
+ if(checkInitialization(builder, "noderemovechildoldchildnonexistent") != null) return;
+ var doc;
+ var oldChild;
+ var elementList;
+ var elementNode;
+ var removedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ oldChild = doc.createElement("oldChild");
+ elementList = doc.getElementsByTagName("employee");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ removedChild = elementNode.removeChild(oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildoldchildnonexistent</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechild.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechild.html
new file mode 100644
index 0000000000..6608a3cfc5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechild.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechild</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechild'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechild';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method replaces
+ the node "oldChild" with the node "newChild".
+
+ Replace the first element of the second employee with
+ a newly created Element node. Check the first position
+ after the replacement operation is completed. The new
+ Element should be "newChild".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function nodereplacechild() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechild") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var newChild;
+ var child;
+ var childName;
+ var replacedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ oldChild = childList.item(0);
+ newChild = doc.createElement("newChild");
+ replacedNode = employeeNode.replaceChild(newChild,oldChild);
+ child = childList.item(0);
+ childName = child.nodeName;
+
+ assertEquals("nodeReplaceChildAssert1","newChild",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechild</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildinvalidnodetype.html
new file mode 100644
index 0000000000..649d6824df
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildinvalidnodetype.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildinvalidnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildinvalidnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildinvalidnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if this node is of
+ a type that does not allow children of the type "newChild"
+ to be inserted.
+
+ Retrieve the root node and attempt to replace
+ one of its children with a newly created Attr node.
+ An Element node cannot have children of the "Attr"
+ type, therefore the desired exception should be raised.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodereplacechildinvalidnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildinvalidnodetype") != null) return;
+ var doc;
+ var rootNode;
+ var newChild;
+ var elementList;
+ var oldChild;
+ var replacedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ rootNode = doc.documentElement;
+
+ newChild = doc.createAttribute("newAttribute");
+ elementList = doc.getElementsByTagName("employee");
+ oldChild = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ replacedChild = rootNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildinvalidnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchilddiffdocument.html
new file mode 100644
index 0000000000..1c601023be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchilddiffdocument.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchilddiffdocument</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildnewchilddiffdocument'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildnewchilddiffdocument';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ WRONG_DOCUMENT_ERR DOMException if the "newChild" was
+ created from a different document than the one that
+ created this node.
+
+ Retrieve the second employee and attempt to replace one
+ of its children with a node created from a different
+ document. An attempt to make such a replacement
+ should raise the desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function nodereplacechildnewchilddiffdocument() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildnewchilddiffdocument") != null) return;
+ var doc1;
+ var doc2;
+ var oldChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var replacedChild;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "staff");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "staff");
+ newChild = doc1.createElement("newChild");
+ elementList = doc2.getElementsByTagName("employee");
+ elementNode = elementList.item(1);
+ oldChild = elementNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ replacedChild = elementNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchilddiffdocument</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchildexists.html
new file mode 100644
index 0000000000..52c2869c9a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchildexists.html
@@ -0,0 +1,188 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchildexists</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildnewchildexists'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildnewchildexists';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the second employee and replace its TWELFTH
+ child(address) with its SECOND child(employeeId). After the
+ replacement the second child should now be the one that used
+ to be at the third position and the TWELFTH child should be the
+ one that used to be at the SECOND position.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function nodereplacechildnewchildexists() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildnewchildexists") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild = null;
+
+ var newChild = null;
+
+ var childName;
+ var childNode;
+ var length;
+ var actual = new Array();
+
+ var expected = new Array();
+
+ expectedWithoutWhitespace = new Array();
+ expectedWithoutWhitespace[0] = "name";
+ expectedWithoutWhitespace[1] = "position";
+ expectedWithoutWhitespace[2] = "salary";
+ expectedWithoutWhitespace[3] = "gender";
+ expectedWithoutWhitespace[4] = "employeeId";
+
+ expectedWithWhitespace = new Array();
+ expectedWithWhitespace[0] = "#text";
+ expectedWithWhitespace[1] = "#text";
+ expectedWithWhitespace[2] = "name";
+ expectedWithWhitespace[3] = "#text";
+ expectedWithWhitespace[4] = "position";
+ expectedWithWhitespace[5] = "#text";
+ expectedWithWhitespace[6] = "salary";
+ expectedWithWhitespace[7] = "#text";
+ expectedWithWhitespace[8] = "gender";
+ expectedWithWhitespace[9] = "#text";
+ expectedWithWhitespace[10] = "employeeId";
+ expectedWithWhitespace[11] = "#text";
+
+ var replacedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ length = childList.length;
+
+
+ if(
+ (13 == length)
+ ) {
+ newChild = childList.item(1);
+ oldChild = childList.item(11);
+ expected = expectedWithWhitespace;
+
+ }
+
+ else {
+ newChild = childList.item(0);
+ oldChild = childList.item(5);
+ expected = expectedWithoutWhitespace;
+
+ }
+ replacedChild = employeeNode.replaceChild(newChild,oldChild);
+ assertSame("return_value_same",oldChild,replacedChild);
+for(var indexN65758 = 0;indexN65758 < childList.length; indexN65758++) {
+ childNode = childList.item(indexN65758);
+ childName = childNode.nodeName;
+
+ actual[actual.length] = childName;
+
+ }
+ assertEqualsList("childNames",expected,actual);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchildexists</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodeancestor.html
new file mode 100644
index 0000000000..57326b4666
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodeancestor.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodeancestor</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildnodeancestor'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildnodeancestor';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ HIERARCHY_REQUEST_ERR DOMException if the node to put
+ in is one of this node's ancestors.
+
+ Retrieve the second employee and attempt to replace
+ one of its children with an ancestor node(root node).
+ An attempt to make such a replacement should raise the
+ desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodereplacechildnodeancestor() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildnodeancestor") != null) return;
+ var doc;
+ var newChild;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var replacedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newChild = doc.documentElement;
+
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ oldChild = childList.item(0);
+
+ {
+ success = false;
+ try {
+ replacedNode = employeeNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodeancestor</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodename.html
new file mode 100644
index 0000000000..2040696479
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodename.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Replace the second Element of the second employee with
+ a newly created node Element and check the NodeName
+ returned by the "replaceChild(newChild,oldChild)"
+ method. The returned node should have a NodeName equal
+ to "employeeId".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function nodereplacechildnodename() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildnodename") != null) return;
+ var doc;
+ var elementList;
+ var employeeNode;
+ var childList;
+ var oldChild;
+ var newChild;
+ var replacedNode;
+ var length;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ employeeNode = elementList.item(1);
+ childList = employeeNode.childNodes;
+
+ length = childList.length;
+
+ oldChild = childList.item(1);
+ newChild = doc.createElement("newChild");
+ replacedNode = employeeNode.replaceChild(newChild,oldChild);
+ childName = replacedNode.nodeName;
+
+
+ if(
+ (6 == length)
+ ) {
+ assertEquals("nowhitespace","name",childName);
+
+ }
+
+ else {
+ assertEquals("whitespace","employeeId",childName);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederr.html
new file mode 100644
index 0000000000..f3c7918364
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederr.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildnomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildnomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the FIRST item
+ from the entity reference and execute the "replaceChild(newChild,oldChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+*/
+function nodereplacechildnomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildnomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entRef;
+ var entElement;
+ var createdNode;
+ var replacedChild;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entRef = genderNode.firstChild;
+
+ nodeType = entRef.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+
+ }
+ entElement = entRef.firstChild;
+
+ createdNode = doc.createElement("newChild");
+
+ {
+ success = false;
+ try {
+ replacedChild = entRef.replaceChild(createdNode,entElement);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederrEE.html
new file mode 100644
index 0000000000..e76c030e09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederrEE.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildnomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildnomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Create an entity reference execute the "replaceChild(newChild,oldChild)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederr.xml
+*/
+function nodereplacechildnomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildnomodificationallowederrEE") != null) return;
+ var doc;
+ var entRef;
+ var entText;
+ var createdNode;
+ var replacedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+entText = entRef.firstChild;
+
+ createdNode = doc.createElement("newChild");
+
+ {
+ success = false;
+ try {
+ replacedChild = entRef.replaceChild(createdNode,entText);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildoldchildnonexistent.html
new file mode 100644
index 0000000000..e3fb91496f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildoldchildnonexistent.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildoldchildnonexistent</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodereplacechildoldchildnonexistent'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodereplacechildoldchildnonexistent';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "replaceChild(newChild,oldChild)" method raises a
+ NOT_FOUND_ERR DOMException if the old child is
+ not a child of this node.
+
+ Retrieve the second employee and attempt to replace a
+ node that is not one of its children. An attempt to
+ replace such a node should raise the desired exception.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function nodereplacechildoldchildnonexistent() {
+ var success;
+ if(checkInitialization(builder, "nodereplacechildoldchildnonexistent") != null) return;
+ var doc;
+ var oldChild;
+ var newChild;
+ var elementList;
+ var elementNode;
+ var replacedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newChild = doc.createElement("newChild");
+ oldChild = doc.createElement("oldChild");
+ elementList = doc.getElementsByTagName("employee");
+ elementNode = elementList.item(1);
+
+ {
+ success = false;
+ try {
+ replacedNode = elementNode.replaceChild(newChild,oldChild);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildoldchildnonexistent</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederr.html
new file mode 100644
index 0000000000..d4ff0df87f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederr.html
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodesetnodevaluenomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodesetnodevaluenomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setNodeValue(nodeValue)" method causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the SECOND item
+ from the entity reference and execute the "setNodeValue(nodeValue)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68D080')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodesetnodevaluenomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "nodesetnodevaluenomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var genderNode;
+ var entRef;
+ var entElement;
+ var entElementText;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ genderNode = genderList.item(2);
+ entRef = genderNode.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+nodeType = entRef.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entRef = doc.createEntityReference("ent4"); // See bug 1663402.
+ assertNotNull("createdEntRefNotNull",entRef);
+
+ }
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+entElementText = entElement.firstChild;
+
+ assertNotNull("entElementTextNotNull",entElementText);
+
+ {
+ success = false;
+ try {
+ entElementText.nodeValue = "newValue";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederrEE.html
new file mode 100644
index 0000000000..77ad39229b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederrEE.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodesetnodevaluenomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodesetnodevaluenomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create an entity reference and execute the "setNodeValue(nodeValue)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68D080')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederr.xml
+*/
+function nodesetnodevaluenomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "nodesetnodevaluenomodificationallowederrEE") != null) return;
+ var doc;
+ var entRef;
+ var entText;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entRef);
+entText = entRef.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ entText.nodeValue = "newValue";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodeattribute.html
new file mode 100644
index 0000000000..29d9963667
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodeattribute.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodeattribute</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodetextnodeattribute'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodetextnodeattribute';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+The "getAttributes()" method invoked on a Text
+Node returns null.
+
+Retrieve the Text node from the last child of the
+first employee and invoke the "getAttributes()" method
+on the Text Node. It should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772
+*/
+function nodetextnodeattribute() {
+ var success;
+ if(checkInitialization(builder, "nodetextnodeattribute") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var attrList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ attrList = textNode.attributes;
+
+ assertNull("nodeTextNodeAttributesAssert1",attrList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodeattribute</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodename.html
new file mode 100644
index 0000000000..1ab8a1377e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodename.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodename</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodetextnodename'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodetextnodename';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The string returned by the "getNodeName()" method for a
+
+ Text Node is "#text".
+
+
+
+ Retrieve the Text Node from the last child of the
+
+ first employee and check the string returned
+
+ by the "getNodeName()" method. It should be equal to
+
+ "#text".
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+*/
+function nodetextnodename() {
+ var success;
+ if(checkInitialization(builder, "nodetextnodename") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var textName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ textName = textNode.nodeName;
+
+ assertEquals("nodeTextNodeNameAssert1","#text",textName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodename</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodetype.html
new file mode 100644
index 0000000000..a1dbc06c04
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodetype.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodetype</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodetextnodetype'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodetextnodetype';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+
+ The "getNodeType()" method for a Text Node
+
+ returns the constant value 3.
+
+
+
+ Retrieve the Text node from the last child of
+
+ the first employee and invoke the "getNodeType()"
+
+ method. The method should return 3.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
+*/
+function nodetextnodetype() {
+ var success;
+ if(checkInitialization(builder, "nodetextnodetype") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ nodeType = textNode.nodeType;
+
+ assertEquals("nodeTextNodeTypeAssert1",3,nodeType);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodetype</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodevalue.html
new file mode 100644
index 0000000000..e766122f20
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodevalue.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodevalue</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodetextnodevalue'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodetextnodevalue';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The string returned by the "getNodeValue()" method for a
+ Text Node is the content of the Text node.
+
+ Retrieve the Text node from the last child of the first
+ employee and check the string returned by the
+ "getNodeValue()" method. It should be equal to
+ "1230 North Ave. Dallas, Texas 98551".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function nodetextnodevalue() {
+ var success;
+ if(checkInitialization(builder, "nodetextnodevalue") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var textNode;
+ var textValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testAddr = elementList.item(0);
+ textNode = testAddr.firstChild;
+
+ textValue = textNode.nodeValue;
+
+ assertEquals("nodeTextNodeValueAssert1","1230 North Ave. Dallas, Texas 98551",textValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodevalue</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue01.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue01.html
new file mode 100644
index 0000000000..a65253ddc1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue01.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue01</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue01';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An element is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+*/
+function nodevalue01() {
+ var success;
+ if(checkInitialization(builder, "nodevalue01") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newNode = doc.createElement("address");
+ newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue02.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue02.html
new file mode 100644
index 0000000000..253ab373c1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue02.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue02</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue02';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An comment is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322
+*/
+function nodevalue02() {
+ var success;
+ if(checkInitialization(builder, "nodevalue02") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newNode = doc.createComment("This is a new Comment node");
+ newValue = newNode.nodeValue;
+
+ assertEquals("initial","This is a new Comment node",newValue);
+ newNode.nodeValue = "This should have an effect";
+
+ newValue = newNode.nodeValue;
+
+ assertEquals("afterChange","This should have an effect",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue03.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue03.html
new file mode 100644
index 0000000000..09c088f8ba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue03.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue03</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue03';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An entity reference is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490
+*/
+function nodevalue03() {
+ var success;
+ if(checkInitialization(builder, "nodevalue03") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newNode = doc.createEntityReference("ent1");
+ assertNotNull("createdEntRefNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue04.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue04.html
new file mode 100644
index 0000000000..cad1d14b54
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue04.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue04</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue04';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An document type accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
+*/
+function nodevalue04() {
+ var success;
+ if(checkInitialization(builder, "nodevalue04") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newNode = doc.doctype;
+
+ assertNotNull("docTypeNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue05.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue05.html
new file mode 100644
index 0000000000..29829860c1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue05.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue05</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue05';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+A document fragment is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3
+*/
+function nodevalue05() {
+ var success;
+ if(checkInitialization(builder, "nodevalue05") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newNode = doc.createDocumentFragment();
+ newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue06.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue06.html
new file mode 100644
index 0000000000..e1a81c48cc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue06.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue06</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var newNodeRef = null;
+ if (typeof(this.newNode) != 'undefined') {
+ newNodeRef = this.newNode;
+ }
+ docsLoaded += preload(newNodeRef, "newNode", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue06';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An document is accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document
+*/
+function nodevalue06() {
+ var success;
+ if(checkInitialization(builder, "nodevalue06") != null) return;
+ var newNode;
+ var newValue;
+
+ var newNodeRef = null;
+ if (typeof(this.newNode) != 'undefined') {
+ newNodeRef = this.newNode;
+ }
+ newNode = load(newNodeRef, "newNode", "staff");
+ newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue07.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue07.html
new file mode 100644
index 0000000000..02abb9fe54
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue07.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue07</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue07';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An Entity is accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2
+*/
+function nodevalue07() {
+ var success;
+ if(checkInitialization(builder, "nodevalue07") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+ var nodeMap;
+ var docType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+nodeMap = docType.entities;
+
+ assertNotNull("entitiesNotNull",nodeMap);
+newNode = nodeMap.getNamedItem("ent1");
+ assertNotNull("entityNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue08.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue08.html
new file mode 100644
index 0000000000..c91968a3bc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue08</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue08';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An notation is accessed, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5431D1B9
+*/
+function nodevalue08() {
+ var success;
+ if(checkInitialization(builder, "nodevalue08") != null) return;
+ var doc;
+ var docType;
+ var newNode;
+ var newValue;
+ var nodeMap;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+nodeMap = docType.notations;
+
+ assertNotNull("notationsNotNull",nodeMap);
+newNode = nodeMap.getNamedItem("notation1");
+ assertNotNull("notationNotNull",newNode);
+newValue = newNode.nodeValue;
+
+ assertNull("initiallyNull",newValue);
+ newNode.nodeValue = "This should have no effect";
+
+ newValue = newNode.nodeValue;
+
+ assertNull("nullAfterAttemptedChange",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue09.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue09.html
new file mode 100644
index 0000000000..5bdab48a7a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue09.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue09</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodevalue09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodevalue09';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+An processing instruction is created, setNodeValue is called with a non-null argument, but getNodeValue
+should still return null.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1004215813
+*/
+function nodevalue09() {
+ var success;
+ if(checkInitialization(builder, "nodevalue09") != null) return;
+ var doc;
+ var newNode;
+ var newValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newNode = doc.createProcessingInstruction("TARGET","DATA");
+ newValue = newNode.nodeValue;
+
+ assertEquals("initial","DATA",newValue);
+ newNode.nodeValue = "This should have an effect";
+
+ newValue = newNode.nodeValue;
+
+ assertEquals("after","This should have an effect",newValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue09</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetnotationname.html b/dom/tests/mochitest/dom-level1-core/test_notationgetnotationname.html
new file mode 100644
index 0000000000..0bc8015087
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_notationgetnotationname.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetnotationname</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['notationgetnotationname'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'notationgetnotationname';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the notation named "notation1" and access its
+ name by invoking the "getNodeName()" method inherited
+ from the Node interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5431D1B9
+*/
+function notationgetnotationname() {
+ var success;
+ if(checkInitialization(builder, "notationgetnotationname") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var notationName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation1");
+ notationName = notationNode.nodeName;
+
+ assertEquals("notationGetNotationNameAssert","notation1",notationName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetnotationname</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetpublicid.html b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicid.html
new file mode 100644
index 0000000000..af0136188f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicid.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicid</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['notationgetpublicid'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'notationgetpublicid';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the notation named "notation1" and access its
+ public identifier. The string "notation1File" should be
+ returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-54F2B4D0
+*/
+function notationgetpublicid() {
+ var success;
+ if(checkInitialization(builder, "notationgetpublicid") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var publicId;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation1");
+ publicId = notationNode.publicId;
+
+ assertEquals("publicId","notation1File",publicId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicid</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetpublicidnull.html b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicidnull.html
new file mode 100644
index 0000000000..0a96b481ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicidnull.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicidnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['notationgetpublicidnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'notationgetpublicidnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getPublicId()" method of a Notation node contains
+ the public identifier associated with the notation, if
+ one was not specified a null value should be returned.
+
+ Retrieve the notation named "notation2" and access its
+ public identifier. Since a public identifier was not
+ specified for this notation, the "getPublicId()" method
+ should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-54F2B4D0
+*/
+function notationgetpublicidnull() {
+ var success;
+ if(checkInitialization(builder, "notationgetpublicidnull") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var publicId;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation2");
+ publicId = notationNode.publicId;
+
+ assertNull("publicId",publicId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicidnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetsystemid.html b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemid.html
new file mode 100644
index 0000000000..d20b2c9a3e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemid.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemid</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['notationgetsystemid'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'notationgetsystemid';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getSystemId()" method of a Notation node contains
+ the system identifier associated with the notation, if
+ one was specified.
+
+ Retrieve the notation named "notation2" and access its
+ system identifier. The string "notation2File" should be
+ returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E8AAB1D0
+*/
+function notationgetsystemid() {
+ var success;
+ if(checkInitialization(builder, "notationgetsystemid") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var systemId;
+ var index;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation2");
+ systemId = notationNode.systemId;
+
+ assertURIEquals("uriEquals",null,null,null,"notation2File",null,null,null,null,systemId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemid</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetsystemidnull.html b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemidnull.html
new file mode 100644
index 0000000000..eecf8838ac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemidnull.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemidnull</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['notationgetsystemidnull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'notationgetsystemidnull';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the notation named "notation1" and access its
+ system identifier. Since a system identifier was not
+ specified for this notation, the "getSystemId()" method
+ should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E8AAB1D0
+*/
+function notationgetsystemidnull() {
+ var success;
+ if(checkInitialization(builder, "notationgetsystemidnull") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notationNode;
+ var systemId;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ docType = doc.doctype;
+
+ assertNotNull("docTypeNotNull",docType);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notationNode = notations.getNamedItem("notation1");
+ systemId = notationNode.systemId;
+
+ assertNull("systemId",systemId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemidnull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_processinginstructiongetdata.html b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongetdata.html
new file mode 100644
index 0000000000..18c2449292
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongetdata.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongetdata</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['processinginstructiongetdata'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'processinginstructiongetdata';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getData()" method returns the content of the
+ processing instruction. It starts at the first non
+ white character following the target and ends at the
+ character immediately preceding the "?>".
+
+ Retrieve the ProcessingInstruction node located
+ immediately after the prolog. Create a nodelist of the
+ child nodes of this document. Invoke the "getData()"
+ method on the first child in the list. This should
+ return the content of the ProcessingInstruction.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393
+*/
+function processinginstructiongetdata() {
+ var success;
+ if(checkInitialization(builder, "processinginstructiongetdata") != null) return;
+ var doc;
+ var childNodes;
+ var piNode;
+ var data;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ childNodes = doc.childNodes;
+
+ piNode = childNodes.item(0);
+ data = piNode.data;
+
+ assertEquals("processinginstructionGetTargetAssert","PIDATA",data);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongetdata</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_processinginstructiongettarget.html b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongettarget.html
new file mode 100644
index 0000000000..7ee9f2f9ec
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongettarget.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongettarget</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['processinginstructiongettarget'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'processinginstructiongettarget';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "getTarget()" method returns the target of the
+ processing instruction. It is the first token following
+ the markup that begins the processing instruction.
+
+ Retrieve the ProcessingInstruction node located
+ immediately after the prolog. Create a nodelist of the
+ child nodes of this document. Invoke the "getTarget()"
+ method on the first child in the list. This should
+ return the target of the ProcessingInstruction.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1478689192
+*/
+function processinginstructiongettarget() {
+ var success;
+ if(checkInitialization(builder, "processinginstructiongettarget") != null) return;
+ var doc;
+ var childNodes;
+ var piNode;
+ var target;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ childNodes = doc.childNodes;
+
+ piNode = childNodes.item(0);
+ target = piNode.target;
+
+ assertEquals("processinginstructionGetTargetAssert","TEST-STYLE",target);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongettarget</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_processinginstructionsetdatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_processinginstructionsetdatanomodificationallowederr.html
new file mode 100644
index 0000000000..982272653e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_processinginstructionsetdatanomodificationallowederr.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['processinginstructionsetdatanomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("expandEntityReferences", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'processinginstructionsetdatanomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "setData(data)" method for a processing instruction causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove the "domestic" attribute
+ from the entity reference by executing the "setData(data)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-837822393')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393
+*/
+function processinginstructionsetdatanomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "processinginstructionsetdatanomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var piNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = gender.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+piNode = entRef.lastChild;
+
+ assertNotNull("piNodeNotNull",piNode);
+
+ {
+ success = false;
+ try {
+ piNode.data = "newData";
+
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textindexsizeerrnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerrnegativeoffset.html
new file mode 100644
index 0000000000..7ca01c6ea3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerrnegativeoffset.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerrnegativeoffset</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textindexsizeerrnegativeoffset'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("signed", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textindexsizeerrnegativeoffset';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset is
+ negative.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The desired exception should be raised since the offset
+ is a negative number.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function textindexsizeerrnegativeoffset() {
+ var success;
+ if(checkInitialization(builder, "textindexsizeerrnegativeoffset") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ splitNode = textNode.splitText(-69);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throws_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerrnegativeoffset</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textindexsizeerroffsetoutofbounds.html b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerroffsetoutofbounds.html
new file mode 100644
index 0000000000..1a556ae14b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerroffsetoutofbounds.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerroffsetoutofbounds</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textindexsizeerroffsetoutofbounds'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textindexsizeerroffsetoutofbounds';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method raises an
+ INDEX_SIZE_ERR DOMException if the specified offset is
+ greater than the number of characters in the Text node.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The desired exception should be raised since the offset
+ is a greater than the number of characters in the Text
+ node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
+*/
+function textindexsizeerroffsetoutofbounds() {
+ var success;
+ if(checkInitialization(builder, "textindexsizeerroffsetoutofbounds") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+
+ {
+ success = false;
+ try {
+ splitNode = textNode.splitText(300);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("throw_INDEX_SIZE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerroffsetoutofbounds</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textparseintolistofelements.html b/dom/tests/mochitest/dom-level1-core/test_textparseintolistofelements.html
new file mode 100644
index 0000000000..9c2e46ab5a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textparseintolistofelements.html
@@ -0,0 +1,184 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textparseintolistofelements</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textparseintolistofelements'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textparseintolistofelements';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Retrieve the textual data from the last child of the
+ second employee. That node is composed of two
+ EntityReference nodes and two Text nodes. After
+ the content node is parsed, the "address" Element
+ should contain four children with each one of the
+ EntityReferences containing one child.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-745549614
+*/
+function textparseintolistofelements() {
+ var success;
+ if(checkInitialization(builder, "textparseintolistofelements") != null) return;
+ var doc;
+ var elementList;
+ var addressNode;
+ var childList;
+ var child;
+ var length;
+ var value;
+ var grandChild;
+ var result = new Array();
+
+ expectedNormal = new Array();
+ expectedNormal[0] = "1900 Dallas Road";
+ expectedNormal[1] = " Dallas, ";
+ expectedNormal[2] = "Texas";
+ expectedNormal[3] = "\n 98554";
+
+ expectedExpanded = new Array();
+ expectedExpanded[0] = "1900 Dallas Road Dallas, Texas\n 98554";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ addressNode = elementList.item(1);
+ childList = addressNode.childNodes;
+
+ length = childList.length;
+
+ for(var indexN65663 = 0;indexN65663 < childList.length; indexN65663++) {
+ child = childList.item(indexN65663);
+ value = child.nodeValue;
+
+
+ if(
+
+ (value == null)
+
+ ) {
+ grandChild = child.firstChild;
+
+ assertNotNull("grandChildNotNull",grandChild);
+value = grandChild.nodeValue;
+
+ result[result.length] = value;
+
+ }
+
+ else {
+ result[result.length] = value;
+
+ }
+
+ }
+
+ if(
+ (4 == length)
+ ) {
+ assertEqualsList("assertEqNormal",expectedNormal,result);
+
+ }
+
+ else {
+ assertEqualsList("assertEqCoalescing",expectedExpanded,result);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textparseintolistofelements</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextfour.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextfour.html
new file mode 100644
index 0000000000..348ee8af05
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextfour.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextfour</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textsplittextfour'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textsplittextfour';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method returns the new Text node.
+
+ Retrieve the textual data from the last child of the
+ first employee and invoke the "splitText(offset)" method.
+ The method should return the new Text node. The offset
+ value used for this test is 30. The "getNodeValue()"
+ method is called to check that the new node now contains
+ the characters at and after position 30.
+ (Starting count at 0)
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function textsplittextfour() {
+ var success;
+ if(checkInitialization(builder, "textsplittextfour") != null) return;
+ var doc;
+ var elementList;
+ var addressNode;
+ var textNode;
+ var splitNode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ addressNode = elementList.item(0);
+ textNode = addressNode.firstChild;
+
+ splitNode = textNode.splitText(30);
+ value = splitNode.nodeValue;
+
+ assertEquals("textSplitTextFourAssert","98551",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextfour</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederr.html
new file mode 100644
index 0000000000..fc04bb0c53
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederr.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederr</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textsplittextnomodificationallowederr'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textsplittextnomodificationallowederr';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method raises a
+ NO_MODIFICATION_ALLOWED_ERR DOMException if the
+ node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Get the element content of the FIRST
+ Text Node of the entity reference and execute the "splitText(offset)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function textsplittextnomodificationallowederr() {
+ var success;
+ if(checkInitialization(builder, "textsplittextnomodificationallowederr") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var entRef;
+ var entElement;
+ var entElementText;
+ var splitNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ entRef = gender.firstChild;
+
+ assertNotNull("entRefNotNull",entRef);
+nodeType = entRef.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ entRef = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",entRef);
+
+ }
+ entElement = entRef.firstChild;
+
+ assertNotNull("entElementNotNull",entElement);
+entElementText = entElement.firstChild;
+
+ assertNotNull("entElementTextNotNull",entElementText);
+
+ {
+ success = false;
+ try {
+ splitNode = entElementText.splitText(2);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederr</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederrEE.html
new file mode 100644
index 0000000000..2d3a132e13
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederrEE.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederrEE</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textsplittextnomodificationallowederrEE'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textsplittextnomodificationallowederrEE';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ Create an ent3 reference and execute the "splitText(offset)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederr.xml
+*/
+function textsplittextnomodificationallowederrEE() {
+ var success;
+ if(checkInitialization(builder, "textsplittextnomodificationallowederrEE") != null) return;
+ var doc;
+ var entRef;
+ var entText;
+ var splitNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ entRef = doc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entRef);
+entText = entRef.firstChild;
+
+ assertNotNull("entTextNotNull",entText);
+
+ {
+ success = false;
+ try {
+ splitNode = entText.splitText(2);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederrEE</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextone.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextone.html
new file mode 100644
index 0000000000..4467b77118
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextone.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextone</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textsplittextone'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textsplittextone';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ The "splitText(offset)" method breaks the Text node into
+ two Text nodes at the specified offset keeping each node
+ as siblings in the tree.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The method splits the Text node into two new sibling
+ Text nodes keeping both of them in the tree. This test
+ checks the "nextSibling()" method of the original node
+ to ensure that the two nodes are indeed siblings.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function textsplittextone() {
+ var success;
+ if(checkInitialization(builder, "textsplittextone") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+ var secondPart;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+ splitNode = textNode.splitText(7);
+ secondPart = textNode.nextSibling;
+
+ value = secondPart.nodeValue;
+
+ assertEquals("textSplitTextOneAssert","Jones",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextone</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextthree.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextthree.html
new file mode 100644
index 0000000000..e02dd2e501
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextthree.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextthree</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textsplittextthree'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textsplittextthree';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ After the "splitText(offset)" method breaks the Text node
+ into two Text nodes, the new Text node contains all the
+ content at and after the offset point.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The new Text node should contain all the content
+ at and after the offset point. The "getNodeValue()"
+ method is called to check that the new node now contains
+ the characters at and after position seven.
+ (Starting count at 0)
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function textsplittextthree() {
+ var success;
+ if(checkInitialization(builder, "textsplittextthree") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+ splitNode = textNode.splitText(6);
+ value = splitNode.nodeValue;
+
+ assertEquals("textSplitTextThreeAssert"," Jones",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextthree</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittexttwo.html b/dom/tests/mochitest/dom-level1-core/test_textsplittexttwo.html
new file mode 100644
index 0000000000..daed27c6f8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textsplittexttwo.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittexttwo</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textsplittexttwo'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textsplittexttwo';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ After the "splitText(offset)" method breaks the Text node
+ into two Text nodes, the original node contains all the
+ content up to the offset point.
+
+ Retrieve the textual data from the second child of the
+ third employee and invoke the "splitText(offset)" method.
+ The original Text node should contain all the content
+ up to the offset point. The "getNodeValue()" method
+ is called to check that the original node now contains
+ the first five characters.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D
+*/
+function textsplittexttwo() {
+ var success;
+ if(checkInitialization(builder, "textsplittexttwo") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var textNode;
+ var splitNode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(2);
+ textNode = nameNode.firstChild;
+
+ splitNode = textNode.splitText(5);
+ value = textNode.nodeValue;
+
+ assertEquals("textSplitTextTwoAssert","Roger",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittexttwo</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level1-core/test_textwithnomarkup.html b/dom/tests/mochitest/dom-level1-core/test_textwithnomarkup.html
new file mode 100644
index 0000000000..cc349c2426
--- /dev/null
+++ b/dom/tests/mochitest/dom-level1-core/test_textwithnomarkup.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textwithnomarkup</title>
+<link href="activity-home.css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['textwithnomarkup'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'textwithnomarkup';
+
+
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(setUpPage);
+
+
+/**
+*
+ If there is not any markup inside an Element or Attr node
+ content, then the text is contained in a single object
+ implementing the Text interface that is the only child
+ of the element.
+
+ Retrieve the textual data from the second child of the
+ third employee. That Text node contains a block of
+ multiple text lines without markup, so they should be
+ treated as a single Text node. The "getNodeValue()"
+ method should contain the combination of the two lines.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
+*/
+function textwithnomarkup() {
+ var success;
+ if(checkInitialization(builder, "textwithnomarkup") != null) return;
+ var doc;
+ var elementList;
+ var nameNode;
+ var nodeV;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("name");
+ nameNode = elementList.item(2);
+ nodeV = nameNode.firstChild;
+
+ value = nodeV.nodeValue;
+
+ assertEquals("textNodeValue","Roger\n Jones",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textwithnomarkup</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/DOMTestCase.js b/dom/tests/mochitest/dom-level2-core/DOMTestCase.js
new file mode 100644
index 0000000000..2d2b2cf645
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/DOMTestCase.js
@@ -0,0 +1,710 @@
+/*
+Copyright (c) 2001-2005 World Wide Web Consortium,
+(Massachusetts Institute of Technology, Institut National de
+Recherche en Informatique et en Automatique, Keio University). All
+Rights Reserved. This program is distributed under the W3C's Software
+Intellectual Property License. This program is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.
+See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+*/
+
+function assertNull(descr, actual) {
+ return ok(actual === null, descr);
+}
+
+
+function assertNotNull(descr, actual) {
+ return ok(actual !== null, descr);
+}
+
+function assertTrue(descr, actual) {
+ return ok(actual === true, descr);
+}
+
+function assertFalse(descr, actual) {
+ return ok(actual === false, descr);
+}
+
+function assertEquals(descr, expected, actual) {
+ return is(expected, actual, descr);
+}
+
+ function assertSize(descr, expected, actual) {
+ ok(actual !== null, descr);
+/*
+ // Work around too strict checks.
+ if (!actual) {
+ ok(actual, "[assertSize()] 'actual' has a value");
+ return;
+ }
+*/
+
+ is(actual.length, expected, descr);
+ }
+
+ function assertEqualsAutoCase(context, descr, expected, actual) {
+ if (builder.contentType == "text/html") {
+ if(context == "attribute") {
+ is(actual.toLowerCase(), expected.toLowerCase(), descr);
+ } else {
+ is(actual, expected.toUpperCase(), descr);
+ }
+ } else {
+ is(expected, actual, descr);
+ }
+ }
+
+
+ function assertEqualsCollectionAutoCase(context, descr, expected, actual) {
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+
+ //
+ // if there length is the same, then every entry in the expected list
+ // must appear once and only once in the actual list
+ var expectedLen = expected.length;
+ var expectedValue;
+ var actualLen = actual.length;
+ var i;
+ var j;
+ var matches;
+ for(i = 0; i < expectedLen; i++) {
+ matches = 0;
+ expectedValue = expected[i];
+ for(j = 0; j < actualLen; j++) {
+ if (builder.contentType == "text/html") {
+ if (context == "attribute") {
+ if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
+ matches++;
+ }
+ } else {
+ if (expectedValue.toUpperCase() == actual[j]) {
+ matches++;
+ }
+ }
+ } else {
+ if(expectedValue == actual[j]) {
+ matches++;
+ }
+ }
+ }
+ if(matches == 0) {
+ ok(false, descr + ": No match found for " + expectedValue);
+ }
+ if(matches > 1) {
+ ok(false, descr + ": Multiple matches found for " + expectedValue);
+ }
+ }
+ }
+
+ function assertEqualsCollection(descr, expected, actual) {
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ //
+ // if there length is the same, then every entry in the expected list
+ // must appear once and only once in the actual list
+ var expectedLen = expected.length;
+ var expectedValue;
+ var actualLen = actual.length;
+ var i;
+ var j;
+ var matches;
+ for(i = 0; i < expectedLen; i++) {
+ matches = 0;
+ expectedValue = expected[i];
+ for(j = 0; j < actualLen; j++) {
+ if(expectedValue == actual[j]) {
+ matches++;
+ }
+ }
+ if(matches == 0) {
+ ok(false, descr + ": No match found for " + expectedValue);
+ }
+ if(matches > 1) {
+ ok(false, descr + ": Multiple matches found for " + expectedValue);
+ }
+ }
+ }
+
+
+ function assertEqualsListAutoCase(context, descr, expected, actual) {
+ var minLength = expected.length;
+ if (actual.length < minLength) {
+ minLength = actual.length;
+ }
+ //
+ for(var i = 0; i < minLength; i++) {
+ assertEqualsAutoCase(context, descr, expected[i], actual[i]);
+ }
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ }
+
+
+ function assertEqualsList(descr, expected, actual) {
+ var minLength = expected.length;
+ if (actual.length < minLength) {
+ minLength = actual.length;
+ }
+ //
+ for(var i = 0; i < minLength; i++) {
+ if(expected[i] != actual[i]) {
+ is(actual[i], expected[i], descr);
+ }
+ }
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ }
+
+ function assertInstanceOf(descr, type, obj) {
+ if(type == "Attr") {
+ is(2, obj.nodeType, descr);
+ var specd = obj.specified;
+ }
+/*
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_is(type, "Attr", "[DOMTestCase.assertInstanceOf()] Fake default check.");
+ }
+*/
+ }
+
+ function assertSame(descr, expected, actual) {
+ if(expected != actual) {
+ is(expected.nodeType, actual.nodeType, descr);
+ is(expected.nodeValue, actual.nodeValue, descr);
+ }
+/*
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(expected, actual, "[DOMTestCase.assertSame()] Fake default check." +
+ " (Type=" + actual.nodeType + ", Value=" + actual.nodeValue + ")");
+ }
+*/
+ }
+
+ function assertURIEquals(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) {
+ //
+ // URI must be non-null
+ ok(assertID, "[assertURIEquals()] 'assertID' has a value");
+ ok(actual, "[assertURIEquals()] 'actual' has a value");
+/*
+ // Add missing early return.
+ if (!actual)
+ return;
+*/
+
+ var uri = actual;
+
+ var lastPound = actual.lastIndexOf("#");
+ var actualFragment = "";
+ if(lastPound != -1) {
+ //
+ // substring before pound
+ //
+ uri = actual.substring(0,lastPound);
+ actualFragment = actual.substring(lastPound+1);
+ }
+ if(fragment != null) is(actualFragment, fragment, assertID);
+
+ var lastQuestion = uri.lastIndexOf("?");
+ var actualQuery = "";
+ if(lastQuestion != -1) {
+ //
+ // substring before pound
+ //
+ uri = actual.substring(0,lastQuestion);
+ actualQuery = actual.substring(lastQuestion+1);
+ }
+ if(query != null) is(actualQuery, query, assertID);
+
+ var firstColon = uri.indexOf(":");
+ var firstSlash = uri.indexOf("/");
+ var actualPath = uri;
+ var actualScheme = "";
+ if(firstColon != -1 && firstColon < firstSlash) {
+ actualScheme = uri.substring(0,firstColon);
+ actualPath = uri.substring(firstColon + 1);
+ }
+
+ if(scheme != null) {
+ is(scheme, actualScheme, assertID);
+ }
+
+ if(path != null) {
+ is(path, actualPath, assertID);
+ }
+
+ if(host != null) {
+ var actualHost = "";
+ if(actualPath.substring(0,2) == "//") {
+ var termSlash = actualPath.substring(2).indexOf("/") + 2;
+ actualHost = actualPath.substring(0,termSlash);
+ }
+ is(actualHost, host, assertID);
+ }
+
+ if(file != null || name != null) {
+ var actualFile = actualPath;
+ var finalSlash = actualPath.lastIndexOf("/");
+ if(finalSlash != -1) {
+ actualFile = actualPath.substring(finalSlash+1);
+ }
+ if (file != null) {
+ is(actualFile, file, assertID);
+ }
+ if (name != null) {
+ var actualName = actualFile;
+ var finalDot = actualFile.lastIndexOf(".");
+ if (finalDot != -1) {
+ actualName = actualName.substring(0, finalDot);
+ }
+ is(actualName, name, assertID);
+ }
+ }
+
+ if(isAbsolute != null) {
+ is(actualPath.substring(0,1) == "/", isAbsolute, assertID);
+ }
+ }
+
+
+// size() used by assertSize element
+function size(collection)
+{
+ return collection.length;
+}
+
+function same(expected, actual)
+{
+ return expected === actual;
+}
+
+function getSuffix(contentType) {
+ switch(contentType) {
+ case "text/html":
+ return ".html";
+
+ case "text/xml":
+ return ".xml";
+
+ case "application/xhtml+xml":
+ return ".xhtml";
+
+ case "image/svg+xml":
+ return ".svg";
+
+ case "text/mathml":
+ return ".mml";
+ }
+ return ".html";
+}
+
+function equalsAutoCase(context, expected, actual) {
+ if (builder.contentType == "text/html") {
+ if (context == "attribute") {
+ return expected.toLowerCase() == actual;
+ }
+ return expected.toUpperCase() == actual;
+ }
+ return expected == actual;
+}
+
+function catchInitializationError(blder, ex) {
+ if (blder == null) {
+ alert(ex);
+ } else {
+ blder.initializationError = ex;
+ blder.initializationFatalError = ex;
+ }
+}
+
+function checkInitialization(blder, testname) {
+ if (blder.initializationError != null) {
+ // Fake a "warn()" function, as it was missing :-|
+ function warn(msg) {
+ info("[checkInitialization() warning] " + msg);
+ }
+
+ if (blder.skipIncompatibleTests) {
+ warn(testname + " not run:" + blder.initializationError);
+ return blder.initializationError;
+ } else {
+ //
+ // if an exception was thrown
+ // rethrow it and do not run the test
+ if (blder.initializationFatalError != null) {
+ throw blder.initializationFatalError;
+ } else {
+ //
+ // might be recoverable, warn but continue the test
+ warn(testname + ": " + blder.initializationError);
+ }
+ }
+ }
+ return null;
+}
+function createTempURI(scheme) {
+ if (scheme == "http") {
+ return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
+ }
+ return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
+}
+
+
+function EventMonitor() {
+ this.atEvents = new Array();
+ this.bubbledEvents = new Array();
+ this.capturedEvents = new Array();
+ this.allEvents = new Array();
+}
+
+EventMonitor.prototype.handleEvent = function(evt) {
+ switch(evt.eventPhase) {
+ case 1:
+ monitor.capturedEvents[monitor.capturedEvents.length] = evt;
+ break;
+
+ case 2:
+ monitor.atEvents[monitor.atEvents.length] = evt;
+ break;
+
+ case 3:
+ monitor.bubbledEvents[monitor.bubbledEvents.length] = evt;
+ break;
+ }
+ monitor.allEvents[monitor.allEvents.length] = evt;
+}
+
+function DOMErrorImpl(err) {
+ this.severity = err.severity;
+ this.message = err.message;
+ this.type = err.type;
+ this.relatedException = err.relatedException;
+ this.relatedData = err.relatedData;
+ this.location = err.location;
+}
+
+
+
+function DOMErrorMonitor() {
+ this.allErrors = new Array();
+}
+
+DOMErrorMonitor.prototype.handleError = function(err) {
+ errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err);
+}
+
+DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) {
+ var i;
+ for (i = 0; i < errorMonitor.allErrors.length; i++) {
+ if (errorMonitor.allErrors[i].severity >= severity) {
+ assertEquals(id, severity - 1, errorMonitor.allErrors[i].severity);
+ }
+ }
+}
+
+function UserDataNotification(operation, key, data, src, dst) {
+ this.operation = operation;
+ this.key = key;
+ this.data = data;
+ this.src = src;
+ this.dst = dst;
+}
+
+function UserDataMonitor() {
+ this.allNotifications = new Array();
+}
+
+UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
+ userDataMonitor.allNotifications[this.allNotifications.length] =
+ new UserDataNotification(operation, key, data, src, dst);
+}
+
+
+
+function IFrameBuilder() {
+ this.contentType = "text/html";
+ this.supportedContentTypes = [ "text/html",
+ "text/xml",
+ "image/svg+xml",
+ "application/xhtml+xml" ];
+
+ this.supportsAsyncChange = false;
+ this.async = true;
+ this.fixedAttributeNames = [
+ "validating", "expandEntityReferences", "coalescing",
+ "signed", "hasNullString", "ignoringElementContentWhitespace", "namespaceAware", "ignoringComments", "schemaValidating"];
+
+ this.fixedAttributeValues = [false, true, false, true, true , false, false, true, false ];
+ this.configurableAttributeNames = [ ];
+ this.configurableAttributeValues = [ ];
+ this.initializationError = null;
+ this.initializationFatalError = null;
+ this.skipIncompatibleTests = false;
+}
+
+IFrameBuilder.prototype.hasFeature = function(feature, version) {
+ return document.implementation.hasFeature(feature, version);
+}
+
+IFrameBuilder.prototype.getImplementation = function() {
+ return document.implementation;
+}
+
+IFrameBuilder.prototype.setContentType = function(contentType) {
+ this.contentType = contentType;
+ if (contentType == "text/html") {
+ this.fixedAttributeValues[6] = false;
+ } else {
+ this.fixedAttributeValues[6] = true;
+ }
+}
+
+
+
+IFrameBuilder.prototype.preload = function(frame, varname, url) {
+ var suffix;
+ if (this.contentType == "text/html" ||
+ this.contentType == "application/xhtml+xml") {
+ if (url.substring(0,5) == "staff" || url == "nodtdstaff" ||
+ url == "datatype_normalization") {
+ suffix = ".xml";
+ }
+ }
+
+ if (!suffix) suffix = getSuffix(this.contentType);
+
+ var iframe = document.createElement("iframe");
+ var srcname = url + suffix;
+ iframe.setAttribute("name", srcname);
+ iframe.setAttribute("src", fileBase + srcname);
+ //
+ // HTML and XHTML have onload attributes that will invoke loadComplete
+ //
+ if (suffix.indexOf("html") < 0) {
+ iframe.addEventListener("load", loadComplete, false);
+ }
+ document.getElementsByTagName("body").item(0).appendChild(iframe);
+ return 0;
+}
+
+IFrameBuilder.prototype.load = function(frame, varname, url) {
+ var suffix;
+ if (url.substring(0,5) == "staff" || url == "nodtdstaff" || url == "datatype_normalization") {
+ suffix = ".xml";
+ }
+ if (!suffix) suffix = getSuffix(this.contentType);
+ var name = url + suffix;
+ var iframes = document.getElementsByTagName("iframe");
+ for(var i = 0; i < iframes.length; i++) {
+ if (iframes.item(i).getAttribute("name") == name) {
+ var item = iframes.item(i);
+ if (typeof(item.contentDocument) != 'undefined') {
+ return item.contentDocument;
+ }
+ if (typeof(item.document) != 'undefined') {
+ return item.document;
+ }
+ return null;
+ }
+ }
+ return null;
+}
+
+IFrameBuilder.prototype.getImplementationAttribute = function(attr) {
+ for (var i = 0; i < this.fixedAttributeNames.length; i++) {
+ if (this.fixedAttributeNames[i] == attr) {
+ return this.fixedAttributeValues[i];
+ }
+ }
+ throw "Unrecognized implementation attribute: " + attr;
+}
+
+
+
+IFrameBuilder.prototype.setImplementationAttribute = function(attribute, value) {
+ var supported = this.getImplementationAttribute(attribute);
+ if (supported != value) {
+ this.initializationError = "IFrame loader does not support " + attribute + "=" + value;
+ }
+}
+
+
+IFrameBuilder.prototype.canSetImplementationAttribute = function(attribute, value) {
+ var supported = this.getImplementationAttribute(attribute);
+ return (supported == value);
+}
+
+
+function createBuilder(implementation) {
+ if (implementation == null) {
+ return new IFrameBuilder();
+ }
+ switch(implementation) {
+/* case "msxml3":
+ return new MSXMLBuilder("Msxml2.DOMDocument.3.0");
+
+ case "msxml4":
+ return new MSXMLBuilder("Msxml2.DOMDocument.4.0");*/
+
+ case "mozillaXML":
+ return new MozillaXMLBuilder();
+/*
+ case "svgplugin":
+ return new SVGPluginBuilder();
+
+ case "dom3ls":
+ return new DOM3LSBuilder(); */
+
+ case "iframe":
+ return new IFrameBuilder();
+
+ case "xmlhttprequest":
+ return new XMLHttpRequestBuilder();
+
+ default:
+ alert ("unrecognized implementation " + implementation);
+ }
+ return new IFrameBuilder();
+}
+
+function checkFeature(feature, version)
+{
+ if (!builder.hasFeature(feature, version))
+ {
+ //
+ // don't throw exception so that users can select to ignore the precondition
+ //
+ builder.initializationError = "builder does not support feature " + feature + " version " + version;
+ }
+}
+
+function createConfiguredBuilder() {
+ var builder = null;
+ var contentType = null;
+ var i;
+ var contentTypeSet = false;
+ var parm = null;
+ builder = new IFrameBuilder();
+ return builder;
+}
+
+
+function preload(frame, varname, url) {
+ return builder.preload(frame, varname, url);
+}
+
+function load(frame, varname, url) {
+ return builder.load(frame, varname, url);
+}
+
+function getImplementationAttribute(attr) {
+ return builder.getImplementationAttribute(attr);
+}
+
+
+function setImplementationAttribute(attribute, value) {
+ builder.setImplementationAttribute(attribute, value);
+}
+
+function setAsynchronous(value) {
+ if (builder.supportsAsyncChange) {
+ builder.async = value;
+ } else {
+ update();
+ }
+}
+
+
+function createXPathEvaluator(doc) {
+ try {
+ return doc.getFeature("XPath", null);
+ }
+ catch(ex) {
+ }
+ return doc;
+}
+
+function toLowerArray(src) {
+ var newArray = new Array();
+ var i;
+ for (i = 0; i < src.length; i++) {
+ newArray[i] = src[i].toLowerCase();
+ }
+ return newArray;
+}
+
+function MSXMLBuilder_onreadystatechange() {
+ if (builder.parser.readyState == 4) {
+ loadComplete();
+ }
+}
+
+
+
+var fileBase = location.href;
+if (fileBase.indexOf('?') != -1) {
+ fileBase = fileBase.substring(0, fileBase.indexOf('?'));
+}
+fileBase = fileBase.substring(0, fileBase.lastIndexOf('/') + 1) + "files/";
+
+function getResourceURI(name, scheme, contentType) {
+ return fileBase + name + getSuffix(contentType);
+}
+
+
+function getImplementation() {
+ return builder.getImplementation();
+}
+
+// Count of failures overridden as todos.
+var gFailuresAsTodos = 0;
+
+// Override SimpleTest result logger.
+var ST_logResult = SimpleTest._logResult;
+SimpleTest._logResult = function overrideSTlR(test, passString, failString) {
+ if (todoTests[docName] && !test.result && !test.todo) {
+ test.name = "[failure as todo] " + test.name;
+ test.todo = true;
+ failString = "TEST-KNOWN-FAIL";
+
+ ++gFailuresAsTodos;
+ }
+
+ ST_logResult(test, passString, failString);
+}
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function(){ setUpPage(); });
+
+// Actual marking code is in overrideSTlR() now.
+function markTodos() {
+ if (todoTests[docName]) {
+ isnot(gFailuresAsTodos, 0, "test marked todo should have failed somewhere");
+ }
+}
+
+function runJSUnitTests() {
+ builder = createConfiguredBuilder();
+ try {
+ var tests = exposeTestFunctionNames();
+ for (var i = 0; i < tests.length; i++) {
+ window[tests[i]]();
+ }
+ } catch (ex) {
+ if (todoTests[docName]) {
+ todo(false, "[failure as todo] Test threw exception: " + ex);
+ ++gFailuresAsTodos;
+ } else {
+ ok(false, "Test threw exception: " + ex);
+ }
+ }
+}
diff --git a/dom/tests/mochitest/dom-level2-core/exclusions.js b/dom/tests/mochitest/dom-level2-core/exclusions.js
new file mode 100644
index 0000000000..cc5a0da12f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/exclusions.js
@@ -0,0 +1,50 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+dtdTests = ["attrgetownerelement01", "documentimportnode03",
+ "documentimportnode04", "documentimportnode19",
+ "documentimportnode20", "documentimportnode21",
+ "documentimportnode22",
+ "elementgetattributenodens03", "elementgetattributens02",
+ "elementhasattribute02", "getAttributeNS01", "getElementById01",
+ "getNamedItemNS03", "getNamedItemNS04", "hasAttribute02",
+ "hasAttributeNS04", "importNode07", "importNode09",
+ "importNode10", "importNode11", "importNode12", "importNode13",
+ "localName02", "namednodemapgetnameditemns01",
+ "namednodemapremovenameditemns02",
+ "namednodemapremovenameditemns05", "namednodemapsetnameditemns05",
+ "namednodemapsetnameditemns09", "namednodemapsetnameditemns10",
+ "namednodemapsetnameditemns11", "namespaceURI01",
+ "nodeissupported04", "nodenormalize01", "nodesetprefix04",
+ "prefix08", "removeAttributeNS01", "removeAttributeNS02",
+ "removeNamedItemNS03", "setAttributeNodeNS02", "setAttributeNS03",
+ "setNamedItemNS04"];
+
+bug371552 = ["elementhasattributens02"];
+wrongDocError = ["elementsetattributenodens05", "namednodemapsetnameditemns03",
+ "setAttributeNodeNS05", "setNamedItemNS02"];
+attrExodus = ["elementsetattributenodens06", "importNode01",
+ "hc_namednodemapinvalidtype1", "nodehasattributes02"];
+bogusPrefix = ["nodesetprefix05", "nodesetprefix09", "prefix06", "prefix07"];
+prefixReplacement = ["setAttributeNodeNS04"];
+
+function concat(lst/*...*/) {
+ var f = [];
+ if (arguments !== null) {
+ f = arguments[0];
+ }
+ for (var i = 1; i < arguments.length; i++) {
+ f = f.concat(arguments[i]);
+ }
+ return f;
+}
+
+var todoTests = {};
+var exclusions = concat(dtdTests, bug371552, wrongDocError, attrExodus,
+ bogusPrefix, prefixReplacement);
+for (var excludedTestName in exclusions) {
+ todoTests[exclusions[excludedTestName]] = true;
+}
diff --git a/dom/tests/mochitest/dom-level2-core/files/hc_staff.html b/dom/tests/mochitest/dom-level2-core/files/hc_staff.html
new file mode 100644
index 0000000000..9acf750493
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/hc_staff.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd" >
+<!-- This is comment number 1.-->
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_staff</title><script type="text/javascript" src="svgunit.js"></script><script charset="UTF-8" type="text/javascript" src="svgtest.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level2-core/files/hc_staff.svg b/dom/tests/mochitest/dom-level2-core/files/hc_staff.svg
new file mode 100644
index 0000000000..cd0cc47f9a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/hc_staff.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE svg
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd" [
+ <!ENTITY alpha "&#945;">
+ <!ENTITY beta "&#946;">
+ <!ENTITY gamma "&#947;">
+ <!ENTITY delta "&#948;">
+ <!ENTITY epsilon "&#949;">
+ <!ENTITY alpha "&#950;">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST acronym dir CDATA "ltr">
+ <!ATTLIST head xmlns CDATA #IMPLIED>
+ <!ATTLIST body xmlns CDATA #IMPLIED>
+ <!ELEMENT svg (rect, script, head, body)>
+ <!ATTLIST svg xmlns CDATA #IMPLIED>
+ <!ELEMENT rect EMPTY>
+ <!ATTLIST rect
+ x CDATA #IMPLIED
+ y CDATA #IMPLIED
+ width CDATA #IMPLIED
+ height CDATA #IMPLIED>
+ <!ENTITY svgunit SYSTEM "svgunit.js">
+ <!ENTITY svgtest SYSTEM "svgtest.js">
+]>
+<!-- This is comment number 1.-->
+<svg xmlns='http://www.w3.org/2000/svg'><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgtest;&svgunit;</script><head xmlns='http://www.w3.org/1999/xhtml'><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title></head><body xmlns='http://www.w3.org/1999/xhtml'>
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></svg>
diff --git a/dom/tests/mochitest/dom-level2-core/files/hc_staff.xhtml b/dom/tests/mochitest/dom-level2-core/files/hc_staff.xhtml
new file mode 100644
index 0000000000..2df9a74154
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/hc_staff.xhtml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd" [
+ <!ENTITY alpha "&#945;">
+ <!ENTITY beta "&#946;">
+ <!ENTITY gamma "&#947;">
+ <!ENTITY delta "&#948;">
+ <!ENTITY epsilon "&#949;">
+ <!ENTITY alpha "&#950;">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST acronym dir CDATA "ltr">
+]>
+<!-- This is comment number 1.-->
+<html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title><script type="text/javascript" src="svgunit.js"/><script charset="UTF-8" type="text/javascript" src="svgtest.js"/><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level2-core/files/hc_staff.xml b/dom/tests/mochitest/dom-level2-core/files/hc_staff.xml
new file mode 100644
index 0000000000..2df9a74154
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/hc_staff.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd" [
+ <!ENTITY alpha "&#945;">
+ <!ENTITY beta "&#946;">
+ <!ENTITY gamma "&#947;">
+ <!ENTITY delta "&#948;">
+ <!ENTITY epsilon "&#949;">
+ <!ENTITY alpha "&#950;">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST acronym dir CDATA "ltr">
+]>
+<!-- This is comment number 1.-->
+<html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title><script type="text/javascript" src="svgunit.js"/><script charset="UTF-8" type="text/javascript" src="svgtest.js"/><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
+ <p>
+ <em>EMP0001</em>
+ <strong>Margaret Martin</strong>
+ <code>Accountant</code>
+ <sup>56,000</sup>
+ <var>Female</var>
+ <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
+ </p>
+ <p>
+ <em>EMP0002</em>
+ <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
+This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
+ <code>Secretary</code>
+ <sup>35,000</sup>
+ <var>Female</var>
+ <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
+ 98554</acronym>
+ </p>
+ <p>
+ <em>EMP0003</em>
+ <strong>Roger
+ Jones</strong>
+ <code>Department Manager</code>
+ <sup>100,000</sup>
+ <var>&delta;</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&alpha;">27 South Road. Dallas, Texas 98556</acronym>
+ </p>
+ <p>
+ <em>EMP0005</em>
+ <strong>Robert Myers</strong>
+ <code>Computer Specialist</code>
+ <sup>90,000</sup>
+ <var>male</var>
+ <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
+ </p>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level2-core/files/internalSubset01.js b/dom/tests/mochitest/dom-level2-core/files/internalSubset01.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/internalSubset01.js
diff --git a/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.svg b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.svg
new file mode 100644
index 0000000000..01aa823f35
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100" height="100"/>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+</svg>
diff --git a/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.xml b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.xml
new file mode 100644
index 0000000000..054a5e1808
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<staff>
+ <employee>
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+</staff>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staff.dtd b/dom/tests/mochitest/dom-level2-core/files/staff.dtd
new file mode 100644
index 0000000000..02a994d57d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staff.dtd
@@ -0,0 +1,17 @@
+<!ELEMENT employeeId (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT position (#PCDATA)>
+<!ELEMENT salary (#PCDATA)>
+<!ELEMENT address (#PCDATA)>
+<!ELEMENT entElement ( #PCDATA ) >
+<!ELEMENT gender ( #PCDATA | entElement )* >
+<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
+<!ELEMENT staff (employee)+>
+<!ATTLIST entElement
+ attr1 CDATA "Attr">
+<!ATTLIST address
+ domestic CDATA #IMPLIED
+ street CDATA "Yes">
+<!ATTLIST entElement
+ domestic CDATA "MALE" >
+
diff --git a/dom/tests/mochitest/dom-level2-core/files/staff.svg b/dom/tests/mochitest/dom-level2-core/files/staff.svg
new file mode 100644
index 0000000000..fd67323a46
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staff.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE svg SYSTEM "staff.dtd" [
+ <!ENTITY ent1 "es">
+ <!ENTITY ent2 "1900 Dallas Road">
+ <!ENTITY ent3 "Texas">
+ <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>">
+ <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
+ <!ENTITY ent1 "This entity should be discarded">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ATTLIST employee xmlns CDATA #IMPLIED>
+ <!ELEMENT svg (rect, script, employee+)>
+ <!ATTLIST svg
+ xmlns CDATA #FIXED "http://www.w3.org/2000/svg"
+ name CDATA #IMPLIED>
+ <!ELEMENT rect EMPTY>
+ <!ATTLIST rect
+ x CDATA #REQUIRED
+ y CDATA #REQUIRED
+ width CDATA #REQUIRED
+ height CDATA #REQUIRED>
+ <!ELEMENT script (#PCDATA)>
+ <!ATTLIST script type CDATA #IMPLIED>
+ <!ENTITY svgunit SYSTEM "svgunit.js">
+ <!ENTITY svgtest SYSTEM "svgtest.js">
+]>
+<!-- This is comment number 1.-->
+<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgtest;&svgunit;</script>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0002</employeeId>
+ <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
+<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
+ <position>Secretary</position>
+ <salary>35,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
+ 98554</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0003</employeeId>
+ <name>Roger
+ Jones</name>
+ <position>Department Manager</position>
+ <salary>100,000</salary>
+ <gender>&ent4;</gender>
+ <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0004</employeeId>
+ <name>Jeny Oconnor</name>
+ <position>Personnel Director</position>
+ <salary>95,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address>
+ </employee>
+ <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files">
+ <employeeId>EMP0005</employeeId>
+ <name>Robert Myers</name>
+ <position>Computer Specialist</position>
+ <salary>90,000</salary>
+ <gender>male</gender>
+ <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address>
+ </employee>
+ </svg>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staff.xml b/dom/tests/mochitest/dom-level2-core/files/staff.xml
new file mode 100644
index 0000000000..f89c5107db
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staff.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE staff SYSTEM "staff.dtd" [
+ <!ENTITY ent1 "es">
+ <!ENTITY ent2 "1900 Dallas Road">
+ <!ENTITY ent3 "Texas">
+ <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>">
+ <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
+ <!ENTITY ent1 "This entity should be discarded">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+]>
+<!-- This is comment number 1.-->
+<staff>
+ <employee>
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0002</employeeId>
+ <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
+<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
+ <position>Secretary</position>
+ <salary>35,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
+ 98554</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0003</employeeId>
+ <name>Roger
+ Jones</name>
+ <position>Department Manager</position>
+ <salary>100,000</salary>
+ <gender>&ent4;</gender>
+ <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0004</employeeId>
+ <name>Jeny Oconnor</name>
+ <position>Personnel Director</position>
+ <salary>95,000</salary>
+ <gender>Female</gender>
+ <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address>
+ </employee>
+ <employee>
+ <employeeId>EMP0005</employeeId>
+ <name>Robert Myers</name>
+ <position>Computer Specialist</position>
+ <salary>90,000</salary>
+ <gender>male</gender>
+ <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address>
+ </employee>
+ </staff>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staff2.dtd b/dom/tests/mochitest/dom-level2-core/files/staff2.dtd
new file mode 100644
index 0000000000..0bac8f2539
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staff2.dtd
@@ -0,0 +1,24 @@
+<!ELEMENT employeeId (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT position (#PCDATA)>
+<!ELEMENT salary (#PCDATA)>
+<!ELEMENT address (#PCDATA)>
+<!ELEMENT gender ( #PCDATA)>
+<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
+<!ATTLIST employee xmlns CDATA #IMPLIED>
+<!ELEMENT staff (employee)+>
+<!ELEMENT svg (rect, script, employee+)>
+<!ATTLIST svg
+ xmlns CDATA #FIXED "http://www.w3.org/2000/svg"
+ name CDATA #IMPLIED>
+<!ELEMENT rect EMPTY>
+<!ATTLIST rect
+ x CDATA #REQUIRED
+ y CDATA #REQUIRED
+ width CDATA #REQUIRED
+ height CDATA #REQUIRED>
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script type CDATA #IMPLIED>
+<!ENTITY svgunit SYSTEM "svgunit.js">
+<!ENTITY svgtest SYSTEM "internalSubset01.js">
+
diff --git a/dom/tests/mochitest/dom-level2-core/files/staff2.svg b/dom/tests/mochitest/dom-level2-core/files/staff2.svg
new file mode 100644
index 0000000000..6f89dad04a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staff2.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE svg SYSTEM "staff2.dtd" []>
+<!-- This is comment number 1.-->
+<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgtest;&svgunit;</script>
+ <employee xmlns="http://www.example.com">
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address>1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ </svg>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staff2.xml b/dom/tests/mochitest/dom-level2-core/files/staff2.xml
new file mode 100644
index 0000000000..d3d9a13dd6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staff2.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE staff SYSTEM "staff2.dtd" []>
+<!-- This is comment number 1.-->
+<staff>
+ <employee>
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address>1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ </staff>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staffNS.dtd b/dom/tests/mochitest/dom-level2-core/files/staffNS.dtd
new file mode 100644
index 0000000000..7643773fc8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staffNS.dtd
@@ -0,0 +1,45 @@
+<!ELEMENT staff (employee+,emp:employee,employee) >
+<!ELEMENT employee (employeeId,name,position,salary,gender,address) >
+<!ATTLIST employee xmlns CDATA #IMPLIED>
+<!ATTLIST employee xmlns:dmstc CDATA #IMPLIED>
+<!ATTLIST employee xmlns:emp2 CDATA #IMPLIED>
+
+<!ELEMENT employeeId (#PCDATA) >
+
+<!ELEMENT name (#PCDATA) >
+
+<!ELEMENT position (#PCDATA) >
+
+<!ELEMENT salary (#PCDATA) >
+
+<!ELEMENT entElement1 (#PCDATA) >
+<!ELEMENT gender (#PCDATA | entElement1)* >
+<!ATTLIST entElement1 xmlns:local1 CDATA #IMPLIED >
+
+<!ELEMENT address (#PCDATA) >
+<!ATTLIST address dmstc:domestic CDATA #IMPLIED>
+<!ATTLIST address street CDATA #IMPLIED>
+<!ATTLIST address domestic CDATA #IMPLIED>
+<!ATTLIST address xmlns CDATA #IMPLIED>
+
+<!ELEMENT emp:employee (emp:employeeId,nm:name,emp:position,emp:salary,emp:gender,emp:address) >
+<!ATTLIST emp:employee xmlns:emp CDATA #IMPLIED>
+<!ATTLIST emp:employee xmlns:nm CDATA #IMPLIED>
+<!ATTLIST emp:employee defaultAttr CDATA 'defaultVal'>
+
+<!ELEMENT emp:employeeId (#PCDATA) >
+
+<!ELEMENT nm:name (#PCDATA) >
+
+<!ELEMENT emp:position (#PCDATA) >
+
+<!ELEMENT emp:salary (#PCDATA) >
+
+<!ELEMENT emp:gender (#PCDATA) >
+
+<!ELEMENT emp:address (#PCDATA) >
+<!ATTLIST emp:address emp:domestic CDATA #IMPLIED>
+<!ATTLIST emp:address street CDATA #IMPLIED>
+<!ATTLIST emp:address emp:zone ID #IMPLIED>
+<!ATTLIST emp:address emp:district CDATA 'DISTRICT'>
+<!ATTLIST emp:address emp:local1 CDATA 'FALSE'>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staffNS.svg b/dom/tests/mochitest/dom-level2-core/files/staffNS.svg
new file mode 100644
index 0000000000..7a7c26ee89
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staffNS.svg
@@ -0,0 +1,73 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE svg PUBLIC "STAFF" "staffNS.dtd"
+[
+ <!ENTITY ent1 "es">
+ <!ENTITY ent2 "1900 Dallas Road">
+ <!ENTITY ent3 "Texas">
+ <!ENTITY ent4 "<entElement1 xmlns:local1='www.xyz.com'>Element data</entElement1><?PItarget PIdata?>">
+ <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
+ <!ENTITY ent6 PUBLIC "uri" "file" NDATA notation2>
+ <!ENTITY ent1 "This entity should be discarded">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+ <!ELEMENT svg (rect, script, employee+, emp:employee, employee*)>
+ <!ATTLIST svg
+ xmlns CDATA #FIXED "http://www.w3.org/2000/svg"
+ name CDATA #IMPLIED>
+ <!ELEMENT rect EMPTY>
+ <!ATTLIST rect
+ x CDATA #REQUIRED
+ y CDATA #REQUIRED
+ width CDATA #REQUIRED
+ height CDATA #REQUIRED>
+ <!ELEMENT script (#PCDATA)>
+ <!ATTLIST script type CDATA #IMPLIED>
+ <!ENTITY svgunit SYSTEM "svgunit.js">
+ <!ENTITY svgtest SYSTEM "svgtest.js">
+]>
+<!-- This is comment number 1.-->
+<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgtest;&svgunit;</script>
+ <employee xmlns="http://www.nist.gov" xmlns:dmstc="http://www.usa.com">
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address dmstc:domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ <employee xmlns:dmstc="http://www.usa.com" xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2/Files">
+ <employeeId>EMP0002</employeeId>
+ <name>Martha Raynolds
+<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
+<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
+ <position>Secretary</position>
+ <salary>35,000</salary>
+ <gender>Female</gender>
+ <address dmstc:domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
+ 98554</address>
+ </employee>
+ <employee xmlns:dmstc="http://www.netzero.com" xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2/Files">
+ <employeeId>EMP0003</employeeId>
+ <name>Roger
+ Jones</name>
+ <position>Department Manager</position>
+ <salary>100,000</salary>
+ <gender>&ent4;</gender>
+ <address dmstc:domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
+ </employee>
+ <emp:employee xmlns:emp="http://www.nist.gov" xmlns:nm="http://www.altavista.com" > <emp:employeeId>EMP0004</emp:employeeId>
+ <nm:name>Jeny Oconnor</nm:name>
+ <emp:position>Personnel Director</emp:position>
+ <emp:salary>95,000</emp:salary>
+ <emp:gender>Female</emp:gender>
+ <emp:address emp:domestic="Yes" street="Y&ent1;" emp:zone="CANADA" emp:local1="TRUE">27 South Road. Dallas, texas 98556</emp:address>
+ </emp:employee>
+ <employee xmlns:emp2="http://www.nist.gov" xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2/Files">
+ <employeeId>EMP0005</employeeId>
+ <name>Robert Myers</name>
+ <position>Computer Specialist</position>
+ <salary>90,000</salary>
+ <gender>male</gender>
+ <address street="Yes" xmlns="http://www.nist.gov">1821 Nordic. Road, Irving Texas 98558</address>
+ </employee>
+ </svg>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staffNS.xml b/dom/tests/mochitest/dom-level2-core/files/staffNS.xml
new file mode 100644
index 0000000000..1cb1459e23
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/staffNS.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE staff PUBLIC "STAFF" "staffNS.dtd"
+[
+ <!ENTITY ent1 "es">
+ <!ENTITY ent2 "1900 Dallas Road">
+ <!ENTITY ent3 "Texas">
+ <!ENTITY ent4 "<entElement1 xmlns:local1='www.xyz.com'>Element data</entElement1><?PItarget PIdata?>">
+ <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
+ <!ENTITY ent6 PUBLIC "uri" "file" NDATA notation2>
+ <!ENTITY ent1 "This entity should be discarded">
+ <!NOTATION notation1 PUBLIC "notation1File">
+ <!NOTATION notation2 SYSTEM "notation2File">
+]>
+<!-- This is comment number 1.-->
+<staff>
+ <employee xmlns="http://www.nist.gov" xmlns:dmstc="http://www.usa.com">
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address dmstc:domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ <employee xmlns:dmstc="http://www.usa.com">
+ <employeeId>EMP0002</employeeId>
+ <name>Martha Raynolds
+<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
+<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
+ <position>Secretary</position>
+ <salary>35,000</salary>
+ <gender>Female</gender>
+ <address dmstc:domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
+ 98554</address>
+ </employee>
+ <employee xmlns:dmstc="http://www.netzero.com">
+ <employeeId>EMP0003</employeeId>
+ <name>Roger
+ Jones</name>
+ <position>Department Manager</position>
+ <salary>100,000</salary>
+ <gender>&ent4;</gender>
+ <address dmstc:domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
+ </employee>
+ <emp:employee xmlns:emp="http://www.nist.gov" xmlns:nm="http://www.altavista.com" > <emp:employeeId>EMP0004</emp:employeeId>
+ <nm:name>Jeny Oconnor</nm:name>
+ <emp:position>Personnel Director</emp:position>
+ <emp:salary>95,000</emp:salary>
+ <emp:gender>Female</emp:gender>
+ <emp:address emp:domestic="Yes" street="Y&ent1;" emp:zone="CANADA" emp:local1="TRUE">27 South Road. Dallas, texas 98556</emp:address>
+ </emp:employee>
+ <employee xmlns:emp2="http://www.nist.gov">
+ <employeeId>EMP0005</employeeId>
+ <name>Robert Myers</name>
+ <position>Computer Specialist</position>
+ <salary>90,000</salary>
+ <gender>male</gender>
+ <address street="Yes" xmlns="http://www.nist.gov">1821 Nordic. Road, Irving Texas 98558</address>
+ </employee>
+ </staff>
diff --git a/dom/tests/mochitest/dom-level2-core/files/svgtest.js b/dom/tests/mochitest/dom-level2-core/files/svgtest.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/svgtest.js
diff --git a/dom/tests/mochitest/dom-level2-core/files/svgunit.js b/dom/tests/mochitest/dom-level2-core/files/svgunit.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/svgunit.js
diff --git a/dom/tests/mochitest/dom-level2-core/files/xhtml-lat1.ent b/dom/tests/mochitest/dom-level2-core/files/xhtml-lat1.ent
new file mode 100644
index 0000000000..ffee223eb1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/xhtml-lat1.ent
@@ -0,0 +1,196 @@
+<!-- Portions (C) International Organization for Standardization 1986
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+ %HTMLlat1;
+-->
+
+<!ENTITY nbsp "&#160;"> <!-- no-break space = non-breaking space,
+ U+00A0 ISOnum -->
+<!ENTITY iexcl "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+ U+00A6 ISOnum -->
+<!ENTITY sect "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml "&#168;"> <!-- diaeresis = spacing diaeresis,
+ U+00A8 ISOdia -->
+<!ENTITY copy "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo "&#171;"> <!-- left-pointing double angle quotation mark
+ = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not "&#172;"> <!-- not sign = angled dash,
+ U+00AC ISOnum -->
+<!ENTITY shy "&#173;"> <!-- soft hyphen = discretionary hyphen,
+ U+00AD ISOnum -->
+<!ENTITY reg "&#174;"> <!-- registered sign = registered trade mark sign,
+ U+00AE ISOnum -->
+<!ENTITY macr "&#175;"> <!-- macron = spacing macron = overline
+ = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+ U+00B1 ISOnum -->
+<!ENTITY sup2 "&#178;"> <!-- superscript two = superscript digit two
+ = squared, U+00B2 ISOnum -->
+<!ENTITY sup3 "&#179;"> <!-- superscript three = superscript digit three
+ = cubed, U+00B3 ISOnum -->
+<!ENTITY acute "&#180;"> <!-- acute accent = spacing acute,
+ U+00B4 ISOdia -->
+<!ENTITY micro "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para "&#182;"> <!-- pilcrow sign = paragraph sign,
+ U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+ = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1 "&#185;"> <!-- superscript one = superscript digit one,
+ U+00B9 ISOnum -->
+<!ENTITY ordm "&#186;"> <!-- masculine ordinal indicator,
+ U+00BA ISOnum -->
+<!ENTITY raquo "&#187;"> <!-- right-pointing double angle quotation mark
+ = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+ = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+ = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+ = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+ = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+ = latin capital letter A grave,
+ U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+ U+00C1 ISOlat1 -->
+<!ENTITY Acirc "&#194;"> <!-- latin capital letter A with circumflex,
+ U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+ U+00C3 ISOlat1 -->
+<!ENTITY Auml "&#196;"> <!-- latin capital letter A with diaeresis,
+ U+00C4 ISOlat1 -->
+<!ENTITY Aring "&#197;"> <!-- latin capital letter A with ring above
+ = latin capital letter A ring,
+ U+00C5 ISOlat1 -->
+<!ENTITY AElig "&#198;"> <!-- latin capital letter AE
+ = latin capital ligature AE,
+ U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+ U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+ U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+ U+00C9 ISOlat1 -->
+<!ENTITY Ecirc "&#202;"> <!-- latin capital letter E with circumflex,
+ U+00CA ISOlat1 -->
+<!ENTITY Euml "&#203;"> <!-- latin capital letter E with diaeresis,
+ U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+ U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+ U+00CD ISOlat1 -->
+<!ENTITY Icirc "&#206;"> <!-- latin capital letter I with circumflex,
+ U+00CE ISOlat1 -->
+<!ENTITY Iuml "&#207;"> <!-- latin capital letter I with diaeresis,
+ U+00CF ISOlat1 -->
+<!ENTITY ETH "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+ U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+ U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+ U+00D3 ISOlat1 -->
+<!ENTITY Ocirc "&#212;"> <!-- latin capital letter O with circumflex,
+ U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+ U+00D5 ISOlat1 -->
+<!ENTITY Ouml "&#214;"> <!-- latin capital letter O with diaeresis,
+ U+00D6 ISOlat1 -->
+<!ENTITY times "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+ = latin capital letter O slash,
+ U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+ U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+ U+00DA ISOlat1 -->
+<!ENTITY Ucirc "&#219;"> <!-- latin capital letter U with circumflex,
+ U+00DB ISOlat1 -->
+<!ENTITY Uuml "&#220;"> <!-- latin capital letter U with diaeresis,
+ U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+ U+00DD ISOlat1 -->
+<!ENTITY THORN "&#222;"> <!-- latin capital letter THORN,
+ U+00DE ISOlat1 -->
+<!ENTITY szlig "&#223;"> <!-- latin small letter sharp s = ess-zed,
+ U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+ = latin small letter a grave,
+ U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+ U+00E1 ISOlat1 -->
+<!ENTITY acirc "&#226;"> <!-- latin small letter a with circumflex,
+ U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+ U+00E3 ISOlat1 -->
+<!ENTITY auml "&#228;"> <!-- latin small letter a with diaeresis,
+ U+00E4 ISOlat1 -->
+<!ENTITY aring "&#229;"> <!-- latin small letter a with ring above
+ = latin small letter a ring,
+ U+00E5 ISOlat1 -->
+<!ENTITY aelig "&#230;"> <!-- latin small letter ae
+ = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+ U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+ U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+ U+00E9 ISOlat1 -->
+<!ENTITY ecirc "&#234;"> <!-- latin small letter e with circumflex,
+ U+00EA ISOlat1 -->
+<!ENTITY euml "&#235;"> <!-- latin small letter e with diaeresis,
+ U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+ U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+ U+00ED ISOlat1 -->
+<!ENTITY icirc "&#238;"> <!-- latin small letter i with circumflex,
+ U+00EE ISOlat1 -->
+<!ENTITY iuml "&#239;"> <!-- latin small letter i with diaeresis,
+ U+00EF ISOlat1 -->
+<!ENTITY eth "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+ U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+ U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+ U+00F3 ISOlat1 -->
+<!ENTITY ocirc "&#244;"> <!-- latin small letter o with circumflex,
+ U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+ U+00F5 ISOlat1 -->
+<!ENTITY ouml "&#246;"> <!-- latin small letter o with diaeresis,
+ U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+ = latin small letter o slash,
+ U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+ U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+ U+00FA ISOlat1 -->
+<!ENTITY ucirc "&#251;"> <!-- latin small letter u with circumflex,
+ U+00FB ISOlat1 -->
+<!ENTITY uuml "&#252;"> <!-- latin small letter u with diaeresis,
+ U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+ U+00FD ISOlat1 -->
+<!ENTITY thorn "&#254;"> <!-- latin small letter thorn,
+ U+00FE ISOlat1 -->
+<!ENTITY yuml "&#255;"> <!-- latin small letter y with diaeresis,
+ U+00FF ISOlat1 -->
diff --git a/dom/tests/mochitest/dom-level2-core/files/xhtml-special.ent b/dom/tests/mochitest/dom-level2-core/files/xhtml-special.ent
new file mode 100644
index 0000000000..ca358b2fec
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/xhtml-special.ent
@@ -0,0 +1,80 @@
+<!-- Special characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+ %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot "&#34;"> <!-- quotation mark, U+0022 ISOnum -->
+<!ENTITY amp "&#38;#38;"> <!-- ampersand, U+0026 ISOnum -->
+<!ENTITY lt "&#38;#60;"> <!-- less-than sign, U+003C ISOnum -->
+<!ENTITY gt "&#62;"> <!-- greater-than sign, U+003E ISOnum -->
+<!ENTITY apos "&#39;"> <!-- apostrophe = APL quote, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;"> <!-- latin capital ligature OE,
+ U+0152 ISOlat2 -->
+<!ENTITY oelig "&#339;"> <!-- latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;"> <!-- latin capital letter S with caron,
+ U+0160 ISOlat2 -->
+<!ENTITY scaron "&#353;"> <!-- latin small letter s with caron,
+ U+0161 ISOlat2 -->
+<!ENTITY Yuml "&#376;"> <!-- latin capital letter Y with diaeresis,
+ U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;"> <!-- modifier letter circumflex accent,
+ U+02C6 ISOpub -->
+<!ENTITY tilde "&#732;"> <!-- small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj "&#8204;"> <!-- zero width non-joiner,
+ U+200C NEW RFC 2070 -->
+<!ENTITY zwj "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo "&#8216;"> <!-- left single quotation mark,
+ U+2018 ISOnum -->
+<!ENTITY rsquo "&#8217;"> <!-- right single quotation mark,
+ U+2019 ISOnum -->
+<!ENTITY sbquo "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo "&#8220;"> <!-- left double quotation mark,
+ U+201C ISOnum -->
+<!ENTITY rdquo "&#8221;"> <!-- right double quotation mark,
+ U+201D ISOnum -->
+<!ENTITY bdquo "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo "&#8249;"> <!-- single left-pointing angle quotation mark,
+ U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;"> <!-- single right-pointing angle quotation mark,
+ U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+
+<!-- Currency Symbols -->
+<!ENTITY euro "&#8364;"> <!-- euro sign, U+20AC NEW -->
diff --git a/dom/tests/mochitest/dom-level2-core/files/xhtml-symbol.ent b/dom/tests/mochitest/dom-level2-core/files/xhtml-symbol.ent
new file mode 100644
index 0000000000..63c2abfa6f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/xhtml-symbol.ent
@@ -0,0 +1,237 @@
+<!-- Mathematical, Greek and Symbolic characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+ %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;"> <!-- latin small letter f with hook = function
+ = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma "&#915;"> <!-- greek capital letter gamma,
+ U+0393 ISOgrk3 -->
+<!ENTITY Delta "&#916;"> <!-- greek capital letter delta,
+ U+0394 ISOgrk3 -->
+<!ENTITY Epsilon "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta "&#920;"> <!-- greek capital letter theta,
+ U+0398 ISOgrk3 -->
+<!ENTITY Iota "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda "&#923;"> <!-- greek capital letter lamda,
+ U+039B ISOgrk3 -->
+<!ENTITY Mu "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma "&#931;"> <!-- greek capital letter sigma,
+ U+03A3 ISOgrk3 -->
+<!ENTITY Tau "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon "&#933;"> <!-- greek capital letter upsilon,
+ U+03A5 ISOgrk3 -->
+<!ENTITY Phi "&#934;"> <!-- greek capital letter phi,
+ U+03A6 ISOgrk3 -->
+<!ENTITY Chi "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi "&#936;"> <!-- greek capital letter psi,
+ U+03A8 ISOgrk3 -->
+<!ENTITY Omega "&#937;"> <!-- greek capital letter omega,
+ U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha "&#945;"> <!-- greek small letter alpha,
+ U+03B1 ISOgrk3 -->
+<!ENTITY beta "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma "&#947;"> <!-- greek small letter gamma,
+ U+03B3 ISOgrk3 -->
+<!ENTITY delta "&#948;"> <!-- greek small letter delta,
+ U+03B4 ISOgrk3 -->
+<!ENTITY epsilon "&#949;"> <!-- greek small letter epsilon,
+ U+03B5 ISOgrk3 -->
+<!ENTITY zeta "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta "&#952;"> <!-- greek small letter theta,
+ U+03B8 ISOgrk3 -->
+<!ENTITY iota "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa "&#954;"> <!-- greek small letter kappa,
+ U+03BA ISOgrk3 -->
+<!ENTITY lambda "&#955;"> <!-- greek small letter lamda,
+ U+03BB ISOgrk3 -->
+<!ENTITY mu "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf "&#962;"> <!-- greek small letter final sigma,
+ U+03C2 ISOgrk3 -->
+<!ENTITY sigma "&#963;"> <!-- greek small letter sigma,
+ U+03C3 ISOgrk3 -->
+<!ENTITY tau "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon "&#965;"> <!-- greek small letter upsilon,
+ U+03C5 ISOgrk3 -->
+<!ENTITY phi "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega "&#969;"> <!-- greek small letter omega,
+ U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek theta symbol,
+ U+03D1 NEW -->
+<!ENTITY upsih "&#978;"> <!-- greek upsilon with hook symbol,
+ U+03D2 NEW -->
+<!ENTITY piv "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;"> <!-- bullet = black small circle,
+ U+2022 ISOpub -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+ U+2026 ISOpub -->
+<!ENTITY prime "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime "&#8243;"> <!-- double prime = seconds = inches,
+ U+2033 ISOtech -->
+<!ENTITY oline "&#8254;"> <!-- overline = spacing overscore,
+ U+203E NEW -->
+<!ENTITY frasl "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;"> <!-- script capital P = power set
+ = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image "&#8465;"> <!-- black-letter capital I = imaginary part,
+ U+2111 ISOamso -->
+<!ENTITY real "&#8476;"> <!-- black-letter capital R = real part symbol,
+ U+211C ISOamso -->
+<!ENTITY trade "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+ U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+ U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr "&#8629;"> <!-- downwards arrow with corner leftwards
+ = carriage return, U+21B5 NEW -->
+<!ENTITY lArr "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+ but also does not have any other character for that function. So lArr can
+ be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr "&#8658;"> <!-- rightwards double arrow,
+ U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have
+ another character with this function so rArr can be used for 'implies'
+ as ISOtech suggests -->
+<!ENTITY dArr "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr "&#8660;"> <!-- left right double arrow,
+ U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part "&#8706;"> <!-- partial differential, U+2202 ISOtech -->
+<!ENTITY exist "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty "&#8709;"> <!-- empty set = null set, U+2205 ISOamso -->
+<!ENTITY nabla "&#8711;"> <!-- nabla = backward difference,
+ U+2207 ISOtech -->
+<!ENTITY isin "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!ENTITY prod "&#8719;"> <!-- n-ary product = product sign,
+ U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+ the same glyph might be used for both -->
+<!ENTITY sum "&#8721;"> <!-- n-ary summation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+ though the same glyph might be used for both -->
+<!ENTITY minus "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic "&#8730;"> <!-- square root = radical sign,
+ U+221A ISOtech -->
+<!ENTITY prop "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4 "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim "&#8764;"> <!-- tilde operator = varies with = similar to,
+ U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+ although the same glyph might be used to represent both -->
+<!ENTITY cong "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp "&#8776;"> <!-- almost equal to = asymptotic to,
+ U+2248 ISOamsr -->
+<!ENTITY ne "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge "&#8805;"> <!-- greater-than or equal to,
+ U+2265 ISOtech -->
+<!ENTITY sub "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!ENTITY nsub "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe "&#8839;"> <!-- superset of or equal to,
+ U+2287 ISOtech -->
+<!ENTITY oplus "&#8853;"> <!-- circled plus = direct sum,
+ U+2295 ISOamsb -->
+<!ENTITY otimes "&#8855;"> <!-- circled times = vector product,
+ U+2297 ISOamsb -->
+<!ENTITY perp "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+ U+22A5 ISOtech -->
+<!ENTITY sdot "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;"> <!-- left ceiling = APL upstile,
+ U+2308 ISOamsc -->
+<!ENTITY rceil "&#8969;"> <!-- right ceiling, U+2309 ISOamsc -->
+<!ENTITY lfloor "&#8970;"> <!-- left floor = APL downstile,
+ U+230A ISOamsc -->
+<!ENTITY rfloor "&#8971;"> <!-- right floor, U+230B ISOamsc -->
+<!ENTITY lang "&#9001;"> <!-- left-pointing angle bracket = bra,
+ U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than sign'
+ or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang "&#9002;"> <!-- right-pointing angle bracket = ket,
+ U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than sign'
+ or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs "&#9827;"> <!-- black club suit = shamrock,
+ U+2663 ISOpub -->
+<!ENTITY hearts "&#9829;"> <!-- black heart suit = valentine,
+ U+2665 ISOpub -->
+<!ENTITY diams "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
diff --git a/dom/tests/mochitest/dom-level2-core/files/xhtml1-frameset.dtd b/dom/tests/mochitest/dom-level2-core/files/xhtml1-frameset.dtd
new file mode 100644
index 0000000000..dc5d7936cc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/xhtml1-frameset.dtd
@@ -0,0 +1,1235 @@
+<!--
+ Extensible HTML version 1.0 Frameset DTD
+
+ This is the same as HTML 4 Frameset except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2007/02/28 22:59:26 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % MultiLengths "CDATA">
+ <!-- comma-separated list of MultiLength -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+ "object | applet | img | map | iframe">
+
+<!ENTITY % special.basic
+ "br | span | bdo">
+
+<!ENTITY % special
+ "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+ | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex | fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ sub, sup, font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+ %inline.forms; | %misc.inline;)*">
+
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, frameset)>
+<!ATTLIST html
+ %i18n;
+ id ID #IMPLIED
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ id ID #IMPLIED
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title
+ %i18n;
+ id ID #IMPLIED
+ >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ id ID #IMPLIED
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ id ID #IMPLIED
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ id ID #IMPLIED
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ id ID #IMPLIED
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- only one noframes element permitted per document -->
+
+<!ELEMENT frameset (frameset|frame|noframes)*>
+<!ATTLIST frameset
+ %coreattrs;
+ rows %MultiLengths; #IMPLIED
+ cols %MultiLengths; #IMPLIED
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ >
+
+<!-- reserved frame names start with "_" otherwise starts with letter -->
+
+<!-- tiled window within frameset -->
+
+<!ELEMENT frame EMPTY>
+<!ATTLIST frame
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ noresize (noresize) #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ >
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes (body)>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ %focus;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form |%inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ %focus;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ %focus;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=":"
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
diff --git a/dom/tests/mochitest/dom-level2-core/files/xhtml1-strict.dtd b/dom/tests/mochitest/dom-level2-core/files/xhtml1-strict.dtd
new file mode 100644
index 0000000000..fefb77f4f0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/xhtml1-strict.dtd
@@ -0,0 +1,65 @@
+<!--
+
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, Institut National de
+Recherche en Informatique et en Automatique, Keio University). All
+Rights Reserved. This program is distributed under the W3C's Software
+Intellectual Property License. This program is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.
+
+See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+
+-->
+
+<!--
+
+This is a radically simplified DTD for use in the DOM Test Suites
+due to a XML non-conformance of one implementation in processing
+parameter entities. When that non-conformance is resolved,
+this DTD can be replaced by the normal DTD for XHTML.
+
+-->
+
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html xmlns CDATA #IMPLIED>
+<!ELEMENT head (meta,title,script*)>
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ http-equiv CDATA #IMPLIED
+ content CDATA #IMPLIED>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT body (p*)>
+<!ATTLIST body onload CDATA #IMPLIED>
+<!ELEMENT p (#PCDATA|em|strong|code|sup|var|acronym|abbr)*>
+<!ATTLIST p
+ xmlns:dmstc CDATA #IMPLIED
+ xmlns:nm CDATA #IMPLIED
+ xmlns:emp2 CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT em (#PCDATA)>
+<!ELEMENT span (#PCDATA)>
+<!ELEMENT strong (#PCDATA)>
+<!ELEMENT code (#PCDATA)>
+<!ELEMENT sup (#PCDATA)>
+<!ELEMENT var (#PCDATA|span)*>
+<!ELEMENT acronym (#PCDATA)>
+<!ATTLIST acronym
+ title CDATA #IMPLIED
+ class CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT abbr (#PCDATA)>
+<!ATTLIST abbr
+ title CDATA #IMPLIED
+ class CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ type CDATA #IMPLIED
+ src CDATA #IMPLIED
+ charset CDATA #IMPLIED>
diff --git a/dom/tests/mochitest/dom-level2-core/files/xhtml1-transitional.dtd b/dom/tests/mochitest/dom-level2-core/files/xhtml1-transitional.dtd
new file mode 100644
index 0000000000..3cad0fbaea
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/files/xhtml1-transitional.dtd
@@ -0,0 +1,1201 @@
+<!--
+ Extensible HTML version 1.0 Transitional DTD
+
+ This is the same as HTML 4 Transitional except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2007/02/28 22:59:26 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+ "object | applet | img | map | iframe">
+
+<!ENTITY % special.basic
+ "br | span | bdo">
+
+<!ENTITY % special
+ "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+ | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+ %inline.forms; | %misc.inline;)*">
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+ %i18n;
+ id ID #IMPLIED
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ id ID #IMPLIED
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title
+ %i18n;
+ id ID #IMPLIED
+ >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ id ID #IMPLIED
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ id ID #IMPLIED
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ id ID #IMPLIED
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ id ID #IMPLIED
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes %Flow;>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ %focus;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Length; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name CDATA #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ %focus;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ %focus;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Length; #IMPLIED
+ height %Length; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Length; #IMPLIED
+ height %Length; #IMPLIED
+ >
+
diff --git a/dom/tests/mochitest/dom-level2-core/mochitest.ini b/dom/tests/mochitest/dom-level2-core/mochitest.ini
new file mode 100644
index 0000000000..e5f4b1e853
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/mochitest.ini
@@ -0,0 +1,270 @@
+[DEFAULT]
+support-files =
+ DOMTestCase.js
+ exclusions.js
+ files/hc_staff.html
+ files/hc_staff.svg
+ files/hc_staff.xhtml
+ files/hc_staff.xml
+ files/internalSubset01.js
+ files/nodtdstaff.svg
+ files/nodtdstaff.xml
+ files/staff.dtd
+ files/staff.svg
+ files/staff.xml
+ files/staff2.dtd
+ files/staff2.svg
+ files/staff2.xml
+ files/staffNS.dtd
+ files/staffNS.svg
+ files/staffNS.xml
+ files/svgtest.js
+ files/svgunit.js
+ files/xhtml-lat1.ent
+ files/xhtml-special.ent
+ files/xhtml-symbol.ent
+ files/xhtml1-frameset.dtd
+ files/xhtml1-strict.dtd
+ files/xhtml1-transitional.dtd
+
+[test_attrgetownerelement01.html]
+[test_attrgetownerelement02.html]
+[test_attrgetownerelement03.html]
+[test_attrgetownerelement04.html]
+[test_attrgetownerelement05.html]
+[test_createAttributeNS01.html]
+[test_createAttributeNS02.html]
+[test_createAttributeNS03.html]
+[test_createAttributeNS04.html]
+[test_createAttributeNS05.html]
+[test_createAttributeNS06.html]
+[test_createDocument01.html]
+[test_createDocument02.html]
+[test_createDocument03.html]
+[test_createDocument04.html]
+[test_createDocument05.html]
+[test_createDocument06.html]
+[test_createDocument07.html]
+[test_createDocumentType01.html]
+[test_createDocumentType02.html]
+[test_createDocumentType03.html]
+[test_createElementNS01.html]
+[test_createElementNS02.html]
+[test_createElementNS03.html]
+[test_createElementNS04.html]
+[test_createElementNS05.html]
+[test_createElementNS06.html]
+[test_documentcreateattributeNS01.html]
+[test_documentcreateattributeNS02.html]
+[test_documentcreateattributeNS03.html]
+[test_documentcreateattributeNS04.html]
+[test_documentcreateattributeNS05.html]
+[test_documentcreateattributeNS06.html]
+[test_documentcreateattributeNS07.html]
+[test_documentcreateelementNS01.html]
+[test_documentcreateelementNS02.html]
+[test_documentcreateelementNS05.html]
+[test_documentcreateelementNS06.html]
+[test_documentgetelementbyid01.html]
+[test_documentgetelementsbytagnameNS01.html]
+[test_documentgetelementsbytagnameNS02.html]
+[test_documentgetelementsbytagnameNS03.html]
+[test_documentgetelementsbytagnameNS04.html]
+[test_documentgetelementsbytagnameNS05.html]
+[test_documentimportnode01.html]
+[test_documentimportnode02.html]
+[test_documentimportnode03.html]
+skip-if =
+ http3
+[test_documentimportnode04.html]
+[test_documentimportnode05.html]
+[test_documentimportnode06.html]
+[test_documentimportnode07.html]
+[test_documentimportnode08.html]
+[test_documentimportnode09.html]
+[test_documentimportnode10.html]
+[test_documentimportnode11.html]
+[test_documentimportnode12.html]
+[test_documentimportnode13.html]
+[test_documentimportnode14.html]
+[test_documentimportnode15.html]
+[test_documentimportnode17.html]
+[test_documentimportnode18.html]
+[test_documentimportnode19.html]
+[test_documentimportnode20.html]
+[test_documentimportnode21.html]
+[test_documentimportnode22.html]
+[test_documenttypepublicid01.html]
+[test_documenttypesystemid01.html]
+[test_domimplementationcreatedocument03.html]
+[test_domimplementationcreatedocument04.html]
+[test_domimplementationcreatedocument05.html]
+[test_domimplementationcreatedocument07.html]
+[test_domimplementationcreatedocumenttype01.html]
+[test_domimplementationcreatedocumenttype02.html]
+[test_domimplementationcreatedocumenttype04.html]
+[test_domimplementationfeaturecore.html]
+[test_domimplementationfeaturexmlversion2.html]
+[test_domimplementationhasfeature01.html]
+[test_elementgetattributenodens01.html]
+[test_elementgetattributenodens02.html]
+[test_elementgetattributenodens03.html]
+[test_elementgetattributens02.html]
+[test_elementgetelementsbytagnamens02.html]
+[test_elementgetelementsbytagnamens04.html]
+[test_elementgetelementsbytagnamens05.html]
+[test_elementhasattribute01.html]
+[test_elementhasattribute02.html]
+[test_elementhasattribute03.html]
+[test_elementhasattribute04.html]
+[test_elementhasattributens01.html]
+[test_elementhasattributens02.html]
+[test_elementhasattributens03.html]
+[test_elementremoveattributens01.html]
+[test_elementsetattributenodens01.html]
+[test_elementsetattributenodens02.html]
+[test_elementsetattributenodens03.html]
+[test_elementsetattributenodens04.html]
+[test_elementsetattributenodens05.html]
+[test_elementsetattributenodens06.html]
+[test_elementsetattributens01.html]
+[test_elementsetattributens02.html]
+[test_elementsetattributens03.html]
+[test_elementsetattributens04.html]
+[test_elementsetattributens05.html]
+[test_elementsetattributens08.html]
+[test_elementsetattributensurinull.html]
+[test_getAttributeNS01.html]
+[test_getAttributeNS02.html]
+[test_getAttributeNS03.html]
+[test_getAttributeNS04.html]
+[test_getAttributeNS05.html]
+[test_getAttributeNodeNS01.html]
+[test_getAttributeNodeNS02.html]
+[test_getElementById01.html]
+[test_getElementById02.html]
+[test_getElementsByTagNameNS01.html]
+[test_getElementsByTagNameNS02.html]
+[test_getElementsByTagNameNS03.html]
+[test_getElementsByTagNameNS04.html]
+[test_getElementsByTagNameNS05.html]
+[test_getElementsByTagNameNS06.html]
+[test_getElementsByTagNameNS07.html]
+[test_getElementsByTagNameNS08.html]
+[test_getElementsByTagNameNS09.html]
+[test_getElementsByTagNameNS10.html]
+[test_getElementsByTagNameNS11.html]
+[test_getElementsByTagNameNS12.html]
+[test_getElementsByTagNameNS13.html]
+[test_getElementsByTagNameNS14.html]
+[test_getNamedItemNS01.html]
+[test_getNamedItemNS02.html]
+[test_getNamedItemNS03.html]
+[test_getNamedItemNS04.html]
+[test_hasAttribute01.html]
+[test_hasAttribute02.html]
+[test_hasAttribute03.html]
+[test_hasAttribute04.html]
+[test_hasAttributeNS01.html]
+[test_hasAttributeNS02.html]
+[test_hasAttributeNS03.html]
+[test_hasAttributeNS04.html]
+[test_hasAttributeNS05.html]
+[test_hasAttributes01.html]
+[test_hasAttributes02.html]
+[test_hc_namednodemapinvalidtype1.html]
+[test_hc_nodedocumentfragmentnormalize1.html]
+[test_hc_nodedocumentfragmentnormalize2.html]
+[test_importNode01.html]
+[test_importNode02.html]
+[test_importNode03.html]
+[test_importNode04.html]
+[test_importNode05.html]
+[test_importNode06.html]
+[test_importNode07.html]
+[test_importNode08.html]
+[test_importNode09.html]
+[test_importNode10.html]
+[test_importNode11.html]
+[test_importNode12.html]
+[test_importNode13.html]
+[test_importNode14.html]
+[test_importNode15.html]
+[test_importNode16.html]
+[test_importNode17.html]
+[test_localName01.html]
+[test_localName02.html]
+[test_localName04.html]
+[test_namednodemapgetnameditemns01.html]
+[test_namednodemapgetnameditemns02.html]
+[test_namednodemapgetnameditemns03.html]
+[test_namednodemapgetnameditemns04.html]
+[test_namednodemapgetnameditemns05.html]
+[test_namednodemapgetnameditemns06.html]
+[test_namednodemapremovenameditemns01.html]
+[test_namednodemapremovenameditemns02.html]
+[test_namednodemapremovenameditemns03.html]
+[test_namednodemapremovenameditemns04.html]
+[test_namednodemapremovenameditemns05.html]
+[test_namednodemapremovenameditemns06.html]
+[test_namednodemapremovenameditemns07.html]
+[test_namednodemapremovenameditemns08.html]
+[test_namednodemapremovenameditemns09.html]
+[test_namednodemapsetnameditemns01.html]
+[test_namednodemapsetnameditemns02.html]
+[test_namednodemapsetnameditemns03.html]
+[test_namednodemapsetnameditemns04.html]
+[test_namednodemapsetnameditemns05.html]
+[test_namednodemapsetnameditemns06.html]
+[test_namednodemapsetnameditemns07.html]
+[test_namednodemapsetnameditemns08.html]
+[test_namednodemapsetnameditemns09.html]
+[test_namednodemapsetnameditemns10.html]
+[test_namednodemapsetnameditemns11.html]
+[test_namespaceURI01.html]
+[test_namespaceURI02.html]
+[test_namespaceURI03.html]
+[test_namespaceURI04.html]
+[test_nodegetlocalname03.html]
+[test_nodegetnamespaceuri03.html]
+[test_nodegetownerdocument01.html]
+[test_nodegetownerdocument02.html]
+[test_nodegetprefix03.html]
+[test_nodehasattributes01.html]
+[test_nodehasattributes02.html]
+[test_nodehasattributes03.html]
+[test_nodehasattributes04.html]
+[test_nodenormalize01.html]
+[test_normalize01.html]
+[test_ownerDocument01.html]
+[test_ownerElement01.html]
+[test_ownerElement02.html]
+[test_prefix01.html]
+[test_prefix03.html]
+[test_prefix04.html]
+[test_publicId01.html]
+[test_removeAttributeNS01.html]
+[test_removeAttributeNS02.html]
+[test_removeNamedItemNS01.html]
+[test_removeNamedItemNS02.html]
+[test_removeNamedItemNS03.html]
+[test_setAttributeNS01.html]
+[test_setAttributeNS02.html]
+[test_setAttributeNS03.html]
+[test_setAttributeNS04.html]
+[test_setAttributeNS05.html]
+[test_setAttributeNS06.html]
+[test_setAttributeNS07.html]
+[test_setAttributeNS09.html]
+[test_setAttributeNS10.html]
+[test_setAttributeNodeNS01.html]
+[test_setAttributeNodeNS02.html]
+[test_setAttributeNodeNS03.html]
+[test_setAttributeNodeNS04.html]
+[test_setAttributeNodeNS05.html]
+[test_setNamedItemNS01.html]
+[test_setNamedItemNS02.html]
+[test_setNamedItemNS03.html]
+[test_setNamedItemNS04.html]
+[test_setNamedItemNS05.html]
+[test_systemId01.html]
diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement01.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement01.html
new file mode 100644
index 0000000000..ca066a49b7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement01.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrgetownerelement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrgetownerelement01';
+
+
+/**
+*
+ The "getOwnerElement()" will return the Element node this attribute is attached to or
+ null if this attribute is not in use.
+
+ Retreive the default attribute defaultAttr and check its owner element. Verify if the name
+ the nodeName of the returned ownerElement is emp:employee.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function attrgetownerelement01() {
+ var success;
+ if(checkInitialization(builder, "attrgetownerelement01") != null) return;
+ var doc;
+ var attr;
+ var element;
+ var ownerElement;
+ var ownerElementName;
+ var elementList;
+ var attributes;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ attr = attributes.getNamedItemNS(nullNS,"defaultAttr");
+ ownerElement = attr.ownerElement;
+
+ ownerElementName = ownerElement.nodeName;
+
+ assertEquals("attrgetownerelement01","emp:employee",ownerElementName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement02.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement02.html
new file mode 100644
index 0000000000..b84f71c79f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement02.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrgetownerelement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrgetownerelement02';
+
+
+/**
+*
+ The "getOwnerElement()" will return the Element node this attribute
+ is attached to or null if this attribute is not in use.
+
+ Create a new element and attribute node, attach the attribute to the element.
+ Check the value of owner element of the new attribute node
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
+*/
+function attrgetownerelement02() {
+ var success;
+ if(checkInitialization(builder, "attrgetownerelement02") != null) return;
+ var doc;
+ var element;
+ var ownerElement;
+ var ownerElementName;
+ var attr;
+ var newAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElement("root");
+ attr = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att");
+ newAttr = element.setAttributeNodeNS(attr);
+ ownerElement = attr.ownerElement;
+
+ ownerElementName = ownerElement.nodeName;
+
+ assertEquals("attrgetownerelement02","root".toLowerCase(),ownerElementName.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement03.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement03.html
new file mode 100644
index 0000000000..115574f500
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement03.html
@@ -0,0 +1,119 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrgetownerelement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrgetownerelement03';
+
+
+/**
+*
+ The "getOwnerElement()" will return the Element node this attribute
+ is attached to or null if this attribute is not in use.
+
+ Create a new attribute node for this document node. Since the newly attribute is
+ not it use its owner element should be null.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
+*/
+function attrgetownerelement03() {
+ var success;
+ if(checkInitialization(builder, "attrgetownerelement03") != null) return;
+ var doc;
+ var ownerElement;
+ var attr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ attr = doc.createAttributeNS("http://www.w3.org/DOM","dom:attr");
+ ownerElement = attr.ownerElement;
+
+ assertNull("attrgetownerelement03",ownerElement);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement04.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement04.html
new file mode 100644
index 0000000000..1a066e45b7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement04.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrgetownerelement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docsLoaded += preload(docImpRef, "docImp", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrgetownerelement04';
+
+
+/**
+*
+ The "getOwnerElement()" will return the Element node this attribute is attached to or
+ null if this attribute is not in use.
+ Import an attribute node to another document. If an Attr node is imported, its
+ ownerElement attribute should be set to null. Verify if the ownerElement has been set
+ to null.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
+*/
+function attrgetownerelement04() {
+ var success;
+ if(checkInitialization(builder, "attrgetownerelement04") != null) return;
+ var doc;
+ var docImp;
+ var ownerElement;
+ var element;
+ var attr;
+ var attrImp;
+ var addresses;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docImp = load(docImpRef, "docImp", "staff");
+ addresses = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = addresses.item(1);
+ assertNotNull("empAddressNotNull",element);
+attr = element.getAttributeNodeNS("http://www.nist.gov","zone");
+ attrImp = docImp.importNode(attr,true);
+ ownerElement = attrImp.ownerElement;
+
+ assertNull("attrgetownerelement04",ownerElement);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement05.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement05.html
new file mode 100644
index 0000000000..90de82b210
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement05.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['attrgetownerelement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'attrgetownerelement05';
+
+
+/**
+*
+ The "getOwnerElement()" will return the Element node this attribute is attached to
+ or null if this attribute is not in use.
+
+ Retreive an element and its attributes. Then remove the element and check the name of
+ the ownerElement of attribute of the attribute "street".
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function attrgetownerelement05() {
+ var success;
+ if(checkInitialization(builder, "attrgetownerelement05") != null) return;
+ var doc;
+ var element;
+ var ownerElement;
+ var parentElement;
+ var elementList;
+ var ownerElementName;
+ var attr;
+ var removedChild;
+ var nodeMap;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(1);
+ parentElement = element.parentNode;
+
+ nodeMap = element.attributes;
+
+ removedChild = parentElement.removeChild(element);
+ attr = nodeMap.getNamedItemNS(nullNS,"street");
+ ownerElement = attr.ownerElement;
+
+ ownerElementName = ownerElement.nodeName;
+
+ assertEquals("attrgetownerelement05","address",ownerElementName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.html
new file mode 100644
index 0000000000..c5dacc9a77
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createAttributeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createAttributeNS01';
+
+
+/**
+*
+ The "createAttributeNS(namespaceURI,qualifiedName)" method for a
+ Document should raise NAMESPACE_ERR DOMException
+ if qualifiedName is malformed.
+
+ Invoke method createAttributeNS(namespaceURI,qualifiedName) on
+ the XMLNS Document with namespaceURI being "http://www.ecommerce.org/",
+ qualifiedName as "prefix::local". Method should raise
+ NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createAttributeNS01() {
+ var success;
+ if(checkInitialization(builder, "createAttributeNS01") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/";
+ var malformedName = "prefix::local";
+ var doc;
+ var newAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ newAttr = doc.createAttributeNS(namespaceURI,malformedName);
+ }
+ catch(ex) {
+ success = ex.code === DOMException.INVALID_CHARACTER_ERR;
+ }
+ assertTrue("throw INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS02.html
new file mode 100644
index 0000000000..2b87f0fc80
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS02.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createAttributeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createAttributeNS02';
+
+/**
+*
+ The "createAttributeNS(namespaceURI,qualifiedName)" method for a
+ Document should raise NAMESPACE_ERR DOMException
+ if qualifiedName has a prefix and namespaceURI is null.
+
+ Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document
+ with namespaceURI being null and qualifiedName contains the prefix "person".
+ Method should raise NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createAttributeNS02() {
+ var success;
+ if(checkInitialization(builder, "createAttributeNS02") != null) return;
+ var namespaceURI = null;
+
+ var qualifiedName = "prefix:local";
+ var doc;
+ var newAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ newAttr = doc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS03.html
new file mode 100644
index 0000000000..fc98d24905
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS03.html
@@ -0,0 +1,164 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createAttributeNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createAttributeNS03';
+
+
+/**
+*
+ The "createAttributeNS(namespaceURI,qualifiedName)" method for a
+ Document should raise INVALID_CHARACTER_ERR DOMException
+ if qualifiedName contains an illegal character.
+
+ Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document
+ with qualifiedName containing an illegal character from illegalChars[].
+ Method should raise INVALID_CHARACTER_ERR DOMException for all
+ characters in illegalChars[].
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+*/
+function createAttributeNS03() {
+ var success;
+ if(checkInitialization(builder, "createAttributeNS03") != null) return;
+ var namespaceURI = "http://www.wedding.com/";
+ var qualifiedName;
+ var doc;
+ var newAttr;
+ illegalQNames = new Array();
+ illegalQNames[0] = "person:{";
+ illegalQNames[1] = "person:}";
+ illegalQNames[2] = "person:~";
+ illegalQNames[3] = "person:'";
+ illegalQNames[4] = "person:!";
+ illegalQNames[5] = "person:@";
+ illegalQNames[6] = "person:#";
+ illegalQNames[7] = "person:$";
+ illegalQNames[8] = "person:%";
+ illegalQNames[9] = "person:^";
+ illegalQNames[10] = "person:&";
+ illegalQNames[11] = "person:*";
+ illegalQNames[12] = "person:(";
+ illegalQNames[13] = "person:)";
+ illegalQNames[14] = "person:+";
+ illegalQNames[15] = "person:=";
+ illegalQNames[16] = "person:[";
+ illegalQNames[17] = "person:]";
+ illegalQNames[18] = "person:\\";
+ illegalQNames[19] = "person:/";
+ illegalQNames[20] = "person:;";
+ illegalQNames[21] = "person:`";
+ illegalQNames[22] = "person:<";
+ illegalQNames[23] = "person:>";
+ illegalQNames[24] = "person:,";
+ illegalQNames[25] = "person:a ";
+ illegalQNames[26] = "person:\"";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ for(var indexN65680 = 0;indexN65680 < illegalQNames.length; indexN65680++) {
+ qualifiedName = illegalQNames[indexN65680];
+
+ {
+ success = false;
+ try {
+ newAttr = doc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS04.html
new file mode 100644
index 0000000000..f9633ffe8d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS04.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createAttributeNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createAttributeNS04';
+
+
+/**
+*
+ The "createAttributeNS(namespaceURI,qualifiedName)" method for a
+ Document should raise NAMESPACE_ERR DOMException
+ if qualifiedName has the "xml" prefix and namespaceURI is different
+ from "http://www.w3.org/XML/1998/namespace".
+
+ Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document
+ with qualifiedName being "xml:attr1 and namespaceURI equals
+ the string "http://www.w3.org/XML/1998/namespaces" (which differs from the required
+ string "http://www.w3.org/XML/1998/namespace").
+ Method should raise NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createAttributeNS04() {
+ var success;
+ if(checkInitialization(builder, "createAttributeNS04") != null) return;
+ var namespaceURI = "http://www.w3.org/XML/1998/namespaces";
+ var qualifiedName = "xml:attr1";
+ var doc;
+ var newAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ newAttr = doc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS05.html
new file mode 100644
index 0000000000..bd997d2d61
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS05.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createAttributeNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createAttributeNS05';
+
+
+/**
+*
+ The "createAttributeNS(namespaceURI,qualifiedName)" method for a
+ Document should return a new Attr object given that all parameters are
+ valid and correctly formed.
+
+ Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document with
+ parameters equal "http://www.ecommerce.org/" and "ecom:local"
+ respectively. Method should return a new Attr object whose name is "ecom:local".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1112119403
+*/
+function createAttributeNS05() {
+ var success;
+ if(checkInitialization(builder, "createAttributeNS05") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/";
+ var qualifiedName = "econm:local";
+ var doc;
+ var newAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ newAttr = doc.createAttributeNS(namespaceURI,qualifiedName);
+ attrName = newAttr.name;
+
+ assertEquals("throw_Equals",qualifiedName,attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS06.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS06.html
new file mode 100644
index 0000000000..54bb2618a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS06.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createAttributeNS06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createAttributeNS06';
+
+
+/**
+*
+Document.createAttributeNS with an empty qualified name should cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function createAttributeNS06() {
+ var success;
+ if(checkInitialization(builder, "createAttributeNS06") != null) return;
+ var namespaceURI = "http://www.example.com/";
+ var qualifiedName;
+ var doc;
+ var newAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ {
+ success = false;
+ try {
+ newAttr = doc.createAttributeNS(namespaceURI,"");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument01.html b/dom/tests/mochitest/dom-level2-core/test_createDocument01.html
new file mode 100644
index 0000000000..50911bd6a2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocument01.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocument01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocument01';
+
+
+/**
+*
+ The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
+ DOMImplementation should raise NAMESPACE_ERR DOMException
+ if parameter qualifiedName is malformed.
+
+ Retrieve the DOMImplementation on the XMLNS Document.
+ Invoke method createDocument(namespaceURI,qualifiedName,doctype)
+ on the retrieved DOMImplementation with namespaceURI being
+ the literal string "http://www.ecommerce.org/", qualifiedName as
+ "prefix::local", and doctype as null. Method should raise
+ NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createDocument01() {
+ var success;
+ if(checkInitialization(builder, "createDocument01") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/";
+ var malformedName = "prefix::local";
+ var doc;
+ var docType = null;
+
+ var domImpl;
+ var aNewDoc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ aNewDoc = domImpl.createDocument(namespaceURI,malformedName,docType);
+ }
+ catch(ex) {
+ success = ex.code === DOMException.INVALID_CHARACTER_ERR;
+ }
+ assertTrue("throw INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument02.html b/dom/tests/mochitest/dom-level2-core/test_createDocument02.html
new file mode 100644
index 0000000000..c19940868b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocument02.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocument02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocument02';
+
+
+/**
+*
+ The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
+ DOMImplementation should raise NAMESPACE_ERR DOMException
+ if qualifiedName has a prefix and namespaceURI is null.
+
+ Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
+ this domimplementation with namespaceURI being null and qualifiedName
+ equals "k:local". Method should raise NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createDocument02() {
+ var success;
+ if(checkInitialization(builder, "createDocument02") != null) return;
+ var namespaceURI = null;
+
+ var qualifiedName = "k:local";
+ var doc;
+ var docType = null;
+
+ var domImpl;
+ var aNewDoc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument03.html b/dom/tests/mochitest/dom-level2-core/test_createDocument03.html
new file mode 100644
index 0000000000..a6ac5615b7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocument03.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocument03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocument03';
+
+
+/**
+*
+ The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
+ DOMImplementation should raise WRONG_DOCUMENT_ERR DOMException
+ if parameter doctype has been used with a different document.
+
+ The specification has changed! No exception should be thrown.
+
+ Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
+ this domimplementation where doctype is the type of this document.
+ Method should raise WRONG_DOCUMENT_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+*/
+function createDocument03() {
+ var success;
+ if(checkInitialization(builder, "createDocument03") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/schema";
+ var qualifiedName = "namespaceURI:x";
+ var doc;
+ var docType;
+ var domImpl;
+ var aNewDoc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ success = true;
+ }
+ catch(ex) {
+ success = false;
+ }
+ //assertTrue("no_throw_WRONG_DOCUMENT_ERR",success);
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ ok(success, "createDocument() succeeded");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument04.html b/dom/tests/mochitest/dom-level2-core/test_createDocument04.html
new file mode 100644
index 0000000000..65872ae7f5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocument04.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocument04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocument04';
+
+
+/**
+*
+ The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
+ DOMImplementation should raise WRONG_DOCUMENT_ERR DOMException
+ if parameter doctype was created from a different implementation.
+
+ The specification has changed! No exception should be thrown.
+
+ Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
+ a domimplementation that is different from this domimplementation.
+ Doctype is the type of this document.
+ Method should raise WRONG_DOCUMENT_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+*/
+function createDocument04() {
+ var success;
+ if(checkInitialization(builder, "createDocument04") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/schema";
+ var qualifiedName = "namespaceURI:x";
+ var doc;
+ var docType;
+ var domImpl;
+ var aNewDoc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ docType = doc.doctype;
+
+ domImpl = aNewDoc.implementation;
+
+ {
+ success = false;
+ try {
+ aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ success = true;
+ }
+ catch(ex) {
+ success = false;
+ }
+ assertTrue("no_throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument05.html b/dom/tests/mochitest/dom-level2-core/test_createDocument05.html
new file mode 100644
index 0000000000..98ab5c9e94
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocument05.html
@@ -0,0 +1,169 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocument05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocument05';
+
+
+/**
+*
+ The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
+ DOMImplementation should raise INVALID_CHARACTER_ERR DOMException
+ if parameter qualifiedName contains an illegal character.
+
+ Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
+ this domimplementation with namespaceURI equals "http://www.ecommerce.org/schema",
+ doctype is null and qualifiedName contains an illegal character from
+ illegalChars[]. Method should raise INVALID_CHARACTER_ERR DOMException
+ for all characters in illegalChars[].
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#
+*/
+function createDocument05() {
+ var success;
+ if(checkInitialization(builder, "createDocument05") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/schema";
+ var qualifiedName;
+ var doc;
+ var docType = null;
+
+ var domImpl;
+ var aNewDoc;
+ var charact;
+ illegalQNames = new Array();
+ illegalQNames[0] = "namespaceURI:{";
+ illegalQNames[1] = "namespaceURI:}";
+ illegalQNames[2] = "namespaceURI:~";
+ illegalQNames[3] = "namespaceURI:'";
+ illegalQNames[4] = "namespaceURI:!";
+ illegalQNames[5] = "namespaceURI:@";
+ illegalQNames[6] = "namespaceURI:#";
+ illegalQNames[7] = "namespaceURI:$";
+ illegalQNames[8] = "namespaceURI:%";
+ illegalQNames[9] = "namespaceURI:^";
+ illegalQNames[10] = "namespaceURI:&";
+ illegalQNames[11] = "namespaceURI:*";
+ illegalQNames[12] = "namespaceURI:(";
+ illegalQNames[13] = "namespaceURI:)";
+ illegalQNames[14] = "namespaceURI:+";
+ illegalQNames[15] = "namespaceURI:=";
+ illegalQNames[16] = "namespaceURI:[";
+ illegalQNames[17] = "namespaceURI:]";
+ illegalQNames[18] = "namespaceURI:\\";
+ illegalQNames[19] = "namespaceURI:/";
+ illegalQNames[20] = "namespaceURI:;";
+ illegalQNames[21] = "namespaceURI:`";
+ illegalQNames[22] = "namespaceURI:<";
+ illegalQNames[23] = "namespaceURI:>";
+ illegalQNames[24] = "namespaceURI:,";
+ illegalQNames[25] = "namespaceURI:a ";
+ illegalQNames[26] = "namespaceURI:\"";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ for(var indexN65690 = 0;indexN65690 < illegalQNames.length; indexN65690++) {
+ qualifiedName = illegalQNames[indexN65690];
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument06.html b/dom/tests/mochitest/dom-level2-core/test_createDocument06.html
new file mode 100644
index 0000000000..a1894f44be
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocument06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocument06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocument06';
+
+
+/**
+*
+ The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
+ DOMImplementation should raise NAMESPACE_ERR DOMException
+ if qualifiedName has the "xml" prefix and namespaceURI different from
+ "http://www.w3.org/XML/1998/namespace"
+
+ Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
+ this domimplementation with qualifiedName "xml:local"
+ and namespaceURI as the string
+ "http://www.ecommerce.org/schema" (which is different from the required
+ "http://www.w3.org/XML/1998/namespace"). Method should raise
+ NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createDocument06() {
+ var success;
+ if(checkInitialization(builder, "createDocument06") != null) return;
+ var namespaceURI = "http://ecommerce.org/schema";
+ var qualifiedName = "xml:local";
+ var doc;
+ var docType = null;
+
+ var domImpl;
+ var aNewDoc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument07.html b/dom/tests/mochitest/dom-level2-core/test_createDocument07.html
new file mode 100644
index 0000000000..24446b0bf5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocument07.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocument07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocument07';
+
+
+/**
+*
+ The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
+ DOMImplementation should return a new xml Document object of the
+ specified type with its document element given that all parameters are
+ valid and correctly formed.
+
+ Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
+ this domimplementation. namespaceURI is "http://www.ecommerce.org/schema"
+ qualifiedName is "y:x" and doctype is null.
+ Method should return a new xml Document as specified by the listed parameters.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+*/
+function createDocument07() {
+ var success;
+ if(checkInitialization(builder, "createDocument07") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/schema";
+ var qualifiedName = "y:x";
+ var doc;
+ var docType = null;
+
+ var domImpl;
+ var aNewDoc;
+ var nodeName;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ nodeName = aNewDoc.nodeName;
+
+ nodeValue = aNewDoc.nodeValue;
+
+ assertEquals("nodeName","#document",nodeName);
+ assertNull("nodeValue",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocumentType01.html b/dom/tests/mochitest/dom-level2-core/test_createDocumentType01.html
new file mode 100644
index 0000000000..2abaf16b70
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocumentType01.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocumentType01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocumentType01';
+
+
+/**
+*
+ The "createDocumentType(qualifiedName,publicId,systemId)" method for a
+ DOMImplementation should raise NAMESPACE_ERR DOMException if
+ qualifiedName is malformed.
+
+ Retrieve the DOMImplementation on the XMLNS Document.
+ Invoke method createDocumentType(qualifiedName,publicId,systemId)
+ on the retrieved DOMImplementation with qualifiedName being the literal
+ string "prefix::local", publicId as "STAFF", and systemId as "staff".
+ Method should raise NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createDocumentType01() {
+ var success;
+ if(checkInitialization(builder, "createDocumentType01") != null) return;
+ var publicId = "STAFF";
+ var systemId = "staff.xml";
+ var malformedName = "prefix::local";
+ var doc;
+ var domImpl;
+ var newType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ newType = domImpl.createDocumentType(malformedName,publicId,systemId);
+ }
+ catch(ex) {
+ success = ex.code === DOMException.INVALID_CHARACTER_ERR;
+ }
+ assertTrue("throw INVALID_CHARACTER_ERR", success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocumentType02.html b/dom/tests/mochitest/dom-level2-core/test_createDocumentType02.html
new file mode 100644
index 0000000000..cd0756fc41
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocumentType02.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocumentType02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocumentType02';
+
+
+/**
+*
+ The "createDocumentType(qualifiedName,publicId,systemId)" method for a
+ DOMImplementation should raise INVALID_CHARACTER_ERR DOMException if
+ qualifiedName contains an illegal character.
+
+ Invoke method createDocumentType(qualifiedName,publicId,systemId) on
+ this domimplementation with qualifiedName containing an illegal character
+ from illegalChars[]. Method should raise INVALID_CHARACTER_ERR
+ DOMException for all characters in illegalChars[].
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+*/
+function createDocumentType02() {
+ var success;
+ if(checkInitialization(builder, "createDocumentType02") != null) return;
+ var publicId = "http://www.localhost.com/";
+ var systemId = "myDoc.dtd";
+ var qualifiedName;
+ var doc;
+ var docType = null;
+
+ var domImpl;
+ illegalQNames = new Array();
+ illegalQNames[0] = "edi:{";
+ illegalQNames[1] = "edi:}";
+ illegalQNames[2] = "edi:~";
+ illegalQNames[3] = "edi:'";
+ illegalQNames[4] = "edi:!";
+ illegalQNames[5] = "edi:@";
+ illegalQNames[6] = "edi:#";
+ illegalQNames[7] = "edi:$";
+ illegalQNames[8] = "edi:%";
+ illegalQNames[9] = "edi:^";
+ illegalQNames[10] = "edi:&";
+ illegalQNames[11] = "edi:*";
+ illegalQNames[12] = "edi:(";
+ illegalQNames[13] = "edi:)";
+ illegalQNames[14] = "edi:+";
+ illegalQNames[15] = "edi:=";
+ illegalQNames[16] = "edi:[";
+ illegalQNames[17] = "edi:]";
+ illegalQNames[18] = "edi:\\";
+ illegalQNames[19] = "edi:/";
+ illegalQNames[20] = "edi:;";
+ illegalQNames[21] = "edi:`";
+ illegalQNames[22] = "edi:<";
+ illegalQNames[23] = "edi:>";
+ illegalQNames[24] = "edi:,";
+ illegalQNames[25] = "edi:a ";
+ illegalQNames[26] = "edi:\"";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ for(var indexN65690 = 0;indexN65690 < illegalQNames.length; indexN65690++) {
+ qualifiedName = illegalQNames[indexN65690];
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ docType = domImpl.createDocumentType(qualifiedName,publicId,systemId);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocumentType03.html b/dom/tests/mochitest/dom-level2-core/test_createDocumentType03.html
new file mode 100644
index 0000000000..a71656c754
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createDocumentType03.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createDocumentType03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createDocumentType03';
+
+
+/**
+*
+ The "createDocumentType(qualifiedName,publicId,systemId)" method for a
+ DOMImplementation should return a new DocumentType node
+ given that qualifiedName is valid and correctly formed.
+
+ Invoke method createDocumentType(qualifiedName,publicId,systemId) on
+ this domimplementation with qualifiedName "prefix:myDoc".
+ Method should return a new DocumentType node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType
+*/
+function createDocumentType03() {
+ var success;
+ if(checkInitialization(builder, "createDocumentType03") != null) return;
+ var namespaceURI = "http://ecommerce.org/schema";
+ var qualifiedName = "prefix:myDoc";
+ var publicId = "http://www.localhost.com";
+ var systemId = "myDoc.dtd";
+ var doc;
+ var domImpl;
+ var newType = null;
+
+ var nodeName;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newType = domImpl.createDocumentType(qualifiedName,publicId,systemId);
+ nodeName = newType.nodeName;
+
+ assertEquals("nodeName","prefix:myDoc",nodeName);
+ nodeValue = newType.nodeValue;
+
+ assertNull("nodeValue",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS01.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS01.html
new file mode 100644
index 0000000000..41e5caa052
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS01.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createElementNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createElementNS01';
+
+
+/**
+*
+ The "createElementNS(namespaceURI,qualifiedName)" method for a
+ Document should raise NAMESPACE_ERR DOMException if
+ qualifiedName is malformed.
+
+ Invoke method createElementNS(namespaceURI,qualifiedName) on
+ the XMLNS Document with namespaceURI being the literal string
+ "http://www.ecommerce.org/", and qualifiedName as "prefix::local".
+ Method should raise NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createElementNS01() {
+ var success;
+ if(checkInitialization(builder, "createElementNS01") != null) return;
+ var namespaceURI = "http://www.ecommerce.org/";
+ var malformedName = "prefix::local";
+ var doc;
+ var newElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ newElement = doc.createElementNS(namespaceURI,malformedName);
+ }
+ catch(ex) {
+ success = ex.code === DOMException.INVALID_CHARACTER_ERR;
+ }
+ assertTrue("throw INVALID_CHARACTER_ERR", success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS02.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS02.html
new file mode 100644
index 0000000000..3b49ff9ac2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS02.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createElementNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createElementNS02';
+
+
+/**
+*
+ The "createElementNS(namespaceURI,qualifiedName)" method for a
+ Document should raise NAMESPACE_ERR DOMException if
+ qualifiedName has a prefix and namespaceURI is null.
+
+ Invoke method createElementNS(namespaceURI,qualifiedName) on this document
+ with namespaceURI being null and qualifiedName being "elem:attr1".
+ Method should raise NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createElementNS02() {
+ var success;
+ if(checkInitialization(builder, "createElementNS02") != null) return;
+ var namespaceURI = null;
+
+ var qualifiedName = "prefix:local";
+ var doc;
+ var newElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ newElement = doc.createElementNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS03.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS03.html
new file mode 100644
index 0000000000..dd71c2f7fe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS03.html
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createElementNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createElementNS03';
+
+
+/**
+*
+ The "createElementNS(namespaceURI,qualifiedName)" method for a
+ Document should raise INVALID_CHARACTER_ERR DOMException if
+ qualifiedName contains an illegal character.
+
+ Invoke method createElementNS(namespaceURI,qualifiedName) on this document
+ with qualifiedName containing an illegal character from illegalChars[].
+ Method should raise INVALID_CHARACTER_ERR DOMException for all characters
+ in illegalChars[].
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+*/
+function createElementNS03() {
+ var success;
+ if(checkInitialization(builder, "createElementNS03") != null) return;
+ var namespaceURI = "http://www.wedding.com/";
+ var qualifiedName;
+ var doc;
+ var done;
+ var newElement;
+ var charact;
+ illegalQNames = new Array();
+ illegalQNames[0] = "person:{";
+ illegalQNames[1] = "person:}";
+ illegalQNames[2] = "person:~";
+ illegalQNames[3] = "person:'";
+ illegalQNames[4] = "person:!";
+ illegalQNames[5] = "person:@";
+ illegalQNames[6] = "person:#";
+ illegalQNames[7] = "person:$";
+ illegalQNames[8] = "person:%";
+ illegalQNames[9] = "person:^";
+ illegalQNames[10] = "person:&";
+ illegalQNames[11] = "person:*";
+ illegalQNames[12] = "person:(";
+ illegalQNames[13] = "person:)";
+ illegalQNames[14] = "person:+";
+ illegalQNames[15] = "person:=";
+ illegalQNames[16] = "person:[";
+ illegalQNames[17] = "person:]";
+ illegalQNames[18] = "person:\\";
+ illegalQNames[19] = "person:/";
+ illegalQNames[20] = "person:;";
+ illegalQNames[21] = "person:`";
+ illegalQNames[22] = "person:<";
+ illegalQNames[23] = "person:>";
+ illegalQNames[24] = "person:,";
+ illegalQNames[25] = "person:a ";
+ illegalQNames[26] = "person:\"";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ for(var indexN65688 = 0;indexN65688 < illegalQNames.length; indexN65688++) {
+ qualifiedName = illegalQNames[indexN65688];
+
+ {
+ success = false;
+ try {
+ newElement = doc.createElementNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS04.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS04.html
new file mode 100644
index 0000000000..e70723aeba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS04.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createElementNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createElementNS04';
+
+
+/**
+*
+ The "createElementNS(namespaceURI,qualifiedName") method for
+ a Document should raise NAMESPACE_ERR DOMException if the
+ qualifiedName has an "xml" prefix and the namespaceURI is different
+ from http://www.w3.org/XML/1998/namespace".
+
+ Invoke method createElementNS(namespaceURI,qualifiedName) on this document
+ with qualifiedName being "xml:element1" and namespaceURI equals the string
+ "http://www.w3.org/XML/1997/namespace" (which differs from the required
+ string "http://www.w3.org/XML/1998/namespace").
+ Method should raise NAMESPACE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function createElementNS04() {
+ var success;
+ if(checkInitialization(builder, "createElementNS04") != null) return;
+ var namespaceURI = "http://www.w3.org/XML/1998/namespaces";
+ var qualifiedName = "xml:element1";
+ var doc;
+ var newElement;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ newElement = doc.createElementNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS05.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS05.html
new file mode 100644
index 0000000000..5ade12f66f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS05.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createElementNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createElementNS05';
+
+
+/**
+*
+ The "createElementNS(namespaceURI,qualifiedName)" method for a
+ Document should return a new Element object given that all parameters
+ are valid and correctly formed.
+
+ Invoke method createElementNS(namespaceURI,qualifiedName on this document
+ with namespaceURI as "http://www.nist.gov" and qualifiedName as "gov:faculty".
+ Method should return a new Element object whose name is "gov:faculty".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815
+*/
+function createElementNS05() {
+ var success;
+ if(checkInitialization(builder, "createElementNS05") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var qualifiedName = "gov:faculty";
+ var doc;
+ var newElement;
+ var elementName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ newElement = doc.createElementNS(namespaceURI,qualifiedName);
+ elementName = newElement.tagName;
+
+ assertEquals("throw_Equals",qualifiedName,elementName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS06.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS06.html
new file mode 100644
index 0000000000..c4bae45769
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS06.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['createElementNS06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'createElementNS06';
+
+
+/**
+*
+Document.createElementNS with an empty qualified name should cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function createElementNS06() {
+ var success;
+ if(checkInitialization(builder, "createElementNS06") != null) return;
+ var namespaceURI = "http://www.example.com/";
+ var qualifiedName;
+ var doc;
+ var done;
+ var newElement;
+ var charact;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+
+ {
+ success = false;
+ try {
+ newElement = doc.createElementNS(namespaceURI,"");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS01.html
new file mode 100644
index 0000000000..ac40eb1c79
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS01.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattributeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattributeNS01';
+
+
+/**
+*
+ The method createAttributeNS creates an attribute of the given qualified name and namespace URI
+
+ Invoke the createAttributeNS method on this Document object with a null
+ namespaceURI, and a qualifiedName without a prefix. This should return a valid Attr
+ node object.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+*/
+function documentcreateattributeNS01() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattributeNS01") != null) return;
+ var doc;
+ var attribute;
+ var namespaceURI = null;
+
+ var qualifiedName = "test";
+ var name;
+ var nodeName;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ attribute = doc.createAttributeNS(namespaceURI,qualifiedName);
+ nodeName = attribute.nodeName;
+
+ nodeValue = attribute.nodeValue;
+
+ assertEquals("documentcreateattributeNS01","test",nodeName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS02.html
new file mode 100644
index 0000000000..1a6614debd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS02.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattributeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattributeNS02';
+
+
+/**
+*
+ The method createAttributeNS creates an attribute of the given qualified name and namespace URI
+
+ Invoke the createAttributeNS method on this Document object with a valid values for
+ namespaceURI, and a qualifiedName as below. This should return a valid Attr node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+*/
+function documentcreateattributeNS02() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattributeNS02") != null) return;
+ var doc;
+ var attribute1;
+ var attribute2;
+ var name;
+ var nodeName;
+ var nodeValue;
+ var prefix;
+ var namespaceURI;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ attribute1 = doc.createAttributeNS("http://www.w3.org/XML/1998/namespace","xml:xml");
+ name = attribute1.name;
+
+ nodeName = attribute1.nodeName;
+
+ nodeValue = attribute1.nodeValue;
+
+ prefix = attribute1.prefix;
+
+ namespaceURI = attribute1.namespaceURI;
+
+ assertEquals("documentcreateattributeNS02_att1_name","xml:xml",name);
+ assertEquals("documentcreateattributeNS02_att1_nodeName","xml:xml",nodeName);
+ assertEquals("documentcreateattributeNS02_att1_nodeValue","",nodeValue);
+ assertEquals("documentcreateattributeNS02_att1_prefix","xml",prefix);
+ assertEquals("documentcreateattributeNS02_att1_namespaceURI","http://www.w3.org/XML/1998/namespace",namespaceURI);
+ attribute2 = doc.createAttributeNS("http://www.w3.org/2000/xmlns/","xmlns");
+ name = attribute2.name;
+
+ nodeName = attribute2.nodeName;
+
+ nodeValue = attribute2.nodeValue;
+
+ prefix = attribute2.prefix;
+
+ namespaceURI = attribute2.namespaceURI;
+
+ assertEquals("documentcreateattributeNS02_att2_name","xmlns",name);
+ assertEquals("documentcreateattributeNS02_att2_nodeName","xmlns",nodeName);
+ assertEquals("documentcreateattributeNS02_att2_nodeValue","",nodeValue);
+ assertEquals("documentcreateattributeNS02_att2_namespaceURI","http://www.w3.org/2000/xmlns/",namespaceURI);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS03.html
new file mode 100644
index 0000000000..b41f476ded
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS03.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattributeNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattributeNS03';
+
+
+/**
+*
+ The method createAttributeNS raises an INVALID_CHARACTER_ERR if the specified
+ qualified name contains an illegal character
+
+ Invoke the createAttributeNS method on this Document object with a valid value for
+ namespaceURI, and qualifiedNames that contain illegal characters. Check if the an
+ INVALID_CHARACTER_ERR was thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+*/
+function documentcreateattributeNS03() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattributeNS03") != null) return;
+ var doc;
+ var attribute;
+ var namespaceURI = "http://www.w3.org/DOM/Test/Level2";
+ var qualifiedName;
+ qualifiedNames = new Array();
+ qualifiedNames[0] = "/";
+ qualifiedNames[1] = "//";
+ qualifiedNames[2] = "\\";
+ qualifiedNames[3] = ";";
+ qualifiedNames[4] = "&";
+ qualifiedNames[5] = "*";
+ qualifiedNames[6] = "]]";
+ qualifiedNames[7] = ">";
+ qualifiedNames[8] = "<";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ for(var indexN65626 = 0;indexN65626 < qualifiedNames.length; indexN65626++) {
+ qualifiedName = qualifiedNames[indexN65626];
+
+ {
+ success = false;
+ try {
+ attribute = doc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("documentcreateattributeNS03",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.html
new file mode 100644
index 0000000000..20466477a9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattributeNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattributeNS04';
+
+
+/**
+*
+ The method createAttributeNS raises a NAMESPACE_ERR if the specified qualified name
+ is malformed.
+
+ Invoke the createAttributeNS method on this Document object with a valid value for
+ namespaceURI, and malformed qualifiedNames. Check if the a NAMESPACE_ERR was thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+*/
+function documentcreateattributeNS04() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattributeNS04") != null) return;
+ var doc;
+ var attribute;
+ var namespaceURI = "http://www.w3.org/DOM/Test/Level2";
+ var qualifiedName;
+ qualifiedNames = new Array();
+ qualifiedNames[0] = "_:";
+ qualifiedNames[1] = ":0a";
+ qualifiedNames[2] = ":";
+ qualifiedNames[3] = "a:b:c";
+ qualifiedNames[4] = "_::a";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ for(var indexN65614 = 0;indexN65614 < qualifiedNames.length; indexN65614++) {
+ qualifiedName = qualifiedNames[indexN65614];
+
+ {
+ success = false;
+ try {
+ attribute = doc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = ex.code === DOMException.INVALID_CHARACTER_ERR;
+ }
+ assertTrue("documentcreateattributeNS04",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS05.html
new file mode 100644
index 0000000000..84f1a40a11
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattributeNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattributeNS05';
+
+
+/**
+*
+ The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName has a prefix and
+ the namespaceURI is null.
+
+ Invoke the createAttributeNS method on a new Document object with a null value for
+ namespaceURI, and a valid qualifiedName. Check if a NAMESPACE_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+*/
+function documentcreateattributeNS05() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattributeNS05") != null) return;
+ var doc;
+ var newDoc;
+ var docType = null;
+
+ var domImpl;
+ var attribute;
+ var namespaceURI = null;
+
+ var qualifiedName = "abc:def";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType);
+
+ {
+ success = false;
+ try {
+ attribute = newDoc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("documentcreateattributeNS05",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS06.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS06.html
new file mode 100644
index 0000000000..ecfeb4af6d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattributeNS06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattributeNS06';
+
+
+/**
+*
+ The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName has a prefix that
+ is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace".
+
+ Invoke the createAttributeNS method on a new DOMImplementation object with the qualifiedName
+ as xml:root and namespaceURI as http://www.w3.org/XML/1998 /namespace.
+ Check if the NAMESPACE_ERR exception is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+*/
+function documentcreateattributeNS06() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattributeNS06") != null) return;
+ var doc;
+ var newDoc;
+ var docType = null;
+
+ var domImpl;
+ var attribute;
+ var namespaceURI = "http://www.w3.org/XML/1998 /namespace";
+ var qualifiedName = "xml:root";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType);
+
+ {
+ success = false;
+ try {
+ attribute = newDoc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("documentcreateattributeNS06",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS07.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS07.html
new file mode 100644
index 0000000000..ae84931402
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS07.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateattributeNS07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateattributeNS07';
+
+
+/**
+*
+ The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName is xmlns and
+ the namespaceURI is different from http://www.w3.org/2000/xmlns
+
+ Invoke the createAttributeNS method on this DOMImplementation object with
+ the qualifiedName as xmlns and namespaceURI as http://www.W3.org/2000/xmlns.
+ Check if the NAMESPACE_ERR exception is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS
+*/
+function documentcreateattributeNS07() {
+ var success;
+ if(checkInitialization(builder, "documentcreateattributeNS07") != null) return;
+ var doc;
+ var attribute;
+ var namespaceURI = "http://www.W3.org/2000/xmlns";
+ var qualifiedName = "xmlns";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ attribute = doc.createAttributeNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("documentcreateattributeNS07",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS01.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS01.html
new file mode 100644
index 0000000000..49652dbaed
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateelementNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateelementNS01';
+
+
+/**
+*
+ The method createElementNS creates an element of the given valid qualifiedName and NamespaceURI.
+
+ Invoke the createElementNS method on this Document object with a valid namespaceURI
+ and qualifiedName. Check if a valid Element object is returned with the same node attributes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+*/
+function documentcreateelementNS01() {
+ var success;
+ if(checkInitialization(builder, "documentcreateelementNS01") != null) return;
+ var doc;
+ var element;
+ var namespaceURI = "http://www.w3.org/DOM/Test/level2";
+ var qualifiedName = "XML:XML";
+ var nodeName;
+ var nsURI;
+ var localName;
+ var prefix;
+ var tagName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS(namespaceURI,qualifiedName);
+ nodeName = element.nodeName;
+
+ nsURI = element.namespaceURI;
+
+ localName = element.localName;
+
+ prefix = element.prefix;
+
+ tagName = element.tagName;
+
+ assertEquals("documentcreateelementNS01_nodeName","XML:XML",nodeName);
+ assertEquals("documentcreateelementNS01_namespaceURI","http://www.w3.org/DOM/Test/level2",nsURI);
+ assertEquals("documentcreateelementNS01_localName","XML",localName);
+ assertEquals("documentcreateelementNS01_prefix","XML",prefix);
+ assertEquals("documentcreateelementNS01_tagName","XML:XML",tagName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS02.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS02.html
new file mode 100644
index 0000000000..fb5662242d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS02.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateelementNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateelementNS02';
+
+
+/**
+*
+ The method createElementNS creates an element of the given valid qualifiedName and NamespaceURI.
+
+ Invoke the createElementNS method on this Document object with null values for namespaceURI,
+ and a qualifiedName with an invalid character and check if an INVALID_CHARACTER_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+*/
+function documentcreateelementNS02() {
+ var success;
+ if(checkInitialization(builder, "documentcreateelementNS02") != null) return;
+ var doc;
+ var element;
+ var namespaceURI = null;
+
+ var qualifiedName = "^^";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ element = doc.createElementNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("documentcreateelementNS02",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS05.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS05.html
new file mode 100644
index 0000000000..2ec363db20
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS05.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateelementNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateelementNS05';
+
+
+/**
+*
+ The method createElementNS raises a NAMESPACE_ERR if the qualifiedName has a prefix and
+ the namespaceURI is null.
+
+ Invoke the createElementNS method on a new Document object with a null value for
+ namespaceURI, and a valid qualifiedName. Check if a NAMESPACE_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+*/
+function documentcreateelementNS05() {
+ var success;
+ if(checkInitialization(builder, "documentcreateelementNS05") != null) return;
+ var doc;
+ var element;
+ var namespaceURI = null;
+
+ var qualifiedName = "null:xml";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ element = doc.createElementNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("documentcreateelementNS05",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS06.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS06.html
new file mode 100644
index 0000000000..6c2f0ce8c9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS06.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentcreateelementNS06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentcreateelementNS06';
+
+
+/**
+*
+ The method createElementNS raises a NAMESPACE_ERR if the qualifiedName
+ has a prefix that is "xml" and the namespaceURI is different
+ from http://www.w3.org/XML/1998/namespace
+
+ Invoke the createElementNS method on this DOMImplementation object with
+ the qualifiedName as xml:root and namespaceURI as http://www.w3.org/xml/1998/namespace
+ Check if the NAMESPACE_ERR exception is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS
+*/
+function documentcreateelementNS06() {
+ var success;
+ if(checkInitialization(builder, "documentcreateelementNS06") != null) return;
+ var doc;
+ var newDoc;
+ var docType = null;
+
+ var domImpl;
+ var element;
+ var namespaceURI = "http://www.w3.org/xml/1998/namespace ";
+ var qualifiedName = "xml:root";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType);
+
+ {
+ success = false;
+ try {
+ element = newDoc.createElementNS(namespaceURI,qualifiedName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("documentcreateelementNS06",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementbyid01.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementbyid01.html
new file mode 100644
index 0000000000..0b6c29e9af
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementbyid01.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementbyid01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementbyid01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementbyid01';
+
+
+/**
+*
+ The method getElementById returns the element whose ID is given by elementId.
+ If not such element exists, returns null.
+
+ Invoke the getElementById method on this Document object with an invalid elementId.
+ This should return a null element.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId
+*/
+function documentgetelementbyid01() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementbyid01") != null) return;
+ var doc;
+ var element;
+ var elementId = "---";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.getElementById(elementId);
+ assertNull("documentgetelementbyid01",element);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementbyid01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS01.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS01.html
new file mode 100644
index 0000000000..54b7fb99ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS01.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnameNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnameNS01';
+
+
+/**
+*
+ The method getElementsByTagNameNS returns a NodeList of all the Elements with
+ a given local name and namespace URI in the order in which they are encountered
+ in a preorder traversal of the Document tree.
+
+ Invoke the getElementsByTagNameNS method on a new Document object with the values of
+ namespaceURI=* and localName=*. This should return a nodeList of 1 item.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function documentgetelementsbytagnameNS01() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnameNS01") != null) return;
+ var doc;
+ var newDoc;
+ var docType = null;
+
+ var domImpl;
+ var childList;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newDoc = domImpl.createDocument(nullNS,"root",docType);
+ childList = newDoc.getElementsByTagNameNS("*","*");
+ assertSize("documentgetelementsbytagnameNS01",1,childList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS02.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS02.html
new file mode 100644
index 0000000000..50d3e8dc06
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS02.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnameNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnameNS02';
+
+
+/**
+*
+ The method getElementsByTagNameNS returns a NodeList of all the Elements with
+ a given local name and namespace URI in the order in which they are encountered
+ in a preorder traversal of the Document tree.
+
+
+ Create a new element having a local name="employeeId" belonging to the namespace "test"
+ and append it to this document. Invoke the getElementsByTagNameNS method on a this
+ Document object with the values of namespaceURI=* and localName="elementId". This
+ should return a nodeList of 6 item. Check the length of the nodeList returned.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function documentgetelementsbytagnameNS02() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnameNS02") != null) return;
+ var doc;
+ var docElem;
+ var element;
+ var childList;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ element = doc.createElementNS("test","employeeId");
+ appendedChild = docElem.appendChild(element);
+ childList = doc.getElementsByTagNameNS("*","employeeId");
+ assertSize("documentgetelementsbytagnameNS02",6,childList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS03.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS03.html
new file mode 100644
index 0000000000..ae45fac214
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS03.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnameNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnameNS03';
+
+
+/**
+*
+ The method getElementsByTagNameNS returns a NodeList of all the Elements with
+ a given local name and namespace URI in the order in which they are encountered
+ in a preorder traversal of the Document tree.
+
+ Invoke the getElementsByTagNameNS method on a new Document object with the values of
+ namespaceURI=** and localName=**. This should return a nodeList of 0 items.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function documentgetelementsbytagnameNS03() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnameNS03") != null) return;
+ var doc;
+ var childList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("**","*");
+ assertSize("documentgetelementsbytagnameNS03",0,childList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS04.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS04.html
new file mode 100644
index 0000000000..793c548413
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS04.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnameNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnameNS04';
+
+
+/**
+*
+ The method getElementsByTagNameNS returns a NodeList of all the Elements with
+ a given local name and namespace URI in the order in which they are encountered
+ in a preorder traversal of the Document tree.
+
+ Invoke the getElementsByTagNameNS method on a new Document object with the values of
+ namespaceURI="null" and localName="0". This should return a nodeList of 0 items.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function documentgetelementsbytagnameNS04() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnameNS04") != null) return;
+ var doc;
+ var childList;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS(nullNS,"0");
+ assertSize("documentgetelementsbytagnameNS04",0,childList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS05.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS05.html
new file mode 100644
index 0000000000..cb6e93b6fb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS05.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentgetelementsbytagnameNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentgetelementsbytagnameNS05';
+
+
+/**
+*
+ The method getElementsByTagNameNS returns a NodeList of all the Elements with
+ a given local name and namespace URI in the order in which they are encountered
+ in a preorder traversal of the Document tree.
+
+
+ Invoke the getElementsByTagNameNS method on a this Document object with the
+ values of namespaceURI=null and localName="elementId". This
+ should return a nodeList of 0 item. Check the length of the nodeList returned.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function documentgetelementsbytagnameNS05() {
+ var success;
+ if(checkInitialization(builder, "documentgetelementsbytagnameNS05") != null) return;
+ var doc;
+ var childList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("null","elementId");
+ assertSize("documentgetelementsbytagnameNS05",0,childList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode01.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode01.html
new file mode 100644
index 0000000000..c73e615041
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode01';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, import the attribute, "street" of the second
+ element node, from a list of nodes whose local names are "address" and namespaceURI
+ "http://www.nist.gov" into the same document. Check the parentNode, nodeName,
+ nodeType and nodeValue of the imported node to verify if it has been imported correctly.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode01() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode01") != null) return;
+ var doc;
+ var element;
+ var attr;
+ var childList;
+ var importedAttr;
+ var nodeName;
+ var nodeType;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = childList.item(1);
+ attr = element.getAttributeNode("street");
+ importedAttr = doc.importNode(attr,false);
+ nodeName = importedAttr.nodeName;
+
+ nodeValue = importedAttr.nodeValue;
+
+ nodeType = importedAttr.nodeType;
+
+ assertEquals("documentimportnode01_nodeName","street",nodeName);
+ assertEquals("documentimportnode01_nodeType",2,nodeType);
+ assertEquals("documentimportnode01_nodeValue","Yes",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode02.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode02.html
new file mode 100644
index 0000000000..325165da75
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode02.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docImportedRef = null;
+ if (typeof(this.docImported) != 'undefined') {
+ docImportedRef = this.docImported;
+ }
+ docsLoaded += preload(docImportedRef, "docImported", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode02';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=false, import the attribute, "emp:zone" of the
+ element node which is retreived by its elementId="CANADA", into the another document.
+ Check the parentNode, nodeName, nodeType and nodeValue of the imported node to
+ verify if it has been imported correctly.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode02() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode02") != null) return;
+ var doc;
+ var docImported;
+ var element;
+ var attr;
+ var importedAttr;
+ var nodeName;
+ var nodeType;
+ var nodeValue;
+ var addresses;
+ var attrsParent;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var docImportedRef = null;
+ if (typeof(this.docImported) != 'undefined') {
+ docImportedRef = this.docImported;
+ }
+ docImported = load(docImportedRef, "docImported", "staff");
+ addresses = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = addresses.item(1);
+ attr = element.getAttributeNodeNS("http://www.nist.gov","zone");
+ importedAttr = docImported.importNode(attr,false);
+ nodeName = importedAttr.nodeName;
+
+ nodeType = importedAttr.nodeType;
+
+ nodeValue = importedAttr.nodeValue;
+
+ attrsParent = importedAttr.parentNode;
+
+ assertNull("documentimportnode02_parentNull",attrsParent);
+ assertEquals("documentimportnode02_nodeName","emp:zone",nodeName);
+ assertEquals("documentimportnode02_nodeType",2,nodeType);
+ assertEquals("documentimportnode02_nodeValue","CANADA",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html
new file mode 100644
index 0000000000..c325c07178
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode03';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=false, import the default Attribute attribute,
+ "defaultAttr" of the second element node whose namespaceURI="http://www.nist.gov" and
+ localName="defaultAttr", into the same document.
+ Check the parentNode, nodeName, nodeType and nodeValue of the imported node to
+ verify if it has been imported correctly.
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode03() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode03") != null) return;
+ var doc;
+ var element;
+ var attr;
+ var childList;
+ var importedAttr;
+ var nodeName;
+ var nodeType;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = childList.item(1);
+ attr = element.getAttributeNode("defaultAttr");
+ importedAttr = doc.importNode(attr,false);
+ nodeName = importedAttr.nodeName;
+
+ nodeValue = importedAttr.nodeValue;
+
+ nodeType = importedAttr.nodeType;
+
+ assertEquals("documentimportnode03_nodeName","defaultAttr",nodeName);
+ assertEquals("documentimportnode03_nodeType",2,nodeType);
+ assertEquals("documentimportnode03_nodeValue","defaultVal",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html
new file mode 100644
index 0000000000..174eece4b7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode04';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, import the default Attribute attribute,
+ "defaultAttr" of the second element node whose namespaceURI="http://www.nist.gov" and
+ localName="defaultAttr", into a new document.
+ Check the parentNode, nodeName, nodeType and nodeValue of the imported node to
+ verify if it has been imported correctly.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode04() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode04") != null) return;
+ var doc;
+ var newDoc;
+ var docType = null;
+
+ var domImpl;
+ var element;
+ var attr;
+ var childList;
+ var importedAttr;
+ var nodeName;
+ var nodeType;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","l2:root",docType);
+ childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = childList.item(1);
+ attr = element.getAttributeNode("defaultAttr");
+ importedAttr = newDoc.importNode(attr,true);
+ nodeName = importedAttr.nodeName;
+
+ nodeValue = importedAttr.nodeValue;
+
+ nodeType = importedAttr.nodeType;
+
+ assertEquals("documentimportnode04_nodeName","defaultAttr",nodeName);
+ assertEquals("documentimportnode04_nodeType",2,nodeType);
+ assertEquals("documentimportnode04_nodeValue","defaultVal",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode05.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode05.html
new file mode 100644
index 0000000000..dac651c0fa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode05.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docImportedRef = null;
+ if (typeof(this.docImported) != 'undefined') {
+ docImportedRef = this.docImported;
+ }
+ docsLoaded += preload(docImportedRef, "docImported", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode05';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=false, import a newly created attribute node,
+ into the another document.
+ Check the nodeName, nodeType and nodeValue namespaceURI of the imported node to
+ verify if it has been imported correctly.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode05() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode05") != null) return;
+ var doc;
+ var docImported;
+ var attr;
+ var importedAttr;
+ var nodeName;
+ var nodeType;
+ var nodeValue;
+ var namespaceURI;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var docImportedRef = null;
+ if (typeof(this.docImported) != 'undefined') {
+ docImportedRef = this.docImported;
+ }
+ docImported = load(docImportedRef, "docImported", "staff");
+ attr = doc.createAttributeNS("http://www.w3.org/DOM/Test","a_:b0");
+ importedAttr = docImported.importNode(attr,false);
+ nodeName = importedAttr.nodeName;
+
+ nodeValue = importedAttr.nodeValue;
+
+ nodeType = importedAttr.nodeType;
+
+ namespaceURI = importedAttr.namespaceURI;
+
+ assertEquals("documentimportnode05_nodeName","a_:b0",nodeName);
+ assertEquals("documentimportnode05_nodeType",2,nodeType);
+ assertEquals("documentimportnode05_nodeValue","",nodeValue);
+ assertEquals("documentimportnode05_namespaceURI","http://www.w3.org/DOM/Test",namespaceURI);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode06.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode06.html
new file mode 100644
index 0000000000..2eb79f2c93
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode06.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode06';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ A NOT_SUPPORTED_ERR is raised if the type of node being imported is
+ not supported
+
+ Using the method importNode with deep=false, try to import this document object to itself.
+ Since Document nodes cannot be imported, a NOT_SUPPORTED_ERR should be raised.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode06() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode06") != null) return;
+ var doc;
+ var docImported;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ {
+ success = false;
+ try {
+ docImported = doc.importNode(doc,false);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode07.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode07.html
new file mode 100644
index 0000000000..18d31146dc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode07';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ A NOT_SUPPORTED_ERR is raised if the type of node being imported is
+ not supported
+
+ Using the method importNode with deep=true, try to import this Document's
+ DocumentType object. Since DocumentType nodes cannot be imported, a
+ NOT_SUPPORTED_ERR should be raised.
+
+ The specification has changed! No exception should be thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode07() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode07") != null) return;
+ var doc;
+ var imported;
+ var docType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+
+ {
+ success = false;
+ try {
+ imported = doc.importNode(docType,true);
+ success = true;
+ }
+ catch(ex) {
+ success = false;
+ }
+ assertTrue("no_throw_NOT_SUPPORTED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode08.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode08.html
new file mode 100644
index 0000000000..062e18842c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode08.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode08</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode08';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ A NOT_SUPPORTED_ERR is raised if the type of node being imported is
+ not supported
+
+ Using the method importNode with deep=true, try to import a newly created DOcumentType
+ node. Since DocumentType nodes cannot be imported, a NOT_SUPPORTED_ERR should be raised.
+
+ The specification has changed! No exception should be thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function documentimportnode08() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode08") != null) return;
+ var doc;
+ var imported;
+ var docType;
+ var domImpl;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+docType = domImpl.createDocumentType("test:root",nullNS,nullNS);
+
+ {
+ success = false;
+ try {
+ imported = doc.importNode(docType,true);
+ success = true;
+ }
+ catch(ex) {
+ success = false;
+ }
+ assertTrue("no_throw_NOT_SUPPORTED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode09.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode09.html
new file mode 100644
index 0000000000..d7c2d4eabb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode09.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode09</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode09';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=false, import a newly created DocumentFragment node
+ with the first address element from this Document appended to it into this document.
+ Since deep=false, an empty DocumentFragment should be returned
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode09() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode09") != null) return;
+ var doc;
+ var docFragment;
+ var childList;
+ var success;
+ var addressNode;
+ var appendedChild;
+ var importedDocFrag;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docFragment = doc.createDocumentFragment();
+ childList = doc.getElementsByTagNameNS("*","address");
+ addressNode = childList.item(0);
+ appendedChild = docFragment.appendChild(addressNode);
+ importedDocFrag = doc.importNode(docFragment,false);
+ success = importedDocFrag.hasChildNodes();
+ assertFalse("documentimportnode09",success);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode09</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode10.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode10.html
new file mode 100644
index 0000000000..85c2e975d6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode10.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode10</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode10';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=false, import a newly created DocumentFragment node
+ with the first address element from this Document appended to it into this document.
+ Since deep=true, a DocumentFragment with its child should be returned
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode10() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode10") != null) return;
+ var doc;
+ var docFragment;
+ var childList;
+ var success;
+ var addressNode;
+ var appendedChild;
+ var importedDocFrag;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docFragment = doc.createDocumentFragment();
+ childList = doc.getElementsByTagNameNS("*","address");
+ addressNode = childList.item(0);
+ appendedChild = docFragment.appendChild(addressNode);
+ importedDocFrag = doc.importNode(docFragment,true);
+ success = importedDocFrag.hasChildNodes();
+ assertTrue("documentimportnode10",success);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode10</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode11.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode11.html
new file mode 100644
index 0000000000..0a695fdde9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode11.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode11</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode11';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=false, import this Document's documentElement
+ node. Verify if the node has been imported correctly by its nodeName atttribute and
+ if the original document is not altered by checking if hasChildNodes returns false.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode11() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode11") != null) return;
+ var doc;
+ var docElement;
+ var imported;
+ var success;
+ var nodeNameOrig;
+ var nodeNameImported;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElement = doc.documentElement;
+
+ imported = doc.importNode(docElement,false);
+ success = imported.hasChildNodes();
+ assertFalse("documentimportnode11",success);
+nodeNameImported = imported.nodeName;
+
+ nodeNameOrig = docElement.nodeName;
+
+ assertEquals("documentimportnode11_NodeName",nodeNameImported,nodeNameOrig);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode11</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode12.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode12.html
new file mode 100644
index 0000000000..af3bfecce9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode12.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode12</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode12';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, import the first address element node of this
+ Document. Verify if the node has been imported correctly by checking the length of the
+ this elements childNode list before and after the import.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode12() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode12") != null) return;
+ var doc;
+ var childList;
+ var imported;
+ var addressElem;
+ var addressElemChildren;
+ var importedChildren;
+ var addressElemLen;
+ var importedLen;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("*","address");
+ addressElem = childList.item(0);
+ imported = doc.importNode(addressElem,true);
+ addressElemChildren = addressElem.childNodes;
+
+ importedChildren = imported.childNodes;
+
+ addressElemLen = addressElemChildren.length;
+
+ importedLen = importedChildren.length;
+
+ assertEquals("documentimportnode12",importedLen,addressElemLen);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode12</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode13.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode13.html
new file mode 100644
index 0000000000..15a0c6bee5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode13.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode13</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode13';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=false, import the first employee element node of this
+ Document. Verify if the node has been imported correctly by checking the length of the
+ this elements childNode list before and after the import.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode13() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode13") != null) return;
+ var doc;
+ var childList;
+ var imported;
+ var importedList;
+ var employeeElem;
+ var importedLen;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("*","employee");
+ employeeElem = childList.item(0);
+ imported = doc.importNode(employeeElem,false);
+ importedList = imported.childNodes;
+
+ importedLen = importedList.length;
+
+ assertEquals("documentimportnode13",0,importedLen);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode13</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode14.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode14.html
new file mode 100644
index 0000000000..aeeb38ebdb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode14.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode14</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode14';
+
+
+/**
+*
+ Using the method importNode with deep=true, import the fourth employee element node of this
+ Document. Verify if the node has been imported correctly by checking
+ if the default attribute present on this node has not been imported
+ and an explicit attribute has been imported.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=402
+*/
+function documentimportnode14() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode14") != null) return;
+ var doc;
+ var newDoc;
+ var domImpl;
+ var nullDocType = null;
+
+ var childList;
+ var imported;
+ var employeeElem;
+ var attrNode;
+ var attrValue;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("*","employee");
+ employeeElem = childList.item(3);
+ domImpl = getImplementation();
+newDoc = domImpl.createDocument(nullNS,"staff",nullDocType);
+ imported = newDoc.importNode(employeeElem,true);
+ attrNode = imported.getAttributeNodeNS(nullNS,"defaultAttr");
+ assertNull("defaultAttrNotImported",attrNode);
+ attrValue = imported.getAttributeNS("http://www.w3.org/2000/xmlns/","emp");
+ assertEquals("explicitAttrImported","http://www.nist.gov",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode14</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode15.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode15.html
new file mode 100644
index 0000000000..4b9d08e33e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode15.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode15</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docsLoaded += preload(docImpRef, "docImp", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode15';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, import a newly created Text node for this
+ Document. Verify if the node has been imported correctly by checking the value of the
+ imported text node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode15() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode15") != null) return;
+ var doc;
+ var docImp;
+ var textImport;
+ var textToImport;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docImp = load(docImpRef, "docImp", "staffNS");
+ textToImport = doc.createTextNode("Document.importNode test for a TEXT_NODE");
+ textImport = doc.importNode(textToImport,true);
+ nodeValue = textImport.nodeValue;
+
+ assertEquals("documentimportnode15","Document.importNode test for a TEXT_NODE",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode15</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode17.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode17.html
new file mode 100644
index 0000000000..03660bc8a2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode17.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode17</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docsLoaded += preload(docImpRef, "docImp", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode17';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, import a newly created Comment node for this
+ Document. Verify if the node has been imported correctly by checking the value of the
+ imported Comment node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode17() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode17") != null) return;
+ var doc;
+ var docImp;
+ var commentImport;
+ var commentToImport;
+ var nodeValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docImp = load(docImpRef, "docImp", "staffNS");
+ commentToImport = doc.createComment("Document.importNode test for a COMMENT_NODE");
+ commentImport = doc.importNode(commentToImport,true);
+ nodeValue = commentImport.nodeValue;
+
+ assertEquals("documentimportnode17","Document.importNode test for a COMMENT_NODE",nodeValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode17</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode18.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode18.html
new file mode 100644
index 0000000000..86d7198884
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode18.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode18</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docsLoaded += preload(docImpRef, "docImp", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode18';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, import a newly created PI node for this
+ Document. Verify if the node has been imported correctly by checking the PITarget and
+ PIData values of the imported PI node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode18() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode18") != null) return;
+ var doc;
+ var docImp;
+ var piImport;
+ var piToImport;
+ var piData;
+ var piTarget;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var docImpRef = null;
+ if (typeof(this.docImp) != 'undefined') {
+ docImpRef = this.docImp;
+ }
+ docImp = load(docImpRef, "docImp", "staffNS");
+ piToImport = doc.createProcessingInstruction("Target","Data");
+ piImport = doc.importNode(piToImport,false);
+ piTarget = piImport.target;
+
+ piData = piImport.data;
+
+ assertEquals("documentimportnode18_Target","Target",piTarget);
+ assertEquals("documentimportnode18_Data","Data",piData);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode18</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode19.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode19.html
new file mode 100644
index 0000000000..95daf1261b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode19.html
@@ -0,0 +1,175 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode19</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode19';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true/false, import a entity nodes ent2 and ent6
+ from this document to a new document object. Verify if the nodes have been
+ imported correctly by checking the nodeNames of the imported nodes and public and system ids.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode19() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode19") != null) return;
+ var doc;
+ var docTypeNull = null;
+
+ var docImp;
+ var domImpl;
+ var docType;
+ var nodeMap;
+ var entity2;
+ var entity6;
+ var entityImp2;
+ var entityImp6;
+ var nodeName;
+ var systemId;
+ var notationName;
+ var nodeNameImp;
+ var systemIdImp;
+ var notationNameImp;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+docType = doc.doctype;
+
+ docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull);
+ nodeMap = docType.entities;
+
+ assertNotNull("entitiesNotNull",nodeMap);
+entity2 = nodeMap.getNamedItem("ent2");
+ entity6 = nodeMap.getNamedItem("ent6");
+ entityImp2 = docImp.importNode(entity2,false);
+ entityImp6 = docImp.importNode(entity6,true);
+ nodeName = entity2.nodeName;
+
+ nodeNameImp = entityImp2.nodeName;
+
+ assertEquals("documentimportnode19_Ent2NodeName",nodeName,nodeNameImp);
+ nodeName = entity6.nodeName;
+
+ nodeNameImp = entityImp6.nodeName;
+
+ assertEquals("documentimportnode19_Ent6NodeName",nodeName,nodeNameImp);
+ systemId = entity2.systemId;
+
+ systemIdImp = entityImp2.systemId;
+
+ assertEquals("documentimportnode19_Ent2SystemId",systemId,systemIdImp);
+ systemId = entity6.systemId;
+
+ systemIdImp = entityImp6.systemId;
+
+ assertEquals("documentimportnode19_Ent6SystemId",systemId,systemIdImp);
+ notationName = entity2.notationName;
+
+ notationNameImp = entityImp2.notationName;
+
+ assertEquals("documentimportnode19_Ent2NotationName",notationName,notationNameImp);
+ notationName = entity6.notationName;
+
+ notationNameImp = entityImp6.notationName;
+
+ assertEquals("documentimportnode19_Ent6NotationName",notationName,notationNameImp);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode19</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode20.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode20.html
new file mode 100644
index 0000000000..0a25a343b6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode20.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode20</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("expandEntityReferences", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode20';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, import a entity node ent4
+ from this document to a new document object. The replacement text of this entity is an element
+ node, a cdata node and a pi. Verify if the nodes have been
+ imported correctly by checking the nodeNames of the imported element node, the data for the
+ cdata nodes and the PItarget and PIData for the pi nodes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode20() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode20") != null) return;
+ var doc;
+ var docImp;
+ var domImpl;
+ var docType;
+ var docTypeNull = null;
+
+ var nodeMap;
+ var entity4;
+ var entityImp4;
+ var element;
+ var cdata;
+ var pi;
+ var childList;
+ var elemchildList;
+ var ent4Name;
+ var ent4ImpName;
+ var cdataVal;
+ var piTargetVal;
+ var piDataVal;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+docType = doc.doctype;
+
+ docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull);
+ nodeMap = docType.entities;
+
+ entity4 = nodeMap.getNamedItem("ent4");
+ entityImp4 = docImp.importNode(entity4,true);
+ childList = entityImp4.childNodes;
+
+ element = childList.item(0);
+ elemchildList = element.childNodes;
+
+ cdata = elemchildList.item(0);
+ pi = childList.item(1);
+ ent4Name = entity4.nodeName;
+
+ ent4ImpName = entityImp4.nodeName;
+
+ cdataVal = cdata.data;
+
+ piTargetVal = pi.target;
+
+ piDataVal = pi.data;
+
+ assertEquals("documentimportnode20_Ent4NodeName",ent4Name,ent4ImpName);
+ assertEquals("documentimportnode20_Cdata","Element data",cdataVal);
+ assertEquals("documentimportnode20_PITarget","PItarget",piTargetVal);
+ assertEquals("documentimportnode20_PIData","PIdata",piDataVal);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode20</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html
new file mode 100644
index 0000000000..c117575f24
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html
@@ -0,0 +1,178 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode21</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("expandEntityReferences", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode21';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true, retreive the entity refs present in the
+ second element node whose tagName is address and import these nodes into another document.
+ Verify if the nodes have been imported correctly by checking the nodeNames of the
+ imported nodes, since they are imported into a new document which doesnot have thes defined,
+ the imported nodes should not have any children.
+ Now import the entityRef nodes into the same document and verify if the nodes have been
+ imported correctly by checking the nodeNames of the imported nodes, and by checking the
+ value of the replacement text of the imported nodes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode21() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode21") != null) return;
+ var doc;
+ var docTypeNull = null;
+
+ var docImp;
+ var domImpl;
+ var addressList;
+ var addressChildList;
+ var element;
+ var entRef2;
+ var entRefImp2;
+ var entRef3;
+ var entRefImp3;
+ var nodeName2;
+ var nodeName3;
+ var nodeNameImp2;
+ var nodeNameImp3;
+ var nodes;
+ var nodeImp3;
+ var nodeImp2;
+ var nodeValueImp2;
+ var nodeValueImp3;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull);
+ addressList = doc.getElementsByTagName("address");
+ element = addressList.item(1);
+ addressChildList = element.childNodes;
+
+ entRef2 = addressChildList.item(0);
+ entRef3 = addressChildList.item(2);
+ entRefImp2 = docImp.importNode(entRef2,true);
+ entRefImp3 = docImp.importNode(entRef3,false);
+ nodeName2 = entRef2.nodeName;
+
+ nodeName3 = entRef3.nodeName;
+
+ nodeNameImp2 = entRefImp2.nodeName;
+
+ nodeNameImp3 = entRefImp3.nodeName;
+
+ assertEquals("documentimportnode21_Ent2NodeName",nodeName2,nodeNameImp2);
+ assertEquals("documentimportnode21_Ent3NodeName",nodeName3,nodeNameImp3);
+ entRefImp2 = doc.importNode(entRef2,true);
+ entRefImp3 = doc.importNode(entRef3,false);
+ nodes = entRefImp2.childNodes;
+
+ nodeImp2 = nodes.item(0);
+ nodeValueImp2 = nodeImp2.nodeValue;
+
+ nodes = entRefImp3.childNodes;
+
+ nodeImp3 = nodes.item(0);
+ nodeValueImp3 = nodeImp3.nodeValue;
+
+ assertEquals("documentimportnode21_Ent2NodeValue","1900 Dallas Road",nodeValueImp2);
+ assertEquals("documentimportnode21_Ent3Nodevalue","Texas",nodeValueImp3);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode21</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode22.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode22.html
new file mode 100644
index 0000000000..3e5a1e9e18
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode22.html
@@ -0,0 +1,181 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode22</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documentimportnode22'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documentimportnode22';
+
+
+/**
+*
+ The importNode method imports a node from another document to this document.
+ The returned node has no parent; (parentNode is null). The source node is not
+ altered or removed from the original document but a new copy of the source node
+ is created.
+
+ Using the method importNode with deep=true/false, import two notaiton nodes into the
+ same and different documnet objects. In each case check if valid public and systemids
+ are returned if any and if none, check if a null value was returned.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function documentimportnode22() {
+ var success;
+ if(checkInitialization(builder, "documentimportnode22") != null) return;
+ var doc;
+ var docTypeNull = null;
+
+ var docImp;
+ var domImpl;
+ var docType;
+ var nodeMap;
+ var notation1;
+ var notation2;
+ var notationImp1;
+ var notationImp2;
+ var notationImpNew1;
+ var notationImpNew2;
+ var publicId1;
+ var publicId1Imp;
+ var publicId1NewImp;
+ var publicId2Imp;
+ var publicId2NewImp;
+ var systemId1Imp;
+ var systemId1NewImp;
+ var systemId2;
+ var systemId2Imp;
+ var systemId2NewImp;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+docType = doc.doctype;
+
+ docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull);
+ nodeMap = docType.notations;
+
+ assertNotNull("notationsNotNull",nodeMap);
+notation1 = nodeMap.getNamedItem("notation1");
+ notation2 = nodeMap.getNamedItem("notation2");
+ notationImp1 = doc.importNode(notation1,true);
+ notationImp2 = doc.importNode(notation2,false);
+ notationImpNew1 = docImp.importNode(notation1,false);
+ notationImpNew2 = docImp.importNode(notation2,true);
+ publicId1 = notation1.publicId;
+
+ publicId1Imp = notation1.publicId;
+
+ publicId1NewImp = notation1.publicId;
+
+ systemId1Imp = notation1.systemId;
+
+ systemId1NewImp = notation1.systemId;
+
+ publicId2Imp = notation2.publicId;
+
+ publicId2NewImp = notation2.publicId;
+
+ systemId2 = notation2.systemId;
+
+ systemId2Imp = notation2.systemId;
+
+ systemId2NewImp = notation2.systemId;
+
+ assertEquals("documentimportnode22_N1PID",publicId1,publicId1Imp);
+ assertEquals("documentimportnode22_N1NPID",publicId1,publicId1NewImp);
+ assertNull("documentimportnode22_N1SID",systemId1Imp);
+ assertNull("documentimportnode22_N1NSID",systemId1NewImp);
+ assertEquals("documentimportnode22_N2SID",systemId2,systemId2Imp);
+ assertEquals("documentimportnode22_N2NSID",systemId2,systemId2NewImp);
+ assertNull("documentimportnode22_N2PID",publicId2Imp);
+ assertNull("documentimportnode22_N2NPID",publicId2Imp);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode22</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documenttypepublicid01.html b/dom/tests/mochitest/dom-level2-core/test_documenttypepublicid01.html
new file mode 100644
index 0000000000..e04a853256
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documenttypepublicid01.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documenttypepublicid01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypepublicid01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypepublicid01';
+
+
+/**
+*
+ The method getInternalSubset() returns the public identifier of the external subset.
+
+ Create a new DocumentType node with the value "PUB" for its publicId.
+ Check the value of the publicId attribute using getPublicId().
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function documenttypepublicid01() {
+ var success;
+ if(checkInitialization(builder, "documenttypepublicid01") != null) return;
+ var doc;
+ var docType;
+ var domImpl;
+ var publicId;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+docType = domImpl.createDocumentType("l2:root","PUB",nullNS);
+ publicId = docType.publicId;
+
+ assertEquals("documenttypepublicid01","PUB",publicId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documenttypepublicid01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_documenttypesystemid01.html b/dom/tests/mochitest/dom-level2-core/test_documenttypesystemid01.html
new file mode 100644
index 0000000000..973b6a9992
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_documenttypesystemid01.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documenttypesystemid01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['documenttypesystemid01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'documenttypesystemid01';
+
+
+/**
+*
+ The method getInternalSubset() returns the public identifier of the external subset.
+
+ Create a new DocumentType node with the value "SYS" for its systemId and PUB for
+ its publicId. Check the value of the systemId and pbulicId attributes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId
+*/
+function documenttypesystemid01() {
+ var success;
+ if(checkInitialization(builder, "documenttypesystemid01") != null) return;
+ var doc;
+ var docType;
+ var domImpl;
+ var publicId;
+ var systemId;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+docType = domImpl.createDocumentType("l2:root","PUB","SYS");
+ publicId = docType.publicId;
+
+ systemId = docType.systemId;
+
+ assertEquals("documenttypepublicid01","PUB",publicId);
+ assertEquals("documenttypesystemid01","SYS",systemId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documenttypesystemid01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument03.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument03.html
new file mode 100644
index 0000000000..eaf5d4832e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument03.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationcreatedocument03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationcreatedocument03';
+
+
+/**
+*
+ The createDocument method with valid arguments, should create a DOM Document of
+ the specified type.
+
+ Call the createDocument on this DOMImplementation with
+ createDocument ("http://www.w3.org/DOMTest/L2",see the array below for valid QNames,null).
+ Check if the returned Document object is is empty with no Document Element.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+*/
+function domimplementationcreatedocument03() {
+ var success;
+ if(checkInitialization(builder, "domimplementationcreatedocument03") != null) return;
+ var doc;
+ var domImpl;
+ var newDoc;
+ var docType = null;
+
+ var namespaceURI = "http://www.w3.org/DOMTest/L2";
+ var qualifiedName;
+ qualifiedNames = new Array();
+ qualifiedNames[0] = "_:_";
+ qualifiedNames[1] = "_:h0";
+ qualifiedNames[2] = "_:test";
+ qualifiedNames[3] = "l_:_";
+ qualifiedNames[4] = "ns:_0";
+ qualifiedNames[5] = "ns:a0";
+ qualifiedNames[6] = "ns0:test";
+ qualifiedNames[7] = "a.b:c";
+ qualifiedNames[8] = "a-b:c";
+ qualifiedNames[9] = "a-b:c";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+for(var indexN65643 = 0;indexN65643 < qualifiedNames.length; indexN65643++) {
+ qualifiedName = qualifiedNames[indexN65643];
+ newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ assertNotNull("domimplementationcreatedocument03",newDoc);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument04.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument04.html
new file mode 100644
index 0000000000..f141c3ee55
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument04.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationcreatedocument04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationcreatedocument04';
+
+
+/**
+*
+ The createDocument method should throw a NAMESPACE_ERR if the qualifiedName has
+ a prefix and the namespaceURI is null.
+
+ Call the createDocument on this DOMImplementation with null namespaceURI and a
+ qualifiedName that has a namespace prefix using this DOMImplementation.
+ Check if the NAMESPACE_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+*/
+function domimplementationcreatedocument04() {
+ var success;
+ if(checkInitialization(builder, "domimplementationcreatedocument04") != null) return;
+ var doc;
+ var domImpl;
+ var newDoc;
+ var namespaceURI = null;
+
+ var qualifiedName = "dom:root";
+ var docType = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("domimplementationcreatedocument04",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument05.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument05.html
new file mode 100644
index 0000000000..9fe0a35e79
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument05.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationcreatedocument05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationcreatedocument05';
+
+
+/**
+*
+ The createDocument method should throw a NAMESPACE_ERR if the qualifiedName has
+ a prefix that is xml and the namespaceURI is different from
+ http://www..w3.org/XML/1998/namespace.
+
+ Call the createDocument on this DOMImplementation with namespaceURI that is
+ http://www.w3.org/xml/1998/namespace and a qualifiedName that has the prefix xml
+ Check if the NAMESPACE_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+*/
+function domimplementationcreatedocument05() {
+ var success;
+ if(checkInitialization(builder, "domimplementationcreatedocument05") != null) return;
+ var doc;
+ var domImpl;
+ var newDoc;
+ var namespaceURI = "http://www.w3.org/xml/1998/namespace";
+ var qualifiedName = "xml:root";
+ var docType = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("domimplementationcreatedocument05",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.html
new file mode 100644
index 0000000000..46c75fc363
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationcreatedocument07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationcreatedocument07';
+
+
+/**
+*
+ The createDocument method should raise a NAMESPACE_ERR if the qualifiedName is malformed
+
+ Invoke the createDocument method on this DOMImplementation object with null values
+ for namespaceURI and docType and a malformed qualifiedName.
+ The NAMESPACE_ERR should be raised.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+*/
+function domimplementationcreatedocument07() {
+ var success;
+ if(checkInitialization(builder, "domimplementationcreatedocument07") != null) return;
+ var doc;
+ var domImpl;
+ var newDoc;
+ var namespaceURI = "http://www.w3.org/DOMTest/level2";
+ var docType = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+
+ {
+ success = false;
+ try {
+ newDoc = domImpl.createDocument(namespaceURI,":",docType);
+ }
+ catch(ex) {
+ success = ex.code === DOMException.INVALID_CHARACTER_ERR;
+ }
+ assertTrue("domimplementationcreatedocument07",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype01.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype01.html
new file mode 100644
index 0000000000..35d1d7d40f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype01.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationcreatedocumenttype01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationcreatedocumenttype01';
+
+
+/**
+*
+ The method createDocumentType with valid values for qualifiedName, publicId and
+ systemId should create an empty DocumentType node.
+
+ Invoke createDocument on this DOMImplementation with a valid qualifiedName and different
+ publicIds and systemIds. Check if the the DocumentType node was created with its
+ ownerDocument attribute set to null.
+
+ The specification has changed! ownerDocument should not be null.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
+*/
+function domimplementationcreatedocumenttype01() {
+ var success;
+ if(checkInitialization(builder, "domimplementationcreatedocumenttype01") != null) return;
+ var doc;
+ var domImpl;
+ var newDocType;
+ var ownerDocument;
+ var qualifiedName = "test:root";
+ var publicId;
+ var systemId;
+ publicIds = new Array();
+ publicIds[0] = "1234";
+ publicIds[1] = "test";
+
+ systemIds = new Array();
+ systemIds[0] = "";
+ systemIds[1] = "test";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+for(var indexN65629 = 0;indexN65629 < publicIds.length; indexN65629++) {
+ publicId = publicIds[indexN65629];
+ for(var indexN65633 = 0;indexN65633 < systemIds.length; indexN65633++) {
+ systemId = systemIds[indexN65633];
+ newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId);
+ assertNotNull("domimplementationcreatedocumenttype01_newDocType",newDocType);
+ownerDocument = newDocType.ownerDocument;
+
+ assertNotNull("domimplementationcreatedocumenttype01_ownerDocument",ownerDocument);
+
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype02.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype02.html
new file mode 100644
index 0000000000..8ddd1126b8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype02.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationcreatedocumenttype02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationcreatedocumenttype02';
+
+
+/**
+*
+ The method createDocumentType with valid values for qualifiedName, publicId and
+ systemId should create an empty DocumentType node.
+
+ Invoke createDocument on this DOMImplementation with a different valid qualifiedNames
+ and a valid publicId and systemId. Check if the the DocumentType node was created
+ with its ownerDocument attribute set to null.
+
+ The specification has changed! ownerDocument should not be null.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType
+*/
+function domimplementationcreatedocumenttype02() {
+ var success;
+ if(checkInitialization(builder, "domimplementationcreatedocumenttype02") != null) return;
+ var doc;
+ var domImpl;
+ var newDocType;
+ var ownerDocument;
+ var publicId = "http://www.w3.org/DOM/Test/dom2.dtd";
+ var systemId = "dom2.dtd";
+ var qualifiedName;
+ qualifiedNames = new Array();
+ qualifiedNames[0] = "_:_";
+ qualifiedNames[1] = "_:h0";
+ qualifiedNames[2] = "_:test";
+ qualifiedNames[3] = "_:_.";
+ qualifiedNames[4] = "_:a-";
+ qualifiedNames[5] = "l_:_";
+ qualifiedNames[6] = "ns:_0";
+ qualifiedNames[7] = "ns:a0";
+ qualifiedNames[8] = "ns0:test";
+ qualifiedNames[9] = "ns:EEE.";
+ qualifiedNames[10] = "ns:_-";
+ qualifiedNames[11] = "a.b:c";
+ qualifiedNames[12] = "a-b:c.j";
+ qualifiedNames[13] = "a-b:c";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+for(var indexN65655 = 0;indexN65655 < qualifiedNames.length; indexN65655++) {
+ qualifiedName = qualifiedNames[indexN65655];
+ newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId);
+ assertNotNull("domimplementationcreatedocumenttype02_newDocType",newDocType);
+ownerDocument = newDocType.ownerDocument;
+
+ assertNotNull("domimplementationcreatedocumenttype02_ownerDocument",ownerDocument);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype04.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype04.html
new file mode 100644
index 0000000000..6a5017d19a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype04.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationcreatedocumenttype04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationcreatedocumenttype04';
+
+
+/**
+*
+ The method createDocumentType should raise a INVALID_CHARACTER_ERR if the qualifiedName
+ contains an illegal characters.
+
+ Invoke createDocument on this DOMImplementation with qualifiedNames having illegal characters.
+ Check if an INVALID_CHARACTER_ERR is raised in each case.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType
+*/
+function domimplementationcreatedocumenttype04() {
+ var success;
+ if(checkInitialization(builder, "domimplementationcreatedocumenttype04") != null) return;
+ var doc;
+ var domImpl;
+ var newDocType;
+ var publicId = "http://www.w3.org/DOM/Test/dom2.dtd";
+ var systemId = "dom2.dtd";
+ var qualifiedName;
+ qualifiedNames = new Array();
+ qualifiedNames[0] = "{";
+ qualifiedNames[1] = "}";
+ qualifiedNames[2] = "'";
+ qualifiedNames[3] = "~";
+ qualifiedNames[4] = "`";
+ qualifiedNames[5] = "@";
+ qualifiedNames[6] = "#";
+ qualifiedNames[7] = "$";
+ qualifiedNames[8] = "%";
+ qualifiedNames[9] = "^";
+ qualifiedNames[10] = "&";
+ qualifiedNames[11] = "*";
+ qualifiedNames[12] = "(";
+ qualifiedNames[13] = ")";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+for(var indexN65651 = 0;indexN65651 < qualifiedNames.length; indexN65651++) {
+ qualifiedName = qualifiedNames[indexN65651];
+
+ {
+ success = false;
+ try {
+ newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("domimplementationcreatedocumenttype04",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturecore.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturecore.html
new file mode 100644
index 0000000000..828c2dd591
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturecore.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationfeaturecore</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationfeaturecore'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationfeaturecore';
+
+
+/**
+*
+
+ The "feature" parameter in the
+
+ "hasFeature(feature,version)" method is the package name
+
+ of the feature. Legal values are XML and HTML and CORE.
+
+ (Test for feature core, lower case)
+
+
+
+ Retrieve the entire DOM document and invoke its
+
+ "getImplementation()" method. This should create a
+
+ DOMImplementation object whose "hasFeature(feature,
+
+ version)" method is invoked with feature equal to "core".
+
+ The method should return a boolean "true".
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function domimplementationfeaturecore() {
+ var success;
+ if(checkInitialization(builder, "domimplementationfeaturecore") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ domImpl = doc.implementation;
+state = domImpl.hasFeature("core","2.0");
+assertTrue("domimplementationFeaturecoreAssert",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationfeaturecore</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturexmlversion2.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturexmlversion2.html
new file mode 100644
index 0000000000..0893a53964
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturexmlversion2.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationfeaturexmlversion2</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationfeaturexmlversion2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationfeaturexmlversion2';
+
+
+/**
+*
+
+ The "feature" parameter in the
+
+ "hasFeature(feature,version)" method is the package name
+
+ of the feature. Legal values are XML and HTML.
+
+ (Test for feature "xml" and version "2.0")
+
+
+
+ Retrieve the entire DOM document and invoke its
+
+ "getImplementation()" method. This should create a
+
+ DOMImplementation object whose "hasFeature(feature,
+
+ version)" method is invoked with "feature" equal to "xml".
+
+ The method should return a boolean "true".
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function domimplementationfeaturexmlversion2() {
+ var success;
+ if(checkInitialization(builder, "domimplementationfeaturexmlversion2") != null) return;
+ var doc;
+ var domImpl;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ domImpl = doc.implementation;
+state = domImpl.hasFeature("xml","2.0");
+assertTrue("domimplementationFeaturexmlVersion2Assert",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationfeaturexmlversion2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationhasfeature01.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationhasfeature01.html
new file mode 100644
index 0000000000..fc18c9f2bd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationhasfeature01.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationhasfeature01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['domimplementationhasfeature01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'domimplementationhasfeature01';
+
+
+/**
+*
+ The method "hasFeature(feature,version)" tests if the DOMImplementation implements
+ a specific feature and if so returns true.
+
+ Call the hasFeature method on this DOMImplementation with a combination of features
+ versions as below. Valid feature names are case insensitive and versions "2.0",
+ "1.0" and if the version is not specified, supporting any version of the feature
+ should return true. Check if the value returned value was true.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function domimplementationhasfeature01() {
+ var success;
+ if(checkInitialization(builder, "domimplementationhasfeature01") != null) return;
+ var doc;
+ var domImpl;
+ var version = "";
+ var version1 = "1.0";
+ var version2 = "2.0";
+ var featureCore;
+ var featureXML;
+ var success;
+ featuresXML = new Array();
+ featuresXML[0] = "XML";
+ featuresXML[1] = "xmL";
+
+ featuresCore = new Array();
+ featuresCore[0] = "Core";
+ featuresCore[1] = "CORE";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+for(var indexN65635 = 0;indexN65635 < featuresXML.length; indexN65635++) {
+ featureXML = featuresXML[indexN65635];
+ success = domImpl.hasFeature(featureXML,version);
+assertTrue("domimplementationhasfeature01_XML_1",success);
+success = domImpl.hasFeature(featureXML,version1);
+assertTrue("domimplementationhasfeature01_XML_2",success);
+
+ }
+ for(var indexN65660 = 0;indexN65660 < featuresCore.length; indexN65660++) {
+ featureCore = featuresCore[indexN65660];
+ success = domImpl.hasFeature(featureCore,version);
+assertTrue("domimplementationhasfeature01_Core_1",success);
+success = domImpl.hasFeature(featureCore,version1);
+success = domImpl.hasFeature(featureCore,version2);
+assertTrue("domimplementationhasfeature01_Core_3",success);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationhasfeature01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens01.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens01.html
new file mode 100644
index 0000000000..6b3281fcd2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens01.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetattributenodens01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetattributenodens01';
+
+
+/**
+*
+ The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI.
+ Create a new element node and add 2 new attribute nodes to it that have the same
+ local name but different namespaceURIs and prefixes.
+ Retrieve an attribute using namespace and localname and check its value, name and
+ namespaceURI.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS
+*/
+function elementgetattributenodens01() {
+ var success;
+ if(checkInitialization(builder, "elementgetattributenodens01") != null) return;
+ var doc;
+ var element;
+ var attribute1;
+ var attribute2;
+ var newAttribute1;
+ var newAttribute2;
+ var attribute;
+ var attrValue;
+ var attrName;
+ var attNodeName;
+ var attrLocalName;
+ var attrNS;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("namespaceURI","root");
+ attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Level2","l2:att");
+ newAttribute1 = element.setAttributeNodeNS(attribute1);
+ attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Level1","att");
+ newAttribute2 = element.setAttributeNodeNS(attribute2);
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2","att");
+ attrValue = attribute.nodeValue;
+
+ attrName = attribute.name;
+
+ attNodeName = attribute.nodeName;
+
+ attrLocalName = attribute.localName;
+
+ attrNS = attribute.namespaceURI;
+
+ assertEquals("elementgetattributenodens01_attrValue","",attrValue);
+ assertEquals("elementgetattributenodens01_attrName","l2:att",attrName);
+ assertEquals("elementgetattributenodens01_attrNodeName","l2:att",attNodeName);
+ assertEquals("elementgetattributenodens01_attrLocalName","att",attrLocalName);
+ assertEquals("elementgetattributenodens01_attrNs","http://www.w3.org/DOM/Level2",attrNS);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens02.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens02.html
new file mode 100644
index 0000000000..2e2a19301c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens02.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetattributenodens02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetattributenodens02';
+
+
+/**
+*
+ The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI.
+ Create a new element node and add a new attribute node to it. Using the getAttributeNodeNS,
+ retrieve the newly added attribute node and check its value.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS
+*/
+function elementgetattributenodens02() {
+ var success;
+ if(checkInitialization(builder, "elementgetattributenodens02") != null) return;
+ var doc;
+ var element;
+ var attribute;
+ var newAttribute1;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("namespaceURI","root");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM/Level2","l2:att");
+ newAttribute1 = element.setAttributeNodeNS(attribute);
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2","att");
+ attrValue = attribute.nodeValue;
+
+ assertEquals("elementgetattributenodens02","",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens03.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens03.html
new file mode 100644
index 0000000000..0546491ae0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens03.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetattributenodens03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetattributenodens03';
+
+
+/**
+*
+ The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI.
+ Using the getAttributeNodeNS, retrieve and verify the value of the default
+ attribute node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function elementgetattributenodens03() {
+ var success;
+ if(checkInitialization(builder, "elementgetattributenodens03") != null) return;
+ var doc;
+ var element;
+ var attribute;
+ var attrValue;
+ var childList;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = childList.item(1);
+ attribute = element.getAttributeNodeNS(nullNS,"defaultAttr");
+ attrValue = attribute.nodeValue;
+
+ assertEquals("elementgetattributenodens03","defaultVal",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributens02.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributens02.html
new file mode 100644
index 0000000000..29725f79e2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributens02.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributens02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetattributens02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetattributens02';
+
+
+/**
+*
+ The method getAttributeNS retrieves an attribute value by local name and namespace URI.
+ Using the getAttributeNodeNS, retreive and verify the value of the default
+ attribute node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function elementgetattributens02() {
+ var success;
+ if(checkInitialization(builder, "elementgetattributens02") != null) return;
+ var doc;
+ var element;
+ var attrValue;
+ var childList;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = childList.item(1);
+ attrValue = element.getAttributeNS(nullNS,"defaultAttr");
+ assertEquals("elementgetattributens02","defaultVal",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributens02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens02.html b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens02.html
new file mode 100644
index 0000000000..29a9c7f4ae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens02.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementsbytagnamens02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementsbytagnamens02';
+
+
+/**
+*
+ The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local
+ name and namespace URI in the order in which they are encountered in a preorder traversal
+ of the Document tree.
+ Invoke getElementsByTagNameNS on the documentElement with values for namespaceURI '*' and
+ localName '*'. Verify if this returns a nodeList of 0 elements.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function elementgetelementsbytagnamens02() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementsbytagnamens02") != null) return;
+ var doc;
+ var element;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.documentElement;
+
+ elementList = element.getElementsByTagNameNS("**","*");
+ assertSize("elementgetelementsbytagnamens02",0,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens04.html b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens04.html
new file mode 100644
index 0000000000..b5d0e80c2b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens04.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementsbytagnamens04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementsbytagnamens04';
+
+
+/**
+*
+ Returns a NodeList of all the Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of the Document tree.
+ Create a new element node ('root') and append three newly created child nodes (all have
+ local name 'child' and defined in different namespaces).
+ Test 1: invoke getElementsByTagNameNS to retrieve one of the children.
+ Test 2: invoke getElementsByTagNameNS with the value of namespace equals to '*', and
+ verify that the node list has length of 3.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function elementgetelementsbytagnamens04() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementsbytagnamens04") != null) return;
+ var doc;
+ var element;
+ var child1;
+ var child2;
+ var child3;
+ var appendedChild;
+ var elementList;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM","root");
+ child1 = doc.createElementNS("http://www.w3.org/DOM/Level1","dom:child");
+ child2 = doc.createElementNS(nullNS,"child");
+ child3 = doc.createElementNS("http://www.w3.org/DOM/Level2","dom:child");
+ appendedChild = element.appendChild(child1);
+ appendedChild = element.appendChild(child2);
+ appendedChild = element.appendChild(child3);
+ elementList = element.getElementsByTagNameNS(nullNS,"child");
+ assertSize("elementgetelementsbytagnamens04_1",1,elementList);
+elementList = element.getElementsByTagNameNS("*","child");
+ assertSize("elementgetelementsbytagnamens04_2",3,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens05.html b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens05.html
new file mode 100644
index 0000000000..35ec75f156
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens05.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementgetelementsbytagnamens05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementgetelementsbytagnamens05';
+
+
+/**
+*
+ Returns a NodeList of all the Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of the Document tree.
+ Invoke getElementsByTagNameNS on the documentElement with the following values:
+ namespaceURI: 'http://www.altavista.com'
+ localName: '*'.
+ Verify if this returns a nodeList of 1 elements.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function elementgetelementsbytagnamens05() {
+ var success;
+ if(checkInitialization(builder, "elementgetelementsbytagnamens05") != null) return;
+ var doc;
+ var element;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.documentElement;
+
+ elementList = element.getElementsByTagNameNS("http://www.altavista.com","*");
+ assertSize("elementgetelementsbytagnamens05",1,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute01.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute01.html
new file mode 100644
index 0000000000..930f8d0b50
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute01.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementhasattribute01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementhasattribute01';
+
+
+/**
+*
+ The method hasAttribute returns true when an attribute with a given name is specified
+ on this element or has a default value, false otherwise
+ Invoke the hasAttribute method to check if the documentElement has attributres.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function elementhasattribute01() {
+ var success;
+ if(checkInitialization(builder, "elementhasattribute01") != null) return;
+ var doc;
+ var element;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.documentElement;
+
+ state = element.hasAttribute("");
+ assertFalse("elementhasattribute01",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute02.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute02.html
new file mode 100644
index 0000000000..0e03abcf2f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute02.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementhasattribute02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementhasattribute02';
+
+
+/**
+*
+ The method hasAttribute returns true when an attribute with a given name is specified
+ on this element or has a default value, false otherwise
+ Invoke the hasAttribute method to on an element with default attributes and verify if it
+ returns true.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function elementhasattribute02() {
+ var success;
+ if(checkInitialization(builder, "elementhasattribute02") != null) return;
+ var doc;
+ var element;
+ var state;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:employee");
+ element = elementList.item(0);
+ assertNotNull("empEmployeeNotNull",element);
+state = element.hasAttribute("defaultAttr");
+ assertTrue("elementhasattribute02",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute03.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute03.html
new file mode 100644
index 0000000000..d63b213eee
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute03.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementhasattribute03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementhasattribute03';
+
+
+/**
+*
+ The method hasAttribute returns true when an attribute with a given name is specified
+ on this element or has a default value, false otherwise.
+
+ Create an element Node and an attribute Node. Invoke hasAttribute method
+ to verify that there is no attribute. Append the attribute node to the element node.
+ Invoke the hasAttribute method on the element and verify if it returns true.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function elementhasattribute03() {
+ var success;
+ if(checkInitialization(builder, "elementhasattribute03") != null) return;
+ var doc;
+ var element;
+ var state;
+ var attribute;
+ var newAttribute;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElement("address");
+ attribute = doc.createAttribute("domestic");
+ state = element.hasAttribute("domestic");
+ assertFalse("elementhasattribute03_False",state);
+newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttribute("domestic");
+ assertTrue("elementhasattribute03_True",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute04.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute04.html
new file mode 100644
index 0000000000..8e19f26794
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute04.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementhasattribute04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementhasattribute04';
+
+
+/**
+*
+ The method hasAttribute returns true when an attribute with a given name is specified
+ on this element or has a default value, false otherwise.
+
+ Create an element Node and an attribute Node and add the attribute node to the element.
+ Invoke the hasAttribute method on the element and verify if the method returns true.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function elementhasattribute04() {
+ var success;
+ if(checkInitialization(builder, "elementhasattribute04") != null) return;
+ var doc;
+ var element;
+ var state;
+ var attribute;
+ var newAttribute;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElement("address");
+ attribute = doc.createAttribute("domestic");
+ newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttribute("domestic");
+ assertTrue("elementhasattribute04",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattributens01.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens01.html
new file mode 100644
index 0000000000..9143e4f7b4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens01.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementhasattributens01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementhasattributens01';
+
+
+/**
+*
+ The method hasAttributeNS returns true when an attribute with a given local name
+ and namespace
+ URI is specified on this element or has a default value, false otherwise.
+
+ Retreive the first employee element node. Invoke the hasAttributeNS method to check if it
+ has the xmlns attribute that belongs to the namespace http://www.w3.org/2000/xmlns/.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+*/
+function elementhasattributens01() {
+ var success;
+ if(checkInitialization(builder, "elementhasattributens01") != null) return;
+ var doc;
+ var element;
+ var state;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","employee");
+ element = elementList.item(0);
+ state = element.hasAttributeNS("http://www.w3.org/2000/xmlns/","xmlns");
+ assertTrue("elementhasattributens01",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattributens02.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens02.html
new file mode 100644
index 0000000000..b188a908c5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens02.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementhasattributens02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementhasattributens02';
+
+
+/**
+*
+ The method hasAttributeNS returns true when an attribute with a given local
+ name and namespace URI is specified on this element or has a default value,
+ false otherwise.
+
+ Create a new element and attribute node that belong to the same namespace.
+ Add the attribute node to the element node. Check if the newly created element
+ node has an attribute by invoking the hasAttributeNS method with appropriate
+ values for the namespaceURI and localName parameters.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+*/
+function elementhasattributens02() {
+ var success;
+ if(checkInitialization(builder, "elementhasattributens02") != null) return;
+ var doc;
+ var element;
+ var state;
+ var attribute;
+ var newAttribute;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS("http://www.w3.org/DOM","address");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM","domestic");
+ newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttributeNS("http://www.w3.org/DOM","domestic");
+ assertTrue("hasDomesticAttr",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattributens03.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens03.html
new file mode 100644
index 0000000000..b529accc4c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens03.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementhasattributens03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementhasattributens03';
+
+
+/**
+*
+ The method hasAttributeNS returns true when an attribute with a given local name
+ and namespace URI is specified on this element or has a default value,
+ false otherwise.
+
+ Create a new element and an attribute node that has an empty namespace.
+ Add the attribute node to the element node. Check if the newly created element
+ node has an attribute by invoking the hasAttributeNS method with appropriate
+ values for the namespaceURI and localName parameters.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function elementhasattributens03() {
+ var success;
+ if(checkInitialization(builder, "elementhasattributens03") != null) return;
+ var doc;
+ var element;
+ var state;
+ var attribute;
+ var newAttribute;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS("http://www.w3.org/DOM","address");
+ assertNotNull("createElementNotNull",element);
+attribute = doc.createAttributeNS(nullNS,"domestic");
+ newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttributeNS(nullNS,"domestic");
+ assertTrue("elementhasattributens03",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementremoveattributens01.html b/dom/tests/mochitest/dom-level2-core/test_elementremoveattributens01.html
new file mode 100644
index 0000000000..feede9d7ca
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementremoveattributens01.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementremoveattributens01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementremoveattributens01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementremoveattributens01';
+
+
+/**
+*
+ The method removeAttributeNS removes an attribute by local name and namespace URI.
+ Create a new element and add a new attribute node to it.
+ Remove the attribute node using the removeAttributeNodeNS method.
+ Check if the attribute was remove by invoking the hasAttributeNS
+ method on the element and check if it returns false.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS
+*/
+function elementremoveattributens01() {
+ var success;
+ if(checkInitialization(builder, "elementremoveattributens01") != null) return;
+ var doc;
+ var element;
+ var state;
+ var attribute;
+ var newAttribute;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS("http://www.w3.org/DOM","elem");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr");
+ newAttribute = element.setAttributeNodeNS(attribute);
+ element.removeAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr");
+ state = element.hasAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr");
+ assertFalse("elementremoveattributens01",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementremoveattributens01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens01.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens01.html
new file mode 100644
index 0000000000..41d6b47968
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens01.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodens01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodens01';
+
+
+/**
+*
+ Testing Element.setAttributeNodeNS: If an attribute with that local name
+ and that namespace URI is already present in the element, it is replaced
+ by the new one.
+
+ Create a new element and two new attribute nodes (in the same namespace
+ and same localNames).
+ Add the two new attribute nodes to the element node using the
+ setAttributeNodeNS method. Check that only one attribute is added, check
+ the value of this attribute.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+*/
+function elementsetattributenodens01() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodens01") != null) return;
+ var doc;
+ var element;
+ var attribute1;
+ var attribute2;
+ var attrNode;
+ var attrName;
+ var attrNS;
+ var attrValue;
+ var attributes;
+ var newAttribute;
+ var length;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/Level2","new:element");
+ attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p1:att");
+ attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p2:att");
+ attribute2.value = "value2";
+
+ newAttribute = element.setAttributeNodeNS(attribute1);
+ newAttribute = element.setAttributeNodeNS(attribute2);
+ attrNode = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/att1","att");
+ attrName = attrNode.nodeName;
+
+ attrNS = attrNode.namespaceURI;
+
+ assertEquals("elementsetattributenodens01_attrName","p2:att",attrName);
+ assertEquals("elementsetattributenodens01_attrNS","http://www.w3.org/DOM/Test/att1",attrNS);
+ attributes = element.attributes;
+
+ length = attributes.length;
+
+ assertEquals("length",1,length);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens02.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens02.html
new file mode 100644
index 0000000000..49ed31a8aa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens02.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodens02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodens02';
+
+
+/**
+*
+ Test the setAttributeNodeNS method.
+ Retreive the street attribute from the second address element node.
+ Clone it and add it to the first address node. The INUSE_ATTRIBUTE_ERR exception
+ should not be thrown. Check the name and value of the newly added node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function elementsetattributenodens02() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodens02") != null) return;
+ var doc;
+ var element;
+ var element2;
+ var attribute;
+ var attributeCloned;
+ var newAttr;
+ var elementList;
+ var attrName;
+ var attrValue;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(1);
+ attribute = element.getAttributeNodeNS(nullNS,"street");
+ attributeCloned = attribute.cloneNode(true);
+ element2 = elementList.item(2);
+ newAttr = element2.setAttributeNodeNS(attributeCloned);
+ attrName = newAttr.nodeName;
+
+ attrValue = newAttr.nodeValue;
+
+ assertEquals("elementsetattributenodens02_attrName","street",attrName);
+ assertEquals("elementsetattributenodens02_attrValue","Yes",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens03.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens03.html
new file mode 100644
index 0000000000..6d818edc9c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens03.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodens03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodens03';
+
+
+/**
+*
+ The method setAttributeNodeNS adds a new attribute and raises the
+ INUSE_ATTRIBUTE_ERR exception if the newAttr is already an attribute of
+ another Element object.
+
+ Retreive an attribute node of an existing element node. Attempt to add it to an another
+ element node. Check if the INUSE_ATTRIBUTE_ERR exception is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+*/
+function elementsetattributenodens03() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodens03") != null) return;
+ var doc;
+ var element1;
+ var element2;
+ var attribute;
+ var newAttribute;
+ var elementList;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element1 = elementList.item(1);
+ attribute = element1.getAttributeNodeNS(nullNS,"street");
+ element2 = elementList.item(2);
+
+ {
+ success = false;
+ try {
+ newAttribute = element2.setAttributeNodeNS(attribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("elementsetattributenodens03",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens04.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens04.html
new file mode 100644
index 0000000000..8d1ca94b1c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens04.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodens04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodens04';
+
+
+/**
+*
+ The method setAttributeNodeNS Adds a new attribute and raises an INUSE_ATTRIBUTE_ERR
+ if newAttr is already an attribute of another Element object.
+
+ Create two new element nodes and a new attribute node. Attempt to add the same attribute
+ node to the same two element nodes.
+ Check if an INUSE_ATTRIBUTE_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+*/
+function elementsetattributenodens04() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodens04") != null) return;
+ var doc;
+ var element1;
+ var element2;
+ var attribute;
+ var newAttribute;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element1 = doc.createElementNS("http://www.w3.org/DOM/Test","elem1");
+ element2 = doc.createElementNS("http://www.w3.org/DOM/Test","elem2");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test","attr");
+ newAttribute = element1.setAttributeNodeNS(attribute);
+
+ {
+ success = false;
+ try {
+ newAttribute = element2.setAttributeNodeNS(attribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("elementsetattributenodens04",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens05.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens05.html
new file mode 100644
index 0000000000..3fb2eaaa93
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens05.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodens05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docAltRef = null;
+ if (typeof(this.docAlt) != 'undefined') {
+ docAltRef = this.docAlt;
+ }
+ docsLoaded += preload(docAltRef, "docAlt", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodens05';
+
+
+/**
+*
+ The method setAttributeNodeNS Adds a new attribute and raises
+ an WRONG_DOCUMENT_ERR if newAttr was created from a different document
+ than the one that created the element.
+ Create new element and attribute nodes in different documents.
+ Attempt to add the attribute node to the element node.
+ Check if an WRONG_DOCUMENT_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+*/
+function elementsetattributenodens05() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodens05") != null) return;
+ var doc;
+ var docAlt;
+ var element;
+ var attribute;
+ var newAttribute;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var docAltRef = null;
+ if (typeof(this.docAlt) != 'undefined') {
+ docAltRef = this.docAlt;
+ }
+ docAlt = load(docAltRef, "docAlt", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test","elem1");
+ attribute = docAlt.createAttributeNS("http://www.w3.org/DOM/Test","attr");
+
+ {
+ success = false;
+ try {
+ newAttribute = element.setAttributeNodeNS(attribute);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens06.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens06.html
new file mode 100644
index 0000000000..d165a7408e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens06.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributenodens06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("expandEntityReferences", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributenodens06';
+
+
+/**
+*
+ The method setAttributeNodeNS Adds a new attribute and raises an WRONG_DOCUMENT_ERR if this node
+ is readonly.
+
+ Attempt to add an attribute node to an element node which is part of the replacement text of
+ a read-only EntityReference node.
+ Check if a NO_MODIFICATION_ALLOWED_ERR is thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+*/
+function elementsetattributenodens06() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributenodens06") != null) return;
+ var doc;
+ var element;
+ var attribute;
+ var attribute2;
+ var entRef;
+ var elementList;
+ var newAttribute;
+ var newChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test","elem1");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test","attr");
+ entRef = doc.createEntityReference("ent4");
+ newChild = attribute.appendChild(entRef);
+ newAttribute = element.setAttributeNodeNS(attribute);
+ elementList = entRef.childNodes;
+
+ element = elementList.item(0);
+ attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test","attr2");
+
+ {
+ success = false;
+ try {
+ newAttribute = element.setAttributeNodeNS(attribute2);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("elementsetattributenodens06",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens01.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens01.html
new file mode 100644
index 0000000000..3c8b8cea6a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens01.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributens01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributens01';
+
+
+/**
+*
+ The method setAttributeNS adds a new attribute.
+ Create a new element and add a new attribute node to it using the setAttributeNS method.
+ Check if the attribute was correctly set by invoking the getAttributeNodeNS method
+ and checking the nodeName and nodeValue of the returned nodes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+*/
+function elementsetattributens01() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributens01") != null) return;
+ var doc;
+ var element;
+ var attribute;
+ var attrName;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS("http://www.w3.org/DOM","dom:elem");
+ element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS","attr","value");
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS","attr");
+ attrName = attribute.nodeName;
+
+ attrValue = attribute.nodeValue;
+
+ assertEquals("elementsetattributens01_attrName","attr",attrName);
+ assertEquals("elementsetattributens01_attrValue","value",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens02.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens02.html
new file mode 100644
index 0000000000..b3b3924abd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens02.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributens02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributens02';
+
+
+/**
+*
+ The method setAttributeNS adds a new attribute.
+
+ Retrieve an existing element node with attributes and add a new attribute node to it using
+ the setAttributeNS method. Check if the attribute was correctly set by invoking the
+ getAttributeNodeNS method and checking the nodeName and nodeValue of the returned nodes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+*/
+function elementsetattributens02() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributens02") != null) return;
+ var doc;
+ var element;
+ var attribute;
+ var elementList;
+ var attrName;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(0);
+ element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS","this:street","Silver Street");
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS","street");
+ attrName = attribute.nodeName;
+
+ attrValue = attribute.nodeValue;
+
+ assertEquals("elementsetattributens02_attrName","this:street",attrName);
+ assertEquals("elementsetattributens02_attrValue","Silver Street",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens03.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens03.html
new file mode 100644
index 0000000000..3764c4a7ac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens03.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributens03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributens03';
+
+
+/**
+*
+ The method setAttributeNS adds a new attribute.
+ Retreive an existing element node with a default attribute node and
+ add two new attribute nodes that have the same local name as the
+ default attribute but different namespaceURI to it using the setAttributeNS method.
+ Check if the attribute was correctly set by invoking the getAttributeNodeNS method
+ and checking the nodeName and nodeValue of the returned nodes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+*/
+function elementsetattributens03() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributens03") != null) return;
+ var doc;
+ var element;
+ var attribute;
+ var elementList;
+ var attrName;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:employee");
+ element = elementList.item(0);
+ assertNotNull("empEmployeeNotNull",element);
+element.setAttributeNS("http://www.w3.org/DOM/Test/1","defaultAttr","default1");
+ element.setAttributeNS("http://www.w3.org/DOM/Test/2","defaultAttr","default2");
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/1","defaultAttr");
+ attrName = attribute.nodeName;
+
+ attrValue = attribute.nodeValue;
+
+ assertEquals("elementsetattributens03_attrName","defaultAttr",attrName);
+ assertEquals("elementsetattributens03_attrValue","default1",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens04.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens04.html
new file mode 100644
index 0000000000..4ba7eacda7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens04.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributens04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributens04';
+
+
+/**
+*
+ The method setAttributeNS adds a new attribute and raises a INVALID_CHARACTER_ERR if
+ the specified qualified name contains an illegal character.
+ Invoke the setAttributeNS method on this Element object with a valid value for
+ namespaceURI, and qualifiedNames that contain illegal characters. Check if the an
+ INVALID_CHARACTER_ERR was thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+*/
+function elementsetattributens04() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributens04") != null) return;
+ var doc;
+ var element;
+ var qualifiedName;
+ qualifiedNames = new Array();
+ qualifiedNames[0] = "/";
+ qualifiedNames[1] = "//";
+ qualifiedNames[2] = "\\";
+ qualifiedNames[3] = ";";
+ qualifiedNames[4] = "&";
+ qualifiedNames[5] = "*";
+ qualifiedNames[6] = "]]";
+ qualifiedNames[7] = ">";
+ qualifiedNames[8] = "<";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/L2","dom:elem");
+ for(var indexN65624 = 0;indexN65624 < qualifiedNames.length; indexN65624++) {
+ qualifiedName = qualifiedNames[indexN65624];
+
+ {
+ success = false;
+ try {
+ element.setAttributeNS("http://www.w3.org/DOM/Test/L2",qualifiedName,"test");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("elementsetattributens04",success);
+ }
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens05.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens05.html
new file mode 100644
index 0000000000..7a8fce7f30
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens05.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributens05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributens05';
+
+
+/**
+*
+ The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR if the
+ qualifiedName has a prefix and the namespaceURI is null.
+ Invoke the setAttributeNS method on a new Element object with null namespaceURI and a
+ qualifiedName that has a namespace prefix. Check if the NAMESPACE_ERR was thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function elementsetattributens05() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributens05") != null) return;
+ var doc;
+ var element;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/L2","dom:elem");
+
+ {
+ success = false;
+ try {
+ element.setAttributeNS(nullNS,"dom:root","test");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("elementsetattributens05",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens08.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens08.html
new file mode 100644
index 0000000000..dc181e460c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens08.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens08</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributens08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributens08';
+
+
+/**
+*
+ The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR
+ if the qualifiedName, or its prefix, is "xmlns" and the namespaceURI is
+ different from "http://www.w3.org/2000/xmlns/".
+
+ Invoke the setAttributeNS method on a new Element object with namespaceURI that is
+ http://www.w3.org/DOMTest/level2 and a qualifiedName that has the prefix xmlns and once
+ again with a qualifiedName that is xmlns.
+ Check if the NAMESPACE_ERR was thrown.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+*/
+function elementsetattributens08() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributens08") != null) return;
+ var doc;
+ var element;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOMTest/level2","dom:elem");
+
+ {
+ success = false;
+ try {
+ element.setAttributeNS("http://www.w3.org/DOMTest/level2","xmlns","test");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("elementsetattributens08_Err1",success);
+ }
+
+ {
+ success = false;
+ try {
+ element.setAttributeNS("http://www.w3.org/DOMTest/level2","xmlns:root","test");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("elementsetattributens08_Err2",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributensurinull.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributensurinull.html
new file mode 100644
index 0000000000..b1cb68f8a9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributensurinull.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributensurinull</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['elementsetattributensurinull'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'elementsetattributensurinull';
+
+
+/**
+*
+
+ The "setAttributeNS(namespaceURI,qualifiedName,value)" method raises a
+
+ NAMESPACE_ERR DOMException if the specified
+
+ qualifiedName has a prefix and the namespaceURI is null.
+
+
+
+ Attempt to add a new attribute on the first employee node.
+
+ An exception should be raised since the "qualifiedName" has a
+
+ prefix and the namespaceURI is null.
+
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function elementsetattributensurinull() {
+ var success;
+ if(checkInitialization(builder, "elementsetattributensurinull") != null) return;
+ var namespaceURI = null;
+
+ var qualifiedName = "emp:qualifiedName";
+ var doc;
+ var elementList;
+ var testAddr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employee");
+ testAddr = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributensurinull</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS01.html
new file mode 100644
index 0000000000..1e19275fa1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS01.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getAttributeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getAttributeNS01';
+
+
+/**
+*
+ The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ attribute value by local name and NamespaceURI.
+
+ Retrieve the first "emp:address" element.
+ The value returned by the "getAttributeNS()" method should be the
+ value "DISTRICT" since the attribute has a default value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238
+*/
+function getAttributeNS01() {
+ var success;
+ if(checkInitialization(builder, "getAttributeNS01") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var localName = "district";
+ var qualifiedName = "emp:district";
+ var doc;
+ var elementList;
+ var testAddr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ attrValue = testAddr.getAttributeNS(namespaceURI,localName);
+ assertEquals("attrValue","DISTRICT",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS02.html
new file mode 100644
index 0000000000..b55b6e4dc1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS02.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getAttributeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getAttributeNS02';
+
+
+/**
+*
+ The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ attribute value by local name and NamespaceURI.
+
+ Retrieve the first "emp:address" element.
+ Create a new attribute with the "createAttributeNS()" method.
+ Add the new attribute with the "setAttributeNS()" method.
+ The value returned by the "getAttributeNS()" method should be the
+ empty string since the attribute does not have a default value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS
+*/
+function getAttributeNS02() {
+ var success;
+ if(checkInitialization(builder, "getAttributeNS02") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var localName = "district";
+ var qualifiedName = "emp:district";
+ var doc;
+ var newAttribute;
+ var elementList;
+ var testAddr;
+ var districtAttr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ newAttribute = doc.createAttributeNS(namespaceURI,qualifiedName);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+districtAttr = testAddr.setAttributeNodeNS(newAttribute);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ attrValue = testAddr.getAttributeNS(namespaceURI,localName);
+ assertEquals("throw_Equals","",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS03.html
new file mode 100644
index 0000000000..20e1196525
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS03.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getAttributeNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getAttributeNS03';
+
+
+/**
+*
+ The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ attribute value by local name and NamespaceURI.
+
+ Retrieve the first "emp:address" element.
+ The value returned by the "getAttributeNS()" method for the emp:domestic attribute
+ should be the empty string since the attribute does not have a specified value
+ because it was removed by the "removeAttributeNS()" method.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS
+*/
+function getAttributeNS03() {
+ var success;
+ if(checkInitialization(builder, "getAttributeNS03") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var localName = "domestic";
+ var doc;
+ var elementList;
+ var testAddr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+testAddr.removeAttributeNS(namespaceURI,localName);
+ attrValue = testAddr.getAttributeNS(namespaceURI,localName);
+ assertEquals("throw_Equals",null,attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS04.html
new file mode 100644
index 0000000000..5e57fef798
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS04.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getAttributeNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getAttributeNS04';
+
+
+/**
+*
+ The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ attribute value by local name and NamespaceURI.
+
+ Retrieve the first "emp:address" element.
+ Create a new attribute with the "createAttributeNS()" method.
+ Add the new attribute and value with the "setAttributeNS()" method.
+ The value returned by the "getAttributeNS()" method should be
+ the string "NewValue" since the attribute had a specified value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS
+*/
+function getAttributeNS04() {
+ var success;
+ if(checkInitialization(builder, "getAttributeNS04") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var localName = "blank";
+ var qualifiedName = "emp:blank";
+ var doc;
+ var newAttribute;
+ var elementList;
+ var testAddr;
+ var districtAttr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ newAttribute = doc.createAttributeNS(namespaceURI,qualifiedName);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+testAddr.setAttributeNS(namespaceURI,qualifiedName,"NewValue");
+ attrValue = testAddr.getAttributeNS(namespaceURI,localName);
+ assertEquals("throw_Equals","NewValue",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS05.html
new file mode 100644
index 0000000000..8605585b39
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS05.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getAttributeNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getAttributeNS05';
+
+
+/**
+*
+ The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ attribute value by local name and NamespaceURI.
+
+ Retrieve the first emp:address element node
+ and retrieve the emp:domestic attribute. The method returns an
+ Attr value as a string, the "value" can be examined to ensure the
+ proper attribute value was retrieved.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS
+*/
+function getAttributeNS05() {
+ var success;
+ if(checkInitialization(builder, "getAttributeNS05") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var attrValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+attrValue = testAddr.getAttributeNS("http://www.nist.gov","domestic");
+ assertEquals("attrValue","Yes",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS01.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS01.html
new file mode 100644
index 0000000000..59b2aed7d8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS01.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNodeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getAttributeNodeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getAttributeNodeNS01';
+
+
+/**
+*
+ The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an
+ attribute node by local name and NamespaceURI.
+
+ Retrieve the first emp:address element node.
+ The getAttributeNodeNS method returns an
+ Attr node, the "value" can be examined to ensure the
+ proper attribute node was retrieved. This attribute
+ value should be null since there is no such attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS
+*/
+function getAttributeNodeNS01() {
+ var success;
+ if(checkInitialization(builder, "getAttributeNodeNS01") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var localName = "invalidlocalname";
+ var doc;
+ var elementList;
+ var testAddr;
+ var attribute;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+attribute = testAddr.getAttributeNodeNS(namespaceURI,localName);
+ assertNull("throw_Null",attribute);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNodeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS02.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS02.html
new file mode 100644
index 0000000000..b55a8f97bd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS02.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNodeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getAttributeNodeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getAttributeNodeNS02';
+
+
+/**
+*
+ The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an
+ attribute node by local name and NamespaceURI.
+
+ Retrieve the first emp:address element node.
+ The getAttributeNodeNS method returns an
+ Attr node, the "value" can be examined to ensure the
+ proper attribute node was retrieved.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095
+*/
+function getAttributeNodeNS02() {
+ var success;
+ if(checkInitialization(builder, "getAttributeNodeNS02") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var attribute;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+attribute = testAddr.getAttributeNodeNS("http://www.nist.gov","domestic");
+ attrName = attribute.nodeName;
+
+ assertEquals("attrName","emp:domestic",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNodeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementById01.html b/dom/tests/mochitest/dom-level2-core/test_getElementById01.html
new file mode 100644
index 0000000000..8282eba33d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementById01.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementById01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementById01';
+
+
+/**
+*
+ The "getElementById(elementId)" method for a
+ Document should return an element whose ID matches elementId.
+
+ Invoke method getElementById(elementId) on this document
+ with elementId equals "CANADA". Method should return an element
+ whose tag name is "emp:address".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=383
+*/
+function getElementById01() {
+ var success;
+ if(checkInitialization(builder, "getElementById01") != null) return;
+ var doc;
+ var element;
+ var tagname;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.getElementById("CANADA");
+ tagname = element.tagName;
+
+ assertEquals("throw_Equals","emp:address",tagname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementById02.html b/dom/tests/mochitest/dom-level2-core/test_getElementById02.html
new file mode 100644
index 0000000000..2e145880db
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementById02.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementById02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementById02';
+
+
+/**
+*
+
+ The "getElementById(elementId)" method for a
+ Document should return null if elementId does not identify any
+ elements in this document.
+
+ Invoke method getElementById(elementId) on this document
+ with elementId equals "Cancun". Method should return null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId
+*/
+function getElementById02() {
+ var success;
+ if(checkInitialization(builder, "getElementById02") != null) return;
+ var doc;
+ var element;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.getElementById("Cancun");
+ assertNull("throw_Null",element);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS01.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS01.html
new file mode 100644
index 0000000000..f83e13382c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS01.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS01';
+
+
+/**
+*
+ Invoke method getElementsByTagNameNS(namespaceURI,localName) on this document
+ with namespaceURI and localName as "*" and check size of returned node list.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function getElementsByTagNameNS01() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS01") != null) return;
+ var namespaceURI = "*";
+ var localName = "*";
+ var doc;
+ var newList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ newList = doc.getElementsByTagNameNS(namespaceURI,localName);
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertSize("listLength_svg",39,newList);
+
+ }
+
+ else {
+ assertSize("listLength",37,newList);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS02.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS02.html
new file mode 100644
index 0000000000..d2705a41ee
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS02.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS02';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method for a
+ Document should return a new NodeList of all Elements with a given
+ localName and namespaceURI in the order they were encountered in a preorder
+ traversal of the document tree.
+
+ Invoke method getElementsByTagNameNS(namespaceURI,localName) on this document
+ with namespaceURI being " " and localName is "employee".
+ Method should return a new NodeList containing five Elements.
+ Retrieve the FOURTH element whose name should be "emp:employee".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function getElementsByTagNameNS02() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS02") != null) return;
+ var doc;
+ var newList;
+ var newElement;
+ var prefix;
+ var lname;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ newList = doc.getElementsByTagNameNS("*","employee");
+ assertSize("employeeCount",5,newList);
+newElement = newList.item(3);
+ prefix = newElement.prefix;
+
+ assertEquals("prefix","emp",prefix);
+ lname = newElement.localName;
+
+ assertEquals("lname","employee",lname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS03.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS03.html
new file mode 100644
index 0000000000..de73f9e63c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS03.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS03';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the "http://www.nist.gov" as the namespaceURI and the special value " " as the
+ localName.
+ The method should return a NodeList of elements that have "http://www.nist.gov
+ as a namespace URI.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function getElementsByTagNameNS03() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS03") != null) return;
+ var doc;
+ var elementList;
+ var child;
+ var childName;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "employee";
+ expectedResult[1] = "employeeId";
+ expectedResult[2] = "name";
+ expectedResult[3] = "position";
+ expectedResult[4] = "salary";
+ expectedResult[5] = "gender";
+ expectedResult[6] = "address";
+ expectedResult[7] = "emp:employee";
+ expectedResult[8] = "emp:employeeId";
+ expectedResult[9] = "emp:position";
+ expectedResult[10] = "emp:salary";
+ expectedResult[11] = "emp:gender";
+ expectedResult[12] = "emp:address";
+ expectedResult[13] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","*");
+ for(var indexN65654 = 0;indexN65654 < elementList.length; indexN65654++) {
+ child = elementList.item(indexN65654);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+ assertEqualsList("nodeNames",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS04.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS04.html
new file mode 100644
index 0000000000..8629f09dd5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS04';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the special value " " as the namespaceURI and "address" as the
+ localName.
+ The method should return a NodeList of Elements that have
+ "address" as the local name.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function getElementsByTagNameNS04() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS04") != null) return;
+ var doc;
+ var elementList;
+ var child;
+ var childName;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "address";
+ expectedResult[1] = "address";
+ expectedResult[2] = "address";
+ expectedResult[3] = "emp:address";
+ expectedResult[4] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ for(var indexN65625 = 0;indexN65625 < elementList.length; indexN65625++) {
+ child = elementList.item(indexN65625);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+ assertEqualsList("nodeNames",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS05.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS05.html
new file mode 100644
index 0000000000..70f4d79e09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS05.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS05';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the "http://www.nist.gov" as the namespaceURI and "nomatch" as the
+ localName.
+ The method should return a NodeList whose length is
+ "0".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function getElementsByTagNameNS05() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS05") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var localName = "nomatch";
+ var doc;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS(namespaceURI,localName);
+ assertSize("throw_Size",0,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS06.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS06.html
new file mode 100644
index 0000000000..31c28fec9b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS06.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS06';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the "http://www.nomatch.com" as the namespaceURI and "address" as the
+ localName.
+ The method should return a NodeList whose length is
+ "0".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function getElementsByTagNameNS06() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS06") != null) return;
+ var doc;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nomatch.com","address");
+ assertSize("matchSize",0,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS07.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS07.html
new file mode 100644
index 0000000000..1213a57f1a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS07.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS07';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the string "http://www.nist.gov" as the namespaceURI and "address" as the
+ localName.
+ The method should return a NodeList whose length is
+ "3".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS
+*/
+function getElementsByTagNameNS07() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS07") != null) return;
+ var doc;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ assertSize("addresses",3,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS08.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS08.html
new file mode 100644
index 0000000000..a6d17fc92f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS08.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS08</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS08';
+
+
+/**
+*
+ Element.getElementsByTagNameNS('*','*') should return all child
+ elements. There is some contention on whether this should match
+ unqualified elements, this test reflects the interpretation that
+ '*' should match elements in all namespaces and unqualified elements.
+
+ Derived from getElementsByTagNameNS01 which tests similar functionality
+ on the Document interface.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D
+*/
+function getElementsByTagNameNS08() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS08") != null) return;
+ var doc;
+ var docElem;
+ var newList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ newList = docElem.getElementsByTagNameNS("*","*");
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertSize("listSize_svg",38,newList);
+
+ }
+
+ else {
+ assertSize("listSize",36,newList);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS09.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS09.html
new file mode 100644
index 0000000000..a0627b4b07
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS09</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS09';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method for a
+ Element should return a new NodeList of all descendant Elements with a given
+ localName and namespaceURI in the order they were encountered in a preorder
+ traversal of the document tree.
+
+ Invoke method getElementsByTagNameNS(namespaceURI,localName) on the document
+ element with namespaceURI being "*" and localName is "employee".
+ Method should return a new NodeList containing five Elements.
+ Retrieve the FOURTH element whose name should be "emp:employee".
+
+ Derived from getElementsByTagNameNS02 and reflects its interpretation
+ that namespace="*" matches namespace unqualified tagnames.
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D
+*/
+function getElementsByTagNameNS09() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS09") != null) return;
+ var doc;
+ var newList;
+ var newElement;
+ var prefix;
+ var lname;
+ var docElem;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ newList = docElem.getElementsByTagNameNS("*","employee");
+ assertSize("employeeCount",5,newList);
+newElement = newList.item(3);
+ prefix = newElement.prefix;
+
+ assertEquals("prefix","emp",prefix);
+ lname = newElement.localName;
+
+ assertEquals("lname","employee",lname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS09</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS10.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS10.html
new file mode 100644
index 0000000000..0da0362f93
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS10.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS10</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS10';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements of the document element
+ using the "http://www.nist.gov" as the namespaceURI and the special value "*" as the
+ localName.
+ The method should return a NodeList of elements that have "http://www.nist.gov
+ as a namespace URI.
+
+ Derived from getElementsByTagNameNS03
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D
+*/
+function getElementsByTagNameNS10() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS10") != null) return;
+ var doc;
+ var docElem;
+ var elementList;
+ var child;
+ var childName;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "employee";
+ expectedResult[1] = "employeeId";
+ expectedResult[2] = "name";
+ expectedResult[3] = "position";
+ expectedResult[4] = "salary";
+ expectedResult[5] = "gender";
+ expectedResult[6] = "address";
+ expectedResult[7] = "emp:employee";
+ expectedResult[8] = "emp:employeeId";
+ expectedResult[9] = "emp:position";
+ expectedResult[10] = "emp:salary";
+ expectedResult[11] = "emp:gender";
+ expectedResult[12] = "emp:address";
+ expectedResult[13] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","*");
+ for(var indexN65662 = 0;indexN65662 < elementList.length; indexN65662++) {
+ child = elementList.item(indexN65662);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+ assertEqualsList("nodeNames",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS10</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS11.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS11.html
new file mode 100644
index 0000000000..0d1ac477b2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS11.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS11</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS11';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the special value "*" as the namespaceURI and "address" as the
+ localName.
+ The method should return a NodeList of Elements that have
+ "address" as the local name.
+
+ This test is derived from getElementsByTagNameNS04
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D
+*/
+function getElementsByTagNameNS11() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS11") != null) return;
+ var doc;
+ var docElem;
+ var elementList;
+ var child;
+ var childName;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "address";
+ expectedResult[1] = "address";
+ expectedResult[2] = "address";
+ expectedResult[3] = "emp:address";
+ expectedResult[4] = "address";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ elementList = docElem.getElementsByTagNameNS("*","address");
+ for(var indexN65630 = 0;indexN65630 < elementList.length; indexN65630++) {
+ child = elementList.item(indexN65630);
+ childName = child.nodeName;
+
+ result[result.length] = childName;
+
+ }
+ assertEqualsList("nodeNames",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS11</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS12.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS12.html
new file mode 100644
index 0000000000..38b000d502
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS12.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS12</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS12';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the "http://www.nist.gov" as the namespaceURI and "nomatch" as the
+ localName.
+ The method should return a NodeList whose length is "0".
+
+ This test is a modification of getElementsByTagName05
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D
+*/
+function getElementsByTagNameNS12() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS12") != null) return;
+ var doc;
+ var docElem;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","nomatch");
+ assertSize("size",0,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS12</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS13.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS13.html
new file mode 100644
index 0000000000..68c1b1b6c6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS13.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS13</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS13';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the "http://www.nomatch.com" as the namespaceURI and "address" as the
+ localName.
+ The method should return a NodeList whose length is
+ "0".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D
+*/
+function getElementsByTagNameNS13() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS13") != null) return;
+ var doc;
+ var docElem;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ elementList = docElem.getElementsByTagNameNS("http://www.nomatch.com","address");
+ assertSize("matchSize",0,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS13</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS14.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS14.html
new file mode 100644
index 0000000000..ddad169e86
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS14.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS14</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getElementsByTagNameNS14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getElementsByTagNameNS14';
+
+
+/**
+*
+ The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList
+ of all descendant Elements with a given local name and namespace URI in the
+ order in which they are encountered in a preorder traversal of this Element tree.
+
+ Create a NodeList of all the descendant elements
+ using the string "http://www.nist.gov" as the namespaceURI and "address" as the
+ localName.
+ The method should return a NodeList whose length is
+ "3".
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D
+*/
+function getElementsByTagNameNS14() {
+ var success;
+ if(checkInitialization(builder, "getElementsByTagNameNS14") != null) return;
+ var doc;
+ var docElem;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docElem = doc.documentElement;
+
+ elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","address");
+ assertSize("addresses",3,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS14</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS01.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS01.html
new file mode 100644
index 0000000000..95eaeb9487
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS01.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getNamedItemNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getNamedItemNS01';
+
+
+/**
+*
+ The "getNamedItemNS(namespaceURI,localName)" method for a
+ NamedNodeMap should return a node specified by localName and namespaceURI
+
+ Retrieve a list of elements with tag name "address".
+ Access the second element from the list and get its attributes.
+ Try to retrieve the attribute node with local name "domestic"
+ and namespace uri "http://www.usa.com" with
+ method getNamedItemNS(namespaceURI,localName).
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095
+*/
+function getNamedItemNS01() {
+ var success;
+ if(checkInitialization(builder, "getNamedItemNS01") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var domesticAttr;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ domesticAttr = attributes.getNamedItemNS("http://www.usa.com","domestic");
+ attrName = domesticAttr.nodeName;
+
+ assertEquals("attrName","dmstc:domestic",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS02.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS02.html
new file mode 100644
index 0000000000..363f5eda30
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS02.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getNamedItemNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getNamedItemNS02';
+
+
+/**
+*
+ The "getNamedItemNS(namespaceURI,localName)" method for a
+ NamedNodeMap should return null
+ if parameters do not identify any node in this map.
+
+ Retrieve a list of elements with tag name "address".
+ Access the second element from the list and get its attributes.
+ Try to retrieve an attribute node with local name "domest"
+ and namespace uri "http://www.usa.com" with
+ method getNamedItemNS(namespaceURI,localName).
+ This should return null because "domest" does not match any local names in this map.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+*/
+function getNamedItemNS02() {
+ var success;
+ if(checkInitialization(builder, "getNamedItemNS02") != null) return;
+ var namespaceURI = "http://www.usa.com";
+ var localName = "domest";
+ var doc;
+ var elementList;
+ var testEmployee;
+ var attributes;
+ var newAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testEmployee = elementList.item(1);
+ attributes = testEmployee.attributes;
+
+ newAttr = attributes.getNamedItemNS(namespaceURI,localName);
+ assertNull("throw_Null",newAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS03.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS03.html
new file mode 100644
index 0000000000..e10a61e047
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS03.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getNamedItemNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getNamedItemNS03';
+
+
+/**
+*
+Entity nodes are not namespaced and should not be retrievable using
+getNamedItemNS.
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function getNamedItemNS03() {
+ var success;
+ if(checkInitialization(builder, "getNamedItemNS03") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var entity;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+entity = entities.getNamedItemNS(nullNS,"ent1");
+ assertNull("entityNull",entity);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS04.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS04.html
new file mode 100644
index 0000000000..6e73498873
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS04.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['getNamedItemNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'getNamedItemNS04';
+
+
+/**
+*
+Notation nodes are not namespaced and should not be retrievable using
+getNamedItemNS.
+
+* @author Curt Arnold
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function getNamedItemNS04() {
+ var success;
+ if(checkInitialization(builder, "getNamedItemNS04") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var notation;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notation = notations.getNamedItemNS(nullNS,"notation1");
+ assertNull("notationNull",notation);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute01.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute01.html
new file mode 100644
index 0000000000..a6b29858d6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute01.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttribute01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttribute01';
+
+
+/**
+*
+ The "hasAttribute()" method for an Element should
+ return true if the element has an attribute with the given name.
+
+ Retrieve the first "address" element and the "hasAttribute()" method
+ should return false since the element does not have a default value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr
+*/
+function hasAttribute01() {
+ var success;
+ if(checkInitialization(builder, "hasAttribute01") != null) return;
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(4);
+ state = testNode.hasAttribute("domestic");
+ assertFalse("throw_False",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute02.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute02.html
new file mode 100644
index 0000000000..bd4b87c9a1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute02.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttribute02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttribute02';
+
+
+/**
+*
+ The "hasAttribute()" method for an Element should
+ return true if the element has an attribute with the given name.
+
+ Retrieve the first "address" element and the "hasAttribute()" method
+ should return true since the attribute "street" has a default value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238
+*/
+function hasAttribute02() {
+ var success;
+ if(checkInitialization(builder, "hasAttribute02") != null) return;
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(0);
+ state = testNode.hasAttribute("street");
+ assertTrue("throw_True",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute03.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute03.html
new file mode 100644
index 0000000000..fd09860de2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute03.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttribute03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttribute03';
+
+
+/**
+*
+ The "hasAttribute()" method for an Element should
+ return false if the element does not have an attribute with the given name.
+
+ Retrieve the first "address" element and the "hasAttribute()" method
+ should return false since the element does not have "nomatch" as an attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr
+*/
+function hasAttribute03() {
+ var success;
+ if(checkInitialization(builder, "hasAttribute03") != null) return;
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(0);
+ state = testNode.hasAttribute("nomatch");
+ assertFalse("throw_False",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute04.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute04.html
new file mode 100644
index 0000000000..6213e84309
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute04.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttribute04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttribute04';
+
+
+/**
+*
+ The "hasAttribute()" method for an Element should
+ return true if the element has an attribute with the given name.
+
+ Retrieve the first "address" element and the "hasAttribute()" method
+ should return true since the element has "domestic" as an attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238
+*/
+function hasAttribute04() {
+ var success;
+ if(checkInitialization(builder, "hasAttribute04") != null) return;
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(0);
+ state = testNode.hasAttribute("dmstc:domestic");
+ assertTrue("hasDomesticAttr",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS01.html
new file mode 100644
index 0000000000..182b102a25
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS01.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttributeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttributeNS01';
+
+
+/**
+*
+
+ The "hasAttributeNS()" method for an Element should
+ return false if the element does not have an attribute with the given local name
+ and/or a namespace URI specified on this element or does not have a default value.
+
+ Retrieve the first "address" element and the "hasAttributeNS()" method
+ should return false since the element has "nomatch" as the local name
+ and "http://www.usa.com" as the namespace URI.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+*/
+function hasAttributeNS01() {
+ var success;
+ if(checkInitialization(builder, "hasAttributeNS01") != null) return;
+ var localName = "nomatch";
+ var namespaceURI = "http://www.usa.com";
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(0);
+ state = testNode.hasAttributeNS(namespaceURI,localName);
+ assertFalse("throw_False",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS02.html
new file mode 100644
index 0000000000..e3222ca86a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS02.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttributeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttributeNS02';
+
+
+/**
+*
+ The "hasAttributeNS()" method for an Element should
+ return false if the element does not have an attribute with the given local name
+ and/or namespace URI specified on this element or does not have a default value.
+
+ Retrieve the first "address" element and the "hasAttributeNS()" method
+ should return false since the element has "domestic" as the local name
+ and "http://www.nomatch.com" as the namespace URI.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+*/
+function hasAttributeNS02() {
+ var success;
+ if(checkInitialization(builder, "hasAttributeNS02") != null) return;
+ var localName = "domestic";
+ var namespaceURI = "http://www.nomatch.com";
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(0);
+ state = testNode.hasAttributeNS(namespaceURI,localName);
+ assertFalse("throw_False",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS03.html
new file mode 100644
index 0000000000..45bebc2c61
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS03.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttributeNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttributeNS03';
+
+
+/**
+*
+ The "hasAttributeNS()" method for an Element should
+ return false if the element does not have an attribute with the given local name
+ and/or namespace URI specified on this element or does not have a default value.
+
+ Retrieve the first "emp:address" element.
+ The boolean value returned by the "hasAttributeNS()" should be false
+ since the attribute does not have a default value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+*/
+function hasAttributeNS03() {
+ var success;
+ if(checkInitialization(builder, "hasAttributeNS03") != null) return;
+ var localName = "blank";
+ var namespaceURI = "http://www.nist.gov";
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testNode = elementList.item(0);
+ assertNotNull("empAddrNotNull",testNode);
+state = testNode.hasAttributeNS(namespaceURI,localName);
+ assertFalse("throw_False",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS04.html
new file mode 100644
index 0000000000..a811705656
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS04.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttributeNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttributeNS04';
+
+
+/**
+*
+ The "hasAttributeNS()" method for an Element should
+ return true if the attribute with the given local name
+ and namespace URI has a default value.
+
+ Retrieve the first "emp:address" element.
+ The boolean value returned by the "hasAttributeNS()" should be true
+ since the attribute has a default value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+*/
+function hasAttributeNS04() {
+ var success;
+ if(checkInitialization(builder, "hasAttributeNS04") != null) return;
+ var localName = "district";
+ var namespaceURI = "http://www.nist.gov";
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testNode = elementList.item(0);
+ assertNotNull("empAddressNotNull",testNode);
+state = testNode.hasAttributeNS(namespaceURI,localName);
+ assertTrue("hasAttribute",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS05.html
new file mode 100644
index 0000000000..1312958f87
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS05.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttributeNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttributeNS05';
+
+
+/**
+*
+ The "hasAttributeNS()" method for an Element should
+ return true if the element has an attribute with the given local name
+ and the namespace URI is specified on this element or has a default value.
+
+ Retrieve the first "address" element and the "hasAttributeNS()" method
+ should return true since the element has "domestic" as the local name
+ and "http://www.usa.com" as the namespace URI.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS
+*/
+function hasAttributeNS05() {
+ var success;
+ if(checkInitialization(builder, "hasAttributeNS05") != null) return;
+ var localName = "domestic";
+ var namespaceURI = "http://www.usa.com";
+ var doc;
+ var elementList;
+ var testNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testNode = elementList.item(0);
+ state = testNode.hasAttributeNS(namespaceURI,localName);
+ assertTrue("hasAttribute",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributes01.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributes01.html
new file mode 100644
index 0000000000..dce45f6536
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributes01.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttributes01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttributes01';
+
+
+/**
+*
+ The "hasAttributes()" method for a node should
+ return false if the node does not have an attribute.
+
+ Retrieve the first "name" node and invoke the "hasAttributes()" method.
+ The method should return false since the node does not have an attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function hasAttributes01() {
+ var success;
+ if(checkInitialization(builder, "hasAttributes01") != null) return;
+ var doc;
+ var addrList;
+ var addrNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addrList = doc.getElementsByTagName("name");
+ addrNode = addrList.item(0);
+ state = addrNode.hasAttributes();
+ assertFalse("throw_False",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributes02.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributes02.html
new file mode 100644
index 0000000000..b560093d0b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributes02.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasAttributes02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hasAttributes02';
+
+
+/**
+*
+ The "hasAttributes()" method for a node should
+ return true if the node has attributes.
+
+ Retrieve the first address node and the "hasAttributes()" method
+ should return true since the node has "domestic" as an attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function hasAttributes02() {
+ var success;
+ if(checkInitialization(builder, "hasAttributes02") != null) return;
+ var doc;
+ var addrList;
+ var addrNode;
+ var state;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addrList = doc.getElementsByTagName("address");
+ addrNode = addrList.item(0);
+ state = addrNode.hasAttributes();
+ assertTrue("throw_True",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hc_namednodemapinvalidtype1.html b/dom/tests/mochitest/dom-level2-core/test_hc_namednodemapinvalidtype1.html
new file mode 100644
index 0000000000..264368712a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hc_namednodemapinvalidtype1.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_namednodemapinvalidtype1</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_namednodemapinvalidtype1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_namednodemapinvalidtype1';
+
+
+/**
+*
+Attempt to insert an element into an attribute list,
+should raise a HIERARCHY_REQUEST_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
+* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-4
+*/
+function hc_namednodemapinvalidtype1() {
+ var success;
+ if(checkInitialization(builder, "hc_namednodemapinvalidtype1") != null) return;
+ var doc;
+ var attributes;
+ var docElem;
+ var newElem;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docElem = doc.documentElement;
+
+ attributes = docElem.attributes;
+
+ newElem = doc.createElement("html");
+
+ {
+ success = false;
+ try {
+ retval = attributes.setNamedItem(newElem);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_namednodemapinvalidtype1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize1.html b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize1.html
new file mode 100644
index 0000000000..555523609f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize1.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize1</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentfragmentnormalize1'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentfragmentnormalize1';
+
+
+/**
+*
+Create a document fragment with two adjacent text nodes, normalize and see if the text nodes
+were combined.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-B63ED1A3
+*/
+function hc_nodedocumentfragmentnormalize1() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentfragmentnormalize1") != null) return;
+ var doc;
+ var docFragment;
+ var nodeValue;
+ var txtNode;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docFragment = doc.createDocumentFragment();
+ txtNode = doc.createTextNode("foo");
+ retval = docFragment.appendChild(txtNode);
+ txtNode = doc.createTextNode("bar");
+ retval = docFragment.appendChild(txtNode);
+ docFragment.normalize();
+ txtNode = docFragment.firstChild;
+
+ nodeValue = txtNode.nodeValue;
+
+ assertEquals("normalizedNodeValue","foobar",nodeValue);
+ retval = txtNode.nextSibling;
+
+ assertNull("singleChild",retval);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize1</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize2.html b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize2.html
new file mode 100644
index 0000000000..360be4a2d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize2.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize2</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hc_nodedocumentfragmentnormalize2'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'hc_nodedocumentfragmentnormalize2';
+
+
+/**
+*
+Create a document fragment with an empty text node, after normalization there should be no child nodes.
+were combined.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-B63ED1A3
+*/
+function hc_nodedocumentfragmentnormalize2() {
+ var success;
+ if(checkInitialization(builder, "hc_nodedocumentfragmentnormalize2") != null) return;
+ var doc;
+ var docFragment;
+ var nodeValue;
+ var txtNode;
+ var retval;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ docFragment = doc.createDocumentFragment();
+ txtNode = doc.createTextNode("");
+ retval = docFragment.appendChild(txtNode);
+ docFragment.normalize();
+ txtNode = docFragment.firstChild;
+
+ assertNull("noChild",txtNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize2</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode01.html b/dom/tests/mochitest/dom-level2-core/test_importNode01.html
new file mode 100644
index 0000000000..182f246f1c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode01.html
@@ -0,0 +1,181 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode01';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Attr.
+ The ownerElement is set to null. Specified flag is set to true.
+ Children is imported.
+
+ Create a new attribute whose name is "elem:attr1" in a different document.
+ Create a child Text node with value "importedText" for the attribute node above.
+ Invoke method importNode(importedNode,deep) on this document with
+ importedNode being the newly created attribute.
+ Method should return a node whose name matches "elem:attr1" and a child node
+ whose value equals "importedText".
+ The returned node should belong to this document whose systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode01() {
+ var success;
+ if(checkInitialization(builder, "importNode01") != null) return;
+ var doc;
+ var aNewDoc;
+ var newAttr;
+ var importedChild;
+ var aNode;
+ var ownerDocument;
+ var attrOwnerElement;
+ var docType;
+ var system;
+ var specified;
+ var childList;
+ var nodeName;
+ var child;
+ var childValue;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = "elem:attr1";
+ expectedResult[1] = "importedText";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ newAttr = aNewDoc.createAttribute("elem:attr1");
+ importedChild = aNewDoc.createTextNode("importedText");
+ aNode = newAttr.appendChild(importedChild);
+ aNode = doc.importNode(newAttr,false);
+ ownerDocument = aNode.ownerDocument;
+
+ docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertNotNull("aNode",aNode);
+assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+attrOwnerElement = aNode.ownerElement;
+
+ assertNull("ownerElement",attrOwnerElement);
+ specified = aNode.specified;
+
+ assertTrue("specified",specified);
+childList = aNode.childNodes;
+
+ assertSize("childList",1,childList);
+nodeName = aNode.nodeName;
+
+ assertEquals("nodeName","elem:attr1",nodeName);
+ child = aNode.firstChild;
+
+ childValue = child.nodeValue;
+
+ assertEquals("childValue","importedText",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode02.html b/dom/tests/mochitest/dom-level2-core/test_importNode02.html
new file mode 100644
index 0000000000..a2b4d0db3f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode02.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode02';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type CData_Section.
+
+ Create a CDATASection node with value being the string "this is CDATASection data" in
+ a different document. Invoke method importNode(importedNode,deep) on
+ this document. Method should return a CDATASection node whose value matches
+ the above string. The returned node should belong to this document whose systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode02() {
+ var success;
+ if(checkInitialization(builder, "importNode02") != null) return;
+ var doc;
+ var aNewDoc;
+ var cDataSec;
+ var aNode;
+ var ownerDocument;
+ var docType;
+ var system;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ cDataSec = aNewDoc.createCDATASection("this is CDATASection data");
+ aNode = doc.importNode(cDataSec,false);
+ ownerDocument = aNode.ownerDocument;
+
+ assertNotNull("ownerDocumentNotNull",ownerDocument);
+docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("dtdSystemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+value = aNode.nodeValue;
+
+ assertEquals("nodeValue","this is CDATASection data",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode03.html b/dom/tests/mochitest/dom-level2-core/test_importNode03.html
new file mode 100644
index 0000000000..3940825641
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode03.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode03';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Comment.
+
+ Create a comment node with value being the string "this is a comment" in
+ a different document. Invoke method importNode(importedNode,deep) on
+ this document. Method should return a comment node whose value matches
+ the above string. The returned node should belong to this document whose
+ systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode03() {
+ var success;
+ if(checkInitialization(builder, "importNode03") != null) return;
+ var doc;
+ var aNewDoc;
+ var comment;
+ var aNode;
+ var ownerDocument;
+ var docType;
+ var system;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ comment = aNewDoc.createComment("this is a comment");
+ aNode = doc.importNode(comment,false);
+ ownerDocument = aNode.ownerDocument;
+
+ assertNotNull("ownerDocumentNotNull",ownerDocument);
+docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+value = aNode.nodeValue;
+
+ assertEquals("nodeValue","this is a comment",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode04.html b/dom/tests/mochitest/dom-level2-core/test_importNode04.html
new file mode 100644
index 0000000000..6cb677d903
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode04.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode04';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Document_Fragment.
+
+ Create a DocumentFragment in a different document.
+ Create a Comment child node for the Document Fragment.
+ Invoke method importNode(importedNode,deep) on this document
+ with importedNode being the newly created DocumentFragment.
+ Method should return a node of type DocumentFragment whose child has
+ comment value "descendant1".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode04() {
+ var success;
+ if(checkInitialization(builder, "importNode04") != null) return;
+ var doc;
+ var aNewDoc;
+ var docFrag;
+ var comment;
+ var aNode;
+ var children;
+ var child;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staff");
+ docFrag = aNewDoc.createDocumentFragment();
+ comment = aNewDoc.createComment("descendant1");
+ aNode = docFrag.appendChild(comment);
+ aNode = doc.importNode(docFrag,true);
+ children = aNode.childNodes;
+
+ assertSize("throw_Size",1,children);
+child = aNode.firstChild;
+
+ childValue = child.nodeValue;
+
+ assertEquals("descendant1","descendant1",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode05.html b/dom/tests/mochitest/dom-level2-core/test_importNode05.html
new file mode 100644
index 0000000000..b03589cd17
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode05.html
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode05';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Element.
+
+ Retrieve element "emp:address" from staffNS.xml document.
+ Invoke method importNode(importedNode,deep) on this document
+ with importedNode being the element from above and deep is false.
+ Method should return an element node whose name matches "emp:address"
+ and whose children are not imported. The returned node should
+ belong to this document whose systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode05() {
+ var success;
+ if(checkInitialization(builder, "importNode05") != null) return;
+ var doc;
+ var aNewDoc;
+ var element;
+ var aNode;
+ var hasChild;
+ var ownerDocument;
+ var docType;
+ var system;
+ var name;
+ var addresses;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ addresses = aNewDoc.getElementsByTagName("emp:address");
+ element = addresses.item(0);
+ assertNotNull("empAddressNotNull",element);
+aNode = doc.importNode(element,false);
+ hasChild = aNode.hasChildNodes();
+ assertFalse("hasChild",hasChild);
+ownerDocument = aNode.ownerDocument;
+
+ docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("dtdSystemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+name = aNode.nodeName;
+
+ assertEquals("nodeName","emp:address",name);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode06.html b/dom/tests/mochitest/dom-level2-core/test_importNode06.html
new file mode 100644
index 0000000000..cd6223b2bf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode06.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode06';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Element.
+
+ Retrieve element "emp:address" from staffNS.xml document.
+ Invoke method importNode(importedNode,deep) on this document
+ with importedNode being the element from above and deep is true.
+ Method should return an element node whose name matches "emp:address" and
+ whose descendant is imported.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode06() {
+ var success;
+ if(checkInitialization(builder, "importNode06") != null) return;
+ var doc;
+ var aNewDoc;
+ var element;
+ var aNode;
+ var hasChild;
+ var name;
+ var child;
+ var value;
+ var addresses;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ addresses = aNewDoc.getElementsByTagName("emp:address");
+ element = addresses.item(0);
+ assertNotNull("empAddressNotNull",element);
+aNode = doc.importNode(element,true);
+ hasChild = aNode.hasChildNodes();
+ assertTrue("throw_True",hasChild);
+name = aNode.nodeName;
+
+ assertEquals("nodeName","emp:address",name);
+ child = aNode.firstChild;
+
+ value = child.nodeValue;
+
+ assertEquals("nodeValue","27 South Road. Dallas, texas 98556",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode07.html b/dom/tests/mochitest/dom-level2-core/test_importNode07.html
new file mode 100644
index 0000000000..d514e6ff42
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode07.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode07';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Element.
+ If this document defines default attributes for this element name (importedNode),
+ those default attributes are assigned.
+
+ Create an element whose name is "emp:employee" in a different document.
+ Invoke method importNode(importedNode,deep) on this document which
+ defines default attribute for the element name "emp:employee".
+ Method should return an the imported element with an assigned default attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238
+*/
+function importNode07() {
+ var success;
+ if(checkInitialization(builder, "importNode07") != null) return;
+ var doc;
+ var aNewDoc;
+ var element;
+ var aNode;
+ var attributes;
+ var name;
+ var attr;
+ var lname;
+ var namespaceURI = "http://www.nist.gov";
+ var qualifiedName = "emp:employee";
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staff");
+ element = aNewDoc.createElementNS(namespaceURI,qualifiedName);
+ aNode = doc.importNode(element,false);
+ attributes = aNode.attributes;
+
+ assertSize("throw_Size",1,attributes);
+name = aNode.nodeName;
+
+ assertEquals("nodeName","emp:employee",name);
+ attr = attributes.item(0);
+ lname = attr.localName;
+
+ assertEquals("lname","defaultAttr",lname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode08.html b/dom/tests/mochitest/dom-level2-core/test_importNode08.html
new file mode 100644
index 0000000000..fdc9ca283b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode08.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode08</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode08';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Document_Fragment.
+
+ Create a DocumentFragment in a different document.
+ Invoke method importNode(importedNode,deep) on this document
+ with importedNode being the newly created DocumentFragment.
+ Method should return an empty DocumentFragment that belongs
+ to this document whose systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId
+*/
+function importNode08() {
+ var success;
+ if(checkInitialization(builder, "importNode08") != null) return;
+ var doc;
+ var aNewDoc;
+ var docFrag;
+ var aNode;
+ var hasChild;
+ var ownerDocument;
+ var docType;
+ var system;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ docFrag = aNewDoc.createDocumentFragment();
+ aNode = doc.importNode(docFrag,false);
+ hasChild = aNode.hasChildNodes();
+ assertFalse("hasChild",hasChild);
+ownerDocument = aNode.ownerDocument;
+
+ docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("system",null,null,null,"staffNS.dtd",null,null,null,null,system);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode09.html b/dom/tests/mochitest/dom-level2-core/test_importNode09.html
new file mode 100644
index 0000000000..739c4a2de5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode09.html
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode09</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode09';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Entity.
+
+ Retrieve entity "ent6" from staffNS.xml document.
+ Invoke method importNode(importedNode,deep) on this document.
+ Method should return a node of type Entity whose publicId, systemId and
+ notationName attributes are copied.
+ The returned node should belong to this document whose systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode09() {
+ var success;
+ if(checkInitialization(builder, "importNode09") != null) return;
+ var doc;
+ var aNewDoc;
+ var doc1Type;
+ var entityList;
+ var entity2;
+ var entity1;
+ var ownerDocument;
+ var docType;
+ var system;
+ var entityName;
+ var publicVal;
+ var notationName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ docType = aNewDoc.doctype;
+
+ entityList = docType.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+entity2 = entityList.getNamedItem("ent6");
+ entity1 = doc.importNode(entity2,false);
+ ownerDocument = entity1.ownerDocument;
+
+ docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("dtdSystemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+entityName = entity1.nodeName;
+
+ assertEquals("entityName","ent6",entityName);
+ publicVal = entity1.publicId;
+
+ assertEquals("entityPublicId","uri",publicVal);
+ system = entity1.systemId;
+
+ assertURIEquals("entitySystemId",null,null,null,"file",null,null,null,null,system);
+notationName = entity1.notationName;
+
+ assertEquals("notationName","notation2",notationName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode09</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode10.html b/dom/tests/mochitest/dom-level2-core/test_importNode10.html
new file mode 100644
index 0000000000..d209214e58
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode10.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode10</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode10';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Entity_Reference.
+ Only the EntityReference is copied, regardless of deep's value.
+
+ Create an entity reference whose name is "entRef1" in a different document.
+ Give it value "entRef1Value".
+ Invoke method importNode(importedNode,deep) on this document with importedNode
+ being "entRef1".
+ Method should return a node of type Entity_Reference (whose value is null) that
+ belongs to this document whose systemId is "staff.dtd".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode10() {
+ var success;
+ if(checkInitialization(builder, "importNode10") != null) return;
+ var doc;
+ var aNewDoc;
+ var entRef;
+ var aNode;
+ var ownerDocument;
+ var docType;
+ var system;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ entRef = aNewDoc.createEntityReference("entRef1");
+ assertNotNull("createdEntRefNotNull",entRef);
+entRef.nodeValue = "entRef1Value";
+
+ aNode = doc.importNode(entRef,false);
+ ownerDocument = aNode.ownerDocument;
+
+ docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+name = aNode.nodeName;
+
+ assertEquals("nodeName","entRef1",name);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode10</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode11.html b/dom/tests/mochitest/dom-level2-core/test_importNode11.html
new file mode 100644
index 0000000000..d1f4727ff0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode11.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode11</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staff");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode11';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Entity_Reference.
+ Only the EntityReference is copied, regardless of deep's value.
+ If the Document provides a definition for the entity name, its value is assigned.
+
+ Create an entity reference whose name is "ent3" in a different document.
+ Invoke method importNode(importedNode,deep) on this document with importedNode
+ being "ent3".
+ Method should return a node of type Entity_Reference whose first child's value is "Texas" as defined
+ in this document.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode11() {
+ var success;
+ if(checkInitialization(builder, "importNode11") != null) return;
+ var doc;
+ var aNewDoc;
+ var entRef;
+ var aNode;
+ var name;
+ var child;
+ var childValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staff");
+ entRef = aNewDoc.createEntityReference("ent3");
+ assertNotNull("createdEntRefNotNull",entRef);
+aNode = doc.importNode(entRef,true);
+ name = aNode.nodeName;
+
+ assertEquals("entityName","ent3",name);
+ child = aNode.firstChild;
+
+ assertNotNull("child",child);
+childValue = child.nodeValue;
+
+ assertEquals("childValue","Texas",childValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode11</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode12.html b/dom/tests/mochitest/dom-level2-core/test_importNode12.html
new file mode 100644
index 0000000000..797b1191a4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode12.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode12</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode12';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Entity.
+
+ Retrieve entity "ent4" from staffNS.xml document.
+ Invoke method importNode(importedNode,deep) on this document with deep as false.
+ Method should return a node of type Entity whose descendant is copied.
+ The returned node should belong to this document whose systemId is "staffNS.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode12() {
+ var success;
+ if(checkInitialization(builder, "importNode12") != null) return;
+ var doc;
+ var aNewDoc;
+ var doc1Type;
+ var entityList;
+ var entity2;
+ var entity1;
+ var ownerDocument;
+ var docType;
+ var system;
+ var entityName;
+ var child;
+ var childName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ doc1Type = aNewDoc.doctype;
+
+ entityList = doc1Type.entities;
+
+ assertNotNull("entitiesNotNull",entityList);
+entity2 = entityList.getNamedItem("ent4");
+ entity1 = doc.importNode(entity2,true);
+ ownerDocument = entity1.ownerDocument;
+
+ docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+entityName = entity1.nodeName;
+
+ assertEquals("entityName","ent4",entityName);
+ child = entity1.firstChild;
+
+ assertNotNull("notnull",child);
+childName = child.nodeName;
+
+ assertEquals("childName","entElement1",childName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode12</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode13.html b/dom/tests/mochitest/dom-level2-core/test_importNode13.html
new file mode 100644
index 0000000000..2b217c8c46
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode13.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode13</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode13';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Notation.
+
+ Retrieve notation named "notation1" from document staffNS.xml.
+ Invoke method importNode(importedNode,deep) where importedNode
+ contains the retrieved notation and deep is false. Method should
+ return a node of type notation whose name is "notation1".
+ The returned node should belong to this document whose systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode13() {
+ var success;
+ if(checkInitialization(builder, "importNode13") != null) return;
+ var doc;
+ var aNewDoc;
+ var doc1Type;
+ var notationList;
+ var notation;
+ var aNode;
+ var ownerDocument;
+ var docType;
+ var system;
+ var publicVal;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ doc1Type = aNewDoc.doctype;
+
+ notationList = doc1Type.notations;
+
+ assertNotNull("notationsNotNull",notationList);
+notation = notationList.getNamedItem("notation1");
+ aNode = doc.importNode(notation,false);
+ ownerDocument = aNode.ownerDocument;
+
+ docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+publicVal = aNode.publicId;
+
+ assertEquals("publicId","notation1File",publicVal);
+ system = aNode.systemId;
+
+ assertNull("notationSystemId",system);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode13</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode14.html b/dom/tests/mochitest/dom-level2-core/test_importNode14.html
new file mode 100644
index 0000000000..f58e7827d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode14.html
@@ -0,0 +1,154 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode14</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode14';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Processing Instruction.
+
+ Create a processing instruction with target as "target1" and data as "data1"
+ in a different document. Invoke method importNode(importedNode,deep) on this document.
+ Method should return a processing instruction whose target and data match the given
+ parameters. The returned PI should belong to this document whose systemId is "staff.dtd".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode14() {
+ var success;
+ if(checkInitialization(builder, "importNode14") != null) return;
+ var doc;
+ var aNewDoc;
+ var pi;
+ var aNode;
+ var ownerDocument;
+ var docType;
+ var system;
+ var target;
+ var data;
+ var result = new Array();
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ pi = aNewDoc.createProcessingInstruction("target1","data1");
+ aNode = doc.importNode(pi,false);
+ ownerDocument = aNode.ownerDocument;
+
+ assertNotNull("ownerDocumentNotNull",ownerDocument);
+docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+target = aNode.target;
+
+ assertEquals("piTarget","target1",target);
+ data = aNode.data;
+
+ assertEquals("piData","data1",data);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode14</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode15.html b/dom/tests/mochitest/dom-level2-core/test_importNode15.html
new file mode 100644
index 0000000000..35c8c5a49c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode15.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode15</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode15';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should import the given importedNode into that Document.
+ The importedNode is of type Text.
+
+ Create a text node with value being the string "this is text data" in
+ a different document. Invoke method importNode(importedNode,deep) on
+ this document. Method should return a text node whose value matches
+ the above string. The returned node should belong to this document
+ whose systemId is "staff.dtd"
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+*/
+function importNode15() {
+ var success;
+ if(checkInitialization(builder, "importNode15") != null) return;
+ var doc;
+ var aNewDoc;
+ var text;
+ var aNode;
+ var ownerDocument;
+ var docType;
+ var system;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var aNewDocRef = null;
+ if (typeof(this.aNewDoc) != 'undefined') {
+ aNewDocRef = this.aNewDoc;
+ }
+ aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS");
+ text = aNewDoc.createTextNode("this is text data");
+ aNode = doc.importNode(text,false);
+ ownerDocument = aNode.ownerDocument;
+
+ assertNotNull("ownerDocumentNotNull",ownerDocument);
+docType = ownerDocument.doctype;
+
+ system = docType.systemId;
+
+ assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
+value = aNode.nodeValue;
+
+ assertEquals("nodeValue","this is text data",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode15</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode16.html b/dom/tests/mochitest/dom-level2-core/test_importNode16.html
new file mode 100644
index 0000000000..412acbefb0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode16.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode16</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var anotherDocRef = null;
+ if (typeof(this.anotherDoc) != 'undefined') {
+ anotherDocRef = this.anotherDoc;
+ }
+ docsLoaded += preload(anotherDocRef, "anotherDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode16';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should raise NOT_SUPPORTED_ERR DOMException if
+ the type of node being imported is DocumentType.
+
+ The specification has changed! No exception should be thrown.
+
+ Retrieve document staff.xml and get its type.
+ Invoke method importNode(importedNode,deep) where importedNode
+ contains the document type of the staff.xml.
+ Method should raise NOT_SUPPORT_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_SUPPORTED_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Core-Document-importNode')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_SUPPORTED_ERR'])
+*/
+function importNode16() {
+ var success;
+ if(checkInitialization(builder, "importNode16") != null) return;
+ var doc;
+ var anotherDoc;
+ var docType;
+ var node;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var anotherDocRef = null;
+ if (typeof(this.anotherDoc) != 'undefined') {
+ anotherDocRef = this.anotherDoc;
+ }
+ anotherDoc = load(anotherDocRef, "anotherDoc", "staffNS");
+ docType = anotherDoc.doctype;
+
+
+ {
+ success = false;
+ try {
+ node = doc.importNode(docType,false);
+ success = true;
+ }
+ catch(ex) {
+ success = false;
+ }
+ assertTrue("no_throw_NOT_SUPPORTED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode16</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode17.html b/dom/tests/mochitest/dom-level2-core/test_importNode17.html
new file mode 100644
index 0000000000..b52c7ddce3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_importNode17.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode17</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['importNode17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var anotherDocRef = null;
+ if (typeof(this.anotherDoc) != 'undefined') {
+ anotherDocRef = this.anotherDoc;
+ }
+ docsLoaded += preload(anotherDocRef, "anotherDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'importNode17';
+
+
+/**
+*
+ The "importNode(importedNode,deep)" method for a
+ Document should raise NOT_SUPPORTED_ERR DOMException if
+ the type of node being imported is Document.
+
+ Retrieve staff.xml document.
+ Invoke method importNode(importedNode,deep) where importedNode
+ contains staff.xml and deep is true.
+ Method should raise NOT_SUPPORTED_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_SUPPORTED_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Core-Document-importNode')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_SUPPORTED_ERR'])
+*/
+function importNode17() {
+ var success;
+ if(checkInitialization(builder, "importNode17") != null) return;
+ var doc;
+ var anotherDoc;
+ var node;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var anotherDocRef = null;
+ if (typeof(this.anotherDoc) != 'undefined') {
+ anotherDocRef = this.anotherDoc;
+ }
+ anotherDoc = load(anotherDocRef, "anotherDoc", "staffNS");
+
+ {
+ success = false;
+ try {
+ node = doc.importNode(anotherDoc,false);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 9);
+ }
+ assertTrue("throw_NOT_SUPPORTED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode17</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_localName01.html b/dom/tests/mochitest/dom-level2-core/test_localName01.html
new file mode 100644
index 0000000000..738417e3cd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_localName01.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['localName01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'localName01';
+
+
+/**
+*
+ The "getLocalName()" method for a Node
+ returns the local part of the qualified name of this node,
+ and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
+ and nodes created with a DOM Level 1 method, this is null.
+
+ Retrieve the first emp:address node and get the attributes of this node."
+ Then apply the getLocalName() method to the emp:domestic attribute.
+ The method should return "domestic".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN
+*/
+function localName01() {
+ var success;
+ if(checkInitialization(builder, "localName01") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var localName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+addrAttr = testAddr.getAttributeNode("emp:domestic");
+ localName = addrAttr.localName;
+
+ assertEquals("localName","domestic",localName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_localName02.html b/dom/tests/mochitest/dom-level2-core/test_localName02.html
new file mode 100644
index 0000000000..a3cad6eb54
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_localName02.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['localName02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'localName02';
+
+
+/**
+*
+ The "getLocalName()" method for a Node
+ returns the local part of the qualified name of this node,
+ and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
+ and nodes created with a DOM Level 1 method, this is null.
+
+ Create an new Element with the createElement() method.
+ Invoke the "getLocalName()" method on the newly created element
+ node will cause "null" to be returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN
+*/
+function localName02() {
+ var success;
+ if(checkInitialization(builder, "localName02") != null) return;
+ var doc;
+ var createdNode;
+ var localName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ createdNode = doc.createElement("test:employee");
+ localName = createdNode.localName;
+
+ assertNull("localNameNull",localName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_localName04.html b/dom/tests/mochitest/dom-level2-core/test_localName04.html
new file mode 100644
index 0000000000..c414e24b4b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_localName04.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['localName04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'localName04';
+
+
+/**
+*
+ The "getLocalName()" method for a Node
+ returns the local part of the qualified name of this node,
+ and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
+ and nodes created with a DOM Level 1 method, this is null.
+
+ Retrieve the first employee node and invoke the "getLocalName()"
+ method. The method should return "employee".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN
+*/
+function localName04() {
+ var success;
+ if(checkInitialization(builder, "localName04") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var employeeLocalName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("employee");
+ testEmployee = elementList.item(0);
+ employeeLocalName = testEmployee.localName;
+
+ assertEquals("lname","employee",employeeLocalName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns01.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns01.html
new file mode 100644
index 0000000000..c7076accd8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns01.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapgetnameditemns01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapgetnameditemns01';
+
+
+/**
+*
+ Using the method getNamedItemNS, retreive the entity "ent1" and notation "notation1"
+ from a NamedNodeMap of this DocumentTypes entities and notations.
+ Both should be null since entities and notations are not namespaced.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=407
+* @see http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html
+*/
+function namednodemapgetnameditemns01() {
+ var success;
+ if(checkInitialization(builder, "namednodemapgetnameditemns01") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var notations;
+ var entity;
+ var notation;
+ var entityName;
+ var notationName;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+entity = entities.getNamedItemNS(nullNS,"ent1");
+ assertNull("entityNull",entity);
+ notation = notations.getNamedItemNS(nullNS,"notation1");
+ assertNull("notationNull",notation);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns02.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns02.html
new file mode 100644
index 0000000000..845518c92d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns02.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapgetnameditemns02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapgetnameditemns02';
+
+
+/**
+*
+ The method getNamedItemNS retrieves a node specified by local name and namespace URI.
+
+ Using the method getNamedItemNS, retreive an attribute node having namespaceURI=http://www.nist.gov
+ and localName=domestic, from a NamedNodeMap of attribute nodes, for the second element
+ whose namespaceURI=http://www.nist.gov and localName=address. Verify if the attr node
+ has been retreived successfully by checking its nodeName atttribute.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+*/
+function namednodemapgetnameditemns02() {
+ var success;
+ if(checkInitialization(builder, "namednodemapgetnameditemns02") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var elementList;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ attribute = attributes.getNamedItemNS("http://www.nist.gov","domestic");
+ attrName = attribute.nodeName;
+
+ assertEquals("namednodemapgetnameditemns02","emp:domestic",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns03.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns03.html
new file mode 100644
index 0000000000..8332b351fe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns03.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapgetnameditemns03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapgetnameditemns03';
+
+
+/**
+*
+ The method getNamedItemNS retrieves a node specified by local name and namespace URI.
+
+ Create a new Element node and add 2 new attribute nodes having the same local name but different
+ namespace names and namespace prefixes to it. Using the getNamedItemNS retreive the second attribute node.
+ Verify if the attr node has been retreived successfully by checking its nodeName atttribute.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+*/
+function namednodemapgetnameditemns03() {
+ var success;
+ if(checkInitialization(builder, "namednodemapgetnameditemns03") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var newAttr1;
+ var newAttr2;
+ var newAttribute;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test","root");
+ newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att");
+ newAttribute = element.setAttributeNodeNS(newAttr1);
+ newAttr2 = doc.createAttributeNS("http://www.w3.org/DOM/L2","L2:att");
+ newAttribute = element.setAttributeNodeNS(newAttr2);
+ attributes = element.attributes;
+
+ attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L2","att");
+ attrName = attribute.nodeName;
+
+ assertEquals("namednodemapgetnameditemns03","L2:att",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns04.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns04.html
new file mode 100644
index 0000000000..61f19562d6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns04.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapgetnameditemns04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapgetnameditemns04';
+
+
+/**
+*
+ The method getNamedItemNS retrieves a node specified by local name and namespace URI.
+
+ Retreive the second address element node having localName=adrress.
+ Create a new attribute node having the same name as an existing node but different namespaceURI
+ and add it to this element. Using the getNamedItemNS retreive the newly created attribute
+ node from a nodemap of attributes of the retreive element node.
+ Verify if the attr node has been retreived successfully by checking its nodeName atttribute.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+*/
+function namednodemapgetnameditemns04() {
+ var success;
+ if(checkInitialization(builder, "namednodemapgetnameditemns04") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var newAttr1;
+ var newAttribute;
+ var elementList;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(1);
+ newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","street");
+ newAttribute = element.setAttributeNodeNS(newAttr1);
+ attributes = element.attributes;
+
+ attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","street");
+ attrName = attribute.nodeName;
+
+ assertEquals("namednodemapgetnameditemns04","street",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns05.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns05.html
new file mode 100644
index 0000000000..f6ccb847f2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns05.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapgetnameditemns05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapgetnameditemns05';
+
+
+/**
+*
+ The method getNamedItemNS retrieves a node specified by local name and namespace URI.
+
+ Retreieve the second address element and its attribute into a named node map.
+ Try retreiving the street attribute from the namednodemap using the
+ default namespace uri and the street attribute name. Since the default
+ namespace doesnot apply to attributes this should return null.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+*/
+function namednodemapgetnameditemns05() {
+ var success;
+ if(checkInitialization(builder, "namednodemapgetnameditemns05") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ attribute = attributes.getNamedItemNS("*","street");
+ assertNull("namednodemapgetnameditemns05",attribute);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns06.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns06.html
new file mode 100644
index 0000000000..5e06946c1e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns06.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapgetnameditemns06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapgetnameditemns06';
+
+
+/**
+*
+ Retreive the second address element node having localName=adrress. Retreive the attributes
+ of this element into 2 nodemaps. Create a new attribute node and add it to this element.
+ Since NamedNodeMaps are live each one should get updated, using the getNamedItemNS retreive
+ the newly created attribute from each node map.
+ Verify if the attr node has been retreived successfully by checking its nodeName atttribute.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+*/
+function namednodemapgetnameditemns06() {
+ var success;
+ if(checkInitialization(builder, "namednodemapgetnameditemns06") != null) return;
+ var doc;
+ var attributesMap1;
+ var attributesMap2;
+ var element;
+ var attribute;
+ var newAttr1;
+ var newAttribute;
+ var elementList;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(1);
+ attributesMap1 = element.attributes;
+
+ attributesMap2 = element.attributes;
+
+ newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","street");
+ newAttribute = element.setAttributeNodeNS(newAttr1);
+ attribute = attributesMap1.getNamedItemNS("http://www.w3.org/DOM/L1","street");
+ attrName = attribute.nodeName;
+
+ assertEquals("namednodemapgetnameditemnsMap106","street",attrName);
+ attribute = attributesMap2.getNamedItemNS("http://www.w3.org/DOM/L1","street");
+ attrName = attribute.nodeName;
+
+ assertEquals("namednodemapgetnameditemnsMap206","street",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns01.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns01.html
new file mode 100644
index 0000000000..e3b8cd8e88
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns01.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns01';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node specified by local name and namespace
+
+ Retreive an attribute node and then remove from the NamedNodeMap. Verify if the attribute
+ node was actually remove from the node map.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+*/
+function namednodemapremovenameditemns01() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns01") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic");
+ attribute = attributes.getNamedItemNS("http://www.nist.gov","domestic");
+ assertNull("namednodemapremovenameditemns01",attribute);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns02.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns02.html
new file mode 100644
index 0000000000..a15582cd15
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns02.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns02';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node specified by local name and namespace
+ A removed attribute may be known to have a default value when this map contains the
+ attributes attached to an element, as returned by the attributes attribute of the Node
+ interface. If so, an attribute immediately appears containing the default value as well
+ as the corresponding namespace URI, local name, and prefix when applicable.
+
+ Retreive a default attribute node. Remove it from the NodeMap. Check if a new one immediately
+ appears containing the default value.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function namednodemapremovenameditemns02() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns02") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var elementList;
+ var attrValue;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ attribute = attributes.removeNamedItemNS(nullNS,"defaultAttr");
+ attribute = attributes.getNamedItemNS(nullNS,"defaultAttr");
+ attrValue = attribute.nodeValue;
+
+ assertNotNull("namednodemapremovenameditemns02",attribute);
+assertEquals("namednodemapremovenameditemns02_attrValue","defaultVal",attrValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns03.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns03.html
new file mode 100644
index 0000000000..e2c8486acb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns03.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns03';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node specified by local name and namespace
+
+ Create a new element node and add 2 new attribute nodes to it that have the same localName
+ but different namespaceURI's. Remove the first attribute node from the namedNodeMap of the
+ new element node and check to see that the second attribute still exists.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+*/
+function namednodemapremovenameditemns03() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns03") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var newAttribute;
+ var attribute1;
+ var attribute2;
+ var nodeName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test","root");
+ attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att");
+ newAttribute = element.setAttributeNodeNS(attribute1);
+ attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/L2","L2:att");
+ newAttribute = element.setAttributeNodeNS(attribute2);
+ attributes = element.attributes;
+
+ attribute = attributes.removeNamedItemNS("http://www.w3.org/DOM/L1","att");
+ attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L2","att");
+ nodeName = attribute.nodeName;
+
+ assertEquals("namednodemapremovenameditemns02","L2:att",nodeName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns04.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns04.html
new file mode 100644
index 0000000000..b29dcffc5c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns04.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns04';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node specified by local name and namespace
+
+ Attempt to remove the xmlns and dmstc attributes of the first element node with the localName
+ employee. Verify if the 2 attributes were successfully removed.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+*/
+function namednodemapremovenameditemns04() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns04") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var attributeRemoved;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","employee");
+ element = elementList.item(0);
+ attributes = element.attributes;
+
+ attributeRemoved = attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/","xmlns");
+ attribute = attributes.getNamedItemNS("http://www.w3.org/2000/xmlns/","xmlns");
+ assertNull("namednodemapremovenameditemns04_1",attribute);
+ attributeRemoved = attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/","dmstc");
+ attribute = attributes.getNamedItemNS("http://www.w3.org/2000/xmlns/","dmstc");
+ assertNull("namednodemapremovenameditemns04_2",attribute);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns05.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns05.html
new file mode 100644
index 0000000000..3f00f5d642
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns05.html
@@ -0,0 +1,167 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns05';
+
+
+/**
+*
+ Retreive an entity and notation node and remove the first notation from the
+ entity node map and first entity node from the notation map. Since both these
+ maps are readonly, a NO_MODIFICATION_ALLOWED_ERR should be raised.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=407
+* @see http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html
+*/
+function namednodemapremovenameditemns05() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns05") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var notations;
+ var removedNode;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+
+ try {
+ removedNode = entities.removeNamedItemNS(nullNS,"ent1");
+ fail("entity_throw_DOMException");
+
+ } catch (ex) {
+ if (typeof(ex.code) != 'undefined') {
+ switch(ex.code) {
+ case /* NOT_FOUND_ERR */ 8 :
+ break;
+ case /* NO_MODIFICATION_ALLOWED_ERR */ 7 :
+ break;
+ default:
+ throw ex;
+ }
+ } else {
+ throw ex;
+ }
+ }
+
+ try {
+ removedNode = notations.removeNamedItemNS(nullNS,"notation1");
+ fail("notation_throw_DOMException");
+
+ } catch (ex) {
+ if (typeof(ex.code) != 'undefined') {
+ switch(ex.code) {
+ case /* NOT_FOUND_ERR */ 8 :
+ break;
+ case /* NO_MODIFICATION_ALLOWED_ERR */ 7 :
+ break;
+ default:
+ throw ex;
+ }
+ } else {
+ throw ex;
+ }
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns06.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns06.html
new file mode 100644
index 0000000000..ea40d0c931
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns06.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns06';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node using its namespaceURI and localName and
+ raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and
+ localName in this map
+
+ Retreive an attribute node into a namednodemap. While removing it from the map specify
+ an incorrect namespaceURI. This should raise a NOT_FOUND_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+*/
+function namednodemapremovenameditemns06() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns06") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+
+ {
+ success = false;
+ try {
+ attribute = attributes.removeNamedItemNS("http://www.Nist.gov","domestic");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns07.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns07.html
new file mode 100644
index 0000000000..99a0cc083d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns07.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns07';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node using its namespaceURI and localName and
+ raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and
+ localName in this map
+
+ Retreive an attribute node from a namednodemap. While removing it from the map specify
+ an incorrect localName. This should raise a NOT_FOUND_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+*/
+function namednodemapremovenameditemns07() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns07") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+
+ {
+ success = false;
+ try {
+ attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns08.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns08.html
new file mode 100644
index 0000000000..1e1448d42f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns08</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns08';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node using its namespaceURI and localName and
+ raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and
+ localName in this map
+
+ Retreive an attribute node from a namednodemap. Remove the attribute node from the document
+ object. Since NamedNodeMaps are live it should also automatically get removed from
+ the node map. And so if an attempt is made to remove it using removeAttributeNS, this should
+ raise a NOT_FOUND_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+*/
+function namednodemapremovenameditemns08() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns08") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ element.removeAttributeNS("http://www.nist.gov","domestic");
+
+ {
+ success = false;
+ try {
+ attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns09.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns09.html
new file mode 100644
index 0000000000..45ef833702
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns09.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns09</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapremovenameditemns09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapremovenameditemns09';
+
+
+/**
+*
+ The method removeNamedItemNS removes a node using its namespaceURI and localName and
+ raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and
+ localName in this map
+
+ Retreive an attribute node. Remove the attribute node from the node map.
+ Check the element object to ensure that the attribute node has been removed from it.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193
+*/
+function namednodemapremovenameditemns09() {
+ var success;
+ if(checkInitialization(builder, "namednodemapremovenameditemns09") != null) return;
+ var doc;
+ var attributes;
+ var newAttributes;
+ var element;
+ var attribute;
+ var elementList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic");
+ newAttributes = element.attributes;
+
+ attribute = newAttributes.getNamedItemNS("http://www.nist.gov","domestic");
+ assertNull("namednodemapremovenameditemns09",attribute);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns09</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns01.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns01.html
new file mode 100644
index 0000000000..84133fd9bf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns01.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns01';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName. If a node with
+ that namespace URI and that local name is already present in this map, it is replaced
+ by the new one.
+
+ Retreive the first element whose localName is address and namespaceURI http://www.nist.gov",
+ and put its attributes into a named node map. Create a new attribute node and add it to this map.
+ Verify if the attr node was successfully added by checking the nodeName of the retreived atttribute.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS
+*/
+function namednodemapsetnameditemns01() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns01") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var newAttribute;
+ var newAttr1;
+ var elementList;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(0);
+ attributes = element.attributes;
+
+ newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","streets");
+ newAttribute = element.setAttributeNodeNS(newAttr1);
+ attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","streets");
+ attrName = attribute.nodeName;
+
+ assertEquals("namednodemapsetnameditemns01","streets",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns02.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns02.html
new file mode 100644
index 0000000000..80eb42e37a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns02.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns02';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName. If a node with
+ that namespace URI and that local name is already present in this map, it is replaced
+ by the new one.
+
+ Create a new element and attribute Node and add the newly created attribute node to the elements
+ NamedNodeMap. Verify if the new attr node has been successfully added to the map by checking
+ the nodeName of the retreived atttribute from the list of attribute nodes in this map.
+
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+*/
+function namednodemapsetnameditemns02() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns02") != null) return;
+ var doc;
+ var attributes;
+ var element;
+ var attribute;
+ var attribute1;
+ var newNode;
+ var attrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test","root");
+ attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att");
+ attributes = element.attributes;
+
+ newNode = attributes.setNamedItemNS(attribute1);
+ attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","att");
+ attrName = attribute.nodeName;
+
+ assertEquals("namednodemapsetnameditemns02","L1:att",attrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns03.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns03.html
new file mode 100644
index 0000000000..e711b7d38c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns03.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var docAltRef = null;
+ if (typeof(this.docAlt) != 'undefined') {
+ docAltRef = this.docAlt;
+ }
+ docsLoaded += preload(docAltRef, "docAlt", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns03';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName and
+ raises a WRONG_DOCUMENT_ERR if arg was created from a different document than the
+ one that created this map.
+
+ Retreieve the second element whose local name is address and its attribute into a named node map.
+ Do the same for another document and retreive its street attribute. Call the setNamedItemNS
+ using the first namedNodeMap and the retreive street attribute of the second. This should
+ raise a WRONG_DOCUMENT_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=408
+*/
+function namednodemapsetnameditemns03() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns03") != null) return;
+ var doc;
+ var docAlt;
+ var attributes;
+ var attributesAlt;
+ var elementList;
+ var elementListAlt;
+ var element;
+ var elementAlt;
+ var attr;
+ var newNode;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+
+ var docAltRef = null;
+ if (typeof(this.docAlt) != 'undefined') {
+ docAltRef = this.docAlt;
+ }
+ docAlt = load(docAltRef, "docAlt", "staffNS");
+ elementListAlt = docAlt.getElementsByTagNameNS("*","address");
+ elementAlt = elementListAlt.item(1);
+ attributesAlt = elementAlt.attributes;
+
+ attr = attributesAlt.getNamedItemNS(nullNS,"street");
+ newNode = attributesAlt.removeNamedItemNS(nullNS,"street");
+
+ {
+ success = false;
+ try {
+ newNode = attributes.setNamedItemNS(attr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns04.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns04.html
new file mode 100644
index 0000000000..6fa313f5e8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns04.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns04';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName and
+ raises a WRONG_DOCUMENT_ERR if arg was created from a different document than the
+ one that created this map.
+
+ Retreieve the second element whose local name is address and its attribute into a named node map.
+ Create a new document and a new attribute node in it. Call the setNamedItemNS using the first
+ namedNodeMap and the new attribute node attribute of the new document. This should
+ raise a WRONG_DOCUMENT_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function namednodemapsetnameditemns04() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns04") != null) return;
+ var doc;
+ var domImpl;
+ var docAlt;
+ var docType = null;
+
+ var attributes;
+ var elementList;
+ var element;
+ var attrAlt;
+ var newNode;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+ domImpl = doc.implementation;
+docAlt = domImpl.createDocument(nullNS,"newDoc",docType);
+ attrAlt = docAlt.createAttributeNS(nullNS,"street");
+
+ {
+ success = false;
+ try {
+ newNode = attributes.setNamedItemNS(attrAlt);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ todo(success, "throw_WRONG_DOCUMENT_ERR");
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns05.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns05.html
new file mode 100644
index 0000000000..07ba4904a1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns05.html
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns05';
+
+
+/**
+*
+ Retreive an entity and notation node and add the first notation to the
+ notation node map and first entity node to the entity map. Since both these
+ maps are for readonly node, a NO_MODIFICATION_ALLOWED_ERR should be raised.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=407
+* @see http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html
+*/
+function namednodemapsetnameditemns05() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns05") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var notations;
+ var entity;
+ var notation;
+ var newNode;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+entity = entities.getNamedItem("ent1");
+ notation = notations.getNamedItem("notation1");
+
+ {
+ success = false;
+ try {
+ newNode = entities.setNamedItemNS(entity);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities",success);
+ }
+
+ {
+ success = false;
+ try {
+ newNode = notations.setNamedItemNS(notation);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns06.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns06.html
new file mode 100644
index 0000000000..031c0b16a5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns06.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns06';
+
+
+/**
+*
+ Retreieve the first element whose localName is address and its attributes into a named node map.
+ Retreiving the domestic attribute from the namednodemap.
+ Retreieve the second element whose localName is address and its attributes into a named node map.
+ Invoke setNamedItemNS on the second NamedNodeMap specifying the first domestic attribute from
+ the first map. This should raise an INUSE_ATTRIBIUTE_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+*/
+function namednodemapsetnameditemns06() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns06") != null) return;
+ var doc;
+ var attributes;
+ var elementList;
+ var element;
+ var attr;
+ var newNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(0);
+ attributes = element.attributes;
+
+ attr = attributes.getNamedItemNS("http://www.usa.com","domestic");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+
+ {
+ success = false;
+ try {
+ newNode = attributes.setNamedItemNS(attr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("namednodemapsetnameditemns06",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns07.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns07.html
new file mode 100644
index 0000000000..0be6db7136
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns07.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns07';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName and
+ raises a INUSE_ATTRIBUTE_ERR Raised if arg is an Attr that is already an
+ attribute of another Element object.
+
+ Retreieve the attributes of first element whose localName is address into a named node map.
+ Retreive the attribute whose namespaceURI=http://www.usa.com and localName=domestic
+ from the NamedNodeMap. Retreieve the attributes of second element whose localName is address
+ into a named node map. Call the setNamedItemNS method on the second nodemap with the domestic
+ attribute that was retreived and removed from the first nodeMap as an argument.
+ Assuming that when an attribute is removed from a nodemap, it still remains in the domtree
+ his should raise an INUSE_ATTRIBIUTE_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+*/
+function namednodemapsetnameditemns07() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns07") != null) return;
+ var doc;
+ var attributes;
+ var elementList;
+ var element;
+ var attr;
+ var newNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(0);
+ attributes = element.attributes;
+
+ attr = attributes.getNamedItemNS("http://www.usa.com","domestic");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+
+ {
+ success = false;
+ try {
+ newNode = attributes.setNamedItemNS(attr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("namednodemapsetnameditemns07",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns08.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns08.html
new file mode 100644
index 0000000000..8d2097a565
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns08.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns08</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns08';
+
+
+/**
+*
+ raises a INUSE_ATTRIBUTE_ERR Raised if arg is an Attr that is already an
+ attribute of another Element object.
+
+ Retreieve the first element whose localName is address and its attributes into a named node map.
+ Retreiving the domestic attribute from the namednodemap. Retreieve the second element whose
+ localName is address and its attributes into a named node map. Invoke setNamedItemNS on the
+ second NamedNodeMap specifying the attribute from the first map.
+ This should raise an INUSE_ATTRIBIUTE_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+*/
+function namednodemapsetnameditemns08() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns08") != null) return;
+ var doc;
+ var attributes;
+ var elementList;
+ var element;
+ var attr;
+ var newNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagNameNS("*","address");
+ element = elementList.item(0);
+ attributes = element.attributes;
+
+ attr = attributes.getNamedItemNS("http://www.usa.com","domestic");
+ element = elementList.item(1);
+ attributes = element.attributes;
+
+
+ {
+ success = false;
+ try {
+ newNode = attributes.setNamedItemNS(attr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("namednodemapsetnameditemns08",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns08</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns09.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns09.html
new file mode 100644
index 0000000000..777b18d923
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns09.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns09</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns09';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName and
+ raises a NO_MODIFICATION_ALLOWED_ERR if this map is readonly.
+
+ Create a new attribute node and attempt to add it to the nodemap of entities and notations
+ for this documenttype. This should reaise a NO_MODIFICATION_ALLOWED_ERR.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+*/
+function namednodemapsetnameditemns09() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns09") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var notations;
+ var attr;
+ var newNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ entities = docType.entities;
+
+ notations = docType.notations;
+
+ attr = doc.createAttributeNS("http://www.w3.org/DOM/Test","test");
+
+ {
+ success = false;
+ try {
+ newNode = entities.setNamedItemNS(attr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities",success);
+ }
+
+ {
+ success = false;
+ try {
+ newNode = notations.setNamedItemNS(attr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns09</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns10.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns10.html
new file mode 100644
index 0000000000..e99b5cdd36
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns10.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns10</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns10';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName and
+ raises a HIERARCHY_REQUEST_ERR if an attempt is made to add a node doesn't belong
+ in this NamedNodeMap.
+
+ Attempt to add an entity to a NamedNodeMap of attribute nodes,
+ Since nodes of this type cannot be added to the attribute node map a HIERARCHY_REQUEST_ERR
+ should be raised.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function namednodemapsetnameditemns10() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns10") != null) return;
+ var doc;
+ var docType;
+ var entities;
+ var attributes;
+ var entity;
+ var notation;
+ var element;
+ var elementList;
+ var newNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ entities = docType.entities;
+
+ assertNotNull("entitiesNotNull",entities);
+entity = entities.getNamedItem("ent1");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(0);
+ attributes = element.attributes;
+
+
+ {
+ success = false;
+ try {
+ newNode = attributes.setNamedItemNS(entity);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns10</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns11.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns11.html
new file mode 100644
index 0000000000..689c233eb7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns11.html
@@ -0,0 +1,147 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns11</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namednodemapsetnameditemns11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namednodemapsetnameditemns11';
+
+
+/**
+*
+ The method setNamedItemNS adds a node using its namespaceURI and localName and
+ raises a HIERARCHY_REQUEST_ERR if an attempt is made to add a node doesn't belong
+ in this NamedNodeMap.
+
+ Attempt to add a notation node to a NamedNodeMap of attribute nodes,
+ Since notations nodes do not belong in the attribute node map a HIERARCHY_REQUEST_ERR
+ should be raised.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function namednodemapsetnameditemns11() {
+ var success;
+ if(checkInitialization(builder, "namednodemapsetnameditemns11") != null) return;
+ var doc;
+ var docType;
+ var notations;
+ var attributes;
+ var notation;
+ var element;
+ var elementList;
+ var newNode;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ notations = docType.notations;
+
+ assertNotNull("notationsNotNull",notations);
+notation = notations.getNamedItem("notation1");
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address");
+ element = elementList.item(0);
+ attributes = element.attributes;
+
+
+ {
+ success = false;
+ try {
+ newNode = attributes.setNamedItemNS(notation);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 3);
+ }
+ assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns11</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI01.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI01.html
new file mode 100644
index 0000000000..e0a078eb1b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI01.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namespaceURI01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namespaceURI01';
+
+
+/**
+*
+ The "getNamespaceURI()" method for an Attribute
+ returns the namespace URI of this node, or null if unspecified.
+
+ Retrieve the first "emp:address" node which has an attribute of "emp:district"
+ that is specified in the DTD.
+ Invoke the "getNamespaceURI()" method on the attribute.
+ The method should return "http://www.nist.gov".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238
+*/
+function namespaceURI01() {
+ var success;
+ if(checkInitialization(builder, "namespaceURI01") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrNamespaceURI;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","district");
+ attrNamespaceURI = addrAttr.namespaceURI;
+
+ assertEquals("namespaceURI","http://www.nist.gov",attrNamespaceURI);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI02.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI02.html
new file mode 100644
index 0000000000..49d3a27d07
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI02.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namespaceURI02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namespaceURI02';
+
+
+/**
+*
+ The "getNamespaceURI()" method for an Attribute
+ returns the namespace URI of this node, or null if unspecified.
+
+ Retrieve the first emp:address node and get the emp:domestic attribute.
+ Invoke the "getNamespaceURI()" method on the attribute.
+ The method should return "http://www.nist.gov".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname
+*/
+function namespaceURI02() {
+ var success;
+ if(checkInitialization(builder, "namespaceURI02") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attrNamespaceURI;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddressNotNull",testAddr);
+addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","domestic");
+ attrNamespaceURI = addrAttr.namespaceURI;
+
+ assertEquals("namespaceURI","http://www.nist.gov",attrNamespaceURI);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI03.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI03.html
new file mode 100644
index 0000000000..c4a7690984
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI03.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namespaceURI03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namespaceURI03';
+
+
+/**
+*
+ The "getNamespaceURI()" method for a Node
+ returns the namespace URI of this node, or null if unspecified.
+
+ Retrieve the first employee node and invoke the "getNamespaceURI()"
+ method. The method should return "http://www.nist.gov".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname
+*/
+function namespaceURI03() {
+ var success;
+ if(checkInitialization(builder, "namespaceURI03") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var employeeNamespace;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("employee");
+ testEmployee = elementList.item(0);
+ assertNotNull("employeeNotNull",testEmployee);
+employeeNamespace = testEmployee.namespaceURI;
+
+ assertEquals("namespaceURI","http://www.nist.gov",employeeNamespace);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI04.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI04.html
new file mode 100644
index 0000000000..765c516e9d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI04.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['namespaceURI04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'namespaceURI04';
+
+
+/**
+*
+ Retrieve the second employee node and invoke the "getNamespaceURI()"
+ method. The method should return "null".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname
+*/
+function namespaceURI04() {
+ var success;
+ if(checkInitialization(builder, "namespaceURI04") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var employeeNamespace;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("employee");
+ testEmployee = elementList.item(1);
+ employeeNamespace = testEmployee.namespaceURI;
+
+
+ if(
+
+ (builder.contentType == "image/svg+xml")
+
+ ) {
+ assertTrue("employeeNS_svg",
+
+ (
+ (employeeNamespace == null)
+ || ("http://www.w3.org/2001/DOM-Test-Suite/Level-2/Files" == employeeNamespace))
+);
+
+ }
+
+ else {
+ assertNull("employeeNS_null",employeeNamespace);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetlocalname03.html b/dom/tests/mochitest/dom-level2-core/test_nodegetlocalname03.html
new file mode 100644
index 0000000000..303ffef14c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodegetlocalname03.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetlocalname03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetlocalname03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetlocalname03';
+
+
+/**
+*
+ The method getLocalName returns the local part of the qualified name of this node.
+
+ Ceate two new element nodes and atribute nodes, with and without namespace prefixes.
+ Retreive the local part of their qualified names using getLocalName and verrify
+ if it is correct.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN
+*/
+function nodegetlocalname03() {
+ var success;
+ if(checkInitialization(builder, "nodegetlocalname03") != null) return;
+ var doc;
+ var element;
+ var qelement;
+ var attr;
+ var qattr;
+ var localElemName;
+ var localQElemName;
+ var localAttrName;
+ var localQAttrName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/elem","elem");
+ qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem");
+ attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","attr");
+ qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr");
+ localElemName = element.localName;
+
+ localQElemName = qelement.localName;
+
+ localAttrName = attr.localName;
+
+ localQAttrName = qattr.localName;
+
+ assertEquals("nodegetlocalname03_localElemName","elem",localElemName);
+ assertEquals("nodegetlocalname03_localQElemName","qelem",localQElemName);
+ assertEquals("nodegetlocalname03_localAttrName","attr",localAttrName);
+ assertEquals("nodegetlocalname03_localQAttrName","qattr",localQAttrName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetlocalname03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetnamespaceuri03.html b/dom/tests/mochitest/dom-level2-core/test_nodegetnamespaceuri03.html
new file mode 100644
index 0000000000..198b950ca4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodegetnamespaceuri03.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetnamespaceuri03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetnamespaceuri03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetnamespaceuri03';
+
+
+/**
+*
+ The method getNamespaceURI returns the namespace URI of this node, or null if it is unspecified
+ For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with
+ a DOM Level 1 method, such as createElement from the Document interface, this is always null.
+
+ Ceate two new element nodes and atribute nodes, with and without namespace prefixes.
+ Retreive their namespaceURI's using getNamespaceURI and verrify if it is correct.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function nodegetnamespaceuri03() {
+ var success;
+ if(checkInitialization(builder, "nodegetnamespaceuri03") != null) return;
+ var doc;
+ var element;
+ var elementNS;
+ var attr;
+ var attrNS;
+ var elemNSURI;
+ var elemNSURINull;
+ var attrNSURI;
+ var attrNSURINull;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS(nullNS,"elem");
+ elementNS = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem");
+ attr = doc.createAttributeNS(nullNS,"attr");
+ attrNS = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr");
+ elemNSURI = elementNS.namespaceURI;
+
+ elemNSURINull = element.namespaceURI;
+
+ attrNSURI = attrNS.namespaceURI;
+
+ attrNSURINull = attr.namespaceURI;
+
+ assertEquals("nodegetnamespaceuri03_elemNSURI","http://www.w3.org/DOM/Test/elem",elemNSURI);
+ assertNull("nodegetnamespaceuri03_1",elemNSURINull);
+ assertEquals("nodegetnamespaceuri03_attrNSURI","http://www.w3.org/DOM/Test/attr",attrNSURI);
+ assertNull("nodegetnamespaceuri03_2",attrNSURINull);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetnamespaceuri03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument01.html b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument01.html
new file mode 100644
index 0000000000..28dacf12c9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument01.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetownerdocument01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetownerdocument01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetownerdocument01';
+
+
+/**
+*
+ The method getOwnerDocument returns the Document object associated with this node
+
+ Create a new DocumentType node. Since this node is not used with any Document yet
+ verify if the ownerDocument is null.
+
+ The specification has changed! ownerDocument should not be null.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function nodegetownerdocument01() {
+ var success;
+ if(checkInitialization(builder, "nodegetownerdocument01") != null) return;
+ var doc;
+ var ownerDoc;
+ var domImpl;
+ var docType;
+ var nullID = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ domImpl = doc.implementation;
+docType = domImpl.createDocumentType("mydoc",nullID,nullID);
+ ownerDoc = docType.ownerDocument;
+
+ assertNotNull("nodegetownerdocument01",ownerDoc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetownerdocument01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument02.html b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument02.html
new file mode 100644
index 0000000000..8f91797a41
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument02.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetownerdocument02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetownerdocument02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetownerdocument02';
+
+
+/**
+*
+ The method getOwnerDocument returns the Document object associated with this node
+
+ Create a new Document node. Since this node is not used with any Document yet
+ verify if the ownerDocument is null. Create a new element Node on the new Document
+ object. Check the ownerDocument of the new element node.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
+*/
+function nodegetownerdocument02() {
+ var success;
+ if(checkInitialization(builder, "nodegetownerdocument02") != null) return;
+ var doc;
+ var newDoc;
+ var newElem;
+ var ownerDocDoc;
+ var ownerDocElem;
+ var domImpl;
+ var docType;
+ var nullNS = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ domImpl = doc.implementation;
+docType = domImpl.createDocumentType("mydoc",nullNS,nullNS);
+ newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","mydoc",docType);
+ ownerDocDoc = newDoc.ownerDocument;
+
+ assertNull("nodegetownerdocument02_1",ownerDocDoc);
+ newElem = newDoc.createElementNS("http://www.w3.org/DOM/Test","myelem");
+ ownerDocElem = newElem.ownerDocument;
+
+ assertNotNull("nodegetownerdocument02_2",ownerDocElem);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetownerdocument02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetprefix03.html b/dom/tests/mochitest/dom-level2-core/test_nodegetprefix03.html
new file mode 100644
index 0000000000..d9c4140ffd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodegetprefix03.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetprefix03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodegetprefix03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodegetprefix03';
+
+
+/**
+*
+ The method getPrefix returns the namespace prefix of this node, or null if it is unspecified.
+
+ Ceate two new element nodes and atribute nodes, with and without namespace prefixes.
+ Retreive the prefix part of their qualified names using getPrefix and verify
+ if it is correct.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix
+*/
+function nodegetprefix03() {
+ var success;
+ if(checkInitialization(builder, "nodegetprefix03") != null) return;
+ var doc;
+ var element;
+ var qelement;
+ var attr;
+ var qattr;
+ var elemNoPrefix;
+ var elemPrefix;
+ var attrNoPrefix;
+ var attrPrefix;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/elem","elem");
+ qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem");
+ attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","attr");
+ qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr");
+ elemNoPrefix = element.prefix;
+
+ elemPrefix = qelement.prefix;
+
+ attrNoPrefix = attr.prefix;
+
+ attrPrefix = qattr.prefix;
+
+ assertNull("nodegetprefix03_1",elemNoPrefix);
+ assertEquals("nodegetprefix03_2","qual",elemPrefix);
+ assertNull("nodegetprefix03_3",attrNoPrefix);
+ assertEquals("nodegetprefix03_4","qual",attrPrefix);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetprefix03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes01.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes01.html
new file mode 100644
index 0000000000..82bca3a4e5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes01.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodehasattributes01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodehasattributes01';
+
+
+/**
+*
+ The method hasAttributes returns whether this node (if it is an element) has any attributes.
+
+ Retreive an element node without attributes. Verify if hasAttributes returns false.
+ Retreive another element node with attributes. Verify if hasAttributes returns true.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function nodehasattributes01() {
+ var success;
+ if(checkInitialization(builder, "nodehasattributes01") != null) return;
+ var doc;
+ var element;
+ var elementList;
+ var hasAttributes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ elementList = doc.getElementsByTagName("employeeId");
+ element = elementList.item(0);
+ hasAttributes = element.hasAttributes();
+ assertFalse("employeeIdHasAttributesFalse",hasAttributes);
+elementList = doc.getElementsByTagName("address");
+ element = elementList.item(0);
+ hasAttributes = element.hasAttributes();
+ assertTrue("addressHasAttributesTrue",hasAttributes);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes02.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes02.html
new file mode 100644
index 0000000000..b94abf3c83
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes02.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodehasattributes02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodehasattributes02';
+
+
+/**
+*
+ The method hasAttributes returns whether this node (if it is an element) has any attributes.
+
+ Retrieve the docType node. Since this is not an element node check if hasAttributes returns
+ null.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function nodehasattributes02() {
+ var success;
+ if(checkInitialization(builder, "nodehasattributes02") != null) return;
+ var doc;
+ var docType;
+ var hasAttributes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ hasAttributes = docType.hasAttributes();
+ assertFalse("nodehasattributes02",hasAttributes);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes03.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes03.html
new file mode 100644
index 0000000000..5b365a2d01
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes03.html
@@ -0,0 +1,119 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodehasattributes03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodehasattributes03';
+
+
+/**
+*
+ The method hasAttributes returns whether this node (if it is an element) has any attributes.
+
+ Retreive an element node with a default attributes. Verify if hasAttributes returns true.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function nodehasattributes03() {
+ var success;
+ if(checkInitialization(builder, "nodehasattributes03") != null) return;
+ var doc;
+ var element;
+ var elementList;
+ var hasAttributes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:employee");
+ element = elementList.item(0);
+ assertNotNull("empEmployeeNotNull",element);
+hasAttributes = element.hasAttributes();
+ assertTrue("hasAttributes",hasAttributes);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes04.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes04.html
new file mode 100644
index 0000000000..e3af33f0e3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes04.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodehasattributes04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodehasattributes04';
+
+
+/**
+*
+ The method hasAttributes returns whether this node (if it is an element) has any attributes.
+
+ Create a new Document, Element and Attr node. Add the Attr to the Element and append the
+ Element to the Document. Retreive the newly created element node from the document and check
+ if it has attributes using hasAttributes.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs
+*/
+function nodehasattributes04() {
+ var success;
+ if(checkInitialization(builder, "nodehasattributes04") != null) return;
+ var doc;
+ var newDoc;
+ var docType = null;
+
+ var domImpl;
+ var element;
+ var elementTest;
+ var elementDoc;
+ var attribute;
+ var setNode;
+ var appendedChild;
+ var elementList;
+ var hasAttributes;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","test",docType);
+ element = newDoc.createElementNS("http://www.w3.org/DOM/Test","dom:elem");
+ attribute = newDoc.createAttribute("attr");
+ setNode = element.setAttributeNode(attribute);
+ elementDoc = newDoc.documentElement;
+
+ appendedChild = elementDoc.appendChild(element);
+ elementList = newDoc.getElementsByTagNameNS("http://www.w3.org/DOM/Test","elem");
+ elementTest = elementList.item(0);
+ hasAttributes = elementTest.hasAttributes();
+ assertTrue("nodehasattributes04",hasAttributes);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_nodenormalize01.html b/dom/tests/mochitest/dom-level2-core/test_nodenormalize01.html
new file mode 100644
index 0000000000..2a2beab4ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_nodenormalize01.html
@@ -0,0 +1,238 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodenormalize01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['nodenormalize01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'nodenormalize01';
+
+
+/**
+*
+ The method "normalize" puts all Text nodes in the full depth of the sub-tree underneath
+ this Node, including attribute nodes, into a "normal" form where only structure
+ (e.g., elements, comments, processing instructions, CDATA sections, and entity references)
+ separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
+
+ Create a dom tree consisting of elements, comments, processing instructions, CDATA sections,
+ and entity references nodes seperated by text nodes. Check the length of the node list of each
+ before and after normalize has been called.
+
+* @author IBM
+* @author Neil Delima
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize
+*/
+function nodenormalize01() {
+ var success;
+ if(checkInitialization(builder, "nodenormalize01") != null) return;
+ var doc;
+ var newDoc;
+ var domImpl;
+ var docType;
+ var docTypeNull = null;
+
+ var documentElement;
+ var element1;
+ var element2;
+ var element3;
+ var element4;
+ var element5;
+ var element6;
+ var element7;
+ var text1;
+ var text2;
+ var text3;
+ var pi;
+ var cData;
+ var comment;
+ var entRef;
+ var elementList;
+ var appendedChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ domImpl = doc.implementation;
+newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:root",docTypeNull);
+ element1 = newDoc.createElement("element1");
+ element2 = newDoc.createElement("element2");
+ element3 = newDoc.createElement("element3");
+ element4 = newDoc.createElement("element4");
+ element5 = newDoc.createElement("element5");
+ element6 = newDoc.createElement("element6");
+ element7 = newDoc.createElement("element7");
+ text1 = newDoc.createTextNode("text1");
+ text2 = newDoc.createTextNode("text2");
+ text3 = newDoc.createTextNode("text3");
+ cData = newDoc.createCDATASection("Cdata");
+ comment = newDoc.createComment("comment");
+ pi = newDoc.createProcessingInstruction("PITarget","PIData");
+ entRef = newDoc.createEntityReference("EntRef");
+ assertNotNull("createdEntRefNotNull",entRef);
+documentElement = newDoc.documentElement;
+
+ appendedChild = documentElement.appendChild(element1);
+ appendedChild = element2.appendChild(text1);
+ appendedChild = element2.appendChild(text2);
+ appendedChild = element2.appendChild(text3);
+ appendedChild = element1.appendChild(element2);
+ text1 = text1.cloneNode(false);
+ text2 = text2.cloneNode(false);
+ appendedChild = element3.appendChild(entRef);
+ appendedChild = element3.appendChild(text1);
+ appendedChild = element3.appendChild(text2);
+ appendedChild = element1.appendChild(element3);
+ text1 = text1.cloneNode(false);
+ text2 = text2.cloneNode(false);
+ appendedChild = element4.appendChild(cData);
+ appendedChild = element4.appendChild(text1);
+ appendedChild = element4.appendChild(text2);
+ appendedChild = element1.appendChild(element4);
+ text2 = text2.cloneNode(false);
+ text3 = text3.cloneNode(false);
+ appendedChild = element5.appendChild(comment);
+ appendedChild = element5.appendChild(text2);
+ appendedChild = element5.appendChild(text3);
+ appendedChild = element1.appendChild(element5);
+ text2 = text2.cloneNode(false);
+ text3 = text3.cloneNode(false);
+ appendedChild = element6.appendChild(pi);
+ appendedChild = element6.appendChild(text2);
+ appendedChild = element6.appendChild(text3);
+ appendedChild = element1.appendChild(element6);
+ entRef = entRef.cloneNode(false);
+ text1 = text1.cloneNode(false);
+ text2 = text2.cloneNode(false);
+ text3 = text3.cloneNode(false);
+ appendedChild = element7.appendChild(entRef);
+ appendedChild = element7.appendChild(text1);
+ appendedChild = element7.appendChild(text2);
+ appendedChild = element7.appendChild(text3);
+ appendedChild = element1.appendChild(element7);
+ elementList = element1.childNodes;
+
+ assertSize("nodeNormalize01_1Bef",6,elementList);
+elementList = element2.childNodes;
+
+ assertSize("nodeNormalize01_2Bef",3,elementList);
+elementList = element3.childNodes;
+
+ assertSize("nodeNormalize01_3Bef",3,elementList);
+elementList = element4.childNodes;
+
+ assertSize("nodeNormalize01_4Bef",3,elementList);
+elementList = element5.childNodes;
+
+ assertSize("nodeNormalize01_5Bef",3,elementList);
+elementList = element6.childNodes;
+
+ assertSize("nodeNormalize01_6Bef",3,elementList);
+elementList = element7.childNodes;
+
+ assertSize("nodeNormalize01_7Bef",4,elementList);
+newDoc.normalize();
+ elementList = element1.childNodes;
+
+ assertSize("nodeNormalize01_1Aft",6,elementList);
+elementList = element2.childNodes;
+
+ assertSize("nodeNormalize01_2Aft",1,elementList);
+elementList = element3.childNodes;
+
+ assertSize("nodeNormalize01_3Aft",2,elementList);
+elementList = element4.childNodes;
+
+ assertSize("nodeNormalize01_4Aft",2,elementList);
+elementList = element5.childNodes;
+
+ assertSize("nodeNormalize01_5Aft",2,elementList);
+elementList = element6.childNodes;
+
+ assertSize("nodeNormalize01_6Aft",2,elementList);
+elementList = element7.childNodes;
+
+ assertSize("nodeNormalize01_7Aft",2,elementList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodenormalize01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_normalize01.html b/dom/tests/mochitest/dom-level2-core/test_normalize01.html
new file mode 100644
index 0000000000..3264355281
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_normalize01.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/normalize01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['normalize01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'normalize01';
+
+
+/**
+*
+ The "normalize()" method puts all the nodes in the full
+ depth of the sub-tree underneath this element into a
+ "normal" form.
+
+ Retrieve the third employee and access its second child.
+ This child contains a block of text that is spread
+ across multiple lines. The content of the "name" child
+ should be parsed and treated as a single Text node.
+
+ This appears to be a duplicate of elementnormalize.xml in DOM L1 Test Suite
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-72AB8359
+*/
+function normalize01() {
+ var success;
+ if(checkInitialization(builder, "normalize01") != null) return;
+ var doc;
+ var root;
+ var elementList;
+ var firstChild;
+ var textList;
+ var textNode;
+ var data;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ root = doc.documentElement;
+
+ root.normalize();
+ elementList = root.getElementsByTagName("name");
+ firstChild = elementList.item(2);
+ textList = firstChild.childNodes;
+
+ textNode = textList.item(0);
+ data = textNode.data;
+
+ assertEquals("data","Roger\n Jones",data);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/normalize01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_ownerDocument01.html b/dom/tests/mochitest/dom-level2-core/test_ownerDocument01.html
new file mode 100644
index 0000000000..8f676c9d41
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_ownerDocument01.html
@@ -0,0 +1,117 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerDocument01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['ownerDocument01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'ownerDocument01';
+
+
+/**
+*
+ The "getOwnerDocument()" method returns null if the target
+ node itself is a DocumentType which is not used with any document yet.
+
+ Invoke the "getOwnerDocument()" method on the master
+ document. The DocumentType returned should be null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc
+*/
+function ownerDocument01() {
+ var success;
+ if(checkInitialization(builder, "ownerDocument01") != null) return;
+ var doc;
+ var ownerDocument;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ ownerDocument = doc.ownerDocument;
+
+ assertNull("throw_Null",ownerDocument);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerDocument01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_ownerElement01.html b/dom/tests/mochitest/dom-level2-core/test_ownerElement01.html
new file mode 100644
index 0000000000..ba2d14b5e2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_ownerElement01.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['ownerElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'ownerElement01';
+
+
+/**
+*
+ The "getOwnerElement()" will return the Element node this attribute
+ is attached to or null if this attribute is not in use.
+ Get the "domestic" attribute from the first "address" node.
+ Apply the "getOwnerElement()" method to get the Element associated
+ with the attribute. The value returned should be "address".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095
+*/
+function ownerElement01() {
+ var success;
+ if(checkInitialization(builder, "ownerElement01") != null) return;
+ var doc;
+ var addressList;
+ var testNode;
+ var attributes;
+ var domesticAttr;
+ var elementNode;
+ var name;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ addressList = doc.getElementsByTagName("address");
+ testNode = addressList.item(0);
+ attributes = testNode.attributes;
+
+ domesticAttr = attributes.getNamedItem("domestic");
+ elementNode = domesticAttr.ownerElement;
+
+ name = elementNode.nodeName;
+
+ assertEquals("throw_Equals","address",name);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_ownerElement02.html b/dom/tests/mochitest/dom-level2-core/test_ownerElement02.html
new file mode 100644
index 0000000000..bbc4eede86
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_ownerElement02.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['ownerElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'ownerElement02';
+
+
+/**
+*
+ The "getOwnerElement()" will return the Element node this attribute
+ is attached to or null if this attribute is not in use.
+ Create a new attribute.
+ Apply the "getOwnerElement()" method to get the Element associated
+ with the attribute. The value returned should be "null" since this
+ attribute is not in use.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
+*/
+function ownerElement02() {
+ var success;
+ if(checkInitialization(builder, "ownerElement02") != null) return;
+ var doc;
+ var newAttr;
+ var elementNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staff");
+ newAttr = doc.createAttribute("newAttribute");
+ elementNode = newAttr.ownerElement;
+
+ assertNull("throw_Null",elementNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_prefix01.html b/dom/tests/mochitest/dom-level2-core/test_prefix01.html
new file mode 100644
index 0000000000..d1ed87b2e1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_prefix01.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['prefix01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'prefix01';
+
+
+/**
+*
+ The "getPrefix()" method for a Node
+ returns the namespace prefix of the node,
+ and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
+ and nodes created with a DOM Level 1 method, this is null.
+
+ Create an new Element with the createElement() method.
+ Invoke the "getPrefix()" method on the newly created element
+ node will cause "null" to be returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix
+*/
+function prefix01() {
+ var success;
+ if(checkInitialization(builder, "prefix01") != null) return;
+ var doc;
+ var createdNode;
+ var prefix;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ createdNode = doc.createElement("test:employee");
+ prefix = createdNode.prefix;
+
+ assertNull("throw_Null",prefix);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_prefix03.html b/dom/tests/mochitest/dom-level2-core/test_prefix03.html
new file mode 100644
index 0000000000..6960ace268
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_prefix03.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['prefix03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'prefix03';
+
+
+/**
+*
+ The "getPrefix()" method for a node
+ returns the namespace prefix of this node, or null if it is unspecified.
+
+ Retrieve the first emp:employee node and invoke the getPrefix() method."
+ The method should return "emp".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix
+*/
+function prefix03() {
+ var success;
+ if(checkInitialization(builder, "prefix03") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var prefix;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:employee");
+ testEmployee = elementList.item(0);
+ assertNotNull("empEmployeeNotNull",testEmployee);
+prefix = testEmployee.prefix;
+
+ assertEquals("prefix","emp",prefix);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_prefix04.html b/dom/tests/mochitest/dom-level2-core/test_prefix04.html
new file mode 100644
index 0000000000..97fac3e3fe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_prefix04.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['prefix04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'prefix04';
+
+
+/**
+*
+ The "getPrefix()" method for a node
+ returns the namespace prefix of this node, or null if it is unspecified.
+
+ Retrieve the first employee node and invoke the getPrefix() method."
+ The method should return "null".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix
+*/
+function prefix04() {
+ var success;
+ if(checkInitialization(builder, "prefix04") != null) return;
+ var doc;
+ var elementList;
+ var testEmployee;
+ var prefix;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("employee");
+ testEmployee = elementList.item(0);
+ prefix = testEmployee.prefix;
+
+ assertNull("throw_Null",prefix);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_publicId01.html b/dom/tests/mochitest/dom-level2-core/test_publicId01.html
new file mode 100644
index 0000000000..ac57ed25bd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_publicId01.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/publicId01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['publicId01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'publicId01';
+
+
+/**
+*
+ The "getPublicId()" method of a documenttype node contains
+ the public identifier associated with the external subset.
+
+ Retrieve the documenttype.
+ Apply the "getPublicId()" method. The string "STAFF" should be
+ returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId
+*/
+function publicId01() {
+ var success;
+ if(checkInitialization(builder, "publicId01") != null) return;
+ var doc;
+ var docType;
+ var publicId;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ publicId = docType.publicId;
+
+ assertEquals("throw_Equals","STAFF",publicId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/publicId01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS01.html
new file mode 100644
index 0000000000..dfafdc4d56
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS01.html
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeAttributeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['removeAttributeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'removeAttributeNS01';
+
+
+/**
+*
+ The "removeAttributeNS(namespaceURI,localName)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to remove an attribute
+ from the entity reference by executing the
+ "removeAttributeNS(namespaceURI,localName)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElRemAtNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+*/
+function removeAttributeNS01() {
+ var success;
+ if(checkInitialization(builder, "removeAttributeNS01") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var gen;
+ var gList;
+ var genElement;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ gen = gender.firstChild;
+
+ nodeType = gen.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ gen = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",gen);
+
+ }
+ gList = gen.childNodes;
+
+ genElement = gList.item(0);
+ assertNotNull("notnull",genElement);
+
+ {
+ success = false;
+ try {
+ genElement.removeAttributeNS("www.xyz.com","local1");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeAttributeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS02.html
new file mode 100644
index 0000000000..5b790fcf1a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS02.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeAttributeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['removeAttributeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+ setImplementationAttribute("validating", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'removeAttributeNS02';
+
+
+/**
+*
+ The "removeAttributeNS(namespaceURI,localName)" removes an attribute by
+ local name and namespace URI. If the removed attribute has a
+ default value it is immediately replaced. The replacing attribute has the same
+ namespace URI and local name, as well as the original prefix.
+
+ Retrieve the attribute named "emp:local" from emp:address
+ node, then remove the "emp:local"
+ attribute by invoking the "removeAttributeNS(namespaceURI,localName)" method.
+ The "emp:local" attribute has a default value defined in the
+ DTD file, that value should immediately replace the old
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238
+*/
+function removeAttributeNS02() {
+ var success;
+ if(checkInitialization(builder, "removeAttributeNS02") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var attr;
+ var namespaceURI;
+ var localName;
+ var prefix;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ testAddr.removeAttributeNS("http://www.nist.gov","local1");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","local1");
+ attr = testAddr.getAttributeNS("http://www.nist.gov","local1");
+ namespaceURI = addrAttr.namespaceURI;
+
+ localName = addrAttr.localName;
+
+ prefix = testAddr.prefix;
+
+ assertEquals("attr","FALSE",attr);
+ assertEquals("uri","http://www.nist.gov",namespaceURI);
+ assertEquals("lname","local1",localName);
+ assertEquals("prefix","emp",prefix);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeAttributeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS01.html b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS01.html
new file mode 100644
index 0000000000..6d85b8d01d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS01.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['removeNamedItemNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'removeNamedItemNS01';
+
+
+/**
+*
+ The "removeNamedItemNS(namespaceURI,localName)" method for a
+ NamedNodeMap should remove a node specified by localName and namespaceURI.
+
+ Retrieve a list of elements with tag name "address".
+ Access the second element from the list and get its attributes.
+ Try to remove the attribute node with local name "domestic"
+ and namespace uri "http://www.usa.com" with
+ method removeNamedItemNS(namespaceURI,localName).
+ Check to see if the node has been removed.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1074577549
+*/
+function removeNamedItemNS01() {
+ var success;
+ if(checkInitialization(builder, "removeNamedItemNS01") != null) return;
+ var doc;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var newAttr;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(1);
+ attributes = testAddress.attributes;
+
+ removedNode = attributes.removeNamedItemNS("http://www.usa.com","domestic");
+ assertNotNull("retval",removedNode);
+newAttr = attributes.getNamedItem("dmstc:domestic");
+ assertNull("nodeRemoved",newAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS02.html b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS02.html
new file mode 100644
index 0000000000..132ec5599d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS02.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['removeNamedItemNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'removeNamedItemNS02';
+
+
+/**
+*
+ The "removeNamedItemNS(namespaceURI,localName)" method for a
+ NamedNodeMap should raise NOT_FOUND_ERR DOMException if
+ there is no node with the specified namespaceURI and localName in this map.
+
+ Retrieve a list of elements with tag name "address".
+ Access the second element from the list and get its attributes.
+ Try to remove an attribute node with local name "domest"
+ and namespace uri "http://www.usa.com" with
+ method removeNamedItemNS(namespaceURI,localName).
+ This should raise NOT_FOUND_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
+*/
+function removeNamedItemNS02() {
+ var success;
+ if(checkInitialization(builder, "removeNamedItemNS02") != null) return;
+ var namespaceURI = "http://www.usa.com";
+ var localName = "domest";
+ var doc;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var removedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(1);
+ attributes = testAddress.attributes;
+
+
+ {
+ success = false;
+ try {
+ removedNode = attributes.removeNamedItemNS(namespaceURI,localName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS03.html b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS03.html
new file mode 100644
index 0000000000..0b41f3fc0a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS03.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['removeNamedItemNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'removeNamedItemNS03';
+
+
+/**
+*
+ The "removeNamedItemNS(namespaceURI,localName)" method for a
+ NamedNodeMap should raise NO_MODIFICATION_ALLOWED_ERR DOMException if
+ this map is readonly.
+
+ Retrieve a list of "gender" elements. Get access to the THIRD element
+ which contains an ENTITY_REFERENCE child node. Try to remove the attribute
+ in the node's map with method removeNamedItemNS(namespaceURI,localName).
+ This should result in NO_MODIFICATION_ALLOWED_ERR
+ DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+*/
+function removeNamedItemNS03() {
+ var success;
+ if(checkInitialization(builder, "removeNamedItemNS03") != null) return;
+ var namespaceURI = "http://www.w3.org/2000/xmlns/";
+ var localName = "local1";
+ var doc;
+ var elementList;
+ var testAddress;
+ var nList;
+ var child;
+ var n2List;
+ var child2;
+ var attributes;
+ var removedNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("gender");
+ testAddress = elementList.item(2);
+ nList = testAddress.childNodes;
+
+ child = nList.item(0);
+ nodeType = child.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ child = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",child);
+
+ }
+ n2List = child.childNodes;
+
+ child2 = n2List.item(0);
+ assertNotNull("notnull",child2);
+attributes = child2.attributes;
+
+
+ {
+ success = false;
+ try {
+ removedNode = attributes.removeNamedItemNS(namespaceURI,localName);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS01.html
new file mode 100644
index 0000000000..68abcf4915
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS01.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS01';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,qualifiedName,Value)" method raises a
+ INVALID_CHARACTER_ERR DOMException if the specified
+ prefix contains an illegal character.
+
+ Attempt to add a new attribute on the first employee node.
+ An exception should be raised since the "qualifiedName" has an invalid
+ character.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+*/
+function setAttributeNS01() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS01") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var qualifiedName = "emp:qual?name";
+ var doc;
+ var elementList;
+ var testAddr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("employee");
+ testAddr = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.html
new file mode 100644
index 0000000000..162cb66649
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS02';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,qualifiedName,value)" method raises a
+ NAMESPACE_ERR DOMException if the specified
+ qualifiedName if malformed.
+
+ Attempt to add a new attribute on the second employee node.
+ An exception should be raised since the "qualifiedName" is malformed.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function setAttributeNS02() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS02") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var qualifiedName = "emp:";
+ var doc;
+ var elementList;
+ var testAddr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:employee");
+ testAddr = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue");
+ }
+ catch(ex) {
+ success = ex.code === DOMException.INVALID_CHARACTER_ERR;
+ }
+ assertTrue("throw INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS03.html
new file mode 100644
index 0000000000..98afdb02da
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS03.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS03';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,qualifiedName,value)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to set an attribute
+ in the entity reference by executing the
+ "setAttributeNS(namespaceURI,qualifiedName,value)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+*/
+function setAttributeNS03() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS03") != null) return;
+ var namespaceURI = "www.xyz.com";
+ var qualifiedName = "emp:local1";
+ var doc;
+ var genderList;
+ var gender;
+ var genList;
+ var gen;
+ var gList;
+ var genElement;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ genList = gender.childNodes;
+
+ gen = genList.item(0);
+ nodeType = gen.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ gen = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",gen);
+
+ }
+ gList = gen.childNodes;
+
+ genElement = gList.item(0);
+ assertNotNull("notnull",genElement);
+
+ {
+ success = false;
+ try {
+ genElement.setAttributeNS(namespaceURI,qualifiedName,"newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS04.html
new file mode 100644
index 0000000000..f06f726904
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS04.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS04';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute.
+ If an attribute with the same local name and namespace URI is already present
+ on the element, its prefix is changed to be the prefix part of the "qualifiedName",
+ and its vale is changed to be the "value" paramter.
+ null value if no previously existing Attr node with the
+ same name was replaced.
+
+ Add a new attribute to the "emp:address" element.
+ Check to see if the new attribute has been successfully added to the document
+ by getting the attributes value, namespace URI, local Name and prefix.
+ The prefix will be changed to the prefix part of the "qualifiedName"
+ and its value changed to the "value" parameter.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#
+*/
+function setAttributeNS04() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS04") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var resultAttr;
+ var resultNamespaceURI;
+ var resultLocalName;
+ var resultPrefix;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+testAddr.setAttributeNS("http://www.nist.gov","newprefix:zone","newValue");
+ addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","zone");
+ resultAttr = testAddr.getAttributeNS("http://www.nist.gov","zone");
+ assertEquals("attrValue","newValue",resultAttr);
+ resultNamespaceURI = addrAttr.namespaceURI;
+
+ assertEquals("nsuri","http://www.nist.gov",resultNamespaceURI);
+ resultLocalName = addrAttr.localName;
+
+ assertEquals("lname","zone",resultLocalName);
+ resultPrefix = addrAttr.prefix;
+
+ assertEquals("prefix","newprefix",resultPrefix);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS05.html
new file mode 100644
index 0000000000..443c817f5b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS05.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS05';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute.
+ If an attribute with the same local name and namespace URI is already present
+ on the element, its prefix is changed to be the prefix part of the "qualifiedName",
+ and its vale is changed to be the "value" paramter.
+ null value if no previously existing Attr node with the
+ same name was replaced.
+
+ Add a new attribute to the "emp:address" element.
+ Check to see if the new attribute has been successfully added to the document.
+ The new attribute "<newValue>" contains markup and therefore is escaped
+ by the implementation.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS
+*/
+function setAttributeNS05() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS05") != null) return;
+ var localName = "newAttr";
+ var namespaceURI = "http://www.newattr.com";
+ var qualifiedName = "emp:newAttr";
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var resultAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+testAddr.setAttributeNS(namespaceURI,qualifiedName,"<newValue>");
+ resultAttr = testAddr.getAttributeNS(namespaceURI,localName);
+ assertEquals("throw_Equals","<newValue>",resultAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS06.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS06.html
new file mode 100644
index 0000000000..df92c69281
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS06</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS06';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,localName,value)" method raises a
+ NAMESPACE_ERR DOMException if the "qualifiedName" has a
+ prefix of "xml" and the namespaceURI is different from
+ http://www.w3.org/XML/1998/namespace.
+
+ Attempt to add an attribute with a prefix of "xml" as the on the first employee node.
+ An exception should be raised since the namespaceURI of this node is not
+ http://www.w3.org/XML/1998/namespace.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function setAttributeNS06() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS06") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var qualifiedName = "xml:qualifiedName";
+ var doc;
+ var elementList;
+ var testAddr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("employee");
+ testAddr = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS06</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS07.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS07.html
new file mode 100644
index 0000000000..d36789de24
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS07.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS07</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS07';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,localName,value)" method raises a
+ NAMESPACE_ERR DOMException if the "qualifiedName" has a
+ value of "xmlns" and the namespaceURI is different from
+ http://www.w3.org/2000/xmlns.
+
+ Attempt to add an attribute with a "qualifiedName" of "xmlns" as the
+ on the first employee node.
+ An exception should be raised since the namespaceURI of this node is not
+ http://www.w3.org/2000/xmlns.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])
+*/
+function setAttributeNS07() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS07") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var qualifiedName = "xmlns";
+ var doc;
+ var elementList;
+ var testAddr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("employee");
+ testAddr = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ assertTrue("throw_NAMESPACE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS07</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS09.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS09.html
new file mode 100644
index 0000000000..3b0ca22005
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS09.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS09</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS09';
+
+
+/**
+*
+ The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute.
+ If an attribute with the same local name and namespace URI is already present
+ on the element, its prefix is changed to be the prefix part of the "qualifiedName",
+ and its vale is changed to be the "value" paramter.
+ null value if no previously existing Attr node with the
+ same name was replaced.
+
+ Add a new attribute to the "emp:address" element.
+ Check to see if the new attribute has been successfully added to the document
+ by getting the attributes value, namespace URI, local Name and prefix.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+*/
+function setAttributeNS09() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS09") != null) return;
+ var localName = "newAttr";
+ var namespaceURI = "http://www.newattr.com";
+ var qualifiedName = "emp:newAttr";
+ var doc;
+ var elementList;
+ var testAddr;
+ var addrAttr;
+ var resultAttr;
+ var resultNamespaceURI;
+ var resultLocalName;
+ var resultPrefix;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue");
+ addrAttr = testAddr.getAttributeNodeNS(namespaceURI,localName);
+ resultAttr = testAddr.getAttributeNS(namespaceURI,localName);
+ assertEquals("attrValue","newValue",resultAttr);
+ resultNamespaceURI = addrAttr.namespaceURI;
+
+ assertEquals("nsuri","http://www.newattr.com",resultNamespaceURI);
+ resultLocalName = addrAttr.localName;
+
+ assertEquals("lname","newAttr",resultLocalName);
+ resultPrefix = addrAttr.prefix;
+
+ assertEquals("prefix","emp",resultPrefix);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS09</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS10.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS10.html
new file mode 100644
index 0000000000..0d2ff8b2e8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS10.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS10</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNS10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hc_staff");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNS10';
+
+
+/**
+*
+Element.setAttributeNS with an empty qualified name should cause an INVALID_CHARACTER_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
+*/
+function setAttributeNS10() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNS10") != null) return;
+ var namespaceURI = "http://www.example.gov";
+ var doc;
+ var elementList;
+ var testAddr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hc_staff");
+ elementList = doc.getElementsByTagName("em");
+ testAddr = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ testAddr.setAttributeNS(namespaceURI,"","newValue");
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 5);
+ }
+ assertTrue("throw_INVALID_CHARACTER_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS10</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+<iframe name="doc" src="files/hc_staff.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS01.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS01.html
new file mode 100644
index 0000000000..80407cd9cb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS01.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNodeNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNodeNS01';
+
+
+/**
+*
+ The "setAttributeNode(newAttr)" method raises an
+ "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr"
+ is already an attribute of another element.
+
+ Retrieve the first emp:address and append
+ a newly created element. The "createAttributeNS(namespaceURI,qualifiedName)"
+ and "setAttributeNodeNS(newAttr)" methods are invoked
+ to create and add a new attribute to the newly created
+ Element. The "setAttributeNodeNS(newAttr)" method is
+ once again called to add the new attribute causing an
+ exception to be raised since the attribute is already
+ an attribute of another element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+*/
+function setAttributeNodeNS01() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNodeNS01") != null) return;
+ var namespaceURI = "http://www.newattr.com";
+ var qualifiedName = "emp:newAttr";
+ var doc;
+ var newElement;
+ var newAttr;
+ var elementList;
+ var testAddr;
+ var appendedChild;
+ var setAttr1;
+ var setAttr2;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+newElement = doc.createElement("newElement");
+ appendedChild = testAddr.appendChild(newElement);
+ newAttr = doc.createAttributeNS(namespaceURI,qualifiedName);
+ setAttr1 = newElement.setAttributeNodeNS(newAttr);
+
+ {
+ success = false;
+ try {
+ setAttr2 = testAddr.setAttributeNodeNS(newAttr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("throw_INUSE_ATTRIBUTE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS02.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS02.html
new file mode 100644
index 0000000000..7fd7447f94
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS02.html
@@ -0,0 +1,160 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNodeNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", false);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNodeNS02';
+
+
+/**
+*
+ The "setAttributeNodeNS(namespaceURI,qualifiedName,value)" method for an attribute causes the
+ DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
+ if the node is readonly.
+
+ Obtain the children of the THIRD "gender" element. The elements
+ content is an entity reference. Try to set an attribute
+ in the entity reference by executing the
+ "setAttributeNodeNS(newAttr)" method.
+ This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+*/
+function setAttributeNodeNS02() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNodeNS02") != null) return;
+ var doc;
+ var genderList;
+ var gender;
+ var genList;
+ var gen;
+ var gList;
+ var genElement;
+ var newAttr;
+ var setAttr1;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ if(
+ (getImplementationAttribute("expandEntityReferences") == false)
+ ) {
+ genderList = doc.getElementsByTagName("gender");
+ gender = genderList.item(2);
+ genList = gender.childNodes;
+
+ gen = genList.item(0);
+
+ }
+
+ else {
+ gen = doc.createEntityReference("ent4");
+
+ }
+ gList = gen.childNodes;
+
+ genElement = gList.item(0);
+ assertNotNull("notnull",genElement);
+newAttr = doc.createAttributeNS("www.xyz.com","emp:local1");
+
+ {
+ success = false;
+ try {
+ setAttr1 = genElement.setAttributeNodeNS(newAttr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS03.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS03.html
new file mode 100644
index 0000000000..c68f5c35bb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS03.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNodeNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNodeNS03';
+
+
+/**
+*
+ The "setAttributeNodeNS(newAttr)" adds a new attribute.
+ If an attribute with that local name and that namespaceURI is already
+ present in the element, it is replaced by the new one.
+
+ Retrieve the first emp:address element and add a new attribute
+ to the element. Since an attribute with the same local name
+ and namespaceURI as the newly created attribute does not exist
+ the value "null" is returned.
+ This test uses the "createAttributeNS(namespaceURI,localName)
+ method from the Document interface to create the new attribute to add.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+*/
+function setAttributeNodeNS03() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNodeNS03") != null) return;
+ var namespaceURI = "http://www.newattr.com";
+ var qualifiedName = "emp:newAttr";
+ var doc;
+ var elementList;
+ var testAddr;
+ var newAttr;
+ var newAddrAttr;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+newAttr = doc.createAttributeNS(namespaceURI,qualifiedName);
+ newAddrAttr = testAddr.setAttributeNodeNS(newAttr);
+ assertNull("throw_Null",newAddrAttr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS04.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS04.html
new file mode 100644
index 0000000000..c2bf1a372c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS04.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNodeNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNodeNS04';
+
+
+/**
+*
+ The "setAttributeNodeNS(newAttr)" adds a new attribute.
+ If an attribute with that local name and that namespaceURI is already
+ present in the element, it is replaced by the new one.
+
+ Retrieve the first emp:address element and add a new attribute
+ to the element. Since an attribute with the same local name
+ and namespaceURI already exists, it is replaced by the new one and
+ returns the replaced "Attr" node.
+ This test uses the "createAttributeNS(namespaceURI,localName)
+ method from the Document interface to create the new attribute to add.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095
+*/
+function setAttributeNodeNS04() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNodeNS04") != null) return;
+ var doc;
+ var elementList;
+ var testAddr;
+ var newAttr;
+ var newAddrAttr;
+ var newName;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+ assertNotNull("empAddrNotNull",testAddr);
+newAttr = doc.createAttributeNS("http://www.nist.gov","xxx:domestic");
+ newAddrAttr = testAddr.setAttributeNodeNS(newAttr);
+ newName = newAddrAttr.nodeName;
+
+ assertEquals("nodeName","emp:domestic",newName);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS05.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS05.html
new file mode 100644
index 0000000000..726fd2091a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS05.html
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setAttributeNodeNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ docsLoaded += preload(doc1Ref, "doc1", "staffNS");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ docsLoaded += preload(doc2Ref, "doc2", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setAttributeNodeNS05';
+
+
+/**
+*
+ The "setAttributeNodeNS(newAttr)" method raises an
+ "WRONG_DOCUMENT_ERR DOMException if the "newAttr"
+ was created from a different document than the one that
+ created this document.
+
+ Retrieve the first emp:address and attempt to set a new
+ attribute node. The new
+ attribute was created from a document other than the
+ one that created this element, therefore a
+ WRONG_DOCUMENT_ERR DOMException should be raised.
+ This test uses the "createAttributeNS(newAttr)" method
+ from the Document interface.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+*/
+function setAttributeNodeNS05() {
+ var success;
+ if(checkInitialization(builder, "setAttributeNodeNS05") != null) return;
+ var namespaceURI = "http://www.newattr.com";
+ var qualifiedName = "emp:newAttr";
+ var doc1;
+ var doc2;
+ var newAttr;
+ var elementList;
+ var testAddr;
+ var setAttr1;
+
+ var doc1Ref = null;
+ if (typeof(this.doc1) != 'undefined') {
+ doc1Ref = this.doc1;
+ }
+ doc1 = load(doc1Ref, "doc1", "staffNS");
+
+ var doc2Ref = null;
+ if (typeof(this.doc2) != 'undefined') {
+ doc2Ref = this.doc2;
+ }
+ doc2 = load(doc2Ref, "doc2", "staffNS");
+ newAttr = doc2.createAttributeNS(namespaceURI,qualifiedName);
+ elementList = doc1.getElementsByTagName("emp:address");
+ testAddr = elementList.item(0);
+
+ {
+ success = false;
+ try {
+ setAttr1 = testAddr.setAttributeNodeNS(newAttr);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS01.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS01.html
new file mode 100644
index 0000000000..31bf521d11
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS01.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setNamedItemNS01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setNamedItemNS01';
+
+
+/**
+*
+ The "setNamedItemNS(arg)" method for a
+ NamedNodeMap should raise INUSE_ATTRIBUTE_ERR DOMException if
+ arg is an Attr that is already an attribute of another Element object.
+
+ Retrieve an attr node from the third "address" element whose local name
+ is "domestic" and namespaceURI is "http://www.netzero.com".
+ Invoke method setNamedItemNS(arg) on the map of the first "address" element with
+ arg being the attr node from above. Method should raise
+ INUSE_ATTRIBUTE_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])
+*/
+function setNamedItemNS01() {
+ var success;
+ if(checkInitialization(builder, "setNamedItemNS01") != null) return;
+ var doc;
+ var elementList;
+ var anotherElement;
+ var anotherMap;
+ var arg;
+ var testAddress;
+ var map;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("address");
+ anotherElement = elementList.item(2);
+ anotherMap = anotherElement.attributes;
+
+ arg = anotherMap.getNamedItemNS("http://www.netzero.com","domestic");
+ testAddress = elementList.item(0);
+ map = testAddress.attributes;
+
+
+ {
+ success = false;
+ try {
+ setNode = map.setNamedItemNS(arg);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 10);
+ }
+ assertTrue("throw_INUSE_ATTRIBUTE_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS02.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS02.html
new file mode 100644
index 0000000000..d33346db17
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS02.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS02</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setNamedItemNS02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ var anotherDocRef = null;
+ if (typeof(this.anotherDoc) != 'undefined') {
+ anotherDocRef = this.anotherDoc;
+ }
+ docsLoaded += preload(anotherDocRef, "anotherDoc", "staffNS");
+
+ if (docsLoaded == 2) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 2) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setNamedItemNS02';
+
+
+/**
+*
+ The "setNamedItemNS(arg)" method for a
+ NamedNodeMap should raise WRONG_DOCUMENT_ERR DOMException if arg was
+ created from a different document than the one that created this map.
+
+ Create an attr node in a different document with qualifiedName equals
+ "dmstc:domestic" and namespaceURI is "http://www.usa.com".
+ Access the namednodemap of the first "address" element in this document.
+ Invoke method setNamedItemNS(arg) with arg being the attr node from above.
+ Method should raise WRONG_DOCUMENT_ERR DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])
+*/
+function setNamedItemNS02() {
+ var success;
+ if(checkInitialization(builder, "setNamedItemNS02") != null) return;
+ var namespaceURI = "http://www.usa.com";
+ var qualifiedName = "dmstc:domestic";
+ var doc;
+ var anotherDoc;
+ var arg;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+
+ var anotherDocRef = null;
+ if (typeof(this.anotherDoc) != 'undefined') {
+ anotherDocRef = this.anotherDoc;
+ }
+ anotherDoc = load(anotherDocRef, "anotherDoc", "staffNS");
+ arg = anotherDoc.createAttributeNS(namespaceURI,qualifiedName);
+ arg.nodeValue = "Maybe";
+
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(0);
+ attributes = testAddress.attributes;
+
+
+ {
+ success = false;
+ try {
+ setNode = attributes.setNamedItemNS(arg);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 4);
+ }
+ assertTrue("throw_WRONG_DOCUMENT_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS02</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS03.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS03.html
new file mode 100644
index 0000000000..3c747fb451
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS03.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS03</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setNamedItemNS03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setNamedItemNS03';
+
+
+/**
+*
+ The "setNamedItemNS(arg)" method for a
+ NamedNodeMap should add a node using its namespaceURI and localName given that
+ there is no existing node with the same namespaceURI and localName in the map.
+
+ Create an attr node with namespaceURI "http://www.nist.gov",qualifiedName
+ "prefix:newAttr" and value "newValue".
+ Invoke method setNamedItemNS(arg) on the map of the first "address"
+ element where arg is identified by the namespaceURI and qualifiedName
+ from above. Method should return the newly added attr node.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D080
+*/
+function setNamedItemNS03() {
+ var success;
+ if(checkInitialization(builder, "setNamedItemNS03") != null) return;
+ var namespaceURI = "http://www.nist.gov";
+ var qualifiedName = "prefix:newAttr";
+ var doc;
+ var arg;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var retnode;
+ var value;
+ var setNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ arg = doc.createAttributeNS(namespaceURI,qualifiedName);
+ arg.nodeValue = "newValue";
+
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(0);
+ attributes = testAddress.attributes;
+
+ setNode = attributes.setNamedItemNS(arg);
+ retnode = attributes.getNamedItemNS(namespaceURI,"newAttr");
+ value = retnode.nodeValue;
+
+ assertEquals("throw_Equals","newValue",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS03</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS04.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS04.html
new file mode 100644
index 0000000000..a53ecfd0a9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS04.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS04</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setNamedItemNS04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+ setImplementationAttribute("namespaceAware", true);
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setNamedItemNS04';
+
+
+/**
+*
+ The "setNamedItemNS(arg)" method for a
+ NamedNodeMap should raise NO_MODIFICATION_ALLOWED_ERR DOMException if
+ this map is readonly.
+
+ Retrieve a list of "gender" elements. Get access to the THIRD element
+ which contains an ENTITY_REFERENCE child node. Get access to the node's
+ map. Try to add an attribute node specified by arg with
+ method setNamedItemNS(arg). This should result in NO_MODIFICATION_ALLOWED_ERR
+ DOMException.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])
+*/
+function setNamedItemNS04() {
+ var success;
+ if(checkInitialization(builder, "setNamedItemNS04") != null) return;
+ var namespaceURI = "http://www.w3.org/2000/xmlns/";
+ var localName = "local1";
+ var doc;
+ var elementList;
+ var testAddress;
+ var nList;
+ var child;
+ var n2List;
+ var child2;
+ var attributes;
+ var arg;
+ var setNode;
+ var nodeType;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ elementList = doc.getElementsByTagName("gender");
+ testAddress = elementList.item(2);
+ nList = testAddress.childNodes;
+
+ child = nList.item(0);
+ nodeType = child.nodeType;
+
+
+ if(
+ (1 == nodeType)
+ ) {
+ child = doc.createEntityReference("ent4");
+ assertNotNull("createdEntRefNotNull",child);
+
+ }
+ n2List = child.childNodes;
+
+ child2 = n2List.item(0);
+ assertNotNull("notnull",child2);
+attributes = child2.attributes;
+
+ arg = attributes.getNamedItemNS(namespaceURI,localName);
+
+ {
+ success = false;
+ try {
+ setNode = attributes.setNamedItemNS(arg);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 7);
+ }
+ assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS04</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS05.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS05.html
new file mode 100644
index 0000000000..ca12b04188
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS05.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS05</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['setNamedItemNS05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'setNamedItemNS05';
+
+
+/**
+*
+ The "setNamedItemNS(arg)" method for a
+ NamedNodeMap should replace an existing node n1 found in the map with arg if n1
+ has the same namespaceURI and localName as arg and return n1.
+
+ Create an attribute node in with namespaceURI "http://www.usa.com"
+ and qualifiedName "dmstc:domestic" whose value is "newVal".
+ Invoke method setNamedItemNS(arg) on the map of the first "address"
+ element. Method should return the old attribute node identified
+ by namespaceURI and qualifiedName from above,whose value is "Yes".
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS
+*/
+function setNamedItemNS05() {
+ var success;
+ if(checkInitialization(builder, "setNamedItemNS05") != null) return;
+ var namespaceURI = "http://www.usa.com";
+ var qualifiedName = "dmstc:domestic";
+ var doc;
+ var arg;
+ var elementList;
+ var testAddress;
+ var attributes;
+ var retnode;
+ var value;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ arg = doc.createAttributeNS(namespaceURI,qualifiedName);
+ arg.nodeValue = "newValue";
+
+ elementList = doc.getElementsByTagName("address");
+ testAddress = elementList.item(0);
+ attributes = testAddress.attributes;
+
+ retnode = attributes.setNamedItemNS(arg);
+ value = retnode.nodeValue;
+
+ assertEquals("throw_Equals","Yes",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS05</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-core/test_systemId01.html b/dom/tests/mochitest/dom-level2-core/test_systemId01.html
new file mode 100644
index 0000000000..09b29ea1df
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/test_systemId01.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/systemId01</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="DOMTestCase.js"></script>
+<script type="text/javascript" src="exclusions.js"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['systemId01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "staffNS");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ markTodos();
+ SimpleTest.finish();
+ }
+}
+
+var docName = 'systemId01';
+
+
+/**
+*
+ The "getSystemId()" method of a documenttype node contains
+ the system identifier associated with the external subset.
+
+ Retrieve the documenttype.
+ Apply the "getSystemId()" method. The string "staffNS.dtd" should be
+ returned.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId
+*/
+function systemId01() {
+ var success;
+ if(checkInitialization(builder, "systemId01") != null) return;
+ var doc;
+ var docType;
+ var systemId;
+ var index;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "staffNS");
+ docType = doc.doctype;
+
+ systemId = docType.systemId;
+
+ assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,systemId);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/systemId01</h2>
+<p></p>
+<p>
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, European Research Consortium
+for Informatics and Mathematics, Keio University). All
+Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/DOMTestCase.js b/dom/tests/mochitest/dom-level2-html/DOMTestCase.js
new file mode 100644
index 0000000000..3747e3962c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/DOMTestCase.js
@@ -0,0 +1,718 @@
+/*
+Copyright (c) 2001-2005 World Wide Web Consortium,
+(Massachusetts Institute of Technology, Institut National de
+Recherche en Informatique et en Automatique, Keio University). All
+Rights Reserved. This program is distributed under the W3C's Software
+Intellectual Property License. This program is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.
+See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+*/
+
+function assertNull(descr, actual) {
+ return ok(actual === null, descr);
+}
+
+
+function assertNotNull(descr, actual) {
+ return ok(actual !== null, descr);
+}
+
+function assertTrue(descr, actual) {
+ return ok(actual === true, descr);
+}
+
+function assertFalse(descr, actual) {
+ return ok(actual === false, descr);
+}
+
+function assertEquals(descr, expected, actual) {
+ return is(actual, expected, descr);
+}
+
+ function assertSize(descr, expected, actual) {
+ ok(actual !== null, descr);
+/*
+ // Work around too strict checks.
+ if (!actual) {
+ ok(actual, "[assertSize()] 'actual' has a value");
+ return;
+ }
+*/
+
+ is(actual.length, expected, descr);
+ }
+
+ function assertEqualsAutoCase(context, descr, expected, actual) {
+ if (builder.contentType == "text/html") {
+ if(context == "attribute") {
+ is(actual.toLowerCase(), expected.toLowerCase(), descr);
+ } else {
+ is(actual, expected.toUpperCase(), descr);
+ }
+ } else {
+ is(actual, expected, descr);
+ }
+ }
+
+
+ function assertEqualsCollectionAutoCase(context, descr, expected, actual) {
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+
+ //
+ // if there length is the same, then every entry in the expected list
+ // must appear once and only once in the actual list
+ var expectedLen = expected.length;
+ var expectedValue;
+ var actualLen = actual.length;
+ var i;
+ var j;
+ var matches;
+ for(i = 0; i < expectedLen; i++) {
+ matches = 0;
+ expectedValue = expected[i];
+ for(j = 0; j < actualLen; j++) {
+ if (builder.contentType == "text/html") {
+ if (context == "attribute") {
+ if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
+ matches++;
+ }
+ } else {
+ if (expectedValue.toUpperCase() == actual[j]) {
+ matches++;
+ }
+ }
+ } else {
+ if(expectedValue == actual[j]) {
+ matches++;
+ }
+ }
+ }
+ if(matches == 0) {
+ ok(false, descr + ": No match found for " + expectedValue);
+ }
+ if(matches > 1) {
+ ok(false, descr + ": Multiple matches found for " + expectedValue);
+ }
+ }
+ }
+
+ function assertEqualsCollection(descr, expected, actual) {
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ //
+ // if there length is the same, then every entry in the expected list
+ // must appear once and only once in the actual list
+ var expectedLen = expected.length;
+ var expectedValue;
+ var actualLen = actual.length;
+ var i;
+ var j;
+ var matches;
+ for(i = 0; i < expectedLen; i++) {
+ matches = 0;
+ expectedValue = expected[i];
+ for(j = 0; j < actualLen; j++) {
+ if(expectedValue == actual[j]) {
+ matches++;
+ }
+ }
+ if(matches == 0) {
+ ok(false, descr + ": No match found for " + expectedValue);
+ }
+ if(matches > 1) {
+ ok(false, descr + ": Multiple matches found for " + expectedValue);
+ }
+ }
+ }
+
+
+ function assertEqualsListAutoCase(context, descr, expected, actual) {
+ var minLength = expected.length;
+ if (actual.length < minLength) {
+ minLength = actual.length;
+ }
+ //
+ for(var i = 0; i < minLength; i++) {
+ assertEqualsAutoCase(context, descr, expected[i], actual[i]);
+ }
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ }
+
+
+ function assertEqualsList(descr, expected, actual) {
+ var minLength = expected.length;
+ if (actual.length < minLength) {
+ minLength = actual.length;
+ }
+ //
+ for(var i = 0; i < minLength; i++) {
+ if(expected[i] != actual[i]) {
+ is(actual[i], expected[i], descr);
+ }
+ }
+ //
+ // if they aren't the same size, they aren't equal
+ is(actual.length, expected.length, descr);
+ }
+
+ function assertInstanceOf(descr, type, obj) {
+ if(type == "Attr") {
+ is(2, obj.nodeType, descr);
+ var specd = obj.specified;
+ }
+/*
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_is(type, "Attr", "[DOMTestCase.assertInstanceOf()] Fake default check.");
+ }
+*/
+ }
+
+ function assertSame(descr, expected, actual) {
+ if(expected != actual) {
+ is(expected.nodeType, actual.nodeType, descr);
+ is(expected.nodeValue, actual.nodeValue, descr);
+ }
+/*
+ else {
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ todo_isnot(expected, actual, "[DOMTestCase.assertSame()] Fake default check." +
+ " (Type=" + actual.nodeType + ", Value=" + actual.nodeValue + ")");
+ }
+*/
+ }
+
+ function assertURIEquals(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) {
+ //
+ // URI must be non-null
+ ok(assertID, "[assertURIEquals()] 'assertID' has a value");
+ ok(actual, "[assertURIEquals()] 'actual' has a value");
+/*
+ // Add missing early return.
+ if (!actual)
+ return;
+*/
+
+ var uri = actual;
+
+ var lastPound = actual.lastIndexOf("#");
+ var actualFragment = "";
+ if(lastPound != -1) {
+ //
+ // substring before pound
+ //
+ uri = actual.substring(0,lastPound);
+ actualFragment = actual.substring(lastPound+1);
+ }
+ if(fragment != null) is(actualFragment, fragment, assertID);
+
+ var lastQuestion = uri.lastIndexOf("?");
+ var actualQuery = "";
+ if(lastQuestion != -1) {
+ //
+ // substring before pound
+ //
+ uri = actual.substring(0,lastQuestion);
+ actualQuery = actual.substring(lastQuestion+1);
+ }
+ if(query != null) is(actualQuery, query, assertID);
+
+ var firstColon = uri.indexOf(":");
+ var firstSlash = uri.indexOf("/");
+ var actualPath = uri;
+ var actualScheme = "";
+ if(firstColon != -1 && firstColon < firstSlash) {
+ actualScheme = uri.substring(0,firstColon);
+ actualPath = uri.substring(firstColon + 1);
+ }
+
+ if(scheme != null) {
+ is(scheme, actualScheme, assertID);
+ }
+
+ if(path != null) {
+ is(path, actualPath, assertID);
+ }
+
+ if(host != null) {
+ var actualHost = "";
+ if(actualPath.substring(0,2) == "//") {
+ var termSlash = actualPath.substring(2).indexOf("/") + 2;
+ actualHost = actualPath.substring(0,termSlash);
+ }
+ is(actualHost, host, assertID);
+ }
+
+ if(file != null || name != null) {
+ var actualFile = actualPath;
+ var finalSlash = actualPath.lastIndexOf("/");
+ if(finalSlash != -1) {
+ actualFile = actualPath.substring(finalSlash+1);
+ }
+ if (file != null) {
+ is(actualFile, file, assertID);
+ }
+ if (name != null) {
+ var actualName = actualFile;
+ var finalDot = actualFile.lastIndexOf(".");
+ if (finalDot != -1) {
+ actualName = actualName.substring(0, finalDot);
+ }
+ is(actualName, name, assertID);
+ }
+ }
+
+ if(isAbsolute != null) {
+ is(actualPath.substring(0,1) == "/", isAbsolute, assertID);
+ }
+ }
+
+
+// size() used by assertSize element
+function size(collection)
+{
+ return collection.length;
+}
+
+function same(expected, actual)
+{
+ return expected === actual;
+}
+
+function getSuffix(contentType) {
+ switch(contentType) {
+ case "text/html":
+ return ".html";
+
+ case "text/xml":
+ return ".xml";
+
+ case "application/xhtml+xml":
+ return ".xhtml";
+
+ case "image/svg+xml":
+ return ".svg";
+
+ case "text/mathml":
+ return ".mml";
+ }
+ return ".html";
+}
+
+function equalsAutoCase(context, expected, actual) {
+ if (builder.contentType == "text/html") {
+ if (context == "attribute") {
+ return expected.toLowerCase() == actual;
+ }
+ return expected.toUpperCase() == actual;
+ }
+ return expected == actual;
+}
+
+function catchInitializationError(blder, ex) {
+ if (blder == null) {
+ alert(ex);
+ } else {
+ blder.initializationError = ex;
+ blder.initializationFatalError = ex;
+ }
+}
+
+function checkInitialization(blder, testname) {
+ if (blder.initializationError != null) {
+ // Fake a "warn()" function, as it was missing :-|
+ function warn(msg) {
+ info("[checkInitialization() warning] " + msg);
+ }
+
+ if (blder.skipIncompatibleTests) {
+ warn(testname + " not run:" + blder.initializationError);
+ return blder.initializationError;
+ } else {
+ //
+ // if an exception was thrown
+ // rethrow it and do not run the test
+ if (blder.initializationFatalError != null) {
+ throw blder.initializationFatalError;
+ } else {
+ //
+ // might be recoverable, warn but continue the test
+ warn(testname + ": " + blder.initializationError);
+ }
+ }
+ }
+ return null;
+}
+function createTempURI(scheme) {
+ if (scheme == "http") {
+ return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
+ }
+ return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
+}
+
+
+function EventMonitor() {
+ this.atEvents = new Array();
+ this.bubbledEvents = new Array();
+ this.capturedEvents = new Array();
+ this.allEvents = new Array();
+}
+
+EventMonitor.prototype.handleEvent = function(evt) {
+ switch(evt.eventPhase) {
+ case 1:
+ monitor.capturedEvents[monitor.capturedEvents.length] = evt;
+ break;
+
+ case 2:
+ monitor.atEvents[monitor.atEvents.length] = evt;
+ break;
+
+ case 3:
+ monitor.bubbledEvents[monitor.bubbledEvents.length] = evt;
+ break;
+ }
+ monitor.allEvents[monitor.allEvents.length] = evt;
+}
+
+function DOMErrorImpl(err) {
+ this.severity = err.severity;
+ this.message = err.message;
+ this.type = err.type;
+ this.relatedException = err.relatedException;
+ this.relatedData = err.relatedData;
+ this.location = err.location;
+}
+
+
+
+function DOMErrorMonitor() {
+ this.allErrors = new Array();
+}
+
+DOMErrorMonitor.prototype.handleError = function(err) {
+ errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err);
+}
+
+DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) {
+ var i;
+ for (i = 0; i < errorMonitor.allErrors.length; i++) {
+ if (errorMonitor.allErrors[i].severity >= severity) {
+ assertEquals(id, severity - 1, errorMonitor.allErrors[i].severity);
+ }
+ }
+}
+
+function UserDataNotification(operation, key, data, src, dst) {
+ this.operation = operation;
+ this.key = key;
+ this.data = data;
+ this.src = src;
+ this.dst = dst;
+}
+
+function UserDataMonitor() {
+ this.allNotifications = new Array();
+}
+
+UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
+ userDataMonitor.allNotifications[this.allNotifications.length] =
+ new UserDataNotification(operation, key, data, src, dst);
+}
+
+
+
+function IFrameBuilder() {
+ this.contentType = "text/html";
+ this.supportedContentTypes = [ "text/html",
+ "text/xml",
+ "image/svg+xml",
+ "application/xhtml+xml" ];
+
+ this.supportsAsyncChange = false;
+ this.async = true;
+ this.fixedAttributeNames = [
+ "validating", "expandEntityReferences", "coalescing",
+ "signed", "hasNullString", "ignoringElementContentWhitespace", "namespaceAware", "ignoringComments", "schemaValidating"];
+
+ this.fixedAttributeValues = [false, true, false, true, true , false, false, true, false ];
+ this.configurableAttributeNames = [ ];
+ this.configurableAttributeValues = [ ];
+ this.initializationError = null;
+ this.initializationFatalError = null;
+ this.skipIncompatibleTests = false;
+}
+
+IFrameBuilder.prototype.hasFeature = function(feature, version) {
+ return document.implementation.hasFeature(feature, version);
+}
+
+IFrameBuilder.prototype.getImplementation = function() {
+ return document.implementation;
+}
+
+IFrameBuilder.prototype.setContentType = function(contentType) {
+ this.contentType = contentType;
+ if (contentType == "text/html") {
+ this.fixedAttributeValues[6] = false;
+ } else {
+ this.fixedAttributeValues[6] = true;
+ }
+}
+
+
+
+IFrameBuilder.prototype.preload = function(frame, varname, url) {
+ var suffix;
+ if (this.contentType == "text/html" ||
+ this.contentType == "application/xhtml+xml") {
+ if (url.substring(0,5) == "staff" || url == "nodtdstaff" ||
+ url == "datatype_normalization") {
+ suffix = ".xml";
+ }
+ }
+
+ if (!suffix) suffix = getSuffix(this.contentType);
+
+ var iframe = document.createElement("iframe");
+ var srcname = url + suffix;
+ iframe.setAttribute("name", srcname);
+ iframe.setAttribute("src", fileBase + srcname);
+ //
+ // HTML and XHTML have onload attributes that will invoke loadComplete
+ //
+ if (suffix.indexOf("html") < 0) {
+ iframe.addEventListener("load", loadComplete, false);
+ }
+ document.getElementsByTagName("body").item(0).appendChild(iframe);
+ return 0;
+}
+
+IFrameBuilder.prototype.load = function(frame, varname, url) {
+ var suffix;
+ if (url.substring(0,5) == "staff" || url == "nodtdstaff" || url == "datatype_normalization") {
+ suffix = ".xml";
+ }
+ if (!suffix) suffix = getSuffix(this.contentType);
+ var name = url + suffix;
+ var iframes = document.getElementsByTagName("iframe");
+ for(var i = 0; i < iframes.length; i++) {
+ if (iframes.item(i).getAttribute("name") == name) {
+ var item = iframes.item(i);
+ if (typeof(item.contentDocument) != 'undefined') {
+ return item.contentDocument;
+ }
+ if (typeof(item.document) != 'undefined') {
+ return item.document;
+ }
+ return null;
+ }
+ }
+ return null;
+}
+
+IFrameBuilder.prototype.getImplementationAttribute = function(attr) {
+ for (var i = 0; i < this.fixedAttributeNames.length; i++) {
+ if (this.fixedAttributeNames[i] == attr) {
+ return this.fixedAttributeValues[i];
+ }
+ }
+ throw "Unrecognized implementation attribute: " + attr;
+}
+
+
+
+IFrameBuilder.prototype.setImplementationAttribute = function(attribute, value) {
+ var supported = this.getImplementationAttribute(attribute);
+ if (supported != value) {
+ this.initializationError = "IFrame loader does not support " + attribute + "=" + value;
+ }
+}
+
+
+IFrameBuilder.prototype.canSetImplementationAttribute = function(attribute, value) {
+ var supported = this.getImplementationAttribute(attribute);
+ return (supported == value);
+}
+
+
+function createBuilder(implementation) {
+ if (implementation == null) {
+ return new IFrameBuilder();
+ }
+ switch(implementation) {
+/* case "msxml3":
+ return new MSXMLBuilder("Msxml2.DOMDocument.3.0");
+
+ case "msxml4":
+ return new MSXMLBuilder("Msxml2.DOMDocument.4.0");*/
+
+ case "mozillaXML":
+ return new MozillaXMLBuilder();
+/*
+ case "svgplugin":
+ return new SVGPluginBuilder();
+
+ case "dom3ls":
+ return new DOM3LSBuilder(); */
+
+ case "iframe":
+ return new IFrameBuilder();
+
+ case "xmlhttprequest":
+ return new XMLHttpRequestBuilder();
+
+ default:
+ alert ("unrecognized implementation " + implementation);
+ }
+ return new IFrameBuilder();
+}
+
+function checkFeature(feature, version)
+{
+ if (!builder.hasFeature(feature, version))
+ {
+ //
+ // don't throw exception so that users can select to ignore the precondition
+ //
+ builder.initializationError = "builder does not support feature " + feature + " version " + version;
+ }
+}
+
+function createConfiguredBuilder() {
+ var builder = null;
+ var contentType = null;
+ var i;
+ var contentTypeSet = false;
+ var parm = null;
+ builder = new IFrameBuilder();
+ return builder;
+}
+
+
+function preload(frame, varname, url) {
+ return builder.preload(frame, varname, url);
+}
+
+function load(frame, varname, url) {
+ return builder.load(frame, varname, url);
+}
+
+function getImplementationAttribute(attr) {
+ return builder.getImplementationAttribute(attr);
+}
+
+
+function setImplementationAttribute(attribute, value) {
+ builder.setImplementationAttribute(attribute, value);
+}
+
+function setAsynchronous(value) {
+ if (builder.supportsAsyncChange) {
+ builder.async = value;
+ } else {
+ update();
+ }
+}
+
+
+function createXPathEvaluator(doc) {
+ try {
+ return doc.getFeature("XPath", null);
+ }
+ catch(ex) {
+ }
+ return doc;
+}
+
+function toLowerArray(src) {
+ var newArray = new Array();
+ var i;
+ for (i = 0; i < src.length; i++) {
+ newArray[i] = src[i].toLowerCase();
+ }
+ return newArray;
+}
+
+function MSXMLBuilder_onreadystatechange() {
+ if (builder.parser.readyState == 4) {
+ loadComplete();
+ }
+}
+
+
+
+var fileBase = location.href;
+if (fileBase.indexOf('?') != -1) {
+ fileBase = fileBase.substring(0, fileBase.indexOf('?'));
+}
+fileBase = fileBase.substring(0, fileBase.lastIndexOf('/') + 1) + "files/";
+
+function getResourceURI(name, scheme, contentType) {
+ return fileBase + name + getSuffix(contentType);
+}
+
+
+function getImplementation() {
+ return builder.getImplementation();
+}
+
+/*
+// Count of failures overridden as todos.
+var gFailuresAsTodos = 0;
+
+// Override SimpleTest result logger.
+var ST_logResult = SimpleTest._logResult;
+SimpleTest._logResult = function overrideSTlR(test, passString, failString) {
+ if (todoTests[docName] && !test.result && !test.todo) {
+ test.name = "[failure as todo] " + test.name;
+ test.todo = true;
+ failString = "TEST-KNOWN-FAIL";
+
+ ++gFailuresAsTodos;
+ }
+
+ ST_logResult(test, passString, failString);
+}
+*/
+
+window.doc = window;
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function(){ setUpPage(); });
+
+/*
+// Actual marking code is in overrideSTlR() now.
+function markTodos() {
+ if (todoTests[docName]) {
+ isnot(gFailuresAsTodos, 0, "test marked todo should have failed somewhere");
+ }
+}
+*/
+
+function runJSUnitTests() {
+ builder = createConfiguredBuilder();
+ try {
+ var tests = exposeTestFunctionNames();
+ for (var i = 0; i < tests.length; i++) {
+ window[tests[i]]();
+ }
+ } catch (ex) {
+/*
+ if (todoTests[docName]) {
+ todo(false, "[failure as todo] Test threw exception: " + ex);
+ ++gFailuresAsTodos;
+ } else {
+*/
+ ok(false, "Test threw exception: " + ex);
+/*
+ }
+*/
+ }
+}
diff --git a/dom/tests/mochitest/dom-level2-html/files/anchor.html b/dom/tests/mochitest/dom-level2-html/files/anchor.html
new file mode 100644
index 0000000000..952e8d9288
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/anchor.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Anchor</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<A ID="Anchor" DIR="LTR" HREF="./pix/submit.gif" ACCESSKEY="g" TYPE="image/gif" COORDS="0,0,100,100" SHAPE="rect" REL="GLOSSARY" REV="STYLESHEET" HREFLANG="en" CHARSET="US-ASCII" TABINDEX="22" NAME="Anchor">View Submit Button</A>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/anchor.xhtml b/dom/tests/mochitest/dom-level2-html/files/anchor.xhtml
new file mode 100644
index 0000000000..1be5755330
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/anchor.xhtml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Anchor</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<a id="Anchor" dir="ltr" href="./pix/submit.gif" accesskey="g" type="image/gif" coords="0,0,100,100" shape="rect" rel="GLOSSARY" rev="STYLESHEET" hreflang="en" charset="US-ASCII" tabindex="22" name="Anchor">View Submit Button</a>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/anchor.xml b/dom/tests/mochitest/dom-level2-html/files/anchor.xml
new file mode 100644
index 0000000000..1be5755330
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/anchor.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Anchor</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<a id="Anchor" dir="ltr" href="./pix/submit.gif" accesskey="g" type="image/gif" coords="0,0,100,100" shape="rect" rel="GLOSSARY" rev="STYLESHEET" hreflang="en" charset="US-ASCII" tabindex="22" name="Anchor">View Submit Button</a>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/anchor2.html b/dom/tests/mochitest/dom-level2-html/files/anchor2.html
new file mode 100644
index 0000000000..1b04fb9ff1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/anchor2.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Anchor</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<A HREF="./pix/submit.gif" TARGET="dynamic">View Submit Button</A>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/anchor2.xhtml b/dom/tests/mochitest/dom-level2-html/files/anchor2.xhtml
new file mode 100644
index 0000000000..096eb60148
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/anchor2.xhtml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Anchor</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<a href="./pix/submit.gif" target="dynamic">View Submit Button</a>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/anchor2.xml b/dom/tests/mochitest/dom-level2-html/files/anchor2.xml
new file mode 100644
index 0000000000..096eb60148
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/anchor2.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Anchor</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<a href="./pix/submit.gif" target="dynamic">View Submit Button</a>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/applet.html b/dom/tests/mochitest/dom-level2-html/files/applet.html
new file mode 100644
index 0000000000..d721cf1d9d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applet.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Applet</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<APPLET ALIGN="bottom" ALT="Applet Number 1" ARCHIVE="" CODE="org/w3c/domts/DOMTSApplet.class" CODEBASE="applets" HEIGHT="306" HSPACE="0" NAME="applet1" VSPACE="0" WIDTH="301"></APPLET>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/applet.xhtml b/dom/tests/mochitest/dom-level2-html/files/applet.xhtml
new file mode 100644
index 0000000000..cf2070cf28
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applet.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Applet</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<applet align="bottom" alt="Applet Number 1" archive="" code="org/w3c/domts/DOMTSApplet.class" codebase="applets" height="306" hspace="0" name="applet1" vspace="0" width="301"></applet>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/applet.xml b/dom/tests/mochitest/dom-level2-html/files/applet.xml
new file mode 100644
index 0000000000..cf2070cf28
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applet.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Applet</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<applet align="bottom" alt="Applet Number 1" archive="" code="org/w3c/domts/DOMTSApplet.class" codebase="applets" height="306" hspace="0" name="applet1" vspace="0" width="301"></applet>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/applet2.class b/dom/tests/mochitest/dom-level2-html/files/applet2.class
new file mode 100644
index 0000000000..3faee91d31
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applet2.class
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
+<html><head>
+<title>300 Multiple Choices</title>
+</head><body>
+<h1>Multiple Choices</h1>
+The document name you requested (<code>/2004/04/ecmascript/level2/html/files/applet2.class</code>) could not be found on this server.
+However, we found documents with names similar to the one you requested.<p>Available documents:
+<ul>
+<li><a href="/2004/04/ecmascript/level2/html/files/applet2.xml">/2004/04/ecmascript/level2/html/files/applet2.xml</a> (common basename)
+<li><a href="/2004/04/ecmascript/level2/html/files/applet2.html">/2004/04/ecmascript/level2/html/files/applet2.html</a> (common basename)
+<li><a href="/2004/04/ecmascript/level2/html/files/applet2.xhtml">/2004/04/ecmascript/level2/html/files/applet2.xhtml</a> (common basename)
+</ul>
+Please consider informing the owner of the <a href="http://www.w3.org/2004/04/ecmascript/level2/html/files/document.html">referring page</a> about the broken link.
+</body></html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/applet2.html b/dom/tests/mochitest/dom-level2-html/files/applet2.html
new file mode 100644
index 0000000000..0379ed1267
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applet2.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Applet</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<APPLET ALIGN="bottom" ALT="Applet Number 1" ARCHIVE="" OBJECT="DOMTSApplet.dat" CODEBASE="applets" HEIGHT="306" HSPACE="0" NAME="applet1" VSPACE="0" WIDTH="301"></APPLET>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/applet2.xhtml b/dom/tests/mochitest/dom-level2-html/files/applet2.xhtml
new file mode 100644
index 0000000000..43b27daeff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applet2.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Applet</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<applet align="bottom" alt="Applet Number 1" archive="" object="DOMTSApplet.dat" codebase="applets" height="306" hspace="0" name="applet1" vspace="0" width="301"></applet>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/applet2.xml b/dom/tests/mochitest/dom-level2-html/files/applet2.xml
new file mode 100644
index 0000000000..43b27daeff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applet2.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Applet</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<applet align="bottom" alt="Applet Number 1" archive="" object="DOMTSApplet.dat" codebase="applets" height="306" hspace="0" name="applet1" vspace="0" width="301"></applet>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/applets/org/w3c/domts/DOMTSApplet.class b/dom/tests/mochitest/dom-level2-html/files/applets/org/w3c/domts/DOMTSApplet.class
new file mode 100644
index 0000000000..17933091f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/applets/org/w3c/domts/DOMTSApplet.class
Binary files differ
diff --git a/dom/tests/mochitest/dom-level2-html/files/area.html b/dom/tests/mochitest/dom-level2-html/files/area.html
new file mode 100644
index 0000000000..dddff68493
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/area.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Area</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<MAP NAME="mapid" ID="mapid">
+<AREA TABINDEX="10" ACCESSKEY="a" SHAPE="rect" ALT="Domain" COORDS="0,2,45,45" HREF="./files/dletter.html" TITLE="Domain">
+</MAP>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/area.xhtml b/dom/tests/mochitest/dom-level2-html/files/area.xhtml
new file mode 100644
index 0000000000..1e497f36c2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/area.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Area</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<map name="mapid" id="mapid">
+<area tabindex="10" accesskey="a" shape="rect" alt="Domain" coords="0,2,45,45" href="./files/dletter.html" title="Domain"/>
+</map>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/area.xml b/dom/tests/mochitest/dom-level2-html/files/area.xml
new file mode 100644
index 0000000000..1e497f36c2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/area.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Area</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<map name="mapid" id="mapid">
+<area tabindex="10" accesskey="a" shape="rect" alt="Domain" coords="0,2,45,45" href="./files/dletter.html" title="Domain"/>
+</map>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/area2.html b/dom/tests/mochitest/dom-level2-html/files/area2.html
new file mode 100644
index 0000000000..f1ae08161d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/area2.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Area</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<MAP NAME="mapid" ID="mapid">
+<AREA HREF="./files/dletter.html" ALT="Domain" TARGET="dynamic">
+</MAP>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/area2.xhtml b/dom/tests/mochitest/dom-level2-html/files/area2.xhtml
new file mode 100644
index 0000000000..5476bee9ef
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/area2.xhtml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Area</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<map name="mapid" id="mapid">
+<area href="./files/dletter.html" alt="Domain" target="dynamic"/>
+</map>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/area2.xml b/dom/tests/mochitest/dom-level2-html/files/area2.xml
new file mode 100644
index 0000000000..5476bee9ef
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/area2.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Area</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<map name="mapid" id="mapid">
+<area href="./files/dletter.html" alt="Domain" target="dynamic"/>
+</map>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/base.html b/dom/tests/mochitest/dom-level2-html/files/base.html
new file mode 100644
index 0000000000..53d151d8b1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/base.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<BASE HREF="about:blank">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Base</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>Some Text</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/base.xhtml b/dom/tests/mochitest/dom-level2-html/files/base.xhtml
new file mode 100644
index 0000000000..bc41a1d029
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/base.xhtml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<base href="about:blank"/>
+<title>NIST DOM HTML Test - Base</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>Some Text</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/base.xml b/dom/tests/mochitest/dom-level2-html/files/base.xml
new file mode 100644
index 0000000000..bc41a1d029
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/base.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<base href="about:blank"/>
+<title>NIST DOM HTML Test - Base</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>Some Text</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/base2.html b/dom/tests/mochitest/dom-level2-html/files/base2.html
new file mode 100644
index 0000000000..514d534fc7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/base2.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+"http://www.w3.org/TR/html4/frameset.dtd">
+<HTML>
+<HEAD>
+<BASE HREF="about:blank" TARGET="Frame1">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Base2</TITLE>
+</HEAD>
+<FRAMESET COLS="20, 80" onload="parent.loadComplete()">
+<FRAMESET ROWS="100, 200">
+<FRAME MARGINHEIGHT="10" MARGINWIDTH="5" NORESIZE="NORESIZE" NAME="Frame1" FRAMEBORDER="1" SCROLLING="yes" SRC="right.png">
+</FRAMESET>
+<FRAME SRC="w3c_main.png">
+</FRAMESET>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/base2.xhtml b/dom/tests/mochitest/dom-level2-html/files/base2.xhtml
new file mode 100644
index 0000000000..3d15b902f6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/base2.xhtml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<base href="about:blank" target="Frame1"/>
+<title>NIST DOM HTML Test - Base2</title>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame marginheight="10" marginwidth="5" noresize="noresize" name="Frame1" frameborder="1" scrolling="yes" src="right.png" />
+</frameset>
+<frame src="w3c_main.png" />
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/base2.xml b/dom/tests/mochitest/dom-level2-html/files/base2.xml
new file mode 100644
index 0000000000..3d15b902f6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/base2.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<base href="about:blank" target="Frame1"/>
+<title>NIST DOM HTML Test - Base2</title>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame marginheight="10" marginwidth="5" noresize="noresize" name="Frame1" frameborder="1" scrolling="yes" src="right.png" />
+</frameset>
+<frame src="w3c_main.png" />
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/body.html b/dom/tests/mochitest/dom-level2-html/files/body.html
new file mode 100644
index 0000000000..6468cd0180
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/body.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Body</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()" ALINK="#0000ff" BACKGROUND="./pix/back1.gif" BGCOLOR="#ffff00" LINK="#ff0000" TEXT="#000000" VLINK="#00ffff">
+<P>Hello, World</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/body.xhtml b/dom/tests/mochitest/dom-level2-html/files/body.xhtml
new file mode 100644
index 0000000000..fa6d1b795c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/body.xhtml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<base href="http://xw2k.sdct.itl.nist.gov/brady/dom/"/>
+<title>NIST DOM HTML Test - Body</title>
+</head>
+<body onload="parent.loadComplete()" alink="#0000ff" background="./pix/back1.gif" bgcolor="#ffff00" link="#ff0000" text="#000000" vlink="#00ffff">
+<p>Hello, World.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/body.xml b/dom/tests/mochitest/dom-level2-html/files/body.xml
new file mode 100644
index 0000000000..fa6d1b795c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/body.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<base href="http://xw2k.sdct.itl.nist.gov/brady/dom/"/>
+<title>NIST DOM HTML Test - Body</title>
+</head>
+<body onload="parent.loadComplete()" alink="#0000ff" background="./pix/back1.gif" bgcolor="#ffff00" link="#ff0000" text="#000000" vlink="#00ffff">
+<p>Hello, World.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/br.html b/dom/tests/mochitest/dom-level2-html/files/br.html
new file mode 100644
index 0000000000..0a3a3d4e20
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/br.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - BR</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<BR CLEAR="none">
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/br.xhtml b/dom/tests/mochitest/dom-level2-html/files/br.xhtml
new file mode 100644
index 0000000000..99c9c1ef8c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/br.xhtml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br clear="none"/>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/br.xml b/dom/tests/mochitest/dom-level2-html/files/br.xml
new file mode 100644
index 0000000000..99c9c1ef8c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/br.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br clear="none"/>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/button.html b/dom/tests/mochitest/dom-level2-html/files/button.html
new file mode 100644
index 0000000000..c891ba4a5f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/button.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Button</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form2" ACTION="..." METHOD="POST">
+<P>
+ <BUTTON ACCESSKEY="f" NAME="disabledButton" TABINDEX="20" TYPE="reset" VALUE="Reset Disabled Button" DISABLED="disabled">Reset</BUTTON>
+</P>
+</FORM>
+<TABLE SUMMARY="Extra Button Table">
+<TR>
+<TD>
+<BUTTON>Extra Button</BUTTON>
+</TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/button.xhtml b/dom/tests/mochitest/dom-level2-html/files/button.xhtml
new file mode 100644
index 0000000000..3136988242
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/button.xhtml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Button</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form2" action="..." method="post">
+<p>
+ <button accesskey="f" name="disabledButton" tabindex="20" type="reset" value="Reset Disabled Button" disabled="disabled">Reset</button>
+</p>
+</form>
+<table summary="Extra Button Table">
+<tr>
+<td>
+<button>Extra Button</button>
+</td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/button.xml b/dom/tests/mochitest/dom-level2-html/files/button.xml
new file mode 100644
index 0000000000..3136988242
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/button.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Button</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form2" action="..." method="post">
+<p>
+ <button accesskey="f" name="disabledButton" tabindex="20" type="reset" value="Reset Disabled Button" disabled="disabled">Reset</button>
+</p>
+</form>
+<table summary="Extra Button Table">
+<tr>
+<td>
+<button>Extra Button</button>
+</td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/collection.html b/dom/tests/mochitest/dom-level2-html/files/collection.html
new file mode 100644
index 0000000000..885202df4e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/collection.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - SELECT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE ID="table-1" BORDER="4" FRAME="border" CELLPADDING="2" CELLSPACING="2" SUMMARY="HTML Control Table" RULES="all">
+<CAPTION>Table Caption</CAPTION>
+<THEAD ALIGN="center" VALIGN="middle">
+<TR ALIGN="center" VALIGN="middle" CHAR="*" CHAROFF="1">
+<TH ID="header-1">Employee Id</TH>
+<TH ID="header-2" ABBR="maiden" AXIS="center" ALIGN="center" COLSPAN="1" ROWSPAN="1" SCOPE="col" HEADERS="header-1" VALIGN="middle">Employee Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+<TH>Gender</TH>
+<TH>Address</TH>
+</TR>
+</THEAD>
+<TFOOT ALIGN="center" VALIGN="middle">
+<TR>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+</TR>
+</TFOOT>
+<TBODY ALIGN="center" VALIGN="middle">
+<TR>
+<TD AXIS="center" ID="Table-3" ABBR="maiden2" COLSPAN="1" ROWSPAN="1" SCOPE="col" HEADERS="header-2" VALIGN="middle">EMP0001</TD>
+<TD HEADERS="header-2">Margaret Martin</TD>
+<TD>Accountant</TD>
+<TD>56,000</TD>
+<TD>Female</TD>
+<TD>1230 North Ave. Dallas, Texas 98551</TD>
+</TR>
+<TR>
+<TD>EMP0002</TD>
+<TD>Martha Raynolds</TD>
+<TD>Secretary</TD>
+<TD>35,000</TD>
+<TD>Female</TD>
+<TD>1900 Dallas Road Dallas, Texas 98554</TD>
+</TR>
+</TBODY>
+</TABLE>
+<FORM ID="form1" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<SELECT ID="selectId" DIR="ltr" TABINDEX="7" NAME="select1" MULTIPLE="multiple" SIZE="1">
+<OPTION SELECTED="selected" value="EMP1">EMP10001</OPTION>
+<OPTION>EMP10002</OPTION>
+<OPTION>EMP10003</OPTION>
+<OPTION>EMP10004</OPTION>
+<OPTION>EMP10005</OPTION>
+</SELECT>
+</P>
+</FORM>
+<P>
+<SELECT NAME="select2">
+<OPTION>EMP20001</OPTION>
+<OPTION>EMP20002</OPTION>
+<OPTION>EMP20003</OPTION>
+<OPTION>EMP20004</OPTION>
+<OPTION>EMP20005</OPTION>
+</SELECT>
+</P>
+<P>
+<SELECT NAME="select3" DISABLED="disabled" TABINDEX="1">
+<OPTION>EMP30001</OPTION>
+<OPTION>EMP30002</OPTION>
+<OPTION>EMP30003</OPTION>
+<OPTION>EMP30004</OPTION>
+<OPTION>EMP30005</OPTION>
+</SELECT>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/collection.xhtml b/dom/tests/mochitest/dom-level2-html/files/collection.xhtml
new file mode 100644
index 0000000000..9da52c1ec5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/collection.xhtml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<table id="table-1" border="4" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all">
+<caption>Table Caption</caption>
+<thead align="center" valign="middle">
+<tr align="center" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" colspan="1" rowspan="1" scope="col" headers="header-1" valign="middle">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" colspan="1" rowspan="1" scope="col" headers="header-2" valign="middle">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="EMP1">EMP10001</option>
+<option>EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option>EMP20005</option>
+</select>
+</p>
+<p>
+<select name="select3" disabled="disabled" tabindex="1">
+<option>EMP30001</option>
+<option>EMP30002</option>
+<option>EMP30003</option>
+<option>EMP30004</option>
+<option>EMP30005</option>
+</select>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/collection.xml b/dom/tests/mochitest/dom-level2-html/files/collection.xml
new file mode 100644
index 0000000000..9da52c1ec5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/collection.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<table id="table-1" border="4" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all">
+<caption>Table Caption</caption>
+<thead align="center" valign="middle">
+<tr align="center" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" colspan="1" rowspan="1" scope="col" headers="header-1" valign="middle">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" colspan="1" rowspan="1" scope="col" headers="header-2" valign="middle">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="EMP1">EMP10001</option>
+<option>EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option>EMP20005</option>
+</select>
+</p>
+<p>
+<select name="select3" disabled="disabled" tabindex="1">
+<option>EMP30001</option>
+<option>EMP30002</option>
+<option>EMP30003</option>
+<option>EMP30004</option>
+<option>EMP30005</option>
+</select>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/directory.html b/dom/tests/mochitest/dom-level2-html/files/directory.html
new file mode 100644
index 0000000000..0e2f460916
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/directory.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Directory</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<DIR COMPACT="compact">
+<LI>DIR item number 1.</LI>
+<LI>DIR item number 2.</LI>
+<LI>DIR item number 3.</LI>
+</DIR>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/directory.xhtml b/dom/tests/mochitest/dom-level2-html/files/directory.xhtml
new file mode 100644
index 0000000000..bf70ef8453
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/directory.xhtml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Directory</title>
+</head>
+<body onload="parent.loadComplete()">
+<dir compact="compact">
+<li>DIR item number 1.</li>
+<li>DIR item number 2.</li>
+<li>DIR item number 3.</li>
+</dir>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/directory.xml b/dom/tests/mochitest/dom-level2-html/files/directory.xml
new file mode 100644
index 0000000000..bf70ef8453
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/directory.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Directory</title>
+</head>
+<body onload="parent.loadComplete()">
+<dir compact="compact">
+<li>DIR item number 1.</li>
+<li>DIR item number 2.</li>
+<li>DIR item number 3.</li>
+</dir>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/div.html b/dom/tests/mochitest/dom-level2-html/files/div.html
new file mode 100644
index 0000000000..6b83646216
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/div.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - DIV</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<DIV ALIGN="center">The DIV element is a generic block container. This text should be centered.</DIV>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/div.xhtml b/dom/tests/mochitest/dom-level2-html/files/div.xhtml
new file mode 100644
index 0000000000..7a1059a38e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/div.xhtml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - DIV</title>
+</head>
+<body onload="parent.loadComplete()">
+<div align="center">The DIV element is a generic block container. This text should be centered.</div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/div.xml b/dom/tests/mochitest/dom-level2-html/files/div.xml
new file mode 100644
index 0000000000..7a1059a38e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/div.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - DIV</title>
+</head>
+<body onload="parent.loadComplete()">
+<div align="center">The DIV element is a generic block container. This text should be centered.</div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/dl.html b/dom/tests/mochitest/dom-level2-html/files/dl.html
new file mode 100644
index 0000000000..5dec3affe3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/dl.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - DL</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<DL COMPACT="COMPACT">
+<DD>Accountant</DD>
+<DD>56,000</DD>
+<DD>Female</DD>
+<DD>1230 North Ave. Dallas, Texas 98551</DD>
+</DL>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/dl.xhtml b/dom/tests/mochitest/dom-level2-html/files/dl.xhtml
new file mode 100644
index 0000000000..72c6475d40
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/dl.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - DL</title>
+</head>
+<body onload="parent.loadComplete()">
+<dl compact="compact">
+<dd>Accountant</dd>
+<dd>56,000</dd>
+<dd>Female</dd>
+<dd>1230 North Ave. Dallas, Texas 98551</dd>
+</dl>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/dl.xml b/dom/tests/mochitest/dom-level2-html/files/dl.xml
new file mode 100644
index 0000000000..72c6475d40
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/dl.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - DL</title>
+</head>
+<body onload="parent.loadComplete()">
+<dl compact="compact">
+<dd>Accountant</dd>
+<dd>56,000</dd>
+<dd>Female</dd>
+<dd>1230 North Ave. Dallas, Texas 98551</dd>
+</dl>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/document-with-applet.html b/dom/tests/mochitest/dom-level2-html/files/document-with-applet.html
new file mode 100644
index 0000000000..4e6025b2d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/document-with-applet.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - DOCUMENT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()" ID="TEST-BODY">
+<FORM ID="form1" ACCEPT-CHARSET="US-ASCII" ACTION="./files/getData.pl" ENCTYPE="application/x-www-form-urlencoded" METHOD="post">
+<P>
+<TEXTAREA NAME="text1" COLS="20" ROWS="7"></TEXTAREA>
+<INPUT TYPE="submit" NAME="submit" VALUE="Submit" />
+<INPUT TYPE="reset" NAME="reset" VALUE="Reset" />
+</P>
+</FORM>
+<P>
+<MAP NAME="mapid" ID="mapid">
+<AREA TABINDEX="10" ACCESSKEY="a" SHAPE="rect" ALT="Domain" COORDS="0,2,45,45" HREF="./files/dletter.html" TITLE="Domain1">
+<AREA TABINDEX="10" ACCESSKEY="a" SHAPE="rect" ALT="Domain" COORDS="0,2,45,45" HREF="./files/dletter.html" TITLE="Domain2">
+</MAP>
+</P>
+<P>
+<IMG ID="IMAGE-1" NAME="IMAGE-1" SRC="./pix/dts.gif" ALT="DTS IMAGE LOGO" LONGDESC="./files/desc.html" USEMAP="#DTS-MAP" WIDTH="115"/>
+</P>
+<P>
+<OBJECT DATA="./pix/line.gif" CODETYPE="image/gif" HEIGHT="10">
+<APPLET ALIGN="bottom" ALT="Applet Number 1" ARCHIVE="" CODE="org/w3c/domts/DOMTSApplet.class" CODEBASE="applets"></APPLET>
+</OBJECT>
+<OBJECT DATA="./pix/logo.gif" type="image/gif">
+<APPLET ALT="Applet Number 2" CODE="org/w3c/domts/DOMTSApplet.class" CODEBASE="applets"></APPLET>
+</OBJECT>
+</P>
+<P>
+<A ID="Anchor" DIR="LTR" HREF="./pix/submit.gif" ACCESSKEY="g" TYPE="image/gif" COORDS="0,0,100,100" SHAPE="rect" REL="GLOSSARY" REV="STYLESHEET" HREFLANG="en" CHARSET="US-ASCII" TABINDEX="22" NAME="Anchor">View Submit Button</A>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/document.html b/dom/tests/mochitest/dom-level2-html/files/document.html
new file mode 100644
index 0000000000..530b92f189
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/document.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - DOCUMENT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()" ID="TEST-BODY">
+<FORM ID="form1" ACCEPT-CHARSET="US-ASCII" ACTION="./files/getData.pl" ENCTYPE="application/x-www-form-urlencoded" METHOD="post">
+<P>
+<TEXTAREA NAME="text1" COLS="20" ROWS="7"></TEXTAREA>
+<INPUT TYPE="submit" NAME="submit" VALUE="Submit" />
+<INPUT TYPE="reset" NAME="reset" VALUE="Reset" />
+</P>
+</FORM>
+<P>
+<MAP NAME="mapid" ID="mapid">
+<AREA TABINDEX="10" ACCESSKEY="a" SHAPE="rect" ALT="Domain" COORDS="0,2,45,45" HREF="./files/dletter.html" TITLE="Domain1">
+<AREA TABINDEX="10" ACCESSKEY="a" SHAPE="rect" ALT="Domain" COORDS="0,2,45,45" HREF="./files/dletter.html" TITLE="Domain2">
+</MAP>
+</P>
+<P>
+<IMG ID="IMAGE-1" NAME="IMAGE-1" SRC="./pix/dts.gif" ALT="DTS IMAGE LOGO" LONGDESC="./files/desc.html" USEMAP="#DTS-MAP" WIDTH="115"/>
+</P>
+<P>
+<OBJECT DATA="./pix/line.gif" CODETYPE="image/gif" HEIGHT="10">
+</OBJECT>
+<OBJECT DATA="./pix/logo.gif" type="image/gif">
+</OBJECT>
+</P>
+<P>
+<A ID="Anchor" DIR="LTR" HREF="./pix/submit.gif" ACCESSKEY="g" TYPE="image/gif" COORDS="0,0,100,100" SHAPE="rect" REL="GLOSSARY" REV="STYLESHEET" HREFLANG="en" CHARSET="US-ASCII" TABINDEX="22" NAME="Anchor">View Submit Button</A>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/document.xhtml b/dom/tests/mochitest/dom-level2-html/files/document.xhtml
new file mode 100644
index 0000000000..3cc6ccf10f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/document.xhtml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - DOCUMENT</title>
+</head>
+<body onload="parent.loadComplete()" id="TEST-BODY">
+<form id="form1" accept-charset="US-ASCII" action="./files/getData.pl" enctype="application/x-www-form-urlencoded" method="post">
+<p>
+<textarea name="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+<p>
+<map name="mapid" id="mapid">
+<area tabindex="10" accesskey="a" shape="rect" alt="Domain" coords="0,2,45,45" href="./files/dletter.html" title="Domain1" />
+<area tabindex="10" accesskey="a" shape="rect" alt="Domain" coords="0,2,45,45" href="./files/dletter.html" title="Domain2" />
+</map>
+</p>
+<p>
+<img id="IMAGE-1" src="./pix/dts.gif" alt="DTS IMAGE LOGO" longdesc="./files/desc.html" usemap="#DTS-MAP" width="115"/>
+</p>
+<p>
+<object data="./pix/line.gif" codetype="image/gif" height="10">
+<applet alt="Applet Number 1" code="applet1.class" width="10" height="10"></applet>
+</object>
+<object data="./pix/logo.gif" type="image/gif">
+<applet alt="Applet Number 2" code="applet2.class" width="10" height="10"></applet>
+</object>
+</p>
+<p>
+<a id="Anchor" dir="ltr" href="./pix/submit.gif" accesskey="g" type="image/gif" coords="0,0,100,100" shape="rect" rel="GLOSSARY" rev="STYLESHEET" hreflang="en" charset="US-ASCII" tabindex="22" name="Anchor">View Submit Button</a>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/document.xml b/dom/tests/mochitest/dom-level2-html/files/document.xml
new file mode 100644
index 0000000000..3cc6ccf10f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/document.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - DOCUMENT</title>
+</head>
+<body onload="parent.loadComplete()" id="TEST-BODY">
+<form id="form1" accept-charset="US-ASCII" action="./files/getData.pl" enctype="application/x-www-form-urlencoded" method="post">
+<p>
+<textarea name="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+<p>
+<map name="mapid" id="mapid">
+<area tabindex="10" accesskey="a" shape="rect" alt="Domain" coords="0,2,45,45" href="./files/dletter.html" title="Domain1" />
+<area tabindex="10" accesskey="a" shape="rect" alt="Domain" coords="0,2,45,45" href="./files/dletter.html" title="Domain2" />
+</map>
+</p>
+<p>
+<img id="IMAGE-1" src="./pix/dts.gif" alt="DTS IMAGE LOGO" longdesc="./files/desc.html" usemap="#DTS-MAP" width="115"/>
+</p>
+<p>
+<object data="./pix/line.gif" codetype="image/gif" height="10">
+<applet alt="Applet Number 1" code="applet1.class" width="10" height="10"></applet>
+</object>
+<object data="./pix/logo.gif" type="image/gif">
+<applet alt="Applet Number 2" code="applet2.class" width="10" height="10"></applet>
+</object>
+</p>
+<p>
+<a id="Anchor" dir="ltr" href="./pix/submit.gif" accesskey="g" type="image/gif" coords="0,0,100,100" shape="rect" rel="GLOSSARY" rev="STYLESHEET" hreflang="en" charset="US-ASCII" tabindex="22" name="Anchor">View Submit Button</a>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/element.html b/dom/tests/mochitest/dom-level2-html/files/element.html
new file mode 100644
index 0000000000..a0c198e815
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/element.html
@@ -0,0 +1,81 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD ID="Test-HEAD" TITLE="HEAD Element" LANG="en" DIR="ltr" CLASS="HEAD-class">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Element</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<CENTER ID="Test-CENTER" TITLE="CENTER Element" LANG="en" DIR="ltr" CLASS="CENTER-class">
+<OBJECT align="middle"></OBJECT>
+</CENTER>
+<CENTER>
+<P align="center">Test Lists</P>
+</CENTER>
+<BR>
+<OL compact="compact" start="1" type="1">
+ <LI type="square" value=2>EMP0001
+ <UL compact type="disc">
+ <LI>Margaret Martin
+ <DL>
+ <DD ID="Test-DD" TITLE="DD Element" LANG="en" DIR="ltr" CLASS="DD-class">Accountant</DD>
+ <DD>56,000</DD>
+ <DD>Female</DD>
+ <DD>1230 North Ave. Dallas, Texas 98551</DD>
+ </DL>
+ </LI>
+ </UL>
+ </LI>
+</OL>
+<BR />
+<B ID="Test-B" TITLE="B Element" LANG="en" DIR="ltr" CLASS="B-class">Bold</B>
+<BR />
+<DL>
+ <DT ID="Test-DT" TITLE="DT Element" LANG="en" DIR="ltr" CLASS="DT-class">DT element</DT>
+</DL>
+<BR />
+<BDO ID="Test-BDO" TITLE="BDO Element" LANG="en" DIR="ltr" CLASS="BDO-class">Bidirectional algorithm overide
+</BDO>
+<BR />
+<I ID="Test-I" TITLE="I Element" LANG="en" DIR="ltr" CLASS="I-class">Italicized</I>
+<BR />
+<SPAN ID="Test-SPAN" TITLE="SPAN Element" LANG="en" DIR="ltr" CLASS="SPAN-class"></SPAN>
+<BR />
+<TT ID="Test-TT" TITLE="TT Element" LANG="en" DIR="ltr" CLASS="TT-class">Teletype</TT>
+<BR />
+<SUB ID="Test-SUB" TITLE="SUB Element" LANG="en" DIR="ltr" CLASS="SUB-class">Subscript</SUB>
+<BR />
+<SUP ID="Test-SUP" TITLE="SUP Element" LANG="en" DIR="ltr" CLASS="SUP-class">SuperScript</SUP>
+<BR />
+<S ID="Test-S" TITLE="S Element" LANG="en" DIR="ltr" CLASS="S-class">Strike Through (S)</S>
+<BR />
+<STRIKE ID="Test-STRIKE" TITLE="STRIKE Element" LANG="en" DIR="ltr" CLASS="STRIKE-class">Strike Through (STRIKE)</STRIKE>
+<BR />
+<SMALL id="Test-SMALL" TITLE="SMALL Element" LANG="en" DIR="ltr" CLASS="SMALL-class">Small</SMALL>
+<BR />
+<BIG ID="Test-BIG" TITLE="BIG Element" LANG="en" DIR="ltr" CLASS="BIG-class">Big</BIG>
+<BR />
+<EM ID="Test-EM" TITLE="EM Element" LANG="en" DIR="ltr" CLASS="EM-class">Emphasis</EM>
+<BR />
+<STRONG ID="Test-STRONG" TITLE="STRONG Element" LANG="en" DIR="ltr" CLASS="STRONG-class">Strong</STRONG>
+<BR />
+<DFN ID="Test-DFN" TITLE="DFN Element" LANG="en" DIR="ltr" CLASS="DFN-class">
+ <CODE ID="Test-CODE" TITLE="CODE Element" LANG="en" DIR="ltr" CLASS="CODE-class">10 Computer Code Fragment 20 Temp = 10</CODE>
+ <SAMP ID="Test-SAMP" TITLE="SAMP Element" LANG="en" DIR="ltr" CLASS="SAMP-class">Temp = 20</SAMP>
+ <KBD ID="Test-KBD" TITLE="KBD Element" LANG="en" DIR="ltr" CLASS="KBD-class">*2</KBD>
+ <VAR ID="Test-VAR" TITLE="VAR Element" LANG="en" DIR="ltr" CLASS="VAR-class">Temp</VAR>
+ <CITE ID="Test-CITE" TITLE="CITE Element" LANG="en" DIR="ltr" CLASS="CITE-class">Citation</CITE>
+</DFN>
+<BR />
+<ABBR ID="Test-ABBR" TITLE="ABBR Element" LANG="en" DIR="ltr" CLASS="ABBR-class">Temp</ABBR>
+<BR />
+<ACRONYM ID="Test-ACRONYM" TITLE="ACRONYM Element" LANG="en" DIR="ltr" CLASS="ACRONYM-class">NIST</ACRONYM>
+<BR />
+<ADDRESS ID="Test-ADDRESS" TITLE="ADDRESS Element" LANG="en" DIR="ltr" CLASS="ADDRESS-class">Gaithersburg, MD 20899</ADDRESS>
+<BR />
+<NOFRAMES ID="Test-NOFRAMES" TITLE="NOFRAMES Element" LANG="en" DIR="ltr" CLASS="NOFRAMES-class">Not</NOFRAMES>
+<BR />
+<NOSCRIPT ID="Test-NOSCRIPT" TITLE="NOSCRIPT Element" LANG="en" DIR="ltr" CLASS="NOSCRIPT-class">Not</NoScript>
+<BR />
+<U ID="Test-U" TITLE="U Element" LANG="en" DIR="ltr" CLASS="U-class">Underlined</U>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/element.xhtml b/dom/tests/mochitest/dom-level2-html/files/element.xhtml
new file mode 100644
index 0000000000..ee996015d1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/element.xhtml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html lang="en" dir="ltr" xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Element</title>
+</head>
+<body onload="parent.loadComplete()">
+<center id="Test-CENTER" title="CENTER Element" lang="en" dir="ltr" class="CENTER-class">
+<object align="middle"></object>
+</center>
+<center>
+<p align="center">Test Lists</p>
+</center>
+<br />
+<ol compact="compact" start="1" type="1">
+ <li type="square" value="2">EMP0001
+ <ul compact="compact" type="disc">
+ <li>Margaret Martin
+ <dl>
+ <dd id="Test-DD" title="DD Element" lang="en" dir="ltr" class="DD-class">Accountant</dd>
+ <dd>56,000</dd>
+ <dd>Female</dd>
+ <dd>1230 North Ave. Dallas, Texas 98551</dd>
+ </dl>
+ </li>
+ </ul>
+ </li>
+</ol>
+<br />
+<b id="Test-B" title="B Element" lang="en" dir="ltr" class="B-class">Bold</b>
+<br />
+<dl>
+ <dt id="Test-DT" title="DT Element" lang="en" dir="ltr" class="DT-class">DT element</dt>
+</dl>
+<br />
+<bdo id="Test-BDO" title="BDO Element" lang="en" dir="ltr" class="BDO-class">Bidirectional algorithm overide
+</bdo>
+<br />
+<i id="Test-I" title="I Element" lang="en" dir="ltr" class="I-class">Italicized</i>
+<br />
+<span id="Test-SPAN" title="SPAN Element" lang="en" dir="ltr" class="SPAN-class"></span>
+<br />
+<tt id="Test-TT" title="TT Element" lang="en" dir="ltr" class="TT-class">Teletype</tt>
+<br />
+<sub id="Test-SUB" title="SUB Element" lang="en" dir="ltr" class="SUB-class">Subscript</sub>
+<br />
+<sup id="Test-SUP" title="SUP Element" lang="en" dir="ltr" class="SUP-class">SuperScript</sup>
+<br />
+<s id="Test-S" title="S Element" lang="en" dir="ltr" class="S-class">Strike Through (S)</s>
+<br />
+<strike id="Test-STRIKE" title="STRIKE Element" lang="en" dir="ltr" class="STRIKE-class">Strike Through (STRIKE)</strike>
+<br />
+<small id="Test-SMALL" title="SMALL Element" lang="en" dir="ltr" class="SMALL-class">Small</small>
+<br />
+<big id="Test-BIG" title="BIG Element" lang="en" dir="ltr" class="BIG-class">Big</big>
+<br />
+<em id="Test-EM" title="EM Element" lang="en" dir="ltr" class="EM-class">Emphasis</em>
+<br />
+<strong id="Test-STRONG" title="STRONG Element" lang="en" dir="ltr" class="STRONG-class">Strong</strong>
+<br />
+<dfn id="Test-DFN" title="DFN Element" lang="en" dir="ltr" class="DFN-class">
+ <code id="Test-CODE" title="CODE Element" lang="en" dir="ltr" class="CODE-class">10 Computer Code Fragment 20 Temp = 10</code>
+ <samp id="Test-SAMP" title="SAMP Element" lang="en" dir="ltr" class="SAMP-class">Temp = 20</samp>
+ <kbd id="Test-KBD" title="KBD Element" lang="en" dir="ltr" class="KBD-class">*2</kbd>
+ <var id="Test-VAR" title="VAR Element" lang="en" dir="ltr" class="VAR-class">Temp</var>
+ <cite id="Test-CITE" title="CITE Element" lang="en" dir="ltr" class="CITE-class">Citation</cite>
+</dfn>
+<br />
+<abbr id="Test-ABBR" title="ABBR Element" lang="en" dir="ltr" class="ABBR-class">Temp</abbr>
+<br />
+<acronym id="Test-ACRONYM" title="ACRONYM Element" lang="en" dir="ltr" class="ACRONYM-class">NIST</acronym>
+<br />
+<address id="Test-ADDRESS" title="ADDRESS Element" lang="en" dir="ltr" class="ADDRESS-class">Gaithersburg, MD 20899</address>
+<br />
+<noframes id="Test-NOFRAMES" title="NOFRAMES Element" lang="en" dir="ltr" class="NOFRAMES-class">Not</noframes>
+<br />
+<noscript id="Test-NOSCRIPT" title="NOSCRIPT Element" lang="en" dir="ltr" class="NOSCRIPT-class">Not</noscript>
+<br />
+<u id="Test-U" title="U Element" lang="en" dir="ltr" class="U-class">Underlined</u>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/element.xml b/dom/tests/mochitest/dom-level2-html/files/element.xml
new file mode 100644
index 0000000000..ee996015d1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/element.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html lang="en" dir="ltr" xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Element</title>
+</head>
+<body onload="parent.loadComplete()">
+<center id="Test-CENTER" title="CENTER Element" lang="en" dir="ltr" class="CENTER-class">
+<object align="middle"></object>
+</center>
+<center>
+<p align="center">Test Lists</p>
+</center>
+<br />
+<ol compact="compact" start="1" type="1">
+ <li type="square" value="2">EMP0001
+ <ul compact="compact" type="disc">
+ <li>Margaret Martin
+ <dl>
+ <dd id="Test-DD" title="DD Element" lang="en" dir="ltr" class="DD-class">Accountant</dd>
+ <dd>56,000</dd>
+ <dd>Female</dd>
+ <dd>1230 North Ave. Dallas, Texas 98551</dd>
+ </dl>
+ </li>
+ </ul>
+ </li>
+</ol>
+<br />
+<b id="Test-B" title="B Element" lang="en" dir="ltr" class="B-class">Bold</b>
+<br />
+<dl>
+ <dt id="Test-DT" title="DT Element" lang="en" dir="ltr" class="DT-class">DT element</dt>
+</dl>
+<br />
+<bdo id="Test-BDO" title="BDO Element" lang="en" dir="ltr" class="BDO-class">Bidirectional algorithm overide
+</bdo>
+<br />
+<i id="Test-I" title="I Element" lang="en" dir="ltr" class="I-class">Italicized</i>
+<br />
+<span id="Test-SPAN" title="SPAN Element" lang="en" dir="ltr" class="SPAN-class"></span>
+<br />
+<tt id="Test-TT" title="TT Element" lang="en" dir="ltr" class="TT-class">Teletype</tt>
+<br />
+<sub id="Test-SUB" title="SUB Element" lang="en" dir="ltr" class="SUB-class">Subscript</sub>
+<br />
+<sup id="Test-SUP" title="SUP Element" lang="en" dir="ltr" class="SUP-class">SuperScript</sup>
+<br />
+<s id="Test-S" title="S Element" lang="en" dir="ltr" class="S-class">Strike Through (S)</s>
+<br />
+<strike id="Test-STRIKE" title="STRIKE Element" lang="en" dir="ltr" class="STRIKE-class">Strike Through (STRIKE)</strike>
+<br />
+<small id="Test-SMALL" title="SMALL Element" lang="en" dir="ltr" class="SMALL-class">Small</small>
+<br />
+<big id="Test-BIG" title="BIG Element" lang="en" dir="ltr" class="BIG-class">Big</big>
+<br />
+<em id="Test-EM" title="EM Element" lang="en" dir="ltr" class="EM-class">Emphasis</em>
+<br />
+<strong id="Test-STRONG" title="STRONG Element" lang="en" dir="ltr" class="STRONG-class">Strong</strong>
+<br />
+<dfn id="Test-DFN" title="DFN Element" lang="en" dir="ltr" class="DFN-class">
+ <code id="Test-CODE" title="CODE Element" lang="en" dir="ltr" class="CODE-class">10 Computer Code Fragment 20 Temp = 10</code>
+ <samp id="Test-SAMP" title="SAMP Element" lang="en" dir="ltr" class="SAMP-class">Temp = 20</samp>
+ <kbd id="Test-KBD" title="KBD Element" lang="en" dir="ltr" class="KBD-class">*2</kbd>
+ <var id="Test-VAR" title="VAR Element" lang="en" dir="ltr" class="VAR-class">Temp</var>
+ <cite id="Test-CITE" title="CITE Element" lang="en" dir="ltr" class="CITE-class">Citation</cite>
+</dfn>
+<br />
+<abbr id="Test-ABBR" title="ABBR Element" lang="en" dir="ltr" class="ABBR-class">Temp</abbr>
+<br />
+<acronym id="Test-ACRONYM" title="ACRONYM Element" lang="en" dir="ltr" class="ACRONYM-class">NIST</acronym>
+<br />
+<address id="Test-ADDRESS" title="ADDRESS Element" lang="en" dir="ltr" class="ADDRESS-class">Gaithersburg, MD 20899</address>
+<br />
+<noframes id="Test-NOFRAMES" title="NOFRAMES Element" lang="en" dir="ltr" class="NOFRAMES-class">Not</noframes>
+<br />
+<noscript id="Test-NOSCRIPT" title="NOSCRIPT Element" lang="en" dir="ltr" class="NOSCRIPT-class">Not</noscript>
+<br />
+<u id="Test-U" title="U Element" lang="en" dir="ltr" class="U-class">Underlined</u>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/fieldset.html b/dom/tests/mochitest/dom-level2-html/files/fieldset.html
new file mode 100644
index 0000000000..312ea44208
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/fieldset.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - FieldSet</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form2" ACTION="..." METHOD="POST">
+<FIELDSET>
+<LEGEND>All data entered must be valid</LEGEND>
+</FIELDSET>
+</FORM>
+<TABLE SUMMARY="Table 1">
+<TR>
+<TD>
+<FIELDSET>
+<LEGEND>All data entered must be valid</LEGEND>
+</FIELDSET>
+</TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/fieldset.xhtml b/dom/tests/mochitest/dom-level2-html/files/fieldset.xhtml
new file mode 100644
index 0000000000..dcfeba133e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/fieldset.xhtml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FieldSet</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form2" action="..." method="post">
+<fieldset>
+<legend>All data entered must be valid</legend>
+</fieldset>
+</form>
+<table summary="Table 1">
+<tr>
+<td>
+<fieldset>
+<legend>All data entered must be valid</legend>
+</fieldset>
+</td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/fieldset.xml b/dom/tests/mochitest/dom-level2-html/files/fieldset.xml
new file mode 100644
index 0000000000..dcfeba133e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/fieldset.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FieldSet</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form2" action="..." method="post">
+<fieldset>
+<legend>All data entered must be valid</legend>
+</fieldset>
+</form>
+<table summary="Table 1">
+<tr>
+<td>
+<fieldset>
+<legend>All data entered must be valid</legend>
+</fieldset>
+</td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/font.html b/dom/tests/mochitest/dom-level2-html/files/font.html
new file mode 100644
index 0000000000..894e442417
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/font.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Font</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FONT COLOR="#000000" FACE="arial,helvetica" SIZE="4">Test Tables</FONT>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/font.xhtml b/dom/tests/mochitest/dom-level2-html/files/font.xhtml
new file mode 100644
index 0000000000..818db76bc9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/font.xhtml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BaseFont</title>
+</head>
+<body onload="parent.loadComplete()">
+<font color="#000000" face="arial,helvitica" size="4">Test Tables</font>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/font.xml b/dom/tests/mochitest/dom-level2-html/files/font.xml
new file mode 100644
index 0000000000..818db76bc9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/font.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BaseFont</title>
+</head>
+<body onload="parent.loadComplete()">
+<font color="#000000" face="arial,helvitica" size="4">Test Tables</font>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/form.html b/dom/tests/mochitest/dom-level2-html/files/form.html
new file mode 100644
index 0000000000..d8bf02424c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - FORM</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" ACCEPT-CHARSET="US-ASCII" ACTION="./files/getData.pl" ENCTYPE="application/x-www-form-urlencoded" METHOD="post">
+<P>
+<TEXTAREA NAME="text1" COLS="20" ROWS="7"></TEXTAREA>
+<INPUT TYPE="submit" NAME="submit1" VALUE="Submit" />
+<INPUT TYPE="reset" NAME="submit2" VALUE="Reset" />
+</P>
+</FORM>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/form.xhtml b/dom/tests/mochitest/dom-level2-html/files/form.xhtml
new file mode 100644
index 0000000000..40d6bf0faf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form.xhtml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FORM</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" accept-charset="US-ASCII" action="./files/getData.pl" enctype="application/x-www-form-urlencoded" method="post">
+<p>
+<textarea id="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/form.xml b/dom/tests/mochitest/dom-level2-html/files/form.xml
new file mode 100644
index 0000000000..40d6bf0faf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FORM</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" accept-charset="US-ASCII" action="./files/getData.pl" enctype="application/x-www-form-urlencoded" method="post">
+<p>
+<textarea id="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/form2.html b/dom/tests/mochitest/dom-level2-html/files/form2.html
new file mode 100644
index 0000000000..c44b6726d5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form2.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - FORM</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" TARGET="dynamic" ACCEPT-CHARSET="US-ASCII" ACTION="./files/getData.pl" ENCTYPE="application/x-www-form-urlencoded" METHOD="post">
+<P>
+<TEXTAREA NAME="text1" COLS="20" ROWS="7"></TEXTAREA>
+<INPUT TYPE="submit" NAME="submit1" VALUE="Submit" />
+<INPUT TYPE="reset" NAME="submit2" VALUE="Reset" />
+</P>
+</FORM>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/form2.xhtml b/dom/tests/mochitest/dom-level2-html/files/form2.xhtml
new file mode 100644
index 0000000000..e639432bfc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form2.xhtml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FORM</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" target="dynamic" accept-charset="US-ASCII" action="./files/getData.pl" enctype="application/x-www-form-urlencoded" method="post">
+<p>
+<textarea id="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/form2.xml b/dom/tests/mochitest/dom-level2-html/files/form2.xml
new file mode 100644
index 0000000000..e639432bfc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form2.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FORM</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" target="dynamic" accept-charset="US-ASCII" action="./files/getData.pl" enctype="application/x-www-form-urlencoded" method="post">
+<p>
+<textarea id="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/form3.html b/dom/tests/mochitest/dom-level2-html/files/form3.html
new file mode 100644
index 0000000000..543d09efb4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form3.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>FORM3</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" ACTION="about:blank">
+<P>
+<TEXTAREA NAME="text1" COLS="20" ROWS="7"></TEXTAREA>
+<INPUT TYPE="submit" NAME="submit1" VALUE="Submit" />
+<INPUT TYPE="reset" NAME="submit2" VALUE="Reset" />
+</P>
+</FORM>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/form3.xhtml b/dom/tests/mochitest/dom-level2-html/files/form3.xhtml
new file mode 100644
index 0000000000..48f5019cba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form3.xhtml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>FORM3</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="about:blank">
+<p>
+<textarea id="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/form3.xml b/dom/tests/mochitest/dom-level2-html/files/form3.xml
new file mode 100644
index 0000000000..bbed66fbe9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/form3.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>FORM3</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="about:blank">
+<p>
+<textarea id="text1" cols="20" rows="7"></textarea>
+<input type="submit" name="submit1" value="Submit" />
+<input type="reset" name="submit2" value="Reset" />
+</p>
+</form>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frame.html b/dom/tests/mochitest/dom-level2-html/files/frame.html
new file mode 100644
index 0000000000..41182c9be3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frame.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+"http://www.w3.org/TR/html4/frameset.dtd">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - FRAME</TITLE>
+</HEAD>
+<FRAMESET COLS="20, 80" onload="parent.loadComplete()">
+<FRAMESET ROWS="100, 200">
+<FRAME LONGDESC="about:blank" MARGINHEIGHT="10" MARGINWIDTH="5" NORESIZE="NORESIZE" NAME="Frame1" FRAMEBORDER="1" SCROLLING="yes" SRC="right.png">
+</FRAMESET>
+<FRAME SRC="w3c_main.png">
+</FRAMESET>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frame.xhtml b/dom/tests/mochitest/dom-level2-html/files/frame.xhtml
new file mode 100644
index 0000000000..bbe00fac1e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frame.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FRAME</title>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame longdesc="about:blank" marginheight="10" marginwidth="5" noresize="noresize" name="Frame1" frameborder="1" scrolling="yes" src="right.png" />
+</frameset>
+<frame src="w3c_main.png" />
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frame.xml b/dom/tests/mochitest/dom-level2-html/files/frame.xml
new file mode 100644
index 0000000000..bbe00fac1e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frame.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FRAME</title>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame longdesc="about:blank" marginheight="10" marginwidth="5" noresize="noresize" name="Frame1" frameborder="1" scrolling="yes" src="right.png" />
+</frameset>
+<frame src="w3c_main.png" />
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frame2.html b/dom/tests/mochitest/dom-level2-html/files/frame2.html
new file mode 100644
index 0000000000..6030ec5f54
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frame2.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+"http://www.w3.org/TR/html4/frameset.dtd">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - FRAME2</TITLE>
+<!-- required by frame contents -->
+<SCRIPT type="text/javascript">function loadComplete() { }</SCRIPT>
+</HEAD>
+<FRAMESET COLS="20, 80" onload="parent.loadComplete()">
+<FRAMESET ROWS="100, 200">
+<FRAME ID="Frame1" NAME="Frame1" SRC="frame.html">
+</FRAMESET>
+<FRAME ID="Frame2" NAME="Frame2" SRC="iframe.html">
+</FRAMESET>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frame2.xhtml b/dom/tests/mochitest/dom-level2-html/files/frame2.xhtml
new file mode 100644
index 0000000000..09008eb864
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frame2.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FRAME2</title>
+<!-- required by frame contents -->
+<script type="text/javascript">function loadComplete() { }</script>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame id="Frame1" name="Frame1" src="frame.xhtml"/>
+</frameset>
+<frame id="Frame2" name="Frame2" src="iframe.xhtml"/>
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frame2.xml b/dom/tests/mochitest/dom-level2-html/files/frame2.xml
new file mode 100644
index 0000000000..615f234068
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frame2.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FRAME2</title>
+<script type="text/javascript">function loadComplete() { }</script>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame id="Frame1" name="Frame1" src="frame.html"/>
+</frameset>
+<frame id="Frame2" name="Frame2" src="iframe.html"/>
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frameset.html b/dom/tests/mochitest/dom-level2-html/files/frameset.html
new file mode 100644
index 0000000000..f208fe0559
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frameset.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+"http://www.w3.org/TR/html4/frameset.dtd">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - FRAMESET</TITLE>
+</HEAD>
+<FRAMESET COLS="20, 80" onload="parent.loadComplete()">
+<FRAMESET ROWS="100, 200">
+<FRAME SRC="right.png">
+</FRAMESET>
+<FRAME SRC="w3c_main.png">
+</FRAMESET>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frameset.xhtml b/dom/tests/mochitest/dom-level2-html/files/frameset.xhtml
new file mode 100644
index 0000000000..2035bd9c80
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frameset.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FRAMESET</title>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame src="right.png" />
+</frameset>
+<frame src="w3c_main.png" />
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/frameset.xml b/dom/tests/mochitest/dom-level2-html/files/frameset.xml
new file mode 100644
index 0000000000..2035bd9c80
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/frameset.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "xhtml1-frameset.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - FRAMESET</title>
+</head>
+<frameset cols="20, 80" onload="parent.loadComplete()">
+<frameset rows="100, 200">
+<frame src="right.png" />
+</frameset>
+<frame src="w3c_main.png" />
+</frameset>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/heading.html b/dom/tests/mochitest/dom-level2-html/files/heading.html
new file mode 100644
index 0000000000..90d388c0f6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/heading.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - HEADING</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<H1 ALIGN="center">Head Element 1</H1>
+<H2 ALIGN="left">Head Element 2</H2>
+<H3 ALIGN="right">Head Element 3</H3>
+<H4 ALIGN="justify">Head Element 4</H4>
+<H5 ALIGN="center">Head Element 5</H5>
+<H6 ALIGN="left">Head Element 6</H6>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/heading.xhtml b/dom/tests/mochitest/dom-level2-html/files/heading.xhtml
new file mode 100644
index 0000000000..3fda259f19
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/heading.xhtml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - HEADING</title>
+</head>
+<body onload="parent.loadComplete()">
+<h1 align="center">Head Element 1</h1>
+<h2 align="left">Head Element 2</h2>
+<h3 align="right">Head Element 3</h3>
+<h4 align="right">Head Element 4</h4>
+<h5 align="center">Head Element 5</h5>
+<h6 align="left">Head Element 6</h6>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/heading.xml b/dom/tests/mochitest/dom-level2-html/files/heading.xml
new file mode 100644
index 0000000000..3fda259f19
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/heading.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - HEADING</title>
+</head>
+<body onload="parent.loadComplete()">
+<h1 align="center">Head Element 1</h1>
+<h2 align="left">Head Element 2</h2>
+<h3 align="right">Head Element 3</h3>
+<h4 align="right">Head Element 4</h4>
+<h5 align="center">Head Element 5</h5>
+<h6 align="left">Head Element 6</h6>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/hr.html b/dom/tests/mochitest/dom-level2-html/files/hr.html
new file mode 100644
index 0000000000..9c4faccd0b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/hr.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - HR</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<HR ALIGN="center" NOSHADE="noShade" SIZE="5" WIDTH="400" />
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/hr.xhtml b/dom/tests/mochitest/dom-level2-html/files/hr.xhtml
new file mode 100644
index 0000000000..685de35151
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/hr.xhtml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - HR</title>
+</head>
+<body onload="parent.loadComplete()">
+<hr align="center" noshade="noshade" size="5" width="400"/>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/hr.xml b/dom/tests/mochitest/dom-level2-html/files/hr.xml
new file mode 100644
index 0000000000..685de35151
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/hr.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - HR</title>
+</head>
+<body onload="parent.loadComplete()">
+<hr align="center" noshade="noshade" size="5" width="400"/>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/html.html b/dom/tests/mochitest/dom-level2-html/files/html.html
new file mode 100644
index 0000000000..2c91731e45
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/html.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML VERSION="-//W3C//DTD HTML 4.01 Transitional//EN">
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - Html</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>Hello, World.</P>
+</BODY>
+</HTML>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/html.xhtml b/dom/tests/mochitest/dom-level2-html/files/html.xhtml
new file mode 100644
index 0000000000..f07d2c1387
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/html.xhtml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Html</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>Hello, World.</p>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/html.xml b/dom/tests/mochitest/dom-level2-html/files/html.xml
new file mode 100644
index 0000000000..f07d2c1387
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/html.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - Html</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>Hello, World.</p>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/iframe.html b/dom/tests/mochitest/dom-level2-html/files/iframe.html
new file mode 100644
index 0000000000..0a44fc3354
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/iframe.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - IFRAME</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<IFRAME LONGDESC="about:blank" MARGINHEIGHT="10" MARGINWIDTH="5" WIDTH="60" HEIGHT="50" NAME="Iframe1" FRAMEBORDER="1" SCROLLING="yes" SRC="right.png" ALIGN="top">IFRAME1</IFRAME>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/iframe.xhtml b/dom/tests/mochitest/dom-level2-html/files/iframe.xhtml
new file mode 100644
index 0000000000..93326c8178
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/iframe.xhtml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - IFRAME</title>
+</head>
+<body onload="parent.loadComplete()">
+<iframe longdesc="about:blank" marginheight="10" marginwidth="5" width="60" height="50" name="Iframe1" frameborder="1" scrolling="yes" src="right.png" align="top">IFRAME1</iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/iframe.xml b/dom/tests/mochitest/dom-level2-html/files/iframe.xml
new file mode 100644
index 0000000000..93326c8178
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/iframe.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - IFRAME</title>
+</head>
+<body onload="parent.loadComplete()">
+<iframe longdesc="about:blank" marginheight="10" marginwidth="5" width="60" height="50" name="Iframe1" frameborder="1" scrolling="yes" src="right.png" align="top">IFRAME1</iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/iframe2.html b/dom/tests/mochitest/dom-level2-html/files/iframe2.html
new file mode 100644
index 0000000000..7f302b8433
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/iframe2.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - IFRAME2</TITLE>
+<!-- required by frame contents -->
+<SCRIPT type="text/javascript">function loadComplete() { }</SCRIPT>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<IFRAME ID="Iframe1" NAME="Iframe1" SRC="iframe.html">IFRAME1</IFRAME>
+<IFRAME ID="Iframe2" SRC="frame.html" NAME="Iframe2">IFRAME2</IFRAME>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/iframe2.xhtml b/dom/tests/mochitest/dom-level2-html/files/iframe2.xhtml
new file mode 100644
index 0000000000..a1b1011396
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/iframe2.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - IFRAME2</title>
+<!-- required by frame contents -->
+<script type="text/javascript">function loadComplete() { }</script>
+</head>
+<body onload="parent.loadComplete()">
+<iframe id="Iframe1" name="Iframe1" src="iframe.html">IFRAME1</iframe>
+<iframe id="Iframe2" src="frame.html" name="Iframe2">IFRAME2</iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/iframe2.xml b/dom/tests/mochitest/dom-level2-html/files/iframe2.xml
new file mode 100644
index 0000000000..a1b1011396
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/iframe2.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - IFRAME2</title>
+<!-- required by frame contents -->
+<script type="text/javascript">function loadComplete() { }</script>
+</head>
+<body onload="parent.loadComplete()">
+<iframe id="Iframe1" name="Iframe1" src="iframe.html">IFRAME1</iframe>
+<iframe id="Iframe2" src="frame.html" name="Iframe2">IFRAME2</iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/img.html b/dom/tests/mochitest/dom-level2-html/files/img.html
new file mode 100644
index 0000000000..b4e8b270eb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/img.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - IMG</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<IMG ID="IMAGE-1" NAME="IMAGE-1" SRC="./pix/dts.gif" ALIGN="middle" ALT="DTS IMAGE LOGO" BORDER="0" HEIGHT="47" HSPACE="4" LONGDESC="./files/desc.html" USEMAP="#DTS-MAP" VSPACE="10" WIDTH="115"/>
+</P>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/img.xhtml b/dom/tests/mochitest/dom-level2-html/files/img.xhtml
new file mode 100644
index 0000000000..40e3695b9c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/img.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - IMG</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<img id="IMAGE-1" name="IMAGE-1" src="./pix/dts.gif" align="middle" alt="DTS IMAGE LOGO" border="0" height="47" hspace="4" longdesc="./files/desc.html" usemap="#DTS-MAP" vspace="10" width="115"/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/img.xml b/dom/tests/mochitest/dom-level2-html/files/img.xml
new file mode 100644
index 0000000000..40e3695b9c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/img.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - IMG</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<img id="IMAGE-1" name="IMAGE-1" src="./pix/dts.gif" align="middle" alt="DTS IMAGE LOGO" border="0" height="47" hspace="4" longdesc="./files/desc.html" usemap="#DTS-MAP" vspace="10" width="115"/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/index.html b/dom/tests/mochitest/dom-level2-html/files/index.html
new file mode 100644
index 0000000000..ee49e443c4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/index.html
@@ -0,0 +1,216 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Index of /2004/04/ecmascript/level2/html/files</title>
+ </head>
+ <body>
+<h1>Index of /2004/04/ecmascript/level2/html/files</h1>
+<table><tr><th><img src="/icons/blank.gif" alt="[ICO]" width="20" height="22" /></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=M;O=A">Last modified</a></th><th><a href="?C=S;O=A">Size</a></th><th><a href="?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr /></th></tr>
+<tr><td valign="top"><img src="/icons/back.gif" alt="[DIR]" width="20" height="22" /></td><td><a href="/2004/04/ecmascript/level2/html/">Parent Directory</a></td><td>&nbsp;</td><td align="right"> - </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="anchor.html">anchor.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">490 </td><td>NIST DOM HTML Test - Anchor</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="anchor.xhtml">anchor.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">530 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="anchor.xml">anchor.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">530 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="anchor2.html">anchor2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">367 </td><td>NIST DOM HTML Test - Anchor</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="anchor2.xhtml">anchor2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">367 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="anchor2.xml">anchor2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">367 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="applet.html">applet.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">446 </td><td>NIST DOM HTML Test - Applet</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="applet.xhtml">applet.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">487 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="applet.xml">applet.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">487 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="applet2.html">applet2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">432 </td><td>NIST DOM HTML Test - Applet</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="applet2.xhtml">applet2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">473 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="applet2.xml">applet2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">473 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="area.html">area.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">405 </td><td>NIST DOM HTML Test - Area</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="area.xhtml">area.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">448 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="area.xml">area.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">448 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="area2.html">area2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">400 </td><td>NIST DOM HTML Test - Area</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="area2.xhtml">area2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">401 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="area2.xml">area2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">401 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="base.html">base.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">292 </td><td>NIST DOM HTML Test - Base</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="base.xhtml">base.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">321 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="base.xml">base.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">321 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="base2.html">base2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">544 </td><td>NIST DOM HTML Test - Base2</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="base2.xhtml">base2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">542 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="base2.xml">base2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">542 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="body.html">body.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">379 </td><td>NIST DOM HTML Test - Body</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="body.xhtml">body.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">476 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="body.xml">body.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">476 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="br.html">br.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">274 </td><td>NIST DOM HTML Test - BR</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="br.xhtml">br.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">315 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="br.xml">br.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">315 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="button.html">button.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">550 </td><td>NIST DOM HTML Test - Button</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="button.xhtml">button.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">592 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="button.xml">button.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">592 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="collection.html">collection.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">2.1K</td><td>NIST DOM HTML Test - SELECT</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="collection.xhtml">collection.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">2.2K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="collection.xml">collection.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">2.2K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="directory.html">directory.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">369 </td><td>NIST DOM HTML Test - Directory</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="directory.xhtml">directory.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">409 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="directory.xml">directory.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">409 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="div.html">div.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">351 </td><td>NIST DOM HTML Test - DIV</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="div.xhtml">div.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">391 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="div.xml">div.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">391 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="dl.html">dl.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">373 </td><td>NIST DOM HTML Test - DL</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="dl.xhtml">dl.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">413 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="dl.xml">dl.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">413 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="document.html">document.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.5K</td><td>NIST DOM HTML Test - DOCUMENT</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="document.xhtml">document.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.6K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="document.xml">document.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.6K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="element.html">element.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">3.5K</td><td>NIST DOM HTML Test - Element</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="element.xhtml">element.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">3.5K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="element.xml">element.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">3.5K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="fieldset.html">fieldset.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">505 </td><td>NIST DOM HTML Test - FieldSet</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="fieldset.xhtml">fieldset.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">545 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="fieldset.xml">fieldset.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">545 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="font.html">font.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">322 </td><td>NIST DOM HTML Test - Font</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="font.xhtml">font.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">366 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="font.xml">font.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">366 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="form.html">form.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">544 </td><td>NIST DOM HTML Test - FORM</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="form.xhtml">form.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">594 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="form.xml">form.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">594 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="form2.html">form2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">613 </td><td>NIST DOM HTML Test - FORM</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="form2.xhtml">form2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">611 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="form2.xml">form2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">611 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="form3.html">form3.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">433 </td><td>FORM3</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="form3.xhtml">form3.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">489 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="form3.xml">form3.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">471 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="frame.html">frame.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">524 </td><td>NIST DOM HTML Test - FRAME</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frame.xhtml">frame.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">522 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frame.xml">frame.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">522 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="frame2.html">frame2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">560 </td><td>NIST DOM HTML Test - FRAME2</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frame2.xhtml">frame2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">558 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frame2.xml">frame2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">518 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="frameset.html">frameset.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">403 </td><td>NIST DOM HTML Test - FRAMESET</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frameset.xhtml">frameset.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">402 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frameset.xml">frameset.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">402 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="heading.html">heading.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">483 </td><td>NIST DOM HTML Test - HEADING</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="heading.xhtml">heading.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">521 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="heading.xml">heading.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">521 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="hr.html">hr.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">309 </td><td>NIST DOM HTML Test - HR</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="hr.xhtml">hr.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">348 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="hr.xml">hr.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">348 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="html.html">html.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">321 </td><td>NIST DOM HTML Test - Html</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="html.xhtml">html.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">300 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="html.xml">html.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">300 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="iframe.html">iframe.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">431 </td><td>NIST DOM HTML Test - IFRAME</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="iframe.xhtml">iframe.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">471 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="iframe.xml">iframe.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">471 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="iframe2.html">iframe2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">499 </td><td>NIST DOM HTML Test - IFRAME2</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="iframe2.xhtml">iframe2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">539 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="iframe2.xml">iframe2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">539 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="img.html">img.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">454 </td><td>NIST DOM HTML Test - IMG</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="img.xhtml">img.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">494 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="img.xml">img.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">494 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="input.html">input.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.7K</td><td>NIST DOM HTML Test - INPUT</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="input.xhtml">input.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.7K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="input.xml">input.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.7K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="isindex.html">isindex.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">389 </td><td>NIST DOM HTML Test - ISINDEX</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="isindex.xhtml">isindex.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">430 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="isindex.xml">isindex.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">430 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="label.html">label.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">572 </td><td>NIST DOM HTML Test - LABEL</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="label.xhtml">label.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">612 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="label.xml">label.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">612 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="legend.html">legend.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">599 </td><td>NIST DOM HTML Test - LEGEND</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="legend.xhtml">legend.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">638 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="legend.xml">legend.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">638 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="li.html">li.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">401 </td><td>NIST DOM HTML Test - LI</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="li.xhtml">li.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">441 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="li.xml">li.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">441 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="link.html">link.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">492 </td><td>NIST DOM HTML Test - LINK</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="link.xhtml">link.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">535 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="link.xml">link.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">535 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="link2.html">link2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">548 </td><td>NIST DOM HTML Test - LINK</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="link2.xhtml">link2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">552 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="link2.xml">link2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">552 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="map.html">map.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">479 </td><td>NIST DOM HTML Test - MAP</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="map.xhtml">map.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">523 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="map.xml">map.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">523 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="menu.html">menu.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">346 </td><td>NIST DOM HTML Test - MENU</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="menu.xhtml">menu.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">386 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="menu.xml">menu.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">386 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="meta.html">meta.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">283 </td><td>NIST DOM HTML Test - META</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="meta.xhtml">meta.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">393 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="meta.xml">meta.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">393 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="mod.html">mod.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">558 </td><td>NIST DOM HTML Test - MOD</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="mod.xhtml">mod.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">599 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="mod.xml">mod.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">599 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="object.html">object.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">669 </td><td>NIST DOM HTML Test - OBJECT</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="object.xhtml">object.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">709 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="object.xml">object.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">709 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="object2.html">object2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">666 </td><td>NIST DOM HTML Test - OBJECT</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="object2.xhtml">object2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">707 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="object2.xml">object2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">707 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="olist.html">olist.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">502 </td><td>NIST DOM HTML Test - OLIST</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="olist.xhtml">olist.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">542 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="olist.xml">olist.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">542 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="optgroup.html">optgroup.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">587 </td><td>NIST DOM HTML Test - OPTGROUP</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="optgroup.xhtml">optgroup.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">628 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="optgroup.xml">optgroup.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">628 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="option.html">option.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">836 </td><td>NIST DOM HTML Test - OPTION</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="option.xhtml">option.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">858 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="option.xml">option.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">858 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="optionscollection.html">optionscollection.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">847 </td><td>NIST DOM HTML Test - OPTIONSCOLLECTION</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="optionscollection.xhtml">optionscollection.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">869 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="optionscollection.xml">optionscollection.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">869 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="paragraph.html">paragraph.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">284 </td><td>NIST DOM HTML Test - PARAGRAPH</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="paragraph.xhtml">paragraph.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">324 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="paragraph.xml">paragraph.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">324 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="param.html">param.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">343 </td><td>NIST DOM HTML Test - PARAM</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="param.xhtml">param.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">386 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="param.xml">param.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">386 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="pre.html">pre.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">549 </td><td>NIST DOM HTML Test - PRE</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="pre.xhtml">pre.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">565 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="pre.xml">pre.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">565 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="quote.html">quote.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">440 </td><td>NIST DOM HTML Test - QUOTE</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="quote.xhtml">quote.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">481 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="quote.xml">quote.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">481 </td></tr>
+<tr><td valign="top"><img src="/icons/image2.gif" alt="[IMG]" width="20" height="22" /></td><td><a href="right.png">right.png</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">137 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="script.html">script.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">359 </td><td>NIST DOM HTML Test - SCRIPT</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="script.xhtml">script.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">399 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="script.xml">script.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">399 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="select.html">select.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.0K</td><td>NIST DOM HTML Test - SELECT</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="select.xhtml">select.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.0K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="select.xml">select.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.0K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="style.html">style.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">319 </td><td>NIST DOM HTML Test - STYLE</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="style.xhtml">style.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">356 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="style.xml">style.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">356 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="table.html">table.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.9K</td><td>NIST DOM HTML Test - TABLE</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="table.xhtml">table.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.9K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="table.xml">table.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.9K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="table1.html">table1.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">336 </td><td>NIST DOM HTML Test - TABLE</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="table1.xhtml">table1.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">378 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="table1.xml">table1.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">378 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="tablecaption.html">tablecaption.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">435 </td><td>NIST DOM HTML Test - TABLECAPTION</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablecaption.xhtml">tablecaption.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">453 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablecaption.xml">tablecaption.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">453 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="tablecell.html">tablecell.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">909 </td><td>NIST DOM HTML Test - TABLECELL</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablecell.xhtml">tablecell.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">944 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablecell.xml">tablecell.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">944 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="tablecol.html">tablecol.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">629 </td><td>NIST DOM HTML Test - TABLECOL</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablecol.xhtml">tablecol.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">656 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablecol.xml">tablecol.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">656 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="tablerow.html">tablerow.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.7K</td><td>NIST DOM HTML Test - TABLEROW</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablerow.xhtml">tablerow.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.8K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablerow.xml">tablerow.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.8K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="tablesection.html">tablesection.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.8K</td><td>NIST DOM HTML Test - TABLESECTION</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablesection.xhtml">tablesection.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.9K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="tablesection.xml">tablesection.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">1.9K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="textarea.html">textarea.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">938 </td><td>NIST DOM HTML Test - TEXTAREA</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="textarea.xhtml">textarea.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">951 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="textarea.xml">textarea.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">951 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="title.html">title.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">266 </td><td>NIST DOM HTML Test - TITLE</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="title.xhtml">title.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">294 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="title.xml">title.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">294 </td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="ulist.html">ulist.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">619 </td><td>NIST DOM HTML Test - ULIST</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="ulist.xhtml">ulist.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">659 </td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="ulist.xml">ulist.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">659 </td></tr>
+<tr><td valign="top"><img src="/icons/image2.gif" alt="[IMG]" width="20" height="22" /></td><td><a href="w3c_main.png">w3c_main.png</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">5.8K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="xhtml-lat1.ent">xhtml-lat1.ent</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right"> 11K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="xhtml-special.ent">xhtml-special.ent</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">4.0K</td></tr>
+<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="xhtml-symbol.ent">xhtml-symbol.ent</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right"> 14K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="xhtml1-frameset.dtd">xhtml1-frameset.dtd</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right"> 32K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="xhtml1-strict.dtd">xhtml1-strict.dtd</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right"> 25K</td></tr>
+<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="xhtml1-transitional.dtd">xhtml1-transitional.dtd</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right"> 31K</td></tr>
+<tr><th colspan="5"><hr /></th></tr>
+</table>
+</body></html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/input.html b/dom/tests/mochitest/dom-level2-html/files/input.html
new file mode 100644
index 0000000000..c36e87d504
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/input.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - INPUT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE CELLPADDING="15" BORDER="BORDER" SUMMARY="Table 1">
+<TR ALIGN="center">
+<TD VAlign="top">Under a FORM control
+<FORM ID="form1" ACTION="./files/getData.pl" METHOD="post">
+<TABLE BORDER="15" SUMMARY="Table 2">
+<TR>
+<TD>
+<LABEL ACCESSKEY="b" FOR="input1">Enter Your Password:</LABEL>
+</TD>
+<TD>
+<INPUT DIR="LTR" ID="input1" TABINDEX="8" VALUE="Password" TYPE="password" NAME="Password" SIZE="25" MAXLENGTH="5" ALT="Password entry" READONLY="READONLY"/>
+</TD>
+</TR>
+<TR>
+<TD>
+<INPUT TYPE="RADIO" NAME="Radio1" ACCESSKEY="c" VALUE="ReHire"/>ReHire
+</TD>
+</TR>
+<TR>
+<TD>
+<INPUT TYPE="RADIO" NAME="Radio2" VALUE="NewHire" TABINDEX="9" CHECKED="CHECKED"/>NewHire
+</TD>
+</TR>
+<TR>
+<TD>Hours available to work</TD>
+<TD>
+<INPUT TYPE="CHECKBOX" NAME="Check1" ALIGN="bottom" TABINDEX="10" VALUE="EarlyMornings" CHECKED="CHECKED"/>EarlyMornings
+<BR/>
+<INPUT ID="input5" TYPE="CHECKBOX" NAME="Check2" TABINDEX="11" VALUE="AfterNoon" ONCLICK="newId(this)"/>Afternoon
+<BR/>
+<INPUT TYPE="CHECKBOX" NAME="Check3" TABINDEX="12" VALUE="Evenings"/>Evenings
+<BR/>
+<INPUT TYPE="CHECKBOX" NAME="Check4" TABINDEX="13" VALUE="Closing" DISABLED="DISABLED"/>Closing
+<BR/>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN="2">
+<INPUT TYPE="IMAGE" TABINDEX="14" NAME="SubmitImage" USEMAP="#submit-map" SRC="./pix/submit.gif"/>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN="2">
+<INPUT TITLE="old_title" TYPE="FILE" NAME="FileControl" TABINDEX="15" ACCEPT="GIF,JPEG" ONSELECT="newTitle(this)"/>
+</TD>
+</TR>
+</TABLE>
+</FORM>
+</TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/input.xhtml b/dom/tests/mochitest/dom-level2-html/files/input.xhtml
new file mode 100644
index 0000000000..b7704ad10e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/input.xhtml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - INPUT</title>
+</head>
+<body onload="parent.loadComplete()">
+<table cellpadding="15" border="border" summary="Table 1">
+<tr align="center">
+<td valign="top">Under a FORM control
+<form id="form1" action="./files/getData.pl" method="post">
+<table border="15" summary="Table 2">
+<tr>
+<td>
+<label accesskey="b" for="input1">Enter Your Password:</label>
+</td>
+<td>
+<input dir="ltr" id="input1" tabindex="8" value="Password" type="password" name="Password" size="25" maxlength="5" alt="Password entry" readonly="readonly"/>
+</td>
+</tr>
+<tr>
+<td>
+<input type="radio" name="Radio1" accesskey="c" value="ReHire"/>
+</td>
+</tr>
+<tr>
+<td>
+<input type="radio" name="Radio2" value="NewHire" tabindex="9" checked="checked"/>
+</td>
+</tr>
+<tr>
+<td>Hours available to work</td>
+<td>
+<input type="checkbox" name="Check1" align="bottom" tabindex="10" value="EarlyMornings" checked="checked"/>
+<br/>
+<input id="input5" type="checkbox" name="Check2" tabindex="11" value="AfterNoon" onclick="newId(this)"/>
+<br/>
+<input type="checkbox" name="Check3" tabindex="12" value="Evenings"/>
+<br/>
+<input type="checkbox" name="Check4" tabindex="13" value="Closing" disabled="disabled"/>
+<br/>
+</td>
+</tr>
+<tr>
+<td colspan="2">
+<input type="image" tabindex="14" name="SubmitImage" usemap="#submit-map" src="./pix/submit.gif"/>
+</td>
+</tr>
+<tr>
+<td colspan="2">
+<input title="old_title" type="file" name="FileControl" tabindex="15" accept="GIF,JPEG" onselect="newTitle(this)"/>
+</td>
+</tr>
+</table>
+</form>
+</td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/input.xml b/dom/tests/mochitest/dom-level2-html/files/input.xml
new file mode 100644
index 0000000000..b7704ad10e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/input.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - INPUT</title>
+</head>
+<body onload="parent.loadComplete()">
+<table cellpadding="15" border="border" summary="Table 1">
+<tr align="center">
+<td valign="top">Under a FORM control
+<form id="form1" action="./files/getData.pl" method="post">
+<table border="15" summary="Table 2">
+<tr>
+<td>
+<label accesskey="b" for="input1">Enter Your Password:</label>
+</td>
+<td>
+<input dir="ltr" id="input1" tabindex="8" value="Password" type="password" name="Password" size="25" maxlength="5" alt="Password entry" readonly="readonly"/>
+</td>
+</tr>
+<tr>
+<td>
+<input type="radio" name="Radio1" accesskey="c" value="ReHire"/>
+</td>
+</tr>
+<tr>
+<td>
+<input type="radio" name="Radio2" value="NewHire" tabindex="9" checked="checked"/>
+</td>
+</tr>
+<tr>
+<td>Hours available to work</td>
+<td>
+<input type="checkbox" name="Check1" align="bottom" tabindex="10" value="EarlyMornings" checked="checked"/>
+<br/>
+<input id="input5" type="checkbox" name="Check2" tabindex="11" value="AfterNoon" onclick="newId(this)"/>
+<br/>
+<input type="checkbox" name="Check3" tabindex="12" value="Evenings"/>
+<br/>
+<input type="checkbox" name="Check4" tabindex="13" value="Closing" disabled="disabled"/>
+<br/>
+</td>
+</tr>
+<tr>
+<td colspan="2">
+<input type="image" tabindex="14" name="SubmitImage" usemap="#submit-map" src="./pix/submit.gif"/>
+</td>
+</tr>
+<tr>
+<td colspan="2">
+<input title="old_title" type="file" name="FileControl" tabindex="15" accept="GIF,JPEG" onselect="newTitle(this)"/>
+</td>
+</tr>
+</table>
+</form>
+</td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/isindex.html b/dom/tests/mochitest/dom-level2-html/files/isindex.html
new file mode 100644
index 0000000000..0fd50ceae2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/isindex.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - ISINDEX</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" ACTION="./files/getData.pl" METHOD="post">
+<ISINDEX PROMPT="New Employee: ">
+</FORM>
+<ISINDEX PROMPT="Old Employee: ">
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/isindex.xhtml b/dom/tests/mochitest/dom-level2-html/files/isindex.xhtml
new file mode 100644
index 0000000000..a48d9a5851
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/isindex.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - ISINDEX</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<isindex prompt="New Employee: "/>
+</form>
+<isindex prompt="Old Employee: "/>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/isindex.xml b/dom/tests/mochitest/dom-level2-html/files/isindex.xml
new file mode 100644
index 0000000000..a48d9a5851
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/isindex.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - ISINDEX</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<isindex prompt="New Employee: "/>
+</form>
+<isindex prompt="Old Employee: "/>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/label.html b/dom/tests/mochitest/dom-level2-html/files/label.html
new file mode 100644
index 0000000000..d0abc044ba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/label.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - LABEL</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<LABEL ACCESSKEY="b" FOR="input1">Enter Your First Password:</LABEL>
+<INPUT ID="input1" TYPE="password" NAME="Password1"/>
+</P>
+</FORM>
+<P>
+<LABEL ACCESSKEY="c" FOR="input2">Enter Your Second Password:</LABEL>
+<INPUT ID="input2" TYPE="password" NAME="Password2"/>
+</P>
+</BODY>
+</HTML>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/label.xhtml b/dom/tests/mochitest/dom-level2-html/files/label.xhtml
new file mode 100644
index 0000000000..902584fdeb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/label.xhtml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LABEL</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<label accesskey="b" for="input1">Enter Your First Password:</label>
+<input id="input1" type="password" name="Password1"/>
+</p>
+</form>
+<p>
+<label accesskey="c" for="input2">Enter Your Second Password:</label>
+<input id="input2" type="password" name="Password2"/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/label.xml b/dom/tests/mochitest/dom-level2-html/files/label.xml
new file mode 100644
index 0000000000..902584fdeb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/label.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LABEL</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<label accesskey="b" for="input1">Enter Your First Password:</label>
+<input id="input1" type="password" name="Password1"/>
+</p>
+</form>
+<p>
+<label accesskey="c" for="input2">Enter Your Second Password:</label>
+<input id="input2" type="password" name="Password2"/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/legend.html b/dom/tests/mochitest/dom-level2-html/files/legend.html
new file mode 100644
index 0000000000..53160eeafa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/legend.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - LEGEND</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" ACTION="./files/getData.pl" METHOD="post">
+<FIELDSET>
+<LEGEND ACCESSKEY="b" ALIGN="top">Enter Password1:</LEGEND>
+<INPUT ID="input1" TYPE="password" NAME="Password1"/>
+</FIELDSET>
+</FORM>
+<FIELDSET>
+<LEGEND ACCESSKEY="c" ALIGN="bottom">Enter Password2:</LEGEND>
+<INPUT ID="input2" TYPE="password" NAME="Password2"/>
+</FIELDSET>
+</BODY>
+</HTML>
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/legend.xhtml b/dom/tests/mochitest/dom-level2-html/files/legend.xhtml
new file mode 100644
index 0000000000..c95e6852a9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/legend.xhtml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LEGEND</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<fieldset>
+<legend accesskey="b" align="top">Enter Password1:</legend>
+<input id="input1" type="password" name="Password1"/>
+</fieldset>
+</form>
+<fieldset>
+<legend accesskey="c" align="bottom">Enter Password2:</legend>
+<input id="input2" type="password" name="Password2"/>
+</fieldset>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/legend.xml b/dom/tests/mochitest/dom-level2-html/files/legend.xml
new file mode 100644
index 0000000000..c95e6852a9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/legend.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LEGEND</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<fieldset>
+<legend accesskey="b" align="top">Enter Password1:</legend>
+<input id="input1" type="password" name="Password1"/>
+</fieldset>
+</form>
+<fieldset>
+<legend accesskey="c" align="bottom">Enter Password2:</legend>
+<input id="input2" type="password" name="Password2"/>
+</fieldset>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/li.html b/dom/tests/mochitest/dom-level2-html/files/li.html
new file mode 100644
index 0000000000..0c97b4c922
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/li.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - LI</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<OL>
+<LI TYPE="square" VALUE="2">EMP0001
+<UL>
+<LI>Margaret Martin
+<DL>
+<DD>Accountant</DD>
+<DD>56,000</DD>
+<DD>Female</DD>
+</DL>
+</LI>
+</UL>
+</LI>
+</OL>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/li.xhtml b/dom/tests/mochitest/dom-level2-html/files/li.xhtml
new file mode 100644
index 0000000000..79af811120
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/li.xhtml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LI</title>
+</head>
+<body onload="parent.loadComplete()">
+<ol>
+<li type="square" value="2">EMP0001
+<ul>
+<li>Margaret Martin
+<dl>
+<dd>Accountant</dd>
+<dd>56,000</dd>
+<dd>Female</dd>
+</dl>
+</li>
+</ul>
+</li>
+</ol>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/li.xml b/dom/tests/mochitest/dom-level2-html/files/li.xml
new file mode 100644
index 0000000000..79af811120
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/li.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LI</title>
+</head>
+<body onload="parent.loadComplete()">
+<ol>
+<li type="square" value="2">EMP0001
+<ul>
+<li>Margaret Martin
+<dl>
+<dd>Accountant</dd>
+<dd>56,000</dd>
+<dd>Female</dd>
+</dl>
+</li>
+</ul>
+</li>
+</ol>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/link.html b/dom/tests/mochitest/dom-level2-html/files/link.html
new file mode 100644
index 0000000000..2d4c082b4f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/link.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - LINK</TITLE>
+<LINK CHARSET="Latin-1" HREF="./files/glossary.html" HREFLANG="en" MEDIA="screen" REL="Glossary" TYPE="text/html">
+<LINK CHARSET="Latin-1" HREF="./files/style1.css" HREFLANG="en" MEDIA="screen" REV="stylesheet" TYPE="text/css">
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<BR>
+</P>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/link.xhtml b/dom/tests/mochitest/dom-level2-html/files/link.xhtml
new file mode 100644
index 0000000000..5a0f18c241
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/link.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LINK</title>
+<link charset="Latin-1" href="./files/glossary.html" hreflang="en" media="screen" rel="Glossary" type="text/html"/>
+<link charset="Latin-1" href="./files/style1.css" hreflang="en" media="screen" rev="stylesheet" type="text/css"/>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/link.xml b/dom/tests/mochitest/dom-level2-html/files/link.xml
new file mode 100644
index 0000000000..5a0f18c241
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/link.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LINK</title>
+<link charset="Latin-1" href="./files/glossary.html" hreflang="en" media="screen" rel="Glossary" type="text/html"/>
+<link charset="Latin-1" href="./files/style1.css" hreflang="en" media="screen" rev="stylesheet" type="text/css"/>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/link2.html b/dom/tests/mochitest/dom-level2-html/files/link2.html
new file mode 100644
index 0000000000..12fac9daa6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/link2.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - LINK</TITLE>
+<LINK CHARSET="Latin-1" TARGET="dynamic" HREF="./files/glossary.html" HREFLANG="en" MEDIA="screen" REL="Glossary" TYPE="text/html">
+<LINK CHARSET="Latin-1" HREF="./files/style1.css" HREFLANG="en" MEDIA="screen" REV="stylesheet" TYPE="text/css">
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<BR>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/link2.xhtml b/dom/tests/mochitest/dom-level2-html/files/link2.xhtml
new file mode 100644
index 0000000000..95c80048f2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/link2.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LINK</title>
+<link charset="Latin-1" target="dynamic" href="./files/glossary.html" hreflang="en" media="screen" rel="Glossary" type="text/html"/>
+<link charset="Latin-1" href="./files/style1.css" hreflang="en" media="screen" rev="stylesheet" type="text/css"/>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/link2.xml b/dom/tests/mochitest/dom-level2-html/files/link2.xml
new file mode 100644
index 0000000000..95c80048f2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/link2.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - LINK</title>
+<link charset="Latin-1" target="dynamic" href="./files/glossary.html" hreflang="en" media="screen" rel="Glossary" type="text/html"/>
+<link charset="Latin-1" href="./files/style1.css" hreflang="en" media="screen" rev="stylesheet" type="text/css"/>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/map.html b/dom/tests/mochitest/dom-level2-html/files/map.html
new file mode 100644
index 0000000000..a636fa5899
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/map.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - MAP</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<MAP NAME="mapid" ID="mapid">
+<AREA HREF="./files/dletter1.html" TITLE="Domain1" ALT="Domain1">
+<AREA HREF="./files/dletter2.html" TITLE="Domain2" ALT="Domain2">
+<AREA HREF="./files/dletter3.html" TITLE="Domain3" ALT="Domain3">
+</MAP>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/map.xhtml b/dom/tests/mochitest/dom-level2-html/files/map.xhtml
new file mode 100644
index 0000000000..f61a2adb9a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/map.xhtml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - MAP</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<map name="mapid" id="mapid">
+<area href="./files/dletter1.html" title="Domain1" alt="Domain1"/>
+<area href="./files/dletter2.html" title="Domain2" alt="Domain2"/>
+<area href="./files/dletter3.html" title="Domain3" alt="Domain3"/>
+</map>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/map.xml b/dom/tests/mochitest/dom-level2-html/files/map.xml
new file mode 100644
index 0000000000..f61a2adb9a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/map.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - MAP</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<map name="mapid" id="mapid">
+<area href="./files/dletter1.html" title="Domain1" alt="Domain1"/>
+<area href="./files/dletter2.html" title="Domain2" alt="Domain2"/>
+<area href="./files/dletter3.html" title="Domain3" alt="Domain3"/>
+</map>
+</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/files/menu.html b/dom/tests/mochitest/dom-level2-html/files/menu.html
new file mode 100644
index 0000000000..e07204f1dc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/menu.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - MENU</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<MENU COMPACT="COMPACT">
+<LI>Interview</LI>
+<LI>Paperwork</LI>
+<LI>Give start date</LI>
+</MENU>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/menu.xhtml b/dom/tests/mochitest/dom-level2-html/files/menu.xhtml
new file mode 100644
index 0000000000..9f020ff8b9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/menu.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - MENU</title>
+</head>
+<body onload="parent.loadComplete()">
+<menu compact="compact">
+<li>Interview</li>
+<li>Paperwork</li>
+<li>Give start date</li>
+</menu>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/menu.xml b/dom/tests/mochitest/dom-level2-html/files/menu.xml
new file mode 100644
index 0000000000..9f020ff8b9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/menu.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - MENU</title>
+</head>
+<body onload="parent.loadComplete()">
+<menu compact="compact">
+<li>Interview</li>
+<li>Paperwork</li>
+<li>Give start date</li>
+</menu>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/meta.html b/dom/tests/mochitest/dom-level2-html/files/meta.html
new file mode 100644
index 0000000000..e88fe8fc1d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/meta.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META NAME="Meta-Name" HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" SCHEME="NIST">
+<TITLE>NIST DOM HTML Test - META</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<BR/>
+</P>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/meta.xhtml b/dom/tests/mochitest/dom-level2-html/files/meta.xhtml
new file mode 100644
index 0000000000..bf89bbeeab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/meta.xhtml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<meta name="Meta-Name" http-equiv="Content-Type" content="text/html; CHARSET=utf-8" scheme="NIST"/>
+<title>NIST DOM HTML Test - META</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/meta.xml b/dom/tests/mochitest/dom-level2-html/files/meta.xml
new file mode 100644
index 0000000000..bf89bbeeab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/meta.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<meta name="Meta-Name" http-equiv="Content-Type" content="text/html; CHARSET=utf-8" scheme="NIST"/>
+<title>NIST DOM HTML Test - META</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/mod.html b/dom/tests/mochitest/dom-level2-html/files/mod.html
new file mode 100644
index 0000000000..1ab79696de
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/mod.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - MOD</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<INS CITE="./files/ins-reasons.html" DATETIME="January 1, 2002">The INS element is used to indicate that a section of a document had been inserted.</INS>
+<BR/>
+<DEL CITE="./files/del-reasons.html" DATETIME="January 2, 2002">The DEL element is used to indicate that a section of a document had been removed.</DEL>
+</P>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/mod.xhtml b/dom/tests/mochitest/dom-level2-html/files/mod.xhtml
new file mode 100644
index 0000000000..b81432d52f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/mod.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - MOD</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<ins cite="./files/ins-reasons.html" datetime="January 1, 2002">The INS element is used to indicate that a section of a document had been inserted.</ins>
+<br/>
+<del cite="./files/del-reasons.html" datetime="January 2, 2002">The DEL element is used to indicate that a section of a document had been removed.</del>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/mod.xml b/dom/tests/mochitest/dom-level2-html/files/mod.xml
new file mode 100644
index 0000000000..b81432d52f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/mod.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - MOD</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<ins cite="./files/ins-reasons.html" datetime="January 1, 2002">The INS element is used to indicate that a section of a document had been inserted.</ins>
+<br/>
+<del cite="./files/del-reasons.html" datetime="January 2, 2002">The DEL element is used to indicate that a section of a document had been removed.</del>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/object.html b/dom/tests/mochitest/dom-level2-html/files/object.html
new file mode 100644
index 0000000000..31da31cdc8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/object.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - OBJECT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<OBJECT ALIGN="middle" ARCHIVE="" BORDER="0" CODEBASE="http://example.org:80" DATA="./pix/logo.gif" HEIGHT="60" HSPACE="0" STANDBY="Loading Image ..." TABINDEX="0" TYPE="image/gif" USEMAP="#DivLogo-map" VSPACE="0" WIDTH="550"></OBJECT>
+</P>
+<FORM NAME="OBJECT2" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<OBJECT DECLARE="declare" NAME="OBJECT2" CODETYPE="image/gif"></OBJECT>
+</P>
+</FORM>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/object.xhtml b/dom/tests/mochitest/dom-level2-html/files/object.xhtml
new file mode 100644
index 0000000000..824f7fc60e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/object.xhtml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OBJECT</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<object align="middle" archive="" border="0" codebase="http://xw2k.sdct.itl.nist.gov/brady/dom/" data="./pix/logo.gif" height="60" hspace="0" standby="Loading Image ..." tabindex="0" type="image/gif" usemap="#DivLogo-map" vspace="0" width="550"></object>
+</p>
+<form name="OBJECT2" action="./files/getData.pl" method="post">
+<p>
+<object declare="declare" name="OBJECT2" codetype="image/gif"></object>
+</p>
+</form>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/object.xml b/dom/tests/mochitest/dom-level2-html/files/object.xml
new file mode 100644
index 0000000000..824f7fc60e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/object.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OBJECT</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<object align="middle" archive="" border="0" codebase="http://xw2k.sdct.itl.nist.gov/brady/dom/" data="./pix/logo.gif" height="60" hspace="0" standby="Loading Image ..." tabindex="0" type="image/gif" usemap="#DivLogo-map" vspace="0" width="550"></object>
+</p>
+<form name="OBJECT2" action="./files/getData.pl" method="post">
+<p>
+<object declare="declare" name="OBJECT2" codetype="image/gif"></object>
+</p>
+</form>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/object2.html b/dom/tests/mochitest/dom-level2-html/files/object2.html
new file mode 100644
index 0000000000..44680cd726
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/object2.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - OBJECT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<OBJECT ALIGN="middle" ARCHIVE="" BORDER="0" CODEBASE="http://example.org:80" DATA="./pix/logo.gif" HEIGHT="60" HSPACE="0" STANDBY="Loading Image ..." TABINDEX="0" TYPE="image/gif" USEMAP="#DivLogo-map" VSPACE="0" WIDTH="550"></OBJECT>
+</P>
+<FORM ID="object2" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<OBJECT DECLARE="declare" NAME="OBJECT2" CODETYPE="image/gif"></OBJECT>
+</P>
+</FORM>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/object2.xhtml b/dom/tests/mochitest/dom-level2-html/files/object2.xhtml
new file mode 100644
index 0000000000..a41e03dd8f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/object2.xhtml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OBJECT</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<object align="middle" archive="" border="0" codebase="http://xw2k.sdct.itl.nist.gov/brady/dom/" data="./pix/logo.gif" height="60" hspace="0" standby="Loading Image ..." tabindex="0" type="image/gif" usemap="#DivLogo-map" vspace="0" width="550"></object>
+</p>
+<form id="object2" action="./files/getData.pl" method="post">
+<p>
+<object declare="declare" name="OBJECT2" codetype="image/gif"></object>
+</p>
+</form>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/object2.xml b/dom/tests/mochitest/dom-level2-html/files/object2.xml
new file mode 100644
index 0000000000..a41e03dd8f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/object2.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OBJECT</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<object align="middle" archive="" border="0" codebase="http://xw2k.sdct.itl.nist.gov/brady/dom/" data="./pix/logo.gif" height="60" hspace="0" standby="Loading Image ..." tabindex="0" type="image/gif" usemap="#DivLogo-map" vspace="0" width="550"></object>
+</p>
+<form id="object2" action="./files/getData.pl" method="post">
+<p>
+<object declare="declare" name="OBJECT2" codetype="image/gif"></object>
+</p>
+</form>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/olist.html b/dom/tests/mochitest/dom-level2-html/files/olist.html
new file mode 100644
index 0000000000..f69c9ded98
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/olist.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - OLIST</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<OL COMPACT="compact" START="1" TYPE="1">
+<LI>EMP0001
+<UL>
+<LI>Margaret Martin
+<DL>
+<DD>Accountant</DD>
+<DD>56,000</DD>
+</DL>
+</LI>
+</UL>
+</LI>
+<LI>EMP0002
+<UL>
+<LI>Martha Raynolds
+<DL>
+<DD>Secretary</DD>
+<DD>35,000</DD>
+</DL>
+</LI>
+</UL>
+</LI>
+</OL>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/olist.xhtml b/dom/tests/mochitest/dom-level2-html/files/olist.xhtml
new file mode 100644
index 0000000000..cbe1ab6add
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/olist.xhtml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OLIST</title>
+</head>
+<body onload="parent.loadComplete()">
+<ol compact="compact" start="1" type="1">
+<li>EMP0001
+<ul>
+<li>Margaret Martin
+<dl>
+<dd>Accountant</dd>
+<dd>56,000</dd>
+</dl>
+</li>
+</ul>
+</li>
+<li>EMP0002
+<ul>
+<li>Martha Raynolds
+<dl>
+<dd>Secretary</dd>
+<dd>35,000</dd>
+</dl>
+</li>
+</ul>
+</li>
+</ol>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/olist.xml b/dom/tests/mochitest/dom-level2-html/files/olist.xml
new file mode 100644
index 0000000000..cbe1ab6add
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/olist.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OLIST</title>
+</head>
+<body onload="parent.loadComplete()">
+<ol compact="compact" start="1" type="1">
+<li>EMP0001
+<ul>
+<li>Margaret Martin
+<dl>
+<dd>Accountant</dd>
+<dd>56,000</dd>
+</dl>
+</li>
+</ul>
+</li>
+<li>EMP0002
+<ul>
+<li>Martha Raynolds
+<dl>
+<dd>Secretary</dd>
+<dd>35,000</dd>
+</dl>
+</li>
+</ul>
+</li>
+</ol>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/optgroup.html b/dom/tests/mochitest/dom-level2-html/files/optgroup.html
new file mode 100644
index 0000000000..a354af8066
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/optgroup.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - OPTGROUP</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="Form1" ACTION="test.pl" METHOD="post">
+<P>
+<SELECT NAME="select2">
+<OPTGROUP LABEL="Regular Employees">
+<OPTION>EMP0001</OPTION>
+<OPTION>EMP0002</OPTION>
+<OPTION>EMP0003A</OPTION>
+</OPTGROUP>
+<OPTGROUP DISABLED="disabled" LABEL="Temporary Employees">
+<OPTION>EMP0004</OPTION>
+<OPTION>EMP0005</OPTION>
+</OPTGROUP>
+</SELECT>
+</P>
+</FORM>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/optgroup.xhtml b/dom/tests/mochitest/dom-level2-html/files/optgroup.xhtml
new file mode 100644
index 0000000000..b421ecabb3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/optgroup.xhtml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OPTGROUP</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="Form1" action="test.pl" method="post">
+<p>
+<select name="select2">
+<optgroup label="Regular Employees">
+<option>EMP0001</option>
+<option>EMP0002</option>
+<option>EMP0003A</option>
+</optgroup>
+<optgroup disabled="disabled" label="Temporary Employees">
+<option>EMP0004</option>
+<option>EMP0005</option>
+</optgroup>
+</select>
+</p>
+</form>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/optgroup.xml b/dom/tests/mochitest/dom-level2-html/files/optgroup.xml
new file mode 100644
index 0000000000..b421ecabb3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/optgroup.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OPTGROUP</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="Form1" action="test.pl" method="post">
+<p>
+<select name="select2">
+<optgroup label="Regular Employees">
+<option>EMP0001</option>
+<option>EMP0002</option>
+<option>EMP0003A</option>
+</optgroup>
+<optgroup disabled="disabled" label="Temporary Employees">
+<option>EMP0004</option>
+<option>EMP0005</option>
+</optgroup>
+</select>
+</p>
+</form>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/option.html b/dom/tests/mochitest/dom-level2-html/files/option.html
new file mode 100644
index 0000000000..83707c3929
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/option.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - OPTION</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" NAME="form1" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<SELECT ID="selectId" DIR="ltr" TABINDEX="7" NAME="select1" MULTIPLE="multiple" SIZE="1">
+<OPTION SELECTED="selected" value="10001">EMP10001</OPTION>
+<OPTION LABEL="l1">EMP10002</OPTION>
+<OPTION>EMP10003</OPTION>
+<OPTION>EMP10004</OPTION>
+<OPTION>EMP10005</OPTION>
+</SELECT>
+</P>
+</FORM>
+<P>
+<SELECT NAME="select2" disabled="disabled">
+<OPTION>EMP20001</OPTION>
+<OPTION>EMP20002</OPTION>
+<OPTION>EMP20003</OPTION>
+<OPTION>EMP20004</OPTION>
+<OPTION DISABLED="disabled">EMP20005</OPTION>
+</SELECT>
+</P>
+</BODY>
+</HTML>
+
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/option.xhtml b/dom/tests/mochitest/dom-level2-html/files/option.xhtml
new file mode 100644
index 0000000000..8cf88d8878
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/option.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OPTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="10001">EMP10001</option>
+<option label="l1">EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2" disabled="disabled">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option disabled="disabled">EMP20005</option>
+</select>
+</p>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/option.xml b/dom/tests/mochitest/dom-level2-html/files/option.xml
new file mode 100644
index 0000000000..8cf88d8878
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/option.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OPTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="10001">EMP10001</option>
+<option label="l1">EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2" disabled="disabled">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option disabled="disabled">EMP20005</option>
+</select>
+</p>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/optionscollection.html b/dom/tests/mochitest/dom-level2-html/files/optionscollection.html
new file mode 100644
index 0000000000..d1e8743eae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/optionscollection.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - OPTIONSCOLLECTION</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" NAME="form1" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<SELECT ID="selectId" DIR="ltr" TABINDEX="7" NAME="select1" MULTIPLE="multiple" SIZE="1">
+<OPTION SELECTED="selected" value="10001">EMP10001</OPTION>
+<OPTION LABEL="l1">EMP10002</OPTION>
+<OPTION>EMP10003</OPTION>
+<OPTION>EMP10004</OPTION>
+<OPTION>EMP10005</OPTION>
+</SELECT>
+</P>
+</FORM>
+<P>
+<SELECT NAME="select2" disabled="disabled">
+<OPTION>EMP20001</OPTION>
+<OPTION>EMP20002</OPTION>
+<OPTION>EMP20003</OPTION>
+<OPTION>EMP20004</OPTION>
+<OPTION DISABLED="disabled">EMP20005</OPTION>
+</SELECT>
+</P>
+</BODY>
+</HTML>
+
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/optionscollection.xhtml b/dom/tests/mochitest/dom-level2-html/files/optionscollection.xhtml
new file mode 100644
index 0000000000..3f04194207
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/optionscollection.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OPTIONSCOLLECTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="10001">EMP10001</option>
+<option label="l1">EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2" disabled="disabled">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option disabled="disabled">EMP20005</option>
+</select>
+</p>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/optionscollection.xml b/dom/tests/mochitest/dom-level2-html/files/optionscollection.xml
new file mode 100644
index 0000000000..3f04194207
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/optionscollection.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - OPTIONSCOLLECTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="10001">EMP10001</option>
+<option label="l1">EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2" disabled="disabled">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option disabled="disabled">EMP20005</option>
+</select>
+</p>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/paragraph.html b/dom/tests/mochitest/dom-level2-html/files/paragraph.html
new file mode 100644
index 0000000000..0da4836097
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/paragraph.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - PARAGRAPH</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P ALIGN="center">
+TEXT
+</P>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/paragraph.xhtml b/dom/tests/mochitest/dom-level2-html/files/paragraph.xhtml
new file mode 100644
index 0000000000..2cdb1dfe15
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/paragraph.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - PARAGRAPH</title>
+</head>
+<body onload="parent.loadComplete()">
+<p align="center">
+TEXT
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/paragraph.xml b/dom/tests/mochitest/dom-level2-html/files/paragraph.xml
new file mode 100644
index 0000000000..2cdb1dfe15
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/paragraph.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - PARAGRAPH</title>
+</head>
+<body onload="parent.loadComplete()">
+<p align="center">
+TEXT
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/param.html b/dom/tests/mochitest/dom-level2-html/files/param.html
new file mode 100644
index 0000000000..290e626601
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/param.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - PARAM</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<OBJECT>
+<PARAM NAME="image3" TYPE="image/gif" VALUE="image/file.gif" VALUETYPE="ref">
+</OBJECT>
+</P>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/param.xhtml b/dom/tests/mochitest/dom-level2-html/files/param.xhtml
new file mode 100644
index 0000000000..3e916eb5a2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/param.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - PARAM</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<object>
+<param name="image3" type="image/gif" value="image/file.gif" valuetype="ref"/>
+</object>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/param.xml b/dom/tests/mochitest/dom-level2-html/files/param.xml
new file mode 100644
index 0000000000..3e916eb5a2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/param.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - PARAM</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<object>
+<param name="image3" type="image/gif" value="image/file.gif" valuetype="ref"/>
+</object>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/pre.html b/dom/tests/mochitest/dom-level2-html/files/pre.html
new file mode 100644
index 0000000000..2a402065e4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/pre.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - PRE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<PRE WIDTH="277">The PRE is used to indicate pre-formatted text. Visual agents may:
+
+ leave white space intact.
+ May render text with a fixed-pitch font.
+ May disable automatic word wrap.
+ Must not disable bidirectional processing.
+</PRE>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/pre.xhtml b/dom/tests/mochitest/dom-level2-html/files/pre.xhtml
new file mode 100644
index 0000000000..69f652b14f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/pre.xhtml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - PRE</title>
+</head>
+<body onload="parent.loadComplete()">
+<pre>The PRE is used to indicate pre-formatted text. Visual agents may:
+
+ leave white space intact.
+ May render text with a fixed-pitch font.
+ May disable automatic word wrap.
+ Must not disable bidirectional processing.
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/pre.xml b/dom/tests/mochitest/dom-level2-html/files/pre.xml
new file mode 100644
index 0000000000..69f652b14f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/pre.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - PRE</title>
+</head>
+<body onload="parent.loadComplete()">
+<pre>The PRE is used to indicate pre-formatted text. Visual agents may:
+
+ leave white space intact.
+ May render text with a fixed-pitch font.
+ May disable automatic word wrap.
+ Must not disable bidirectional processing.
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/quote.html b/dom/tests/mochitest/dom-level2-html/files/quote.html
new file mode 100644
index 0000000000..6bad2b83f6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/quote.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - QUOTE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<Q CITE="./files/Q.html">The Q element is intended for short quotations</Q>
+</P>
+<BLOCKQUOTE CITE="./files/BLOCKQUOTE.html">
+<P>The BLOCKQUOTE element is used for long quotations.</P>
+</BLOCKQUOTE>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/quote.xhtml b/dom/tests/mochitest/dom-level2-html/files/quote.xhtml
new file mode 100644
index 0000000000..93e6c422f9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/quote.xhtml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - QUOTE</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<q cite="./files/Q.html">The Q element is intended for short quotations</q>
+</p>
+<blockquote cite="./files/BLOCKQUOTE.html">
+<p>The BLOCKQUOTE element is used for long quotations.</p>
+</blockquote>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/quote.xml b/dom/tests/mochitest/dom-level2-html/files/quote.xml
new file mode 100644
index 0000000000..93e6c422f9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/quote.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - QUOTE</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<q cite="./files/Q.html">The Q element is intended for short quotations</q>
+</p>
+<blockquote cite="./files/BLOCKQUOTE.html">
+<p>The BLOCKQUOTE element is used for long quotations.</p>
+</blockquote>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/right.png b/dom/tests/mochitest/dom-level2-html/files/right.png
new file mode 100644
index 0000000000..41ad0bdad2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/right.png
Binary files differ
diff --git a/dom/tests/mochitest/dom-level2-html/files/script.html b/dom/tests/mochitest/dom-level2-html/files/script.html
new file mode 100644
index 0000000000..362860b393
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/script.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - SCRIPT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<SCRIPT CHARSET="US-ASCII" TYPE="text/javaScript" DEFER="defer" SRC="./files/script1.js">var a=2;</SCRIPT>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/script.xhtml b/dom/tests/mochitest/dom-level2-html/files/script.xhtml
new file mode 100644
index 0000000000..ebdaa7246f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/script.xhtml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - SCRIPT</title>
+</head>
+<body onload="parent.loadComplete()">
+<script charset="US-ASCII" type="text/javaScript" defer="defer" src="./files/script1.js">var a=2;</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/script.xml b/dom/tests/mochitest/dom-level2-html/files/script.xml
new file mode 100644
index 0000000000..ebdaa7246f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/script.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - SCRIPT</title>
+</head>
+<body onload="parent.loadComplete()">
+<script charset="US-ASCII" type="text/javaScript" defer="defer" src="./files/script1.js">var a=2;</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/select.html b/dom/tests/mochitest/dom-level2-html/files/select.html
new file mode 100644
index 0000000000..78206240f0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/select.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - SELECT</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<SELECT ID="selectId" DIR="ltr" TABINDEX="7" NAME="select1" MULTIPLE="multiple" SIZE="1">
+<OPTION SELECTED="selected" value="EMP1">EMP10001</OPTION>
+<OPTION>EMP10002</OPTION>
+<OPTION>EMP10003</OPTION>
+<OPTION>EMP10004</OPTION>
+<OPTION>EMP10005</OPTION>
+</SELECT>
+</P>
+</FORM>
+<P>
+<SELECT NAME="select2">
+<OPTION>EMP20001</OPTION>
+<OPTION>EMP20002</OPTION>
+<OPTION>EMP20003</OPTION>
+<OPTION>EMP20004</OPTION>
+<OPTION>EMP20005</OPTION>
+</SELECT>
+</P>
+<P>
+<SELECT NAME="select3" DISABLED="disabled" TABINDEX="1">
+<OPTION>EMP30001</OPTION>
+<OPTION>EMP30002</OPTION>
+<OPTION>EMP30003</OPTION>
+<OPTION>EMP30004</OPTION>
+<OPTION>EMP30005</OPTION>
+</SELECT>
+</P>
+</BODY>
+</HTML>
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/select.xhtml b/dom/tests/mochitest/dom-level2-html/files/select.xhtml
new file mode 100644
index 0000000000..491a74c6ac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/select.xhtml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - SELECT</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="EMP1">EMP10001</option>
+<option>EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option>EMP20005</option>
+</select>
+</p>
+<p>
+<select name="select3" disabled="disabled" tabindex="1">
+<option>EMP30001</option>
+<option>EMP30002</option>
+<option>EMP30003</option>
+<option>EMP30004</option>
+<option>EMP30005</option>
+</select>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/select.xml b/dom/tests/mochitest/dom-level2-html/files/select.xml
new file mode 100644
index 0000000000..491a74c6ac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/select.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - SELECT</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<select id="selectId" dir="ltr" tabindex="7" name="select1" multiple="multiple" size="1">
+<option selected="selected" value="EMP1">EMP10001</option>
+<option>EMP10002</option>
+<option>EMP10003</option>
+<option>EMP10004</option>
+<option>EMP10005</option>
+</select>
+</p>
+</form>
+<p>
+<select name="select2">
+<option>EMP20001</option>
+<option>EMP20002</option>
+<option>EMP20003</option>
+<option>EMP20004</option>
+<option>EMP20005</option>
+</select>
+</p>
+<p>
+<select name="select3" disabled="disabled" tabindex="1">
+<option>EMP30001</option>
+<option>EMP30002</option>
+<option>EMP30003</option>
+<option>EMP30004</option>
+<option>EMP30005</option>
+</select>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/style.html b/dom/tests/mochitest/dom-level2-html/files/style.html
new file mode 100644
index 0000000000..c3df42432d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/style.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<STYLE MEDIA="screen" type="text/css"></STYLE>
+<TITLE>NIST DOM HTML Test - STYLE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>Hello, World.</P>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/style.xhtml b/dom/tests/mochitest/dom-level2-html/files/style.xhtml
new file mode 100644
index 0000000000..b8477c1f6d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/style.xhtml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<style media="screen" type="text/css"></style>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>Hello, World.</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/style.xml b/dom/tests/mochitest/dom-level2-html/files/style.xml
new file mode 100644
index 0000000000..b8477c1f6d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/style.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<style media="screen" type="text/css"></style>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>Hello, World.</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/table.html b/dom/tests/mochitest/dom-level2-html/files/table.html
new file mode 100644
index 0000000000..b8f151e069
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/table.html
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE ALIGN="center" SUMMARY="Table 1">
+<TR>
+<TH>Id</TH>
+<TH>Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+</TABLE>
+<TABLE ID="table-1" ALIGN="center" BORDER="4" BGCOLOR="#ff0000" FRAME="border" CELLPADDING="2" CELLSPACING="2" SUMMARY="HTML Control Table" RULES="all" WIDTH="680">
+<CAPTION ALIGN="top">Table Caption</CAPTION>
+<THEAD ALIGN="center" VALIGN="middle">
+<TR ALIGN="center" BGCOLOR="#00FFFF" VALIGN="middle">
+<TH ID="header-1">Employee Id</TH>
+<TH ID="header-2" ABBR="maiden" AXIS="center" ALIGN="center" BGCOLOR="#00FFFF" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-1" VALIGN="middle" WIDTH="100">Employee Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+<TH>Gender</TH>
+<TH>Address</TH>
+</TR>
+</THEAD>
+<TFOOT ALIGN="center" VALIGN="middle">
+<TR>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+</TR>
+</TFOOT>
+<TBODY ALIGN="center" VALIGN="middle">
+<TR>
+<TD AXIS="center" ID="Table-3" ABBR="maiden2" ALIGN="center" BGCOLOR="#FF0000" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-2" VALIGN="middle" WIDTH="175">EMP0001</TD>
+<TD HEADERS="header-2">Margaret Martin</TD>
+<TD>Accountant</TD>
+<TD>56,000</TD>
+<TD>Female</TD>
+<TD>1230 North Ave. Dallas, Texas 98551</TD>
+</TR>
+<TR>
+<TD>EMP0002</TD>
+<TD>Martha Raynolds</TD>
+<TD>Secretary</TD>
+<TD>35,000</TD>
+<TD>Female</TD>
+<TD>1900 Dallas Road Dallas, Texas 98554</TD>
+</TR>
+</TBODY>
+</TABLE>
+<TABLE SUMMARY="Table 3">
+<TBODY>
+<TR>
+<TD>
+</TD>
+</TR>
+</TBODY>
+<TBODY>
+<TR>
+<TD>
+</TD>
+</TR>
+</TBODY>
+<TBODY>
+<TR>
+<TD>
+</TD>
+</TR>
+</TBODY>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/table.xhtml b/dom/tests/mochitest/dom-level2-html/files/table.xhtml
new file mode 100644
index 0000000000..8300b90a17
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/table.xhtml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle">
+<tr align="center" bgcolor="#00FFFF" valign="middle">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+<table summary="Table 3">
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/table.xml b/dom/tests/mochitest/dom-level2-html/files/table.xml
new file mode 100644
index 0000000000..8300b90a17
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/table.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle">
+<tr align="center" bgcolor="#00FFFF" valign="middle">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+<table summary="Table 3">
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/table1.html b/dom/tests/mochitest/dom-level2-html/files/table1.html
new file mode 100644
index 0000000000..8f5d19b282
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/table1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE SUMMARY="Empty Table">
+<tr><td>HTML can't abide empty table</td></tr>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/table1.xhtml b/dom/tests/mochitest/dom-level2-html/files/table1.xhtml
new file mode 100644
index 0000000000..e174c63dfd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/table1.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Empty Table">
+<tr><td>XHTML can't abide empty table</td></tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/table1.xml b/dom/tests/mochitest/dom-level2-html/files/table1.xml
new file mode 100644
index 0000000000..e174c63dfd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/table1.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Empty Table">
+<tr><td>XHTML can't abide empty table</td></tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecaption.html b/dom/tests/mochitest/dom-level2-html/files/tablecaption.html
new file mode 100644
index 0000000000..f9181c739c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecaption.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLECAPTION</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE SUMMARY="Table Summary">
+<CAPTION ALIGN="top">CAPTION 1</CAPTION>
+<TR>
+<TH>Employee Id</TH>
+<TH>Employee Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
+
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecaption.xhtml b/dom/tests/mochitest/dom-level2-html/files/tablecaption.xhtml
new file mode 100644
index 0000000000..67b72dcc36
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecaption.xhtml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Table 1">
+<caption align="top">CAPTION 1</caption>
+<tr>
+<th>Employee Id</th>
+<th>Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecaption.xml b/dom/tests/mochitest/dom-level2-html/files/tablecaption.xml
new file mode 100644
index 0000000000..67b72dcc36
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecaption.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - BR</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Table 1">
+<caption align="top">CAPTION 1</caption>
+<tr>
+<th>Employee Id</th>
+<th>Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecell.html b/dom/tests/mochitest/dom-level2-html/files/tablecell.html
new file mode 100644
index 0000000000..c9adef2a41
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecell.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLECELL</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE SUMMARY="Table Summary">
+<TR>
+<TH ID="header-1">Employee Id</TH>
+<TH ID="header-2" ABBR="hd1" AXIS="center" ALIGN="center" BGCOLOR="#00FFFF" CHAR=":" CHAROFF="1" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-1" VALIGN="middle" WIDTH="170">Employee Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+<TR>
+<TD ID="header-3">EMP0001</TD>
+<TD ID="header-4" ABBR="hd2" AXIS="center" ALIGN="center" BGCOLOR="#FF0000" CHAR=":" CHAROFF="1" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-3" VALIGN="middle" WIDTH="175">Margaret Martin</TD>
+<TD>Accountant</TD>
+<TD>56,000</TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecell.xhtml b/dom/tests/mochitest/dom-level2-html/files/tablecell.xhtml
new file mode 100644
index 0000000000..0e8ee7f0dd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecell.xhtml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLECELL</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Table 1">
+<tr>
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="hd1" axis="center" align="center" bgcolor="#00FFFF" char=":" charoff="1" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="170">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+<tr>
+<td id="header-3">EMP0001</td>
+<td id="header-4" abbr="hd2" axis="center" align="center" bgcolor="#FF0000" char=":" charoff="1" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-3" valign="middle" width="175">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecell.xml b/dom/tests/mochitest/dom-level2-html/files/tablecell.xml
new file mode 100644
index 0000000000..0e8ee7f0dd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecell.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLECELL</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Table 1">
+<tr>
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="hd1" axis="center" align="center" bgcolor="#00FFFF" char=":" charoff="1" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="170">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+<tr>
+<td id="header-3">EMP0001</td>
+<td id="header-4" abbr="hd2" axis="center" align="center" bgcolor="#FF0000" char=":" charoff="1" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-3" valign="middle" width="175">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecol.html b/dom/tests/mochitest/dom-level2-html/files/tablecol.html
new file mode 100644
index 0000000000..c72a948990
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecol.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLECOL</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE SUMMARY="Table Summary">
+<COLGROUP VALIGN="middle" SPAN="2" ALIGN="center" WIDTH="20" CHAR="$" CHAROFF="15">
+<COL VALIGN="middle" SPAN="1" ALIGN="center" WIDTH="20" CHAR="*" CHAROFF="20">
+</COLGROUP>
+<TR>
+<TH>Id</TH>
+<TH>Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+<TR>
+<TD>EMP0001</TD>
+<TD>Martin</TD>
+<TD>Accountant</TD>
+<TD>56,000</TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
+
+
+
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecol.xhtml b/dom/tests/mochitest/dom-level2-html/files/tablecol.xhtml
new file mode 100644
index 0000000000..a69c4fec46
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecol.xhtml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLECOL</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Table 1">
+<colgroup valign="middle" span="2" align="center" width="20" char="$" charoff="15">
+<col valign="middle" span="1" align="center" width="20" char="*" charoff="20"/>
+</colgroup>
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+<tr>
+<td>EMP0001</td>
+<td>Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablecol.xml b/dom/tests/mochitest/dom-level2-html/files/tablecol.xml
new file mode 100644
index 0000000000..a69c4fec46
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablecol.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLECOL</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Table 1">
+<colgroup valign="middle" span="2" align="center" width="20" char="$" charoff="15">
+<col valign="middle" span="1" align="center" width="20" char="*" charoff="20"/>
+</colgroup>
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+<tr>
+<td>EMP0001</td>
+<td>Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablerow.html b/dom/tests/mochitest/dom-level2-html/files/tablerow.html
new file mode 100644
index 0000000000..9e76a4cdb5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablerow.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLEROW</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE ALIGN="center" SUMMARY="Table 1">
+<TR>
+<TH>Id</TH>
+<TH>Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+</TABLE>
+<TABLE ID="table-1" ALIGN="center" BORDER="4" BGCOLOR="#ff0000" FRAME="border" CELLPADDING="2" CELLSPACING="2" SUMMARY="HTML Control Table" RULES="all" WIDTH="680">
+<CAPTION ALIGN="top">Table Caption</CAPTION>
+<THEAD ALIGN="center" VALIGN="middle">
+<TR ALIGN="center" BGCOLOR="#00FFFF" VALIGN="middle" CHAR="*" CHAROFF="1">
+<TH ID="header-1">Employee Id</TH>
+<TH ID="header-2" ABBR="maiden" AXIS="center" ALIGN="center" BGCOLOR="#00FFFF" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-1" VALIGN="middle" WIDTH="100">Employee Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+<TH>Gender</TH>
+<TH>Address</TH>
+</TR>
+</THEAD>
+<TFOOT ALIGN="center" VALIGN="middle">
+<TR>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+</TR>
+</TFOOT>
+<TBODY ALIGN="center" VALIGN="middle">
+<TR>
+<TD AXIS="center" ID="Table-3" ABBR="maiden2" ALIGN="center" BGCOLOR="#FF0000" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-2" VALIGN="middle" WIDTH="175">EMP0001</TD>
+<TD HEADERS="header-2">Margaret Martin</TD>
+<TD>Accountant</TD>
+<TD>56,000</TD>
+<TD>Female</TD>
+<TD>1230 North Ave. Dallas, Texas 98551</TD>
+</TR>
+<TR>
+<TD>EMP0002</TD>
+<TD>Martha Raynolds</TD>
+<TD>Secretary</TD>
+<TD>35,000</TD>
+<TD>Female</TD>
+<TD>1900 Dallas Road Dallas, Texas 98554</TD>
+</TR>
+</TBODY>
+</TABLE>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablerow.xhtml b/dom/tests/mochitest/dom-level2-html/files/tablerow.xhtml
new file mode 100644
index 0000000000..b901e3ce0e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablerow.xhtml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle">
+<tr align="center" bgcolor="#00FFFF" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablerow.xml b/dom/tests/mochitest/dom-level2-html/files/tablerow.xml
new file mode 100644
index 0000000000..b901e3ce0e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablerow.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle">
+<tr align="center" bgcolor="#00FFFF" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablesection.html b/dom/tests/mochitest/dom-level2-html/files/tablesection.html
new file mode 100644
index 0000000000..0c1a5f784d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablesection.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLESECTION</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE ALIGN="center" SUMMARY="Table 1">
+<TBODY>
+<TR>
+<TH>Id</TH>
+<TH>Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+</TBODY>
+</TABLE>
+<TABLE ID="table-1" ALIGN="center" BORDER="4" BGCOLOR="#ff0000" FRAME="border" CELLPADDING="2" CELLSPACING="2" SUMMARY="HTML Control Table" RULES="all" WIDTH="680">
+<CAPTION ALIGN="top">Table Caption</CAPTION>
+<THEAD ALIGN="center" VALIGN="middle" CHAR="*" CHAROFF="1">
+<TR ALIGN="center" BGCOLOR="#00FFFF" VALIGN="middle" CHAR="*" CHAROFF="1">
+<TH ID="header-1">Employee Id</TH>
+<TH ID="header-2" ABBR="maiden" AXIS="center" ALIGN="center" BGCOLOR="#00FFFF" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-1" VALIGN="middle" WIDTH="100">Employee Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+<TH>Gender</TH>
+<TH>Address</TH>
+</TR>
+</THEAD>
+<TFOOT ALIGN="center" VALIGN="middle" CHAR="+" CHAROFF="2">
+<TR>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+</TR>
+</TFOOT>
+<TBODY ALIGN="center" VALIGN="middle" CHAR="$" CHAROFF="3">
+<TR>
+<TD AXIS="center" ID="Table-3" ABBR="maiden2" ALIGN="center" BGCOLOR="#FF0000" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-2" VALIGN="middle" WIDTH="175">EMP0001</TD>
+<TD HEADERS="header-2">Margaret Martin</TD>
+<TD>Accountant</TD>
+<TD>56,000</TD>
+<TD>Female</TD>
+<TD>1230 North Ave. Dallas, Texas 98551</TD>
+</TR>
+<TR>
+<TD>EMP0002</TD>
+<TD>Martha Raynolds</TD>
+<TD>Secretary</TD>
+<TD>35,000</TD>
+<TD>Female</TD>
+<TD>1900 Dallas Road Dallas, Texas 98554</TD>
+</TR>
+</TBODY>
+</TABLE>
+</BODY>
+</HTML>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablesection.xhtml b/dom/tests/mochitest/dom-level2-html/files/tablesection.xhtml
new file mode 100644
index 0000000000..34986508bc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablesection.xhtml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLESECTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tbody>
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</tbody>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle" char="*" charoff="1">
+<tr align="center" bgcolor="#00FFFF" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle" char="+" charoff="2">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle" char="$" charoff="3">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/tablesection.xml b/dom/tests/mochitest/dom-level2-html/files/tablesection.xml
new file mode 100644
index 0000000000..34986508bc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/tablesection.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLESECTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tbody>
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</tbody>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle" char="*" charoff="1">
+<tr align="center" bgcolor="#00FFFF" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle" char="+" charoff="2">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle" char="$" charoff="3">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/textarea.html b/dom/tests/mochitest/dom-level2-html/files/textarea.html
new file mode 100644
index 0000000000..b9aedc4997
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/textarea.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TEXTAREA</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<FORM ID="form1" ACCEPT-CHARSET="US-ASCII" ACTION="./files/getData.pl" METHOD="post">
+<P>
+<TEXTAREA NAME="text1" COLS="20" ROWS="7" ACCESSKEY="c" TABINDEX="5">TEXTAREA1</TEXTAREA>
+<INPUT TYPE="submit" NAME="submit1" VALUE="Submit1"/>
+<INPUT TYPE="reset" NAME="reset1" VALUE="Reset1"/>
+</P>
+</FORM>
+<P>
+<TEXTAREA NAME="text2" COLS="50" ROWS="2" DISABLED="disabled">TEXTAREA2</TEXTAREA>
+<INPUT TYPE="submit" NAME="submit2" VALUE="Submit2"/>
+<INPUT TYPE="reset" NAME="reset2" VALUE="Reset2"/>
+<TEXTAREA NAME="text2" COLS="50" ROWS="2" READONLY="readonly">TEXTAREA3</TEXTAREA>
+<INPUT TYPE="submit" NAME="submit2" VALUE="Submit2"/>
+<INPUT TYPE="reset" NAME="reset3" VALUE="Reset3"/>
+</P>
+</BODY>
+</HTML>
+
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/textarea.xhtml b/dom/tests/mochitest/dom-level2-html/files/textarea.xhtml
new file mode 100644
index 0000000000..eb6ca48bac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/textarea.xhtml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TEXTAREA</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<textarea name="text1" cols="20" rows="7" accesskey="c" tabindex="5">TEXTAREA1</textarea>
+<input type="submit" name="submit1" value="Submit1"/>
+<input type="reset" name="reset1" value="Reset1"/>
+</p>
+</form>
+<p>
+<textarea name="text2" cols="50" rows="2" disabled="disabled">TEXTAREA2</textarea>
+<input type="submit" name="submit2" value="Submit2"/>
+<input type="reset" name="reset2" value="Reset2"/>
+<textarea name="text2" cols="50" rows="2" readonly="readonly">TEXTAREA3</textarea>
+<input type="submit" name="submit3" value="Submit3"/>
+<input type="reset" name="reset3" value="Reset3"/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/textarea.xml b/dom/tests/mochitest/dom-level2-html/files/textarea.xml
new file mode 100644
index 0000000000..eb6ca48bac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/textarea.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TEXTAREA</title>
+</head>
+<body onload="parent.loadComplete()">
+<form id="form1" action="./files/getData.pl" method="post">
+<p>
+<textarea name="text1" cols="20" rows="7" accesskey="c" tabindex="5">TEXTAREA1</textarea>
+<input type="submit" name="submit1" value="Submit1"/>
+<input type="reset" name="reset1" value="Reset1"/>
+</p>
+</form>
+<p>
+<textarea name="text2" cols="50" rows="2" disabled="disabled">TEXTAREA2</textarea>
+<input type="submit" name="submit2" value="Submit2"/>
+<input type="reset" name="reset2" value="Reset2"/>
+<textarea name="text2" cols="50" rows="2" readonly="readonly">TEXTAREA3</textarea>
+<input type="submit" name="submit3" value="Submit3"/>
+<input type="reset" name="reset3" value="Reset3"/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/title.html b/dom/tests/mochitest/dom-level2-html/files/title.html
new file mode 100644
index 0000000000..2078ee95d3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/title.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TITLE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<P>
+<BR/>
+</P>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/title.xhtml b/dom/tests/mochitest/dom-level2-html/files/title.xhtml
new file mode 100644
index 0000000000..e8ec6b55a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/title.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TITLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/title.xml b/dom/tests/mochitest/dom-level2-html/files/title.xml
new file mode 100644
index 0000000000..e8ec6b55a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/title.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "xhtml1-strict.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TITLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<p>
+<br/>
+</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/ulist.html b/dom/tests/mochitest/dom-level2-html/files/ulist.html
new file mode 100644
index 0000000000..75498e2cbc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/ulist.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - ULIST</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<OL>
+<LI>EMP0001
+<UL COMPACT="compact" TYPE="disc">
+<LI>Margaret Martin
+<DL>
+<DD>Accountant</DD>
+<DD>56,000</DD>
+<DD>Female</DD>
+<DD>1230 North Ave. Dallas, Texas 98551</DD>
+</DL>
+</LI>
+</UL>
+</LI>
+<LI>EMP0002
+<UL>
+<LI>Martha Raynolds
+<DL>
+<DD>Secretary</DD>
+<DD>35,000</DD>
+<DD>Female</DD>
+<DD>1900 Dallas Road. Dallas, Texas 98554</DD>
+</DL>
+</LI>
+</UL>
+</LI>
+</OL>
+</BODY>
+</HTML>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/ulist.xhtml b/dom/tests/mochitest/dom-level2-html/files/ulist.xhtml
new file mode 100644
index 0000000000..fd9d7a5a46
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/ulist.xhtml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - ULIST</title>
+</head>
+<body onload="parent.loadComplete()">
+<ol>
+<li>EMP0001
+<ul compact="compact" type="disc">
+<li>Margaret Martin
+<dl>
+<dd>Accountant</dd>
+<dd>56,000</dd>
+<dd>Female</dd>
+<dd>1230 North Ave. Dallas, Texas 98551</dd>
+</dl>
+</li>
+</ul>
+</li>
+<li>EMP0002
+<ul>
+<li>Martha Raynolds
+<dl>
+<dd>Secretary</dd>
+<dd>35,000</dd>
+<dd>Female</dd>
+<dd>1900 Dallas Road. Dallas, Texas 98554</dd>
+</dl>
+</li>
+</ul>
+</li>
+</ol>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/ulist.xml b/dom/tests/mochitest/dom-level2-html/files/ulist.xml
new file mode 100644
index 0000000000..fd9d7a5a46
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/ulist.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - ULIST</title>
+</head>
+<body onload="parent.loadComplete()">
+<ol>
+<li>EMP0001
+<ul compact="compact" type="disc">
+<li>Margaret Martin
+<dl>
+<dd>Accountant</dd>
+<dd>56,000</dd>
+<dd>Female</dd>
+<dd>1230 North Ave. Dallas, Texas 98551</dd>
+</dl>
+</li>
+</ul>
+</li>
+<li>EMP0002
+<ul>
+<li>Martha Raynolds
+<dl>
+<dd>Secretary</dd>
+<dd>35,000</dd>
+<dd>Female</dd>
+<dd>1900 Dallas Road. Dallas, Texas 98554</dd>
+</dl>
+</li>
+</ul>
+</li>
+</ol>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/w3c_main.png b/dom/tests/mochitest/dom-level2-html/files/w3c_main.png
new file mode 100644
index 0000000000..ac0ecd37eb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/w3c_main.png
Binary files differ
diff --git a/dom/tests/mochitest/dom-level2-html/files/xhtml-lat1.ent b/dom/tests/mochitest/dom-level2-html/files/xhtml-lat1.ent
new file mode 100644
index 0000000000..ffee223eb1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/xhtml-lat1.ent
@@ -0,0 +1,196 @@
+<!-- Portions (C) International Organization for Standardization 1986
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+ %HTMLlat1;
+-->
+
+<!ENTITY nbsp "&#160;"> <!-- no-break space = non-breaking space,
+ U+00A0 ISOnum -->
+<!ENTITY iexcl "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+ U+00A6 ISOnum -->
+<!ENTITY sect "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml "&#168;"> <!-- diaeresis = spacing diaeresis,
+ U+00A8 ISOdia -->
+<!ENTITY copy "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo "&#171;"> <!-- left-pointing double angle quotation mark
+ = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not "&#172;"> <!-- not sign = angled dash,
+ U+00AC ISOnum -->
+<!ENTITY shy "&#173;"> <!-- soft hyphen = discretionary hyphen,
+ U+00AD ISOnum -->
+<!ENTITY reg "&#174;"> <!-- registered sign = registered trade mark sign,
+ U+00AE ISOnum -->
+<!ENTITY macr "&#175;"> <!-- macron = spacing macron = overline
+ = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+ U+00B1 ISOnum -->
+<!ENTITY sup2 "&#178;"> <!-- superscript two = superscript digit two
+ = squared, U+00B2 ISOnum -->
+<!ENTITY sup3 "&#179;"> <!-- superscript three = superscript digit three
+ = cubed, U+00B3 ISOnum -->
+<!ENTITY acute "&#180;"> <!-- acute accent = spacing acute,
+ U+00B4 ISOdia -->
+<!ENTITY micro "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para "&#182;"> <!-- pilcrow sign = paragraph sign,
+ U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+ = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1 "&#185;"> <!-- superscript one = superscript digit one,
+ U+00B9 ISOnum -->
+<!ENTITY ordm "&#186;"> <!-- masculine ordinal indicator,
+ U+00BA ISOnum -->
+<!ENTITY raquo "&#187;"> <!-- right-pointing double angle quotation mark
+ = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+ = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+ = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+ = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+ = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+ = latin capital letter A grave,
+ U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+ U+00C1 ISOlat1 -->
+<!ENTITY Acirc "&#194;"> <!-- latin capital letter A with circumflex,
+ U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+ U+00C3 ISOlat1 -->
+<!ENTITY Auml "&#196;"> <!-- latin capital letter A with diaeresis,
+ U+00C4 ISOlat1 -->
+<!ENTITY Aring "&#197;"> <!-- latin capital letter A with ring above
+ = latin capital letter A ring,
+ U+00C5 ISOlat1 -->
+<!ENTITY AElig "&#198;"> <!-- latin capital letter AE
+ = latin capital ligature AE,
+ U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+ U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+ U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+ U+00C9 ISOlat1 -->
+<!ENTITY Ecirc "&#202;"> <!-- latin capital letter E with circumflex,
+ U+00CA ISOlat1 -->
+<!ENTITY Euml "&#203;"> <!-- latin capital letter E with diaeresis,
+ U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+ U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+ U+00CD ISOlat1 -->
+<!ENTITY Icirc "&#206;"> <!-- latin capital letter I with circumflex,
+ U+00CE ISOlat1 -->
+<!ENTITY Iuml "&#207;"> <!-- latin capital letter I with diaeresis,
+ U+00CF ISOlat1 -->
+<!ENTITY ETH "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+ U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+ U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+ U+00D3 ISOlat1 -->
+<!ENTITY Ocirc "&#212;"> <!-- latin capital letter O with circumflex,
+ U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+ U+00D5 ISOlat1 -->
+<!ENTITY Ouml "&#214;"> <!-- latin capital letter O with diaeresis,
+ U+00D6 ISOlat1 -->
+<!ENTITY times "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+ = latin capital letter O slash,
+ U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+ U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+ U+00DA ISOlat1 -->
+<!ENTITY Ucirc "&#219;"> <!-- latin capital letter U with circumflex,
+ U+00DB ISOlat1 -->
+<!ENTITY Uuml "&#220;"> <!-- latin capital letter U with diaeresis,
+ U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+ U+00DD ISOlat1 -->
+<!ENTITY THORN "&#222;"> <!-- latin capital letter THORN,
+ U+00DE ISOlat1 -->
+<!ENTITY szlig "&#223;"> <!-- latin small letter sharp s = ess-zed,
+ U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+ = latin small letter a grave,
+ U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+ U+00E1 ISOlat1 -->
+<!ENTITY acirc "&#226;"> <!-- latin small letter a with circumflex,
+ U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+ U+00E3 ISOlat1 -->
+<!ENTITY auml "&#228;"> <!-- latin small letter a with diaeresis,
+ U+00E4 ISOlat1 -->
+<!ENTITY aring "&#229;"> <!-- latin small letter a with ring above
+ = latin small letter a ring,
+ U+00E5 ISOlat1 -->
+<!ENTITY aelig "&#230;"> <!-- latin small letter ae
+ = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+ U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+ U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+ U+00E9 ISOlat1 -->
+<!ENTITY ecirc "&#234;"> <!-- latin small letter e with circumflex,
+ U+00EA ISOlat1 -->
+<!ENTITY euml "&#235;"> <!-- latin small letter e with diaeresis,
+ U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+ U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+ U+00ED ISOlat1 -->
+<!ENTITY icirc "&#238;"> <!-- latin small letter i with circumflex,
+ U+00EE ISOlat1 -->
+<!ENTITY iuml "&#239;"> <!-- latin small letter i with diaeresis,
+ U+00EF ISOlat1 -->
+<!ENTITY eth "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+ U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+ U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+ U+00F3 ISOlat1 -->
+<!ENTITY ocirc "&#244;"> <!-- latin small letter o with circumflex,
+ U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+ U+00F5 ISOlat1 -->
+<!ENTITY ouml "&#246;"> <!-- latin small letter o with diaeresis,
+ U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+ = latin small letter o slash,
+ U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+ U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+ U+00FA ISOlat1 -->
+<!ENTITY ucirc "&#251;"> <!-- latin small letter u with circumflex,
+ U+00FB ISOlat1 -->
+<!ENTITY uuml "&#252;"> <!-- latin small letter u with diaeresis,
+ U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+ U+00FD ISOlat1 -->
+<!ENTITY thorn "&#254;"> <!-- latin small letter thorn,
+ U+00FE ISOlat1 -->
+<!ENTITY yuml "&#255;"> <!-- latin small letter y with diaeresis,
+ U+00FF ISOlat1 -->
diff --git a/dom/tests/mochitest/dom-level2-html/files/xhtml-special.ent b/dom/tests/mochitest/dom-level2-html/files/xhtml-special.ent
new file mode 100644
index 0000000000..ca358b2fec
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/xhtml-special.ent
@@ -0,0 +1,80 @@
+<!-- Special characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+ %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot "&#34;"> <!-- quotation mark, U+0022 ISOnum -->
+<!ENTITY amp "&#38;#38;"> <!-- ampersand, U+0026 ISOnum -->
+<!ENTITY lt "&#38;#60;"> <!-- less-than sign, U+003C ISOnum -->
+<!ENTITY gt "&#62;"> <!-- greater-than sign, U+003E ISOnum -->
+<!ENTITY apos "&#39;"> <!-- apostrophe = APL quote, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;"> <!-- latin capital ligature OE,
+ U+0152 ISOlat2 -->
+<!ENTITY oelig "&#339;"> <!-- latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;"> <!-- latin capital letter S with caron,
+ U+0160 ISOlat2 -->
+<!ENTITY scaron "&#353;"> <!-- latin small letter s with caron,
+ U+0161 ISOlat2 -->
+<!ENTITY Yuml "&#376;"> <!-- latin capital letter Y with diaeresis,
+ U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;"> <!-- modifier letter circumflex accent,
+ U+02C6 ISOpub -->
+<!ENTITY tilde "&#732;"> <!-- small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj "&#8204;"> <!-- zero width non-joiner,
+ U+200C NEW RFC 2070 -->
+<!ENTITY zwj "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo "&#8216;"> <!-- left single quotation mark,
+ U+2018 ISOnum -->
+<!ENTITY rsquo "&#8217;"> <!-- right single quotation mark,
+ U+2019 ISOnum -->
+<!ENTITY sbquo "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo "&#8220;"> <!-- left double quotation mark,
+ U+201C ISOnum -->
+<!ENTITY rdquo "&#8221;"> <!-- right double quotation mark,
+ U+201D ISOnum -->
+<!ENTITY bdquo "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo "&#8249;"> <!-- single left-pointing angle quotation mark,
+ U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;"> <!-- single right-pointing angle quotation mark,
+ U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+
+<!-- Currency Symbols -->
+<!ENTITY euro "&#8364;"> <!-- euro sign, U+20AC NEW -->
diff --git a/dom/tests/mochitest/dom-level2-html/files/xhtml-symbol.ent b/dom/tests/mochitest/dom-level2-html/files/xhtml-symbol.ent
new file mode 100644
index 0000000000..63c2abfa6f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/xhtml-symbol.ent
@@ -0,0 +1,237 @@
+<!-- Mathematical, Greek and Symbolic characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+ %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;"> <!-- latin small letter f with hook = function
+ = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma "&#915;"> <!-- greek capital letter gamma,
+ U+0393 ISOgrk3 -->
+<!ENTITY Delta "&#916;"> <!-- greek capital letter delta,
+ U+0394 ISOgrk3 -->
+<!ENTITY Epsilon "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta "&#920;"> <!-- greek capital letter theta,
+ U+0398 ISOgrk3 -->
+<!ENTITY Iota "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda "&#923;"> <!-- greek capital letter lamda,
+ U+039B ISOgrk3 -->
+<!ENTITY Mu "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma "&#931;"> <!-- greek capital letter sigma,
+ U+03A3 ISOgrk3 -->
+<!ENTITY Tau "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon "&#933;"> <!-- greek capital letter upsilon,
+ U+03A5 ISOgrk3 -->
+<!ENTITY Phi "&#934;"> <!-- greek capital letter phi,
+ U+03A6 ISOgrk3 -->
+<!ENTITY Chi "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi "&#936;"> <!-- greek capital letter psi,
+ U+03A8 ISOgrk3 -->
+<!ENTITY Omega "&#937;"> <!-- greek capital letter omega,
+ U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha "&#945;"> <!-- greek small letter alpha,
+ U+03B1 ISOgrk3 -->
+<!ENTITY beta "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma "&#947;"> <!-- greek small letter gamma,
+ U+03B3 ISOgrk3 -->
+<!ENTITY delta "&#948;"> <!-- greek small letter delta,
+ U+03B4 ISOgrk3 -->
+<!ENTITY epsilon "&#949;"> <!-- greek small letter epsilon,
+ U+03B5 ISOgrk3 -->
+<!ENTITY zeta "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta "&#952;"> <!-- greek small letter theta,
+ U+03B8 ISOgrk3 -->
+<!ENTITY iota "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa "&#954;"> <!-- greek small letter kappa,
+ U+03BA ISOgrk3 -->
+<!ENTITY lambda "&#955;"> <!-- greek small letter lamda,
+ U+03BB ISOgrk3 -->
+<!ENTITY mu "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf "&#962;"> <!-- greek small letter final sigma,
+ U+03C2 ISOgrk3 -->
+<!ENTITY sigma "&#963;"> <!-- greek small letter sigma,
+ U+03C3 ISOgrk3 -->
+<!ENTITY tau "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon "&#965;"> <!-- greek small letter upsilon,
+ U+03C5 ISOgrk3 -->
+<!ENTITY phi "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega "&#969;"> <!-- greek small letter omega,
+ U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek theta symbol,
+ U+03D1 NEW -->
+<!ENTITY upsih "&#978;"> <!-- greek upsilon with hook symbol,
+ U+03D2 NEW -->
+<!ENTITY piv "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;"> <!-- bullet = black small circle,
+ U+2022 ISOpub -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+ U+2026 ISOpub -->
+<!ENTITY prime "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime "&#8243;"> <!-- double prime = seconds = inches,
+ U+2033 ISOtech -->
+<!ENTITY oline "&#8254;"> <!-- overline = spacing overscore,
+ U+203E NEW -->
+<!ENTITY frasl "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;"> <!-- script capital P = power set
+ = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image "&#8465;"> <!-- black-letter capital I = imaginary part,
+ U+2111 ISOamso -->
+<!ENTITY real "&#8476;"> <!-- black-letter capital R = real part symbol,
+ U+211C ISOamso -->
+<!ENTITY trade "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+ U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+ U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr "&#8629;"> <!-- downwards arrow with corner leftwards
+ = carriage return, U+21B5 NEW -->
+<!ENTITY lArr "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+ but also does not have any other character for that function. So lArr can
+ be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr "&#8658;"> <!-- rightwards double arrow,
+ U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have
+ another character with this function so rArr can be used for 'implies'
+ as ISOtech suggests -->
+<!ENTITY dArr "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr "&#8660;"> <!-- left right double arrow,
+ U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part "&#8706;"> <!-- partial differential, U+2202 ISOtech -->
+<!ENTITY exist "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty "&#8709;"> <!-- empty set = null set, U+2205 ISOamso -->
+<!ENTITY nabla "&#8711;"> <!-- nabla = backward difference,
+ U+2207 ISOtech -->
+<!ENTITY isin "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!ENTITY prod "&#8719;"> <!-- n-ary product = product sign,
+ U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+ the same glyph might be used for both -->
+<!ENTITY sum "&#8721;"> <!-- n-ary summation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+ though the same glyph might be used for both -->
+<!ENTITY minus "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic "&#8730;"> <!-- square root = radical sign,
+ U+221A ISOtech -->
+<!ENTITY prop "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4 "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim "&#8764;"> <!-- tilde operator = varies with = similar to,
+ U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+ although the same glyph might be used to represent both -->
+<!ENTITY cong "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp "&#8776;"> <!-- almost equal to = asymptotic to,
+ U+2248 ISOamsr -->
+<!ENTITY ne "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge "&#8805;"> <!-- greater-than or equal to,
+ U+2265 ISOtech -->
+<!ENTITY sub "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!ENTITY nsub "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe "&#8839;"> <!-- superset of or equal to,
+ U+2287 ISOtech -->
+<!ENTITY oplus "&#8853;"> <!-- circled plus = direct sum,
+ U+2295 ISOamsb -->
+<!ENTITY otimes "&#8855;"> <!-- circled times = vector product,
+ U+2297 ISOamsb -->
+<!ENTITY perp "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+ U+22A5 ISOtech -->
+<!ENTITY sdot "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;"> <!-- left ceiling = APL upstile,
+ U+2308 ISOamsc -->
+<!ENTITY rceil "&#8969;"> <!-- right ceiling, U+2309 ISOamsc -->
+<!ENTITY lfloor "&#8970;"> <!-- left floor = APL downstile,
+ U+230A ISOamsc -->
+<!ENTITY rfloor "&#8971;"> <!-- right floor, U+230B ISOamsc -->
+<!ENTITY lang "&#9001;"> <!-- left-pointing angle bracket = bra,
+ U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than sign'
+ or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang "&#9002;"> <!-- right-pointing angle bracket = ket,
+ U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than sign'
+ or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs "&#9827;"> <!-- black club suit = shamrock,
+ U+2663 ISOpub -->
+<!ENTITY hearts "&#9829;"> <!-- black heart suit = valentine,
+ U+2665 ISOpub -->
+<!ENTITY diams "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
diff --git a/dom/tests/mochitest/dom-level2-html/files/xhtml1-frameset.dtd b/dom/tests/mochitest/dom-level2-html/files/xhtml1-frameset.dtd
new file mode 100644
index 0000000000..c22b666d19
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/xhtml1-frameset.dtd
@@ -0,0 +1,1235 @@
+<!--
+ Extensible HTML version 1.0 Frameset DTD
+
+ This is the same as HTML 4 Frameset except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2008/03/29 19:06:30 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % MultiLengths "CDATA">
+ <!-- comma-separated list of MultiLength -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+ "object | applet | img | map | iframe">
+
+<!ENTITY % special.basic
+ "br | span | bdo">
+
+<!ENTITY % special
+ "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+ | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex | fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ sub, sup, font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+ %inline.forms; | %misc.inline;)*">
+
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, frameset)>
+<!ATTLIST html
+ %i18n;
+ id ID #IMPLIED
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ id ID #IMPLIED
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title
+ %i18n;
+ id ID #IMPLIED
+ >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ id ID #IMPLIED
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ id ID #IMPLIED
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ id ID #IMPLIED
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ id ID #IMPLIED
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- only one noframes element permitted per document -->
+
+<!ELEMENT frameset (frameset|frame|noframes)*>
+<!ATTLIST frameset
+ %coreattrs;
+ rows %MultiLengths; #IMPLIED
+ cols %MultiLengths; #IMPLIED
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ >
+
+<!-- reserved frame names start with "_" otherwise starts with letter -->
+
+<!-- tiled window within frameset -->
+
+<!ELEMENT frame EMPTY>
+<!ATTLIST frame
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ noresize (noresize) #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ >
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes (body)>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ %focus;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form |%inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ %focus;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ %focus;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=":"
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/xhtml1-strict.dtd b/dom/tests/mochitest/dom-level2-html/files/xhtml1-strict.dtd
new file mode 100644
index 0000000000..06228785f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/xhtml1-strict.dtd
@@ -0,0 +1,978 @@
+<!--
+ Extensible HTML version 1.0 Strict DTD
+
+ This is the same as HTML 4 Strict except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2008/03/29 19:06:30 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.pre
+ "br | span | bdo | map">
+
+
+<!ENTITY % special
+ "%special.pre; | object | img ">
+
+<!ENTITY % fontstyle "tt | i | b | big | small ">
+
+<!ENTITY % phrase "em | strong | dfn | code | q |
+ samp | kbd | var | cite | abbr | acronym | sub | sup ">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl">
+<!ENTITY % blocktext "pre | hr | blockquote | address">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | fieldset | table">
+
+<!ENTITY % Block "(%block; | form | %misc;)*">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding big, small, sup or sup -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | %fontstyle; | %phrase; | %special.pre; | %misc.inline;
+ | %inline.forms;)*">
+
+<!-- form uses %Block; excluding form -->
+
+<!ENTITY % form.content "(%block; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form and form controls -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | %special; | %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+ %i18n;
+ id ID #IMPLIED
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ id ID #IMPLIED
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title
+ %i18n;
+ id ID #IMPLIED
+ >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ href %URI; #REQUIRED
+ id ID #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ id ID #IMPLIED
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ id ID #IMPLIED
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ id ID #IMPLIED
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Block;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Block;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ >
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ >
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address %Inline;>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding "img|object|big|small|sub|sup" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Block;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ %focus;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+ Note that in this DTD there is no name attribute. That
+ is only available in the transitional and frameset DTD.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ %focus;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ >
+
+<!--================ Forms ===============================================-->
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ %focus;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form and form controls
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ >
+
+<!ATTLIST caption
+ %attrs;
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ >
+
diff --git a/dom/tests/mochitest/dom-level2-html/files/xhtml1-transitional.dtd b/dom/tests/mochitest/dom-level2-html/files/xhtml1-transitional.dtd
new file mode 100644
index 0000000000..215a4b078b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/files/xhtml1-transitional.dtd
@@ -0,0 +1,1201 @@
+<!--
+ Extensible HTML version 1.0 Transitional DTD
+
+ This is the same as HTML 4 Transitional except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2008/03/29 19:06:30 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+ "object | applet | img | map | iframe">
+
+<!ENTITY % special.basic
+ "br | span | bdo">
+
+<!ENTITY % special
+ "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+ | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+ %inline.forms; | %misc.inline;)*">
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+ %i18n;
+ id ID #IMPLIED
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ id ID #IMPLIED
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title
+ %i18n;
+ id ID #IMPLIED
+ >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ id ID #IMPLIED
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ id ID #IMPLIED
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ id ID #IMPLIED
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ id ID #IMPLIED
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes %Flow;>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ %focus;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Length; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name CDATA #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ %focus;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ %focus;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ %focus;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Length; #IMPLIED
+ height %Length; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Length; #IMPLIED
+ height %Length; #IMPLIED
+ >
+
diff --git a/dom/tests/mochitest/dom-level2-html/mochitest.ini b/dom/tests/mochitest/dom-level2-html/mochitest.ini
new file mode 100644
index 0000000000..17c9ec57a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/mochitest.ini
@@ -0,0 +1,863 @@
+[DEFAULT]
+support-files =
+ DOMTestCase.js
+ files/anchor.html
+ files/anchor.xhtml
+ files/anchor.xml
+ files/anchor2.html
+ files/anchor2.xhtml
+ files/anchor2.xml
+ files/applet.html
+ files/applet.xhtml
+ files/applet.xml
+ files/applet2.class
+ files/applet2.html
+ files/applet2.xhtml
+ files/applet2.xml
+ files/area.html
+ files/area.xhtml
+ files/area.xml
+ files/area2.html
+ files/area2.xhtml
+ files/area2.xml
+ files/base.html
+ files/base.xhtml
+ files/base.xml
+ files/base2.html
+ files/base2.xhtml
+ files/base2.xml
+ files/body.html
+ files/body.xhtml
+ files/body.xml
+ files/br.html
+ files/br.xhtml
+ files/br.xml
+ files/button.html
+ files/button.xhtml
+ files/button.xml
+ files/collection.html
+ files/collection.xhtml
+ files/collection.xml
+ files/directory.html
+ files/directory.xhtml
+ files/directory.xml
+ files/div.html
+ files/div.xhtml
+ files/div.xml
+ files/dl.html
+ files/dl.xhtml
+ files/dl.xml
+ files/document.html
+ files/document-with-applet.html
+ files/document.xhtml
+ files/document.xml
+ files/element.html
+ files/element.xhtml
+ files/element.xml
+ files/fieldset.html
+ files/fieldset.xhtml
+ files/fieldset.xml
+ files/font.html
+ files/font.xhtml
+ files/font.xml
+ files/form.html
+ files/form.xhtml
+ files/form.xml
+ files/form2.html
+ files/form2.xhtml
+ files/form2.xml
+ files/form3.html
+ files/form3.xhtml
+ files/form3.xml
+ files/frame.html
+ files/frame.xhtml
+ files/frame.xml
+ files/frame2.html
+ files/frame2.xhtml
+ files/frame2.xml
+ files/frameset.html
+ files/frameset.xhtml
+ files/frameset.xml
+ files/heading.html
+ files/heading.xhtml
+ files/heading.xml
+ files/hr.html
+ files/hr.xhtml
+ files/hr.xml
+ files/html.html
+ files/html.xhtml
+ files/html.xml
+ files/iframe.html
+ files/iframe.xhtml
+ files/iframe.xml
+ files/iframe2.html
+ files/iframe2.xhtml
+ files/iframe2.xml
+ files/img.html
+ files/img.xhtml
+ files/img.xml
+ files/index.html
+ files/input.html
+ files/input.xhtml
+ files/input.xml
+ files/isindex.html
+ files/isindex.xhtml
+ files/isindex.xml
+ files/label.html
+ files/label.xhtml
+ files/label.xml
+ files/legend.html
+ files/legend.xhtml
+ files/legend.xml
+ files/li.html
+ files/li.xhtml
+ files/li.xml
+ files/link.html
+ files/link.xhtml
+ files/link.xml
+ files/link2.html
+ files/link2.xhtml
+ files/link2.xml
+ files/map.html
+ files/map.xhtml
+ files/map.xml
+ files/menu.html
+ files/menu.xhtml
+ files/menu.xml
+ files/meta.html
+ files/meta.xhtml
+ files/meta.xml
+ files/mod.html
+ files/mod.xhtml
+ files/mod.xml
+ files/object.html
+ files/object.xhtml
+ files/object.xml
+ files/object2.html
+ files/object2.xhtml
+ files/object2.xml
+ files/olist.html
+ files/olist.xhtml
+ files/olist.xml
+ files/optgroup.html
+ files/optgroup.xhtml
+ files/optgroup.xml
+ files/option.html
+ files/option.xhtml
+ files/option.xml
+ files/optionscollection.html
+ files/optionscollection.xhtml
+ files/optionscollection.xml
+ files/paragraph.html
+ files/paragraph.xhtml
+ files/paragraph.xml
+ files/param.html
+ files/param.xhtml
+ files/param.xml
+ files/pre.html
+ files/pre.xhtml
+ files/pre.xml
+ files/quote.html
+ files/quote.xhtml
+ files/quote.xml
+ files/right.png
+ files/script.html
+ files/script.xhtml
+ files/script.xml
+ files/select.html
+ files/select.xhtml
+ files/select.xml
+ files/style.html
+ files/style.xhtml
+ files/style.xml
+ files/table.html
+ files/table.xhtml
+ files/table.xml
+ files/table1.html
+ files/table1.xhtml
+ files/table1.xml
+ files/tablecaption.html
+ files/tablecaption.xhtml
+ files/tablecaption.xml
+ files/tablecell.html
+ files/tablecell.xhtml
+ files/tablecell.xml
+ files/tablecol.html
+ files/tablecol.xhtml
+ files/tablecol.xml
+ files/tablerow.html
+ files/tablerow.xhtml
+ files/tablerow.xml
+ files/tablesection.html
+ files/tablesection.xhtml
+ files/tablesection.xml
+ files/textarea.html
+ files/textarea.xhtml
+ files/textarea.xml
+ files/title.html
+ files/title.xhtml
+ files/title.xml
+ files/ulist.html
+ files/ulist.xhtml
+ files/ulist.xml
+ files/w3c_main.png
+ files/xhtml-lat1.ent
+ files/xhtml-special.ent
+ files/xhtml-symbol.ent
+ files/xhtml1-frameset.dtd
+ files/xhtml1-strict.dtd
+ files/xhtml1-transitional.dtd
+
+[test_HTMLAnchorElement01.html]
+[test_HTMLAnchorElement02.html]
+[test_HTMLAnchorElement03.html]
+[test_HTMLAnchorElement04.html]
+[test_HTMLAnchorElement05.html]
+[test_HTMLAnchorElement06.html]
+[test_HTMLAnchorElement07.html]
+[test_HTMLAnchorElement08.html]
+[test_HTMLAnchorElement09.html]
+[test_HTMLAnchorElement10.html]
+[test_HTMLAnchorElement11.html]
+[test_HTMLAnchorElement12.html]
+[test_HTMLAnchorElement13.html]
+[test_HTMLAnchorElement14.html]
+[test_HTMLAreaElement01.html]
+[test_HTMLAreaElement02.html]
+[test_HTMLAreaElement03.html]
+[test_HTMLAreaElement04.html]
+[test_HTMLAreaElement05.html]
+[test_HTMLAreaElement06.html]
+[test_HTMLAreaElement07.html]
+[test_HTMLAreaElement08.html]
+[test_HTMLBRElement01.html]
+[test_HTMLBaseElement01.html]
+[test_HTMLBaseElement02.html]
+[test_HTMLBodyElement01.html]
+[test_HTMLBodyElement02.html]
+[test_HTMLBodyElement03.html]
+[test_HTMLBodyElement04.html]
+[test_HTMLBodyElement05.html]
+[test_HTMLBodyElement06.html]
+[test_HTMLButtonElement01.html]
+[test_HTMLButtonElement02.html]
+[test_HTMLButtonElement03.html]
+[test_HTMLButtonElement04.html]
+[test_HTMLButtonElement05.html]
+[test_HTMLButtonElement06.html]
+[test_HTMLButtonElement07.html]
+[test_HTMLButtonElement08.html]
+[test_HTMLCollection01.html]
+[test_HTMLCollection02.html]
+[test_HTMLCollection03.html]
+[test_HTMLCollection04.html]
+[test_HTMLCollection05.html]
+[test_HTMLCollection06.html]
+[test_HTMLCollection07.html]
+[test_HTMLCollection08.html]
+[test_HTMLCollection09.html]
+[test_HTMLCollection10.html]
+[test_HTMLCollection11.html]
+[test_HTMLCollection12.html]
+[test_HTMLDirectoryElement01.html]
+[test_HTMLDivElement01.html]
+[test_HTMLDlistElement01.html]
+[test_HTMLDocument01.html]
+[test_HTMLDocument02.html]
+[test_HTMLDocument03.html]
+[test_HTMLDocument04.html]
+[test_HTMLDocument05.html]
+[test_HTMLDocument07.html]
+[test_HTMLDocument09.html]
+[test_HTMLDocument10.html]
+[test_HTMLDocument11.html]
+[test_HTMLDocument12.html]
+[test_HTMLDocument13.html]
+[test_HTMLDocument14.html]
+[test_HTMLDocument15.html]
+[test_HTMLDocument16.html]
+[test_HTMLDocument17.html]
+[test_HTMLDocument18.html]
+[test_HTMLDocument19.html]
+[test_HTMLDocument20.html]
+[test_HTMLDocument21.html]
+[test_HTMLElement01.html]
+[test_HTMLElement02.html]
+[test_HTMLElement03.html]
+[test_HTMLElement04.html]
+[test_HTMLElement05.html]
+[test_HTMLElement06.html]
+[test_HTMLElement07.html]
+[test_HTMLElement08.html]
+[test_HTMLElement09.html]
+[test_HTMLElement10.html]
+[test_HTMLElement100.html]
+[test_HTMLElement101.html]
+[test_HTMLElement102.html]
+[test_HTMLElement103.html]
+[test_HTMLElement104.html]
+[test_HTMLElement105.html]
+[test_HTMLElement106.html]
+[test_HTMLElement107.html]
+[test_HTMLElement108.html]
+[test_HTMLElement109.html]
+[test_HTMLElement11.html]
+[test_HTMLElement110.html]
+[test_HTMLElement111.html]
+[test_HTMLElement112.html]
+[test_HTMLElement113.html]
+[test_HTMLElement114.html]
+[test_HTMLElement115.html]
+[test_HTMLElement116.html]
+[test_HTMLElement117.html]
+[test_HTMLElement118.html]
+[test_HTMLElement119.html]
+[test_HTMLElement12.html]
+[test_HTMLElement120.html]
+[test_HTMLElement121.html]
+[test_HTMLElement122.html]
+[test_HTMLElement123.html]
+[test_HTMLElement124.html]
+[test_HTMLElement125.html]
+[test_HTMLElement126.html]
+[test_HTMLElement127.html]
+[test_HTMLElement128.html]
+[test_HTMLElement129.html]
+[test_HTMLElement13.html]
+[test_HTMLElement130.html]
+[test_HTMLElement131.html]
+[test_HTMLElement132.html]
+[test_HTMLElement133.html]
+[test_HTMLElement134.html]
+[test_HTMLElement135.html]
+[test_HTMLElement136.html]
+[test_HTMLElement137.html]
+[test_HTMLElement138.html]
+[test_HTMLElement139.html]
+[test_HTMLElement14.html]
+[test_HTMLElement140.html]
+[test_HTMLElement141.html]
+[test_HTMLElement142.html]
+[test_HTMLElement143.html]
+[test_HTMLElement144.html]
+[test_HTMLElement145.html]
+[test_HTMLElement15.html]
+[test_HTMLElement16.html]
+[test_HTMLElement17.html]
+[test_HTMLElement18.html]
+[test_HTMLElement19.html]
+[test_HTMLElement20.html]
+[test_HTMLElement21.html]
+[test_HTMLElement22.html]
+[test_HTMLElement23.html]
+[test_HTMLElement24.html]
+[test_HTMLElement25.html]
+[test_HTMLElement26.html]
+[test_HTMLElement27.html]
+[test_HTMLElement28.html]
+[test_HTMLElement29.html]
+[test_HTMLElement30.html]
+[test_HTMLElement31.html]
+[test_HTMLElement32.html]
+[test_HTMLElement33.html]
+[test_HTMLElement34.html]
+[test_HTMLElement35.html]
+[test_HTMLElement36.html]
+[test_HTMLElement37.html]
+[test_HTMLElement38.html]
+[test_HTMLElement39.html]
+[test_HTMLElement40.html]
+[test_HTMLElement41.html]
+[test_HTMLElement42.html]
+[test_HTMLElement43.html]
+[test_HTMLElement44.html]
+[test_HTMLElement45.html]
+[test_HTMLElement46.html]
+[test_HTMLElement47.html]
+[test_HTMLElement48.html]
+[test_HTMLElement49.html]
+[test_HTMLElement50.html]
+[test_HTMLElement51.html]
+[test_HTMLElement52.html]
+[test_HTMLElement53.html]
+[test_HTMLElement54.html]
+[test_HTMLElement55.html]
+[test_HTMLElement56.html]
+[test_HTMLElement57.html]
+[test_HTMLElement58.html]
+[test_HTMLElement59.html]
+[test_HTMLElement60.html]
+[test_HTMLElement61.html]
+[test_HTMLElement62.html]
+[test_HTMLElement63.html]
+[test_HTMLElement64.html]
+[test_HTMLElement65.html]
+[test_HTMLElement66.html]
+[test_HTMLElement67.html]
+[test_HTMLElement68.html]
+[test_HTMLElement69.html]
+[test_HTMLElement70.html]
+[test_HTMLElement71.html]
+[test_HTMLElement72.html]
+[test_HTMLElement73.html]
+[test_HTMLElement74.html]
+[test_HTMLElement75.html]
+[test_HTMLElement76.html]
+[test_HTMLElement77.html]
+[test_HTMLElement78.html]
+[test_HTMLElement79.html]
+[test_HTMLElement80.html]
+[test_HTMLElement81.html]
+[test_HTMLElement82.html]
+[test_HTMLElement83.html]
+[test_HTMLElement84.html]
+[test_HTMLElement85.html]
+[test_HTMLElement86.html]
+[test_HTMLElement87.html]
+[test_HTMLElement88.html]
+[test_HTMLElement89.html]
+[test_HTMLElement90.html]
+[test_HTMLElement91.html]
+[test_HTMLElement92.html]
+[test_HTMLElement93.html]
+[test_HTMLElement94.html]
+[test_HTMLElement95.html]
+[test_HTMLElement96.html]
+[test_HTMLElement97.html]
+[test_HTMLElement98.html]
+[test_HTMLElement99.html]
+[test_HTMLFieldSetElement01.html]
+[test_HTMLFieldSetElement02.html]
+[test_HTMLFontElement01.html]
+[test_HTMLFontElement02.html]
+[test_HTMLFontElement03.html]
+[test_HTMLFormElement01.html]
+[test_HTMLFormElement02.html]
+[test_HTMLFormElement03.html]
+[test_HTMLFormElement04.html]
+[test_HTMLFormElement05.html]
+[test_HTMLFormElement06.html]
+[test_HTMLFormElement07.html]
+[test_HTMLFormElement08.html]
+[test_HTMLFormElement09.html]
+[test_HTMLFormElement10.html]
+[test_HTMLFrameElement01.html]
+[test_HTMLFrameElement02.html]
+[test_HTMLFrameElement03.html]
+[test_HTMLFrameElement04.html]
+[test_HTMLFrameElement05.html]
+[test_HTMLFrameElement06.html]
+[test_HTMLFrameElement07.html]
+[test_HTMLFrameElement08.html]
+[test_HTMLFrameElement09.html]
+[test_HTMLFrameSetElement01.html]
+[test_HTMLFrameSetElement02.html]
+[test_HTMLHRElement01.html]
+[test_HTMLHRElement02.html]
+[test_HTMLHRElement03.html]
+[test_HTMLHRElement04.html]
+[test_HTMLHeadingElement01.html]
+[test_HTMLHeadingElement02.html]
+[test_HTMLHeadingElement03.html]
+[test_HTMLHeadingElement04.html]
+[test_HTMLHeadingElement05.html]
+[test_HTMLHeadingElement06.html]
+[test_HTMLHtmlElement01.html]
+[test_HTMLIFrameElement01.html]
+[test_HTMLIFrameElement02.html]
+[test_HTMLIFrameElement03.html]
+[test_HTMLIFrameElement04.html]
+[test_HTMLIFrameElement05.html]
+[test_HTMLIFrameElement06.html]
+[test_HTMLIFrameElement07.html]
+[test_HTMLIFrameElement08.html]
+[test_HTMLIFrameElement09.html]
+[test_HTMLIFrameElement10.html]
+[test_HTMLIFrameElement11.html]
+[test_HTMLImageElement01.html]
+[test_HTMLImageElement02.html]
+[test_HTMLImageElement03.html]
+[test_HTMLImageElement04.html]
+[test_HTMLImageElement05.html]
+[test_HTMLImageElement06.html]
+[test_HTMLImageElement07.html]
+[test_HTMLImageElement08.html]
+[test_HTMLImageElement09.html]
+[test_HTMLImageElement10.html]
+[test_HTMLImageElement11.html]
+[test_HTMLImageElement12.html]
+[test_HTMLInputElement01.html]
+[test_HTMLInputElement02.html]
+[test_HTMLInputElement03.html]
+[test_HTMLInputElement04.html]
+[test_HTMLInputElement05.html]
+[test_HTMLInputElement06.html]
+[test_HTMLInputElement07.html]
+[test_HTMLInputElement08.html]
+[test_HTMLInputElement09.html]
+[test_HTMLInputElement10.html]
+[test_HTMLInputElement11.html]
+[test_HTMLInputElement12.html]
+[test_HTMLInputElement13.html]
+[test_HTMLInputElement14.html]
+[test_HTMLInputElement15.html]
+[test_HTMLInputElement16.html]
+[test_HTMLInputElement17.html]
+[test_HTMLInputElement18.html]
+[test_HTMLInputElement19.html]
+[test_HTMLInputElement20.html]
+[test_HTMLInputElement21.html]
+[test_HTMLInputElement22.html]
+[test_HTMLLIElement01.html]
+[test_HTMLLIElement02.html]
+[test_HTMLLabelElement01.html]
+[test_HTMLLabelElement02.html]
+[test_HTMLLabelElement03.html]
+[test_HTMLLabelElement04.html]
+[test_HTMLLegendElement01.html]
+[test_HTMLLegendElement02.html]
+[test_HTMLLegendElement03.html]
+[test_HTMLLegendElement04.html]
+[test_HTMLLinkElement01.html]
+[test_HTMLLinkElement02.html]
+[test_HTMLLinkElement03.html]
+[test_HTMLLinkElement04.html]
+[test_HTMLLinkElement05.html]
+[test_HTMLLinkElement06.html]
+[test_HTMLLinkElement07.html]
+[test_HTMLLinkElement08.html]
+[test_HTMLLinkElement09.html]
+[test_HTMLMapElement01.html]
+[test_HTMLMapElement02.html]
+[test_HTMLMenuElement01.html]
+[test_HTMLMetaElement01.html]
+[test_HTMLMetaElement02.html]
+[test_HTMLMetaElement03.html]
+[test_HTMLMetaElement04.html]
+[test_HTMLModElement01.html]
+[test_HTMLModElement02.html]
+[test_HTMLModElement03.html]
+[test_HTMLModElement04.html]
+[test_HTMLOListElement01.html]
+[test_HTMLOListElement02.html]
+[test_HTMLOListElement03.html]
+[test_HTMLObjectElement01.html]
+[test_HTMLObjectElement02.html]
+[test_HTMLObjectElement03.html]
+[test_HTMLObjectElement04.html]
+[test_HTMLObjectElement05.html]
+[test_HTMLObjectElement06.html]
+[test_HTMLObjectElement07.html]
+[test_HTMLObjectElement08.html]
+[test_HTMLObjectElement09.html]
+[test_HTMLObjectElement10.html]
+[test_HTMLObjectElement11.html]
+[test_HTMLObjectElement12.html]
+[test_HTMLObjectElement13.html]
+[test_HTMLObjectElement14.html]
+[test_HTMLObjectElement15.html]
+[test_HTMLObjectElement16.html]
+[test_HTMLObjectElement17.html]
+[test_HTMLObjectElement18.html]
+[test_HTMLObjectElement19.html]
+[test_HTMLObjectElement20.html]
+[test_HTMLOptGroupElement01.html]
+[test_HTMLOptGroupElement02.html]
+[test_HTMLOptionElement01.html]
+[test_HTMLOptionElement02.html]
+[test_HTMLOptionElement03.html]
+[test_HTMLOptionElement04.html]
+[test_HTMLOptionElement05.html]
+[test_HTMLOptionElement06.html]
+[test_HTMLOptionElement07.html]
+[test_HTMLOptionElement08.html]
+[test_HTMLOptionElement09.html]
+[test_HTMLOptionsCollection01.html]
+[test_HTMLOptionsCollection02.html]
+[test_HTMLOptionsCollection03.html]
+[test_HTMLOptionsCollection04.html]
+[test_HTMLOptionsCollection05.html]
+[test_HTMLOptionsCollection06.html]
+[test_HTMLOptionsCollection07.html]
+[test_HTMLParagraphElement01.html]
+[test_HTMLParamElement01.html]
+[test_HTMLParamElement02.html]
+[test_HTMLParamElement03.html]
+[test_HTMLParamElement04.html]
+[test_HTMLPreElement01.html]
+[test_HTMLQuoteElement01.html]
+[test_HTMLQuoteElement02.html]
+[test_HTMLScriptElement01.html]
+[test_HTMLScriptElement02.html]
+[test_HTMLScriptElement03.html]
+[test_HTMLScriptElement04.html]
+[test_HTMLScriptElement05.html]
+[test_HTMLScriptElement06.html]
+[test_HTMLScriptElement07.html]
+[test_HTMLSelectElement01.html]
+[test_HTMLSelectElement02.html]
+[test_HTMLSelectElement03.html]
+[test_HTMLSelectElement04.html]
+[test_HTMLSelectElement05.html]
+[test_HTMLSelectElement06.html]
+[test_HTMLSelectElement07.html]
+[test_HTMLSelectElement08.html]
+[test_HTMLSelectElement09.html]
+[test_HTMLSelectElement10.html]
+[test_HTMLSelectElement11.html]
+[test_HTMLSelectElement12.html]
+[test_HTMLSelectElement13.html]
+[test_HTMLSelectElement14.html]
+[test_HTMLSelectElement15.html]
+[test_HTMLSelectElement16.html]
+[test_HTMLSelectElement17.html]
+[test_HTMLSelectElement18.html]
+[test_HTMLSelectElement19.html]
+[test_HTMLSelectElement20.html]
+[test_HTMLStyleElement01.html]
+[test_HTMLStyleElement02.html]
+[test_HTMLStyleElement03.html]
+[test_HTMLTableCaptionElement01.html]
+[test_HTMLTableCellElement01.html]
+[test_HTMLTableCellElement02.html]
+[test_HTMLTableCellElement03.html]
+[test_HTMLTableCellElement04.html]
+[test_HTMLTableCellElement05.html]
+[test_HTMLTableCellElement06.html]
+[test_HTMLTableCellElement07.html]
+[test_HTMLTableCellElement08.html]
+[test_HTMLTableCellElement09.html]
+[test_HTMLTableCellElement10.html]
+[test_HTMLTableCellElement11.html]
+[test_HTMLTableCellElement12.html]
+[test_HTMLTableCellElement13.html]
+[test_HTMLTableCellElement14.html]
+[test_HTMLTableCellElement15.html]
+[test_HTMLTableCellElement16.html]
+[test_HTMLTableCellElement17.html]
+[test_HTMLTableCellElement18.html]
+[test_HTMLTableCellElement19.html]
+[test_HTMLTableCellElement20.html]
+[test_HTMLTableCellElement21.html]
+[test_HTMLTableCellElement22.html]
+[test_HTMLTableCellElement23.html]
+[test_HTMLTableCellElement24.html]
+[test_HTMLTableCellElement25.html]
+[test_HTMLTableCellElement26.html]
+[test_HTMLTableCellElement27.html]
+[test_HTMLTableCellElement28.html]
+[test_HTMLTableCellElement29.html]
+[test_HTMLTableCellElement30.html]
+[test_HTMLTableColElement01.html]
+[test_HTMLTableColElement02.html]
+[test_HTMLTableColElement03.html]
+[test_HTMLTableColElement04.html]
+[test_HTMLTableColElement05.html]
+[test_HTMLTableColElement06.html]
+[test_HTMLTableColElement07.html]
+[test_HTMLTableColElement08.html]
+[test_HTMLTableColElement09.html]
+[test_HTMLTableColElement10.html]
+[test_HTMLTableColElement11.html]
+[test_HTMLTableColElement12.html]
+[test_HTMLTableElement01.html]
+[test_HTMLTableElement02.html]
+[test_HTMLTableElement03.html]
+[test_HTMLTableElement04.html]
+[test_HTMLTableElement05.html]
+[test_HTMLTableElement06.html]
+[test_HTMLTableElement07.html]
+[test_HTMLTableElement08.html]
+[test_HTMLTableElement09.html]
+[test_HTMLTableElement10.html]
+[test_HTMLTableElement11.html]
+[test_HTMLTableElement12.html]
+[test_HTMLTableElement13.html]
+[test_HTMLTableElement14.html]
+[test_HTMLTableElement15.html]
+[test_HTMLTableElement16.html]
+[test_HTMLTableElement17.html]
+[test_HTMLTableElement18.html]
+[test_HTMLTableElement19.html]
+[test_HTMLTableElement20.html]
+[test_HTMLTableElement21.html]
+[test_HTMLTableElement22.html]
+[test_HTMLTableElement23.html]
+[test_HTMLTableElement24.html]
+[test_HTMLTableElement25.html]
+[test_HTMLTableElement26.html]
+[test_HTMLTableElement27.html]
+[test_HTMLTableElement28.html]
+[test_HTMLTableElement29.html]
+[test_HTMLTableElement30.html]
+[test_HTMLTableElement31.html]
+[test_HTMLTableElement32.html]
+[test_HTMLTableElement33.html]
+[test_HTMLTableElement34.html]
+[test_HTMLTableElement35.html]
+[test_HTMLTableElement36.html]
+[test_HTMLTableElement37.html]
+[test_HTMLTableElement38.html]
+[test_HTMLTableElement39.html]
+[test_HTMLTableElement40.html]
+[test_HTMLTableRowElement01.html]
+[test_HTMLTableRowElement02.html]
+[test_HTMLTableRowElement03.html]
+[test_HTMLTableRowElement04.html]
+[test_HTMLTableRowElement05.html]
+[test_HTMLTableRowElement06.html]
+[test_HTMLTableRowElement07.html]
+[test_HTMLTableRowElement08.html]
+[test_HTMLTableRowElement09.html]
+[test_HTMLTableRowElement10.html]
+[test_HTMLTableRowElement11.html]
+[test_HTMLTableRowElement12.html]
+[test_HTMLTableRowElement13.html]
+[test_HTMLTableRowElement14.html]
+[test_HTMLTableRowElement15.html]
+[test_HTMLTableRowElement16.html]
+[test_HTMLTableRowElement17.html]
+[test_HTMLTableRowElement18.html]
+[test_HTMLTableRowElement19.html]
+[test_HTMLTableRowElement20.html]
+[test_HTMLTableRowElement21.html]
+[test_HTMLTableSectionElement01.html]
+[test_HTMLTableSectionElement02.html]
+[test_HTMLTableSectionElement03.html]
+[test_HTMLTableSectionElement04.html]
+[test_HTMLTableSectionElement05.html]
+[test_HTMLTableSectionElement06.html]
+[test_HTMLTableSectionElement07.html]
+[test_HTMLTableSectionElement08.html]
+[test_HTMLTableSectionElement09.html]
+[test_HTMLTableSectionElement10.html]
+[test_HTMLTableSectionElement11.html]
+[test_HTMLTableSectionElement12.html]
+[test_HTMLTableSectionElement13.html]
+[test_HTMLTableSectionElement14.html]
+[test_HTMLTableSectionElement15.html]
+[test_HTMLTableSectionElement16.html]
+[test_HTMLTableSectionElement17.html]
+[test_HTMLTableSectionElement18.html]
+[test_HTMLTableSectionElement19.html]
+[test_HTMLTableSectionElement20.html]
+[test_HTMLTableSectionElement21.html]
+[test_HTMLTableSectionElement22.html]
+[test_HTMLTableSectionElement23.html]
+[test_HTMLTableSectionElement24.html]
+[test_HTMLTableSectionElement25.html]
+[test_HTMLTableSectionElement26.html]
+[test_HTMLTableSectionElement27.html]
+[test_HTMLTableSectionElement28.html]
+[test_HTMLTableSectionElement29.html]
+[test_HTMLTableSectionElement30.html]
+[test_HTMLTableSectionElement31.html]
+[test_HTMLTextAreaElement01.html]
+[test_HTMLTextAreaElement02.html]
+[test_HTMLTextAreaElement03.html]
+[test_HTMLTextAreaElement04.html]
+[test_HTMLTextAreaElement05.html]
+[test_HTMLTextAreaElement06.html]
+[test_HTMLTextAreaElement07.html]
+[test_HTMLTextAreaElement08.html]
+[test_HTMLTextAreaElement09.html]
+[test_HTMLTextAreaElement10.html]
+[test_HTMLTextAreaElement11.html]
+[test_HTMLTextAreaElement12.html]
+[test_HTMLTextAreaElement13.html]
+[test_HTMLTextAreaElement14.html]
+[test_HTMLTextAreaElement15.html]
+[test_HTMLTitleElement01.html]
+[test_HTMLUListElement01.html]
+[test_HTMLUListElement02.html]
+[test_anchor01.html]
+[test_anchor02.html]
+[test_anchor03.html]
+[test_anchor04.html]
+[test_anchor05.html]
+[test_anchor06.html]
+[test_area01.html]
+[test_area02.html]
+[test_area03.html]
+[test_area04.html]
+[test_body01.html]
+[test_button01.html]
+[test_button02.html]
+[test_button03.html]
+[test_button04.html]
+[test_button05.html]
+[test_button06.html]
+[test_button07.html]
+[test_button08.html]
+[test_button09.html]
+[test_dlist01.html]
+[test_doc01.html]
+[test_hasFeature01.html]
+[test_hasFeature02.html]
+[test_hasFeature03.html]
+[test_hasFeature04.html]
+[test_hasFeature05.html]
+[test_hasFeature06.html]
+[test_object01.html]
+[test_object02.html]
+[test_object03.html]
+[test_object04.html]
+[test_object05.html]
+[test_object06.html]
+[test_object07.html]
+[test_object08.html]
+[test_object09.html]
+[test_object10.html]
+[test_object11.html]
+[test_object12.html]
+[test_object13.html]
+[test_object14.html]
+[test_object15.html]
+[test_table01.html]
+[test_table02.html]
+[test_table03.html]
+[test_table04.html]
+[test_table06.html]
+[test_table07.html]
+[test_table08.html]
+[test_table09.html]
+[test_table10.html]
+[test_table12.html]
+[test_table15.html]
+[test_table17.html]
+[test_table18.html]
+[test_table19.html]
+[test_table20.html]
+[test_table21.html]
+[test_table22.html]
+[test_table23.html]
+[test_table24.html]
+[test_table25.html]
+[test_table26.html]
+[test_table27.html]
+[test_table28.html]
+[test_table29.html]
+[test_table30.html]
+[test_table31.html]
+[test_table32.html]
+[test_table33.html]
+[test_table34.html]
+[test_table35.html]
+[test_table36.html]
+[test_table37.html]
+[test_table38.html]
+[test_table39.html]
+[test_table40.html]
+[test_table41.html]
+[test_table42.html]
+[test_table43.html]
+[test_table44.html]
+[test_table45.html]
+[test_table46.html]
+[test_table47.html]
+[test_table48.html]
+[test_table49.html]
+[test_table50.html]
+[test_table51.html]
+[test_table52.html]
+[test_table53.html]
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement01.html
new file mode 100644
index 0000000000..dc899e3861
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accessKey attribute is a single character access key to give
+ access to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89647724
+*/
+function HTMLAnchorElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accessKeyLink","g",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement01</h2>
+<p>&lt;test name='HTMLAnchorElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accessKey attribute is a single character access key to give
+ access to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89647724">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89647724</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLAnchorElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"g"' <a id="accessKeyLink">id='accessKeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement02.html
new file mode 100644
index 0000000000..9df6310722
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The charset attribute indicates the character encoding of the linked
+ resource.
+
+ Retrieve the charset attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67619266
+*/
+function HTMLAnchorElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharset;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcharset = testNode.charset;
+
+ assertEquals("charsetLink","US-ASCII",vcharset);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement02</h2>
+<p>&lt;test name='HTMLAnchorElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The charset attribute indicates the character encoding of the linked
+ resource.
+
+ Retrieve the charset attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67619266">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67619266</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharset' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;charset interface='HTMLAnchorElement' obj='testNode' var='vcharset'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharset' expected='"US-ASCII"' <a id="charsetLink">id='charsetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement03.html
new file mode 100644
index 0000000000..8255bd3067
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The coords attribute is a comma-seperated list of lengths, defining
+ an active region geometry.
+
+ Retrieve the coords attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92079539
+*/
+function HTMLAnchorElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vcoords;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcoords = testNode.coords;
+
+ assertEquals("coordsLink","0,0,100,100",vcoords);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement03</h2>
+<p>&lt;test name='HTMLAnchorElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The coords attribute is a comma-seperated list of lengths, defining
+ an active region geometry.
+
+ Retrieve the coords attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92079539">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92079539</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcoords' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;coords interface='HTMLAnchorElement' obj='testNode' var='vcoords'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcoords' expected='"0,0,100,100"' <a id="coordsLink">id='coordsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement04.html
new file mode 100644
index 0000000000..01342aa7af
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The href attribute contains the URL of the linked resource.
+
+ Retrieve the href attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88517319
+*/
+function HTMLAnchorElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vhref;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vhref = testNode.href;
+
+ assertURIEquals("hrefLink",null,null,null,"submit.gif",null,null,null,null,vhref);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement04</h2>
+<p>&lt;test name='HTMLAnchorElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The href attribute contains the URL of the linked resource.
+
+ Retrieve the href attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88517319">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88517319</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhref' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;href interface='HTMLAnchorElement' obj='testNode' var='vhref'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vhref' file='"submit.gif"' <a id="hrefLink">id='hrefLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement05.html
new file mode 100644
index 0000000000..679063c4ff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The hreflang attribute contains the language code of the linked resource.
+
+ Retrieve the hreflang attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87358513
+*/
+function HTMLAnchorElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vhreflink;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vhreflink = testNode.hreflang;
+
+ assertEquals("hreflangLink","en",vhreflink);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement05</h2>
+<p>&lt;test name='HTMLAnchorElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The hreflang attribute contains the language code of the linked resource.
+
+ Retrieve the hreflang attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87358513">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87358513</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhreflink' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hreflang interface='HTMLAnchorElement' obj='testNode' var='vhreflink'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhreflink' expected='"en"' <a id="hreflangLink">id='hreflangLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement06.html
new file mode 100644
index 0000000000..e28bcbcdd5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute contains the anchor name.
+
+ Retrieve the name attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32783304
+*/
+function HTMLAnchorElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","Anchor",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement06</h2>
+<p>&lt;test name='HTMLAnchorElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute contains the anchor name.
+
+ Retrieve the name attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32783304">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32783304</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLAnchorElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"Anchor"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement07.html
new file mode 100644
index 0000000000..6780083dab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rel attribute contains the forward link type.
+
+ Retrieve the rel attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3815891
+*/
+function HTMLAnchorElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vrel;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vrel = testNode.rel;
+
+ assertEquals("relLink","GLOSSARY",vrel);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement07</h2>
+<p>&lt;test name='HTMLAnchorElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rel attribute contains the forward link type.
+
+ Retrieve the rel attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3815891">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3815891</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrel' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rel interface='HTMLAnchorElement' obj='testNode' var='vrel'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrel' expected='"GLOSSARY"' <a id="relLink">id='relLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement08.html
new file mode 100644
index 0000000000..7a615e662c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement08.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rev attribute contains the reverse link type
+
+ Retrieve the rev attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58259771
+*/
+function HTMLAnchorElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vrev;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vrev = testNode.rev;
+
+ assertEquals("revLink","STYLESHEET",vrev);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement08</h2>
+<p>&lt;test name='HTMLAnchorElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rev attribute contains the reverse link type
+
+ Retrieve the rev attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58259771">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58259771</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrev' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rev interface='HTMLAnchorElement' obj='testNode' var='vrev'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrev' expected='"STYLESHEET"' <a id="revLink">id='revLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement09.html
new file mode 100644
index 0000000000..30453216fe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement09.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The shape attribute contains the shape of the active area.
+
+ Retrieve the shape attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49899808
+*/
+function HTMLAnchorElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vshape;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vshape = testNode.shape;
+
+ assertEquals("shapeLink","rect",vshape);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement09</h2>
+<p>&lt;test name='HTMLAnchorElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The shape attribute contains the shape of the active area.
+
+ Retrieve the shape attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49899808">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49899808</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vshape' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;shape interface='HTMLAnchorElement' obj='testNode' var='vshape'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vshape' expected='"rect"' <a id="shapeLink">id='shapeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement10.html
new file mode 100644
index 0000000000..8b377e7da9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement10.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tabIndex attribute contains an index that represents the elements
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41586466
+*/
+function HTMLAnchorElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",22,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement10</h2>
+<p>&lt;test name='HTMLAnchorElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tabIndex attribute contains an index that represents the elements
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41586466">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41586466</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLAnchorElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='22' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement11.html
new file mode 100644
index 0000000000..64e54da9b4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement11.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The target attribute specifies the frame to render the source in.
+
+ Retrieve the target attribute and examine it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6414197
+*/
+function HTMLAnchorElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vtarget;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor2");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtarget = testNode.target;
+
+ assertEquals("targetLink","dynamic",vtarget);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement11</h2>
+<p>&lt;test name='HTMLAnchorElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The target attribute specifies the frame to render the source in.
+
+ Retrieve the target attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6414197">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6414197</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtarget' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target interface='HTMLAnchorElement' obj='testNode' var='vtarget'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtarget' expected='"dynamic"' <a id="targetLink">id='targetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement12.html
new file mode 100644
index 0000000000..cf48f9dc99
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement12.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute contains the advisory content model.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63938221
+*/
+function HTMLAnchorElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","image/gif",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement12</h2>
+<p>&lt;test name='HTMLAnchorElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute contains the advisory content model.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63938221">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63938221</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLAnchorElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"image/gif"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement13.html
new file mode 100644
index 0000000000..750832dd47
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement13.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLAnchorElement.blur should surrender input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65068939
+*/
+function HTMLAnchorElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ testNode.blur();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement13</h2>
+<p>&lt;test name='HTMLAnchorElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLAnchorElement.blur should surrender input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65068939">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65068939</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;blur interface='HTMLAnchorElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement14.html
new file mode 100644
index 0000000000..7daee66eb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAnchorElement14.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAnchorElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLAnchorElement.focus should capture input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47150313
+*/
+function HTMLAnchorElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLAnchorElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ testNode.focus();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAnchorElement14</h2>
+<p>&lt;test name='HTMLAnchorElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAnchorElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLAnchorElement.focus should capture input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47150313">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47150313</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='HTMLAnchorElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;focus interface='HTMLAnchorElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement01.html
new file mode 100644
index 0000000000..33cb668b00
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accessKey attribute specifies a single character access key to
+ give access to the control form.
+
+ Retrieve the accessKey attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57944457
+*/
+function HTMLAreaElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("alignLink","a",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement01</h2>
+<p>&lt;test name='HTMLAreaElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accessKey attribute specifies a single character access key to
+ give access to the control form.
+
+ Retrieve the accessKey attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57944457">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57944457</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLAreaElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"a"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement02.html
new file mode 100644
index 0000000000..c863149863
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The alt attribute specifies an alternate text for user agents not
+ rendering the normal content of this element.
+
+ Retrieve the alt attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39775416
+*/
+function HTMLAreaElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var valt;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valt = testNode.alt;
+
+ assertEquals("altLink","Domain",valt);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement02</h2>
+<p>&lt;test name='HTMLAreaElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The alt attribute specifies an alternate text for user agents not
+ rendering the normal content of this element.
+
+ Retrieve the alt attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39775416">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39775416</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valt' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;alt interface='HTMLAreaElement' obj='testNode' var='valt'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valt' expected='"Domain"' <a id="altLink">id='altLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement03.html
new file mode 100644
index 0000000000..fcfc102c6c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The coords attribute specifies a comma-seperated list of lengths,
+ defining an active region geometry.
+
+ Retrieve the coords attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66021476
+*/
+function HTMLAreaElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vcoords;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcoords = testNode.coords;
+
+ assertEquals("coordsLink","0,2,45,45",vcoords);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement03</h2>
+<p>&lt;test name='HTMLAreaElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The coords attribute specifies a comma-seperated list of lengths,
+ defining an active region geometry.
+
+ Retrieve the coords attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66021476">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66021476</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcoords' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;coords interface='HTMLAreaElement' obj='testNode' var='vcoords'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcoords' expected='"0,2,45,45"' <a id="coordsLink">id='coordsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement04.html
new file mode 100644
index 0000000000..fd2f9ed7a4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The href attribute specifies the URI of the linked resource.
+
+ Retrieve the href attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34672936
+*/
+function HTMLAreaElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vhref;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vhref = testNode.href;
+
+ assertURIEquals("hrefLink",null,null,null,"dletter.html",null,null,null,null,vhref);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement04</h2>
+<p>&lt;test name='HTMLAreaElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The href attribute specifies the URI of the linked resource.
+
+ Retrieve the href attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34672936">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34672936</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhref' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;href interface='HTMLAreaElement' obj='testNode' var='vhref'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vhref' file='"dletter.html"' <a id="hrefLink">id='hrefLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement05.html
new file mode 100644
index 0000000000..91f422ba57
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The noHref attribute specifies that this area is inactive.
+
+ Retrieve the noHref attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61826871
+*/
+function HTMLAreaElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vnohref;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vnohref = testNode.noHref;
+
+ assertFalse("noHrefLink",vnohref);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement05</h2>
+<p>&lt;test name='HTMLAreaElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The noHref attribute specifies that this area is inactive.
+
+ Retrieve the noHref attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61826871">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61826871</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vnohref' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;noHref interface='HTMLAreaElement' obj='testNode' var='vnohref'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertFalse actual='vnohref' <a id="noHrefLink">id='noHrefLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement06.html
new file mode 100644
index 0000000000..4573ad5e9f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The shape attribute specifies the shape of the active area.
+
+ Retrieve the shape attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85683271
+*/
+function HTMLAreaElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vshape;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vshape = testNode.shape;
+
+ assertEquals("shapeLink","rect".toLowerCase(),vshape.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement06</h2>
+<p>&lt;test name='HTMLAreaElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The shape attribute specifies the shape of the active area.
+
+ Retrieve the shape attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85683271">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85683271</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vshape' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;shape interface='HTMLAreaElement' obj='testNode' var='vshape'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vshape' expected='"rect"' <a id="shapeLink">id='shapeLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement07.html
new file mode 100644
index 0000000000..51a20af37d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement07.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tabIndex attribute specifies an index that represents the element's
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8722121
+*/
+function HTMLAreaElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",10,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement07</h2>
+<p>&lt;test name='HTMLAreaElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tabIndex attribute specifies an index that represents the element's
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8722121">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8722121</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLAreaElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='10' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement08.html
new file mode 100644
index 0000000000..34beaca59b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAreaElement08.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAreaElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The target specifies the frame to render the resource in.
+
+ Retrieve the target attribute and examine it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46054682
+*/
+function HTMLAreaElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLAreaElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vtarget;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area2");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtarget = testNode.target;
+
+ assertEquals("targetLink","dynamic",vtarget);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAreaElement08</h2>
+<p>&lt;test name='HTMLAreaElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAreaElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The target specifies the frame to render the resource in.
+
+ Retrieve the target attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46054682">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46054682</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtarget' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target interface='HTMLAreaElement' obj='testNode' var='vtarget'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtarget' expected='"dynamic"' <a id="targetLink">id='targetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBRElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBRElement01.html
new file mode 100644
index 0000000000..d214e9c4c3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBRElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBRElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBRElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "br");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The clear attribute specifies control flow of text around floats.
+
+ Retrieve the clear attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82703081
+*/
+function HTMLBRElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLBRElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vclear;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "br");
+ nodeList = doc.getElementsByTagName("br");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclear = testNode.clear;
+
+ assertEquals("clearLink","none",vclear);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBRElement01</h2>
+<p>&lt;test name='HTMLBRElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBRElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The clear attribute specifies control flow of text around floats.
+
+ Retrieve the clear attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82703081">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82703081</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclear' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='br' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"br"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;clear interface='HTMLBRElement' obj='testNode' var='vclear'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclear' expected='"none"' <a id="clearLink">id='clearLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/br.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement01.html
new file mode 100644
index 0000000000..b5301beb83
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBaseElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "base");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The href attribute specifies the base URI.
+
+ Retrieve the href attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65382887
+*/
+function HTMLBaseElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLBaseElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vhref;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "base");
+ nodeList = doc.getElementsByTagName("base");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vhref = testNode.href;
+
+ assertEquals("hrefLink","about:blank",vhref);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseElement01</h2>
+<p>&lt;test name='HTMLBaseElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBaseElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The href attribute specifies the base URI.
+
+ Retrieve the href attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65382887">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65382887</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhref' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='base' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"base"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;href interface='HTMLBaseElement' obj='testNode' var='vhref'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhref' expected='"about:blank"' <a id="hrefLink">id='hrefLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/base.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement02.html
new file mode 100644
index 0000000000..c271e9565a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBaseElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBaseElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "base2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The target attribute specifies the default target frame.
+
+ Retrieve the target attribute and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73844298
+*/
+function HTMLBaseElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLBaseElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vtarget;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "base2");
+ nodeList = doc.getElementsByTagName("base");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtarget = testNode.target;
+
+ assertEquals("targetLink","Frame1",vtarget);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseElement02</h2>
+<p>&lt;test name='HTMLBaseElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBaseElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The target attribute specifies the default target frame.
+
+ Retrieve the target attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73844298">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73844298</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtarget' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='base2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"base"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target interface='HTMLBaseElement' obj='testNode' var='vtarget'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtarget' expected='"Frame1"' <a id="targetLink">id='targetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/base2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement01.html
new file mode 100644
index 0000000000..3e1fa8e484
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBodyElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "body");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The aLink attribute specifies the color of active links.
+
+ Retrieve the aLink attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59424581
+*/
+function HTMLBodyElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLBodyElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valink;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "body");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valink = testNode.aLink;
+
+ assertEquals("aLinkLink","#0000ff",valink);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement01</h2>
+<p>&lt;test name='HTMLBodyElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBodyElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The aLink attribute specifies the color of active links.
+
+ Retrieve the aLink attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59424581">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59424581</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valink' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='body' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;aLink interface='HTMLBodyElement' obj='testNode' var='valink'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valink' expected='"#0000ff"' <a id="aLinkLink">id='aLinkLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/body.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement02.html
new file mode 100644
index 0000000000..1aaa2e3782
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement02.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBodyElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "body");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The background attribute specifies the URI of the background texture
+ tile image.
+
+ Retrieve the background attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-37574810
+*/
+function HTMLBodyElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLBodyElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vbackground;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "body");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vbackground = testNode.background;
+ assertEquals("backgroundLink","./pix/back1.gif",vbackground);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement02</h2>
+<p>&lt;test name='HTMLBodyElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBodyElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The background attribute specifies the URI fo the background texture
+ tile image.
+
+ Retrieve the background attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-37574810">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-37574810</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbackground' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='body' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;background interface='HTMLBodyElement' obj='testNode' var='vbackground'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbackground' expected='"./pix/back1.gif"' <a id="backgroundLink">id='backgroundLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/body.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement03.html
new file mode 100644
index 0000000000..1cb2e6d2ff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBodyElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "body");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The bgColor attribute specifies the document background color.
+
+ Retrieve the bgColor attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-24940084
+*/
+function HTMLBodyElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLBodyElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "body");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgColorLink","#ffff00",vbgcolor);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement03</h2>
+<p>&lt;test name='HTMLBodyElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBodyElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The bgColor attribute specifies the document background color.
+
+ Retrieve the bgColor attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-24940084">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-24940084</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='body' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLBodyElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#ffff00"' <a id="bgColorLink">id='bgColorLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/body.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement04.html
new file mode 100644
index 0000000000..313430d770
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBodyElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "body");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The link attribute specifies the color of links that are not active
+ and unvisited.
+
+ Retrieve the link attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7662206
+*/
+function HTMLBodyElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLBodyElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vlink;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "body");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlink = testNode.link;
+
+ assertEquals("linkLink","#ff0000",vlink);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement04</h2>
+<p>&lt;test name='HTMLBodyElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBodyElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The link attribute specifies the color of links that are not active
+ and unvisited.
+
+ Retrieve the link attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7662206">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7662206</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlink' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='body' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;link interface='HTMLBodyElement' obj='testNode' var='vlink'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlink' expected='"#ff0000"' <a id="linkLink">id='linkLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/body.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement05.html
new file mode 100644
index 0000000000..b81ef57bc3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBodyElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "body");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The text attribute specifies the document text color.
+
+ Retrieve the text attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73714763
+*/
+function HTMLBodyElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLBodyElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vtext;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "body");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtext = testNode.text;
+
+ assertEquals("textLink","#000000",vtext);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement05</h2>
+<p>&lt;test name='HTMLBodyElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBodyElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The text attribute specifies the document text color.
+
+ Retrieve the text attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73714763">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73714763</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtext' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='body' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;text interface='HTMLBodyElement' obj='testNode' var='vtext'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtext' expected='"#000000"' <a id="textLink">id='textLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/body.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement06.html
new file mode 100644
index 0000000000..090cf5784c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLBodyElement06.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLBodyElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "body");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vLink attribute specifies the color of links that have been
+ visited by the user.
+
+ Retrieve the vLink attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83224305
+*/
+function HTMLBodyElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLBodyElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vvlink;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "body");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvlink = testNode.vLink;
+
+ assertEquals("vLinkLink","#00ffff",vvlink);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement06</h2>
+<p>&lt;test name='HTMLBodyElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBodyElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vLink attribute specifies the color of links that have been
+ visited by the user.
+
+ Retrieve the vLink attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83224305">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83224305</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvlink' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='body' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vLink interface='HTMLBodyElement' obj='testNode' var='vvlink'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvlink' expected='"#00ffff"' <a id="vLinkLink">id='vLinkLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/body.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement01.html
new file mode 100644
index 0000000000..a2671e0db7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement01.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493
+*/
+function HTMLButtonElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var fNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form2",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement01</h2>
+<p>&lt;test name='HTMLButtonElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLButtonElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form2"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement02.html
new file mode 100644
index 0000000000..6a5549ddc2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493
+*/
+function HTMLButtonElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement02</h2>
+<p>&lt;test name='HTMLButtonElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLButtonElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement03.html
new file mode 100644
index 0000000000..51d5ecdb0a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accessKey attribute returns a single character access key to
+ give access to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73169431
+*/
+function HTMLButtonElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accessKeyLink","f",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement03</h2>
+<p>&lt;test name='HTMLButtonElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accessKey attribute returns a single character access key to
+ give access to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73169431">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73169431</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLButtonElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"f"' <a id="accessKeyLink">id='accessKeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement04.html
new file mode 100644
index 0000000000..eb437b66e5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute specifies whether the control is unavailable
+ in this context.
+
+ Retrieve the disabled attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92757155
+*/
+function HTMLButtonElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vdisabled = testNode.disabled;
+
+ assertTrue("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement04</h2>
+<p>&lt;test name='HTMLButtonElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute specifies whether the control is unavailable
+ in this context.
+
+ Retrieve the disabled attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92757155">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92757155</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLButtonElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement05.html
new file mode 100644
index 0000000000..3dda0c1285
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement05.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute is the form control or object name when submitted
+ with a form.
+
+ Retrieve the name attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11029910
+*/
+function HTMLButtonElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","disabledButton",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement05</h2>
+<p>&lt;test name='HTMLButtonElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute is the form control or object name when submitted
+ with a form.
+
+ Retrieve the name attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11029910">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11029910</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLButtonElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"disabledButton"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement06.html
new file mode 100644
index 0000000000..a35ce44be9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement06.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tabIndex attribute specifies an index that represents the element's
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39190908
+*/
+function HTMLButtonElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",20,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement06</h2>
+<p>&lt;test name='HTMLButtonElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tabIndex attribute specifies an index that represents the element's
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39190908">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39190908</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLButtonElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='20' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement07.html
new file mode 100644
index 0000000000..121bd16258
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the type of button.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27430092
+*/
+function HTMLButtonElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","reset",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement07</h2>
+<p>&lt;test name='HTMLButtonElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the type of button.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27430092">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27430092</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLButtonElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"reset"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement08.html
new file mode 100644
index 0000000000..e3e688a6c8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLButtonElement08.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLButtonElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The value attribute specifies the current control value.
+
+ Retrieve the value attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72856782
+*/
+function HTMLButtonElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLButtonElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vvalue = testNode.value;
+
+ assertEquals("valueLink","Reset Disabled Button",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLButtonElement08</h2>
+<p>&lt;test name='HTMLButtonElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLButtonElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The value attribute specifies the current control value.
+
+ Retrieve the value attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72856782">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72856782</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLButtonElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"Reset Disabled Button"' <a id="valueLink">id='valueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection01.html
new file mode 100644
index 0000000000..a9db5018a1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection01.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. The item located at ordinal index 0 is further
+ retrieved and its "rowIndex" attribute is examined.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535
+*/
+function HTMLCollection01() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection01") != null) return;
+ var nodeList;
+ var testNode;
+ var rowNode;
+ var rowsnodeList;
+ var vrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ rowNode = rowsnodeList.item(0);
+ vrowindex = rowNode.rowIndex;
+
+ assertEquals("rowIndexLink",0,vrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection01</h2>
+<p>&lt;test name='HTMLCollection01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. The item located at ordinal index 0 is further
+ retrieved and its "rowIndex" attribute is examined.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='rowsnodeList' var='rowNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowIndex interface='HTMLTableRowElement' obj='rowNode' var='vrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowindex' expected='0' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection02.html
new file mode 100644
index 0000000000..250be450b6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection02.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The first SELECT element is further retrieved
+ using the elements name attribute.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479
+*/
+function HTMLCollection02() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection02") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var formsnodeList;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ formNode = formsnodeList.namedItem("select1");
+ vname = formNode.nodeName;
+
+ assertEqualsAutoCase("element", "nameIndexLink","SELECT",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection02</h2>
+<p>&lt;test name='HTMLCollection02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The first SELECT element is further retrieved
+ using the elements name attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem obj='formsnodeList' var='formNode' name='"select1"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='formNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"SELECT"' <a id="nameIndexLink">id='nameIndexLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection03.html
new file mode 100644
index 0000000000..4106a252f9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection03.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test id attribute).
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the "element" attribute. The first SELECT element is further retrieved
+ using the elements id.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976
+*/
+function HTMLCollection03() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection03") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var formsnodeList;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ formNode = formsnodeList.namedItem("selectId");
+ vname = formNode.nodeName;
+
+ assertEqualsAutoCase("element", "nameIndexLink","select",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection03</h2>
+<p>&lt;test name='HTMLCollection03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test id attribute).
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the "element" attribute. The first SELECT element is further retrieved
+ using the elements id.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem obj='formsnodeList' var='formNode' name='"selectId"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='formNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"select"' <a id="nameIndexLink">id='nameIndexLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection04.html
new file mode 100644
index 0000000000..1dd77c08d8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection04.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ HTMLCollections are live, they are automatically updated when the
+ underlying document is changed.
+
+ Create a HTMLCollection object by invoking the rows attribute of the
+ first TABLE element and examine its length, then add a new row and
+ re-examine the length.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551
+*/
+function HTMLCollection04() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection04") != null) return;
+ var nodeList;
+ var testNode;
+ var rowLength1;
+ var rowLength2;
+ var rowsnodeList;
+ var newRow;
+ var vrowindex;
+ var doc;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = 4;
+ expectedResult[1] = 5;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ rowLength1 = rowsnodeList.length;
+
+ result[result.length] = rowLength1;
+newRow = testNode.insertRow(4);
+ rowLength2 = rowsnodeList.length;
+
+ result[result.length] = rowLength2;
+assertEqualsList("rowIndexLink",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection04</h2>
+<p>&lt;test name='HTMLCollection04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ HTMLCollections are live, they are automatically updated when the
+ underlying document is changed.
+
+ Create a HTMLCollection object by invoking the rows attribute of the
+ first TABLE element and examine its length, then add a new row and
+ re-examine the length.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowLength1' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowLength2' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='result' type='List'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='expectedResult' type='List'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/var&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='rowLength1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='rowLength1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='4'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='rowLength2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='rowLength2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='result' expected='expectedResult' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection05.html
new file mode 100644
index 0000000000..9e5cbc4d75
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection05.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The length attribute specifies the length or size of the list.
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. Retrieve the length attribute of the HTMLCollection
+ object.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551
+*/
+function HTMLCollection05() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection05") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var rowLength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ rowLength = rowsnodeList.length;
+
+ assertEquals("rowIndexLink",4,rowLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection05</h2>
+<p>&lt;test name='HTMLCollection05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The length attribute specifies the length or size of the list.
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. Retrieve the length attribute of the HTMLCollection
+ object.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowLength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='rowLength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='rowLength' expected='4' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection06.html
new file mode 100644
index 0000000000..065f33a9a4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection06.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An item(index) method retrieves an item specified by ordinal index
+ (Test for index=0).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. The item located at ordinal index 0 is further
+ retrieved and its "rowIndex" attribute is examined.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6156016
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535
+*/
+function HTMLCollection06() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection06") != null) return;
+ var nodeList;
+ var testNode;
+ var rowNode;
+ var rowsnodeList;
+ var vrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ rowNode = rowsnodeList.item(0);
+ vrowindex = rowNode.rowIndex;
+
+ assertEquals("rowIndexLink",0,vrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection06</h2>
+<p>&lt;test name='HTMLCollection06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An item(index) method retrieves an item specified by ordinal index
+ (Test for index=0).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. The item located at ordinal index 0 is further
+ retrieved and its "rowIndex" attribute is examined.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6156016">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6156016</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='rowsnodeList' var='rowNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowIndex interface='HTMLTableRowElement' obj='rowNode' var='vrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowindex' expected='0' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection07.html
new file mode 100644
index 0000000000..6bf2f46144
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection07.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An item(index) method retrieves an item specified by ordinal index
+ (Test for index=3).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. The item located at ordinal index 3 is further
+ retrieved and its "rowIndex" attribute is examined.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535
+*/
+function HTMLCollection07() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection07") != null) return;
+ var nodeList;
+ var testNode;
+ var rowNode;
+ var rowsnodeList;
+ var vrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ rowNode = rowsnodeList.item(3);
+ vrowindex = rowNode.rowIndex;
+
+ assertEquals("rowIndexLink",3,vrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection07</h2>
+<p>&lt;test name='HTMLCollection07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An item(index) method retrieves an item specified by ordinal index
+ (Test for index=3).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. The item located at ordinal index 3 is further
+ retrieved and its "rowIndex" attribute is examined.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='rowsnodeList' var='rowNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowIndex interface='HTMLTableRowElement' obj='rowNode' var='vrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowindex' expected='3' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection08.html
new file mode 100644
index 0000000000..3a808d8246
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection08.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ Nodes in a HTMLCollection object are numbered in tree order.
+ (Depth-first traversal order).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. Access the item in the third ordinal index. The
+ resulting rowIndex attribute is examined and should be two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535
+*/
+function HTMLCollection08() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection08") != null) return;
+ var nodeList;
+ var testNode;
+ var rowNode;
+ var rowsnodeList;
+ var vrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ rowNode = rowsnodeList.item(2);
+ vrowindex = rowNode.rowIndex;
+
+ assertEquals("rowIndexLink",2,vrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection08</h2>
+<p>&lt;test name='HTMLCollection08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ Nodes in a HTMLCollection object are numbered in tree order.
+ (Depth-first traversal order).
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. Access the item in the third ordinal index. The
+ resulting rowIndex attribute is examined and should be two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='rowsnodeList' var='rowNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowIndex interface='HTMLTableRowElement' obj='rowNode' var='vrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowindex' expected='2' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection09.html
new file mode 100644
index 0000000000..dc68289b4c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection09.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The item(index) method returns null if the index is out of range.
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. Invoke the item(index) method with an index
+ of 5. This index is out of range and should return null.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535
+*/
+function HTMLCollection09() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection09") != null) return;
+ var nodeList;
+ var testNode;
+ var rowNode;
+ var rowsnodeList;
+ var vrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ rowNode = rowsnodeList.item(5);
+ assertNull("rowIndexLink",rowNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection09</h2>
+<p>&lt;test name='HTMLCollection09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The item(index) method returns null if the index is out of range.
+
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. Invoke the item(index) method with an index
+ of 5. This index is out of range and should return null.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='rowsnodeList' var='rowNode' index='5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='rowNode' <a id="rowIndexLink">id='rowIndexLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection10.html
new file mode 100644
index 0000000000..13f4ea3753
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection10.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The namedItem(name) method retrieves a node using a name. It first
+ searches for a node with a matching id attribute. If it doesn't find
+ one, it then searches for a Node with a matching name attribute, but only
+ on those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The first SELECT element is further retrieved
+ using the elements name attribute since the id attribute doesn't match.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976
+*/
+function HTMLCollection10() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection10") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var formsnodeList;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ formNode = formsnodeList.namedItem("select1");
+ vname = formNode.nodeName;
+
+ assertEqualsAutoCase("element", "nameIndexLink","SELECT",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection10</h2>
+<p>&lt;test name='HTMLCollection10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The namedItem(name) method retrieves a node using a name. It first
+ searches for a node with a matching id attribute. If it doesn't find
+ one, it then searches for a Node with a matching name attribute, but only
+ on those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The first SELECT element is further retrieved
+ using the elements name attribute since the id attribute doesn't match.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem obj='formsnodeList' var='formNode' name='"select1"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='formNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"SELECT"' <a id="nameIndexLink">id='nameIndexLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection11.html
new file mode 100644
index 0000000000..226c6e35c2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection11.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The namedItem(name) method retrieves a node using a name. It first
+ searches for a node with a matching id attribute. If it doesn't find
+ one, it then searches for a Node with a matching name attribute, but only
+ on those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The first SELECT element is further retrieved
+ using the elements id attribute.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479
+*/
+function HTMLCollection11() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection11") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var formsnodeList;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ formNode = formsnodeList.namedItem("selectId");
+ vname = formNode.nodeName;
+
+ assertEqualsAutoCase("element", "nameIndexLink","select",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection11</h2>
+<p>&lt;test name='HTMLCollection11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The namedItem(name) method retrieves a node using a name. It first
+ searches for a node with a matching id attribute. If it doesn't find
+ one, it then searches for a Node with a matching name attribute, but only
+ on those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The first SELECT element is further retrieved
+ using the elements id attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem obj='formsnodeList' var='formNode' name='"selectId"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='formNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"select"' <a id="nameIndexLink">id='nameIndexLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLCollection12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection12.html
new file mode 100644
index 0000000000..f19b0b4a9c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLCollection12.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLCollection12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "collection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The namedItem(name) method retrieves a node using a name. It first
+ searches for a node with a matching id attribute. If it doesn't find
+ one, it then searches for a Node with a matching name attribute, but only
+ on those elements that are allowed a name attribute. If there isn't
+ a matching node the method returns null.
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The method returns null since there is not a
+ match of the name or id attribute.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976
+*/
+function HTMLCollection12() {
+ var success;
+ if(checkInitialization(builder, "HTMLCollection12") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var formsnodeList;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "collection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ formNode = formsnodeList.namedItem("select9");
+ assertNull("nameIndexLink",formNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLCollection12</h2>
+<p>&lt;test name='HTMLCollection12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLCollection12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The namedItem(name) method retrieves a node using a name. It first
+ searches for a node with a matching id attribute. If it doesn't find
+ one, it then searches for a Node with a matching name attribute, but only
+ on those elements that are allowed a name attribute. If there isn't
+ a matching node the method returns null.
+
+ Retrieve the first FORM element and create a HTMLCollection by invoking
+ the elements attribute. The method returns null since there is not a
+ match of the name or id attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='collection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem obj='formsnodeList' var='formNode' name='"select9"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='formNode' <a id="nameIndexLink">id='nameIndexLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/collection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDirectoryElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDirectoryElement01.html
new file mode 100644
index 0000000000..d83de76aff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDirectoryElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDirectoryElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDirectoryElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "directory");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75317739
+*/
+function HTMLDirectoryElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLDirectoryElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcompact;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "directory");
+ nodeList = doc.getElementsByTagName("dir");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcompact = testNode.compact;
+
+ assertTrue("compactLink",vcompact);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDirectoryElement01</h2>
+<p>&lt;test name='HTMLDirectoryElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDirectoryElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75317739">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75317739</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcompact' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='directory' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dir"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;compact interface='HTMLDirectoryElement' obj='testNode' var='vcompact'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vcompact' <a id="compactLink">id='compactLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/directory.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDivElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDivElement01.html
new file mode 100644
index 0000000000..6e345f6955
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDivElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDivElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDivElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "div");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment.
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70908791
+*/
+function HTMLDivElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLDivElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "div");
+ nodeList = doc.getElementsByTagName("div");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDivElement01</h2>
+<p>&lt;test name='HTMLDivElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDivElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment.
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70908791">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70908791</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='div' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"div"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLDivElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/div.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDlistElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDlistElement01.html
new file mode 100644
index 0000000000..3d537a71c1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDlistElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDlistElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDlistElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "dl");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21738539
+*/
+function HTMLDlistElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLDlistElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcompact;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "dl");
+ nodeList = doc.getElementsByTagName("dl");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcompact = testNode.compact;
+
+ assertTrue("compactLink",vcompact);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDlistElement01</h2>
+<p>&lt;test name='HTMLDlistElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDListElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21738539">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21738539</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcompact' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='dl' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dl"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;compact interface='HTMLDListElement' obj='testNode' var='vcompact'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vcompact' <a id="compactLink">id='compactLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/dl.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument01.html
new file mode 100644
index 0000000000..b5a1e2bbf7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument01.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute is the specified title as a string.
+
+ Retrieve the title attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18446827
+*/
+function HTMLDocument01() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument01") != null) return;
+ var nodeList;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vtitle = doc.title;
+
+ assertEquals("titleLink","NIST DOM HTML Test - DOCUMENT",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument01</h2>
+<p>&lt;test name='HTMLDocument01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute is the specified title as a string.
+
+ Retrieve the title attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-01-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18446827">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18446827</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLDocument' obj='doc' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"NIST DOM HTML Test - DOCUMENT"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument02.html
new file mode 100644
index 0000000000..274877d02c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument02.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The referrer attribute returns the URI of the page that linked to this
+ page.
+
+ Retrieve the referrer attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95229140
+*/
+function HTMLDocument02() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument02") != null) return;
+ var nodeList;
+ var testNode;
+ var vreferrer;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vreferrer = doc.referrer;
+
+ // assertEquals("referrerLink","",vreferrer);
+ // Its not sure that this test is valid.
+ // webkit also fails this
+ // http://svn.webkit.org/repository/webkit/trunk/LayoutTests/dom/html/level2/html/HTMLDocument02.html
+ todo_is(vreferrer,"","referrerLink");
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument02</h2>
+<p>&lt;test name='HTMLDocument02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The referrer attribute returns the URI of the page that linked to this
+ page.
+
+ Retrieve the referrer attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-01-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95229140">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95229140</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vreferrer' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;referrer interface='HTMLDocument' obj='doc' var='vreferrer'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vreferrer' expected='""' <a id="referrerLink">id='referrerLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument03.html
new file mode 100644
index 0000000000..b3036dfff2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument03.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The domain attribute specifies the domain name of the server that served
+ the document, or null if the server cannot be identified by a domain name.
+
+ Retrieve the domain attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-2250147
+*/
+function HTMLDocument03() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument03") != null) return;
+ var nodeList;
+ var testNode;
+ var vdomain;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vdomain = doc.domain;
+
+ assertEquals("domainLink","mochi.test",vdomain);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument03</h2>
+<p>&lt;test name='HTMLDocument03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The domain attribute specifies the domain name of the server that served
+ the document, or null if the server cannot be identified by a domain name.
+
+ Retrieve the domain attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-01-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-2250147">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-2250147</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdomain' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;domain interface='HTMLDocument' obj='doc' var='vdomain'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdomain' expected='""' <a id="domainLink">id='domainLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument04.html
new file mode 100644
index 0000000000..ea6cd77bd0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument04.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The URL attribute specifies the absolute URI of the document.
+
+ Retrieve the URL attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46183437
+*/
+function HTMLDocument04() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument04") != null) return;
+ var nodeList;
+ var testNode;
+ var vurl;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vurl = doc.URL;
+
+ assertURIEquals("URLLink",null,null,null,null,"document",null,null,true,vurl);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument04</h2>
+<p>&lt;test name='HTMLDocument04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The URL attribute specifies the absolute URI of the document.
+
+ Retrieve the URL attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-01-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46183437">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46183437</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vurl' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;URL interface='HTMLDocument' obj='doc' var='vurl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vurl' name='"document"' <a id="URLLink">id='URLLink'</a> isAbsolute='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument05.html
new file mode 100644
index 0000000000..942c8c914f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument05.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The body attribute is the element that contains the content for the
+ document.
+
+ Retrieve the body attribute and examine its value for the id attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-56360201
+*/
+function HTMLDocument05() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument05") != null) return;
+ var nodeList;
+ var testNode;
+ var vbody;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vbody = doc.body;
+
+ vid = vbody.id;
+
+ assertEquals("idLink","TEST-BODY",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument05</h2>
+<p>&lt;test name='HTMLDocument05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The body attribute is the element that contains the content for the
+ document.
+
+ Retrieve the body attribute and examine its value for the id attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-01-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-56360201">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-56360201</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbody' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;body interface='HTMLDocument' obj='doc' var='vbody'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='vbody' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"TEST-BODY"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument07.html
new file mode 100644
index 0000000000..82f8a6cae3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The images attribute returns a collection of all IMG elements in a document.
+
+ Retrieve the images attribute from the document and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90379117
+*/
+function HTMLDocument07() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument07") != null) return;
+ var nodeList;
+ var testNode;
+ var vimages;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vimages = doc.images;
+
+ vlength = vimages.length;
+
+ assertEquals("lengthLink",1,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument07</h2>
+<p>&lt;test name='HTMLDocument07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The images attribute returns a collection of all IMG elements in a document.
+
+ Retrieve the images attribute from the document and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-04-30&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90379117">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90379117</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vimages' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;images interface='HTMLDocument' obj='doc' var='vimages'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='vimages' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='1' <a id="lengthLink">id='lengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument09.html
new file mode 100644
index 0000000000..bab6a50f0a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The links attribute returns a collection of all AREA and A elements
+ in a document with a value for the href attribute.
+
+ Retrieve the links attribute from the document and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7068919
+*/
+function HTMLDocument09() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument09") != null) return;
+ var nodeList;
+ var testNode;
+ var vlinks;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vlinks = doc.links;
+
+ vlength = vlinks.length;
+
+ assertEquals("lengthLink",3,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument09</h2>
+<p>&lt;test name='HTMLDocument09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The links attribute returns a collection of all AREA and A elements
+ in a document with a value for the href attribute.
+
+ Retrieve the links attribute from the document and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-04-30&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7068919">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7068919</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlinks' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;links interface='HTMLDocument' obj='doc' var='vlinks'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='vlinks' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='3' <a id="lengthLink">id='lengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument10.html
new file mode 100644
index 0000000000..c9b128b99e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument10.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The forms attribute returns a collection of all the forms in a document.
+
+ Retrieve the forms attribute from the document and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1689064
+*/
+function HTMLDocument10() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument10") != null) return;
+ var nodeList;
+ var testNode;
+ var vforms;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vforms = doc.forms;
+
+ vlength = vforms.length;
+
+ assertEquals("lengthLink",1,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument10</h2>
+<p>&lt;test name='HTMLDocument10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The forms attribute returns a collection of all the forms in a document.
+
+ Retrieve the forms attribute from the document and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-04-30&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1689064">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1689064</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vforms' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;forms interface='HTMLDocument' obj='doc' var='vforms'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='vforms' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='1' <a id="lengthLink">id='lengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument11.html
new file mode 100644
index 0000000000..58dee1d5d9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument11.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The anchors attribute returns a collection of all A elements with values
+ for the name attribute.
+
+ Retrieve the anchors attribute from the document and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7577272
+*/
+function HTMLDocument11() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument11") != null) return;
+ var nodeList;
+ var testNode;
+ var vanchors;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vanchors = doc.anchors;
+
+ vlength = vanchors.length;
+
+ assertEquals("lengthLink",1,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument11</h2>
+<p>&lt;test name='HTMLDocument11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The anchors attribute returns a collection of all A elements with values
+ for the name attribute.
+
+ Retrieve the anchors attribute from the document and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-04-30&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7577272">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7577272</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vanchors' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;anchors interface='HTMLDocument' obj='doc' var='vanchors'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='vanchors' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='1' <a id="lengthLink">id='lengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument12.html
new file mode 100644
index 0000000000..0788ec7b3f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument12.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+
+<!--
+This test relies on that no cookies exist when the test starts.
+If this test is failing, add code to clear all cookies to the beginning of the test.
+-->
+
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cookie attribute returns the cookies associated with this document.
+
+ Retrieve the cookie attribute and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8747038
+*/
+function HTMLDocument12() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument12") != null) return;
+ var nodeList;
+ var vcookie;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ vcookie = doc.cookie;
+
+ assertEquals("cookieLink","",vcookie);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument12</h2>
+<p>&lt;test name='HTMLDocument12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cookie attribute returns the cookies associated with this document.
+
+ Retrieve the cookie attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-04-30&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8747038">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8747038</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcookie' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cookie interface='HTMLDocument' obj='doc' var='vcookie'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcookie' expected='""' <a id="cookieLink">id='cookieLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument13.html
new file mode 100644
index 0000000000..5ccb3fdd41
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument13.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The getElementsByName method returns the (possibly empty) collection
+ of elements whose name value is given by the elementName.
+
+ Retrieve all the elements whose name attribute is "mapid".
+ Check the length of the nodelist. It should be 1.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259
+*/
+function HTMLDocument13() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument13") != null) return;
+ var nodeList;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ nodeList = doc.getElementsByName("mapid");
+ assertSize("Asize",1,nodeList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument13</h2>
+<p>&lt;test name='HTMLDocument13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The getElementsByName method returns the (possibly empty) collection
+ of elements whose name value is given by the elementName.
+
+ Retrieve all the elements whose name attribute is "mapid".
+ Check the length of the nodelist. It should be 1.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByName interface='HTMLDocument' var='nodeList' obj='doc' elementName='"mapid"' <a id="getElementsNameId">id='getElementsNameId'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument14.html
new file mode 100644
index 0000000000..a0e0080cdc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument14.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The getElementsByName method returns the (possibly empty) collection
+ of elements whose name value is given by the elementName.
+
+ Retrieve all the elements whose name attribute is "noid".
+ Check the length of the nodelist. It should be 0 since
+ the id "noid" does not exist.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259
+*/
+function HTMLDocument14() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument14") != null) return;
+ var nodeList;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ nodeList = doc.getElementsByName("noid");
+ assertSize("Asize",0,nodeList);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument14</h2>
+<p>&lt;test name='HTMLDocument14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The getElementsByName method returns the (possibly empty) collection
+ of elements whose name value is given by the elementName.
+
+ Retrieve all the elements whose name attribute is "noid".
+ Check the length of the nodelist. It should be 0 since
+ the id "noid" does not exist.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByName interface='HTMLDocument' var='nodeList' obj='doc' elementName='"noid"' <a id="getElementsNameId">id='getElementsNameId'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='0' <a id="Asize">id='Asize'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument15.html
new file mode 100644
index 0000000000..b5e8940dd6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument15.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The getElementById method returns the Element whose id is given by
+ elementId. If no such element exists, returns null.
+
+ Retrieve the element whose id is "mapid".
+ Check the value of the element.
+
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId
+*/
+function HTMLDocument15() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument15") != null) return;
+ var elementNode;
+ var elementValue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ elementNode = doc.getElementById("mapid");
+ elementValue = elementNode.nodeName;
+
+ assertEqualsAutoCase("element", "elementId","map",elementValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument15</h2>
+<p>&lt;test name='HTMLDocument15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The getElementById method returns the Element whose id is given by
+ elementId. If no such element exists, returns null.
+
+ Retrieve the element whose id is "mapid".
+ Check the value of the element.
+
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='elementNode' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='elementValue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementById var='elementNode' obj='doc' elementId='"mapid"' <a id="getElementsId">id='getElementsId'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='elementNode' var='elementValue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='elementValue' expected='"map"' <a id="elementId">id='elementId'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument16.html
new file mode 100644
index 0000000000..98946ccd49
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument16.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The getElementById method returns the Element whose id is given by
+ elementId. If no such element exists, returns null.
+
+ Retrieve the element whose id is "noid".
+ The value returned should be null since there are not any elements with
+ an id of "noid".
+
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId
+*/
+function HTMLDocument16() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument16") != null) return;
+ var elementNode;
+ var elementValue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ elementNode = doc.getElementById("noid");
+ assertNull("elementId",elementNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument16</h2>
+<p>&lt;test name='HTMLDocument16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The getElementById method returns the Element whose id is given by
+ elementId. If no such element exists, returns null.
+
+ Retrieve the element whose id is "noid".
+ The value returned should be null since there are not any elements with
+ an id of "noid".
+
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='elementNode' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='elementValue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementById var='elementNode' obj='doc' elementId='"noid"' <a id="getElementsId">id='getElementsId'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='elementNode' <a id="elementId">id='elementId'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument17.html
new file mode 100644
index 0000000000..e922831ad4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument17.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Clears the current document using HTMLDocument.open immediately followed by close.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567
+*/
+function HTMLDocument17() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument17") != null) return;
+ var doc;
+ var bodyElem;
+ var bodyChild;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ doc.open();
+ doc.close();
+ bodyElem = doc.body;
+
+
+ if(
+
+ (bodyElem != null)
+
+ ) {
+ bodyChild = bodyElem.firstChild;
+
+ assertNull("bodyContainsChildren",bodyChild);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument17</h2>
+<p>&lt;test name='HTMLDocument17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Clears the current document using HTMLDocument.open immediately followed by close.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='bodyElem' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='bodyChild' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;open obj='doc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;close obj='doc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;body var='bodyElem' obj='doc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;notNull obj='bodyElem'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' var='bodyChild' obj='bodyElem'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='bodyChild' <a id="bodyContainsChildren">id='bodyContainsChildren'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/if&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument18.html
new file mode 100644
index 0000000000..737f79ad8a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument18.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Calls HTMLDocument.close on a document that has not been opened for modification.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567
+*/
+function HTMLDocument18() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument18") != null) return;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ doc.close();
+
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ ok(true, "Test complete");
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument18</h2>
+<p>&lt;test name='HTMLDocument18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Calls HTMLDocument.close on a document that has not been opened for modification.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;close obj='doc'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument19.html
new file mode 100644
index 0000000000..c7a67609db
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument19.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Replaces the current document with a valid HTML document using HTMLDocument.open, write and close.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634
+*/
+function HTMLDocument19() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument19") != null) return;
+ var doc;
+ var docElem;
+ var title;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ doc.open();
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ doc.write("&lt;html>");
+
+ }
+
+ else {
+ doc.write("&lt;html xmlns='http://www.w3.org/1999/xhtml'>");
+
+ }
+ doc.write("&lt;body>");
+ doc.write("&lt;title>Replacement&lt;/title>");
+ doc.write("&lt;/body>");
+ doc.write("&lt;p>");
+ doc.write("Hello, World.");
+ doc.write("&lt;/p>");
+ doc.write("&lt;/body>");
+ doc.write("&lt;/html>");
+ doc.close();
+
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ ok(true, "Test complete");
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument19</h2>
+<p>&lt;test name='HTMLDocument19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Replaces the current document with a valid HTML document using HTMLDocument.open, write and close.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='docElem' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='title' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;open obj='doc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentType type='text/html'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;title&gt;Replacement&lt;/title&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;p&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"Hello, World."'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;/p&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;/html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;close obj='doc'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument20.html
new file mode 100644
index 0000000000..81dbb8a10f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument20.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Replaces the current document with a valid HTML document using HTMLDocument.open, writeln and close.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390
+*/
+function HTMLDocument20() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument20") != null) return;
+ var doc;
+ var docElem;
+ var title;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ doc.open();
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ doc.writeln("&lt;html>");
+
+ }
+
+ else {
+ doc.writeln("&lt;html xmlns='http://www.w3.org/1999/xhtml'>");
+
+ }
+ doc.writeln("&lt;body>");
+ doc.writeln("&lt;title>Replacement&lt;/title>");
+ doc.writeln("&lt;/body>");
+ doc.writeln("&lt;p>");
+ doc.writeln("Hello, World.");
+ doc.writeln("&lt;/p>");
+ doc.writeln("&lt;/body>");
+ doc.writeln("&lt;/html>");
+ doc.close();
+
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ ok(true, "Test complete");
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument20</h2>
+<p>&lt;test name='HTMLDocument20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Replaces the current document with a valid HTML document using HTMLDocument.open, writeln and close.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='docElem' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='title' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;open obj='doc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentType type='text/html'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;title&gt;Replacement&lt;/title&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;p&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"Hello, World."'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/p&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;close obj='doc'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLDocument21.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument21.html
new file mode 100644
index 0000000000..cd6d9a5a7b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument21.html
@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "document");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Replaces the current document checks that writeln adds a new line.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390
+*/
+function HTMLDocument21() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument21") != null) return;
+ var doc;
+ var docElem;
+ var preElems;
+ var preElem;
+ var preText;
+ var preValue;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document");
+ doc.open();
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ doc.writeln("&lt;html>");
+
+ }
+
+ else {
+ doc.writeln("&lt;html xmlns='http://www.w3.org/1999/xhtml'>");
+
+ }
+ doc.writeln("&lt;body>");
+ doc.writeln("&lt;title>Replacement&lt;/title>");
+ doc.writeln("&lt;/body>");
+ doc.write("&lt;pre>");
+ doc.writeln("Hello, World.");
+ doc.writeln("Hello, World.");
+ doc.writeln("&lt;/pre>");
+ doc.write("&lt;pre>");
+ doc.write("Hello, World.");
+ doc.write("Hello, World.");
+ doc.writeln("&lt;/pre>");
+ doc.writeln("&lt;/body>");
+ doc.writeln("&lt;/html>");
+ doc.close();
+
+ // Ensure at least one SimpleTest check is reported. (Bug 483992)
+ ok(true, "Test complete");
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument21</h2>
+<p>&lt;test name='HTMLDocument21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Replaces the current document checks that writeln adds a new line.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='docElem' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='preElems' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='preElem' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='preText' type='Text'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='preValue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;open obj='doc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentType type='text/html'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;title&gt;Replacement&lt;/title&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;pre&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"Hello, World."'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"Hello, World."'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/pre&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"&lt;pre&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"Hello, World."'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;write obj='doc' text='"Hello, World."'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/pre&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;close obj='doc'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/document.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement01.html
new file mode 100644
index 0000000000..33f5659ea2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the HEAD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("head");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-HEAD",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement01</h2>
+<p>&lt;test name='HTMLElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the HEAD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"head"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-HEAD"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement02.html
new file mode 100644
index 0000000000..b3e0d001d3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SUB element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sub");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-SUB",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement02</h2>
+<p>&lt;test name='HTMLElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SUB element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sub"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-SUB"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement03.html
new file mode 100644
index 0000000000..154524f9da
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SUP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-SUP",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement03</h2>
+<p>&lt;test name='HTMLElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SUP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-SUP"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement04.html
new file mode 100644
index 0000000000..99c4255625
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SPAN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("span");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-SPAN",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement04</h2>
+<p>&lt;test name='HTMLElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SPAN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"span"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-SPAN"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement05.html
new file mode 100644
index 0000000000..5365551c11
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the BDO element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("bdo");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-BDO",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement05</h2>
+<p>&lt;test name='HTMLElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the BDO element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"bdo"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-BDO"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement06.html
new file mode 100644
index 0000000000..c4390b512b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the TT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("tt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-TT",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement06</h2>
+<p>&lt;test name='HTMLElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the TT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-TT"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement07.html
new file mode 100644
index 0000000000..7ccf12b5e7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the I element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("i");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-I",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement07</h2>
+<p>&lt;test name='HTMLElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the I element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"i"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-I"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement08.html
new file mode 100644
index 0000000000..8738e2cdf2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement08.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the B element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("b");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-B",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement08</h2>
+<p>&lt;test name='HTMLElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the B element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"b"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-B"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement09.html
new file mode 100644
index 0000000000..42ed5bd096
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement09.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the U element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("u");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-U",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement09</h2>
+<p>&lt;test name='HTMLElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the U element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"u"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-U"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement10.html
new file mode 100644
index 0000000000..dee669c99d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement10.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the S element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("s");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-S",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement10</h2>
+<p>&lt;test name='HTMLElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the S element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"s"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-S"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement100.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement100.html
new file mode 100644
index 0000000000..b8ca6a8daa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement100.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement100</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement100'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SMALL element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement100() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement100") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("small");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement100</h2>
+<p>&lt;test name='HTMLElement100' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement100&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SMALL element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"small"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement101.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement101.html
new file mode 100644
index 0000000000..8162c4ce0d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement101.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement101</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement101'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the EM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement101() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement101") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("em");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement101</h2>
+<p>&lt;test name='HTMLElement101' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement101&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the EM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"em"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement102.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement102.html
new file mode 100644
index 0000000000..9a987c9455
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement102.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement102</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement102'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the STRONG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement102() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement102") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strong");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement102</h2>
+<p>&lt;test name='HTMLElement102' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement102&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the STRONG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strong"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement103.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement103.html
new file mode 100644
index 0000000000..d1aa2e053c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement103.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement103</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement103'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the DFN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement103() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement103") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dfn");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement103</h2>
+<p>&lt;test name='HTMLElement103' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement103&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the DFN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dfn"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement104.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement104.html
new file mode 100644
index 0000000000..2aa66e4d34
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement104.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement104</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement104'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the CODE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement104() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement104") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("code");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement104</h2>
+<p>&lt;test name='HTMLElement104' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement104&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the CODE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"code"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement105.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement105.html
new file mode 100644
index 0000000000..a7fd6bcb0a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement105.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement105</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement105'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SAMP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement105() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement105") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("samp");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement105</h2>
+<p>&lt;test name='HTMLElement105' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement105&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SAMP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"samp"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement106.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement106.html
new file mode 100644
index 0000000000..93cc16acdf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement106.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement106</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement106'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the KBD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement106() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement106") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("kbd");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement106</h2>
+<p>&lt;test name='HTMLElement106' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement106&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the KBD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"kbd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement107.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement107.html
new file mode 100644
index 0000000000..1de43c43dc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement107.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement107</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement107'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the VAR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement107() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement107") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("var");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement107</h2>
+<p>&lt;test name='HTMLElement107' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement107&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the VAR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"var"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement108.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement108.html
new file mode 100644
index 0000000000..34549391e1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement108.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement108</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement108'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the CITE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement108() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement108") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("cite");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement108</h2>
+<p>&lt;test name='HTMLElement108' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement108&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the CITE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"cite"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement109.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement109.html
new file mode 100644
index 0000000000..9173777d56
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement109.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement109</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement109'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the ACRONYM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement109() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement109") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("acronym");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement109</h2>
+<p>&lt;test name='HTMLElement109' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement109&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the ACRONYM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"acronym"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement11.html
new file mode 100644
index 0000000000..cc7bb65547
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement11.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the STRIKE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strike");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-STRIKE",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement11</h2>
+<p>&lt;test name='HTMLElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the STRIKE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strike"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-STRIKE"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement110.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement110.html
new file mode 100644
index 0000000000..8acf8ce736
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement110.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement110</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement110'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the ABBR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement110() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement110") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("abbr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement110</h2>
+<p>&lt;test name='HTMLElement110' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement110&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the ABBR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"abbr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement111.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement111.html
new file mode 100644
index 0000000000..8a4105f4cd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement111.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement111</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement111'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the DD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement111() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement111") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dd");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement111</h2>
+<p>&lt;test name='HTMLElement111' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement111&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the DD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement112.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement112.html
new file mode 100644
index 0000000000..091c72bdf3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement112.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement112</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement112'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the DT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement112() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement112") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement112</h2>
+<p>&lt;test name='HTMLElement112' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement112&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the DT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement113.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement113.html
new file mode 100644
index 0000000000..ab360118a8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement113.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement113</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement113'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the NOFRAMES element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement113() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement113") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noframes");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement113</h2>
+<p>&lt;test name='HTMLElement113' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement113&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the NOFRAMES element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noframes"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement114.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement114.html
new file mode 100644
index 0000000000..7dc20c8941
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement114.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement114</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement114'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the NOSCRIPT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement114() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement114") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noscript");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement114</h2>
+<p>&lt;test name='HTMLElement114' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement114&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the NOSCRIPT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noscript"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement115.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement115.html
new file mode 100644
index 0000000000..8e56fd081a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement115.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement115</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement115'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the ADDRESS element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement115() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement115") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("address");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement115</h2>
+<p>&lt;test name='HTMLElement115' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement115&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the ADDRESS element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"address"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement116.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement116.html
new file mode 100644
index 0000000000..68961a6071
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement116.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement116</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement116'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the CENTER element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement116() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement116") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("center");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement116</h2>
+<p>&lt;test name='HTMLElement116' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement116&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the CENTER element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"center"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement117.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement117.html
new file mode 100644
index 0000000000..69d1299219
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement117.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement117</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement117'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the HEAD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement117() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement117") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("head");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","HEAD-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement117</h2>
+<p>&lt;test name='HTMLElement117' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement117&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the HEAD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"head"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"HEAD-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement118.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement118.html
new file mode 100644
index 0000000000..d386dd4051
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement118.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement118</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement118'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SUB element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement118() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement118") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sub");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","SUB-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement118</h2>
+<p>&lt;test name='HTMLElement118' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement118&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SUB element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sub"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"SUB-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement119.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement119.html
new file mode 100644
index 0000000000..426000c4c7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement119.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement119</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement119'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SUP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement119() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement119") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","SUP-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement119</h2>
+<p>&lt;test name='HTMLElement119' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement119&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SUP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"SUP-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement12.html
new file mode 100644
index 0000000000..b71fbb4414
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement12.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the BIG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("big");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-BIG",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement12</h2>
+<p>&lt;test name='HTMLElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the BIG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"big"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-BIG"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement120.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement120.html
new file mode 100644
index 0000000000..d947b07426
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement120.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement120</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement120'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SPAN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement120() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement120") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("span");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","SPAN-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement120</h2>
+<p>&lt;test name='HTMLElement120' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement120&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SPAN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"span"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"SPAN-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement121.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement121.html
new file mode 100644
index 0000000000..b4beea87cd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement121.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement121</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement121'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the BDO element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement121() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement121") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("bdo");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","BDO-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement121</h2>
+<p>&lt;test name='HTMLElement121' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement121&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the BDO element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"bdo"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"BDO-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement122.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement122.html
new file mode 100644
index 0000000000..e5da51a91c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement122.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement122</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement122'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the TT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement122() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement122") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("tt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","TT-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement122</h2>
+<p>&lt;test name='HTMLElement122' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement122&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the TT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"TT-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement123.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement123.html
new file mode 100644
index 0000000000..e2bec40d6f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement123.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement123</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement123'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the I element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement123() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement123") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("i");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","I-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement123</h2>
+<p>&lt;test name='HTMLElement123' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement123&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the I element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"i"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"I-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement124.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement124.html
new file mode 100644
index 0000000000..03d51cb312
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement124.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement124</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement124'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the B element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement124() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement124") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("b");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","B-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement124</h2>
+<p>&lt;test name='HTMLElement124' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement124&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the B element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"b"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"B-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement125.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement125.html
new file mode 100644
index 0000000000..7ca302486a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement125.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement125</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement125'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the U element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement125() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement125") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("u");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","U-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement125</h2>
+<p>&lt;test name='HTMLElement125' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement125&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the U element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"u"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"U-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement126.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement126.html
new file mode 100644
index 0000000000..512100c986
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement126.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement126</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement126'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the S element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement126() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement126") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("s");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","S-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement126</h2>
+<p>&lt;test name='HTMLElement126' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement126&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the S element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"s"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"S-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement127.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement127.html
new file mode 100644
index 0000000000..ce9589a053
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement127.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement127</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement127'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the STRIKE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement127() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement127") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strike");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","STRIKE-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement127</h2>
+<p>&lt;test name='HTMLElement127' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement127&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the STRIKE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strike"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"STRIKE-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement128.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement128.html
new file mode 100644
index 0000000000..93a8c76b48
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement128.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement128</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement128'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the BIG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement128() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement128") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("big");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","BIG-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement128</h2>
+<p>&lt;test name='HTMLElement128' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement128&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the BIG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"big"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"BIG-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement129.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement129.html
new file mode 100644
index 0000000000..f0ff2117dc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement129.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement129</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement129'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SMALL element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement129() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement129") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("small");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","SMALL-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement129</h2>
+<p>&lt;test name='HTMLElement129' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement129&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SMALL element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"small"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"SMALL-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement13.html
new file mode 100644
index 0000000000..166b0fe143
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement13.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SMALL element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("small");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-SMALL",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement13</h2>
+<p>&lt;test name='HTMLElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SMALL element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"small"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-SMALL"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement130.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement130.html
new file mode 100644
index 0000000000..4aefeef5d6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement130.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement130</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement130'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the EM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement130() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement130") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("em");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","EM-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement130</h2>
+<p>&lt;test name='HTMLElement130' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement130&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the EM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"em"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"EM-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement131.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement131.html
new file mode 100644
index 0000000000..26c779f804
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement131.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement131</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement131'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the STRONG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement131() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement131") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strong");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","STRONG-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement131</h2>
+<p>&lt;test name='HTMLElement131' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement131&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the STRONG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strong"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"STRONG-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement132.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement132.html
new file mode 100644
index 0000000000..53d4e6a436
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement132.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement132</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement132'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the DFN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement132() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement132") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dfn");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","DFN-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement132</h2>
+<p>&lt;test name='HTMLElement132' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement132&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the DFN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dfn"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"DFN-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement133.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement133.html
new file mode 100644
index 0000000000..27cd339f0a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement133.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement133</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement133'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the CODE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement133() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement133") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("code");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","CODE-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement133</h2>
+<p>&lt;test name='HTMLElement133' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement133&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the CODE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"code"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"CODE-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement134.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement134.html
new file mode 100644
index 0000000000..d64f1fd210
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement134.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement134</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement134'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SAMP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement134() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement134") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("samp");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","SAMP-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement134</h2>
+<p>&lt;test name='HTMLElement134' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement134&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the SAMP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"samp"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"SAMP-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement135.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement135.html
new file mode 100644
index 0000000000..b0377bcd21
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement135.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement135</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement135'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the KBD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement135() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement135") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("kbd");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","KBD-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement135</h2>
+<p>&lt;test name='HTMLElement135' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement135&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the KBD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"kbd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"KBD-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement136.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement136.html
new file mode 100644
index 0000000000..7d35fe2685
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement136.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement136</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement136'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the VAR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement136() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement136") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("var");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","VAR-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement136</h2>
+<p>&lt;test name='HTMLElement136' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement136&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the VAR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"var"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"VAR-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement137.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement137.html
new file mode 100644
index 0000000000..52fcc7b508
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement137.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement137</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement137'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the CITE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement137() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement137") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("cite");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","CITE-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement137</h2>
+<p>&lt;test name='HTMLElement137' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement137&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the CITE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"cite"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"CITE-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement138.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement138.html
new file mode 100644
index 0000000000..a634219242
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement138.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement138</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement138'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the ACRONYM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement138() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement138") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("acronym");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","ACRONYM-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement138</h2>
+<p>&lt;test name='HTMLElement138' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement138&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the ACRONYM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"acronym"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"ACRONYM-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement139.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement139.html
new file mode 100644
index 0000000000..db97835538
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement139.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement139</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement139'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the ABBR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement139() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement139") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("abbr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","ABBR-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement139</h2>
+<p>&lt;test name='HTMLElement139' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement139&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the ABBR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"abbr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"ABBR-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement14.html
new file mode 100644
index 0000000000..9986bfef1e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement14.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the EM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("em");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-EM",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement14</h2>
+<p>&lt;test name='HTMLElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the EM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"em"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-EM"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement140.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement140.html
new file mode 100644
index 0000000000..0a66a41e0c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement140.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement140</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement140'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the DD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement140() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement140") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dd");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","DD-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement140</h2>
+<p>&lt;test name='HTMLElement140' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement140&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the DD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"DD-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement141.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement141.html
new file mode 100644
index 0000000000..c960b5fd7e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement141.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement141</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement141'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the DT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement141() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement141") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","DT-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement141</h2>
+<p>&lt;test name='HTMLElement141' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement141&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the DT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"DT-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement142.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement142.html
new file mode 100644
index 0000000000..aaf0545103
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement142.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement142</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement142'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the NOFRAMES element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement142() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement142") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noframes");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","NOFRAMES-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement142</h2>
+<p>&lt;test name='HTMLElement142' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement142&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the NOFRAMES element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noframes"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"NOFRAMES-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement143.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement143.html
new file mode 100644
index 0000000000..561c26d161
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement143.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement143</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement143'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the NOSCRIPT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement143() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement143") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noscript");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","NOSCRIPT-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement143</h2>
+<p>&lt;test name='HTMLElement143' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement143&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the NOSCRIPT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noscript"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"NOSCRIPT-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement144.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement144.html
new file mode 100644
index 0000000000..578ebe20b6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement144.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement144</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement144'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the ADDRESS element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement144() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement144") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("address");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","ADDRESS-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement144</h2>
+<p>&lt;test name='HTMLElement144' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement144&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the ADDRESS element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"address"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"ADDRESS-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement145.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement145.html
new file mode 100644
index 0000000000..6df3fd8a89
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement145.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement145</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement145'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the CENTER element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176
+*/
+function HTMLElement145() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement145") != null) return;
+ var nodeList;
+ var testNode;
+ var vclassname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("center");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vclassname = testNode.className;
+
+ assertEquals("classNameLink","CENTER-class",vclassname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement145</h2>
+<p>&lt;test name='HTMLElement145' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement145&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The className attribute specifies the class attribute of the element.
+
+ Retrieve the class attribute of the CENTER element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vclassname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"center"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;className interface='HTMLElement' obj='testNode' var='vclassname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vclassname' expected='"CENTER-class"' <a id="classNameLink">id='classNameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement15.html
new file mode 100644
index 0000000000..3970167dc1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement15.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the STRONG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strong");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-STRONG",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement15</h2>
+<p>&lt;test name='HTMLElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the STRONG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strong"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-STRONG"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement16.html
new file mode 100644
index 0000000000..9599f1d74f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement16.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the DFN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dfn");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-DFN",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement16</h2>
+<p>&lt;test name='HTMLElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the DFN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dfn"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-DFN"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement17.html
new file mode 100644
index 0000000000..7d90786de6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement17.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the CODE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("code");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-CODE",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement17</h2>
+<p>&lt;test name='HTMLElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the CODE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"code"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-CODE"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement18.html
new file mode 100644
index 0000000000..b3a41f9f08
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement18.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SAMP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("samp");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-SAMP",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement18</h2>
+<p>&lt;test name='HTMLElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the SAMP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"samp"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-SAMP"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement19.html
new file mode 100644
index 0000000000..0500241bca
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement19.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the KBD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("kbd");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-KBD",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement19</h2>
+<p>&lt;test name='HTMLElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the KBD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"kbd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-KBD"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement20.html
new file mode 100644
index 0000000000..0a4a135580
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement20.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the VAR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement20") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("var");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-VAR",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement20</h2>
+<p>&lt;test name='HTMLElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the VAR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"var"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-VAR"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement21.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement21.html
new file mode 100644
index 0000000000..2eeafa7472
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement21.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the CITE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement21() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement21") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("cite");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-CITE",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement21</h2>
+<p>&lt;test name='HTMLElement21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the CITE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"cite"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-CITE"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement22.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement22.html
new file mode 100644
index 0000000000..cdc2f0019b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement22.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement22</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement22'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the ACRONYM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement22() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement22") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("acronym");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-ACRONYM",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement22</h2>
+<p>&lt;test name='HTMLElement22' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement22&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the ACRONYM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"acronym"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-ACRONYM"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement23.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement23.html
new file mode 100644
index 0000000000..3d204d201b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement23.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement23</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement23'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the ABBR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement23() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement23") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("abbr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-ABBR",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement23</h2>
+<p>&lt;test name='HTMLElement23' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement23&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the ABBR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"abbr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-ABBR"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement24.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement24.html
new file mode 100644
index 0000000000..35f95826f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement24.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement24</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement24'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the DD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement24() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement24") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dd");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-DD",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement24</h2>
+<p>&lt;test name='HTMLElement24' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement24&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the DD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-DD"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement25.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement25.html
new file mode 100644
index 0000000000..80e3cca658
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement25.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement25</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement25'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the DT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement25() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement25") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-DT",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement25</h2>
+<p>&lt;test name='HTMLElement25' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement25&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the DT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-DT"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement26.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement26.html
new file mode 100644
index 0000000000..d76b252f66
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement26.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement26</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement26'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the NOFRAMES element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement26() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement26") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noframes");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-NOFRAMES",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement26</h2>
+<p>&lt;test name='HTMLElement26' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement26&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the NOFRAMES element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noframes"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-NOFRAMES"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement27.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement27.html
new file mode 100644
index 0000000000..bc78722b68
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement27.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement27</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement27'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the NOSCRIPT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement27() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement27") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noscript");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-NOSCRIPT",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement27</h2>
+<p>&lt;test name='HTMLElement27' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement27&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the NOSCRIPT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noscript"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-NOSCRIPT"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement28.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement28.html
new file mode 100644
index 0000000000..99ff340b42
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement28.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement28</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement28'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the ADDRESS element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement28() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement28") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("address");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-ADDRESS",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement28</h2>
+<p>&lt;test name='HTMLElement28' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement28&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the ADDRESS element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"address"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-ADDRESS"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement29.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement29.html
new file mode 100644
index 0000000000..05ac44dde3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement29.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement29</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement29'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the CENTER element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function HTMLElement29() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement29") != null) return;
+ var nodeList;
+ var testNode;
+ var vid;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("center");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vid = testNode.id;
+
+ assertEquals("idLink","Test-CENTER",vid);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement29</h2>
+<p>&lt;test name='HTMLElement29' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement29&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id specifies the elements identifier.
+
+ Retrieve the id attribute of the CENTER element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vid' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"center"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='testNode' var='vid'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vid' expected='"Test-CENTER"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement30.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement30.html
new file mode 100644
index 0000000000..f6d34d3c95
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement30.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement30</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement30'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the HEAD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement30() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement30") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("head");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","HEAD Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement30</h2>
+<p>&lt;test name='HTMLElement30' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement30&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the HEAD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"head"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"HEAD Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement31.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement31.html
new file mode 100644
index 0000000000..545c044e00
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement31.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement31</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement31'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SUB element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement31() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement31") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sub");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","SUB Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement31</h2>
+<p>&lt;test name='HTMLElement31' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement31&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SUB element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sub"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"SUB Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement32.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement32.html
new file mode 100644
index 0000000000..77ba145d9b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement32.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement32</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement32'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SUP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement32() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement32") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","SUP Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement32</h2>
+<p>&lt;test name='HTMLElement32' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement32&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SUP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"SUP Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement33.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement33.html
new file mode 100644
index 0000000000..92b86a42af
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement33.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement33</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement33'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SPAN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement33() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement33") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("span");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","SPAN Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement33</h2>
+<p>&lt;test name='HTMLElement33' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement33&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SPAN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"span"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"SPAN Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement34.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement34.html
new file mode 100644
index 0000000000..eecbf1d458
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement34.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement34</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement34'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the BDO element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement34() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement34") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("bdo");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","BDO Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement34</h2>
+<p>&lt;test name='HTMLElement34' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement34&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the BDO element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"bdo"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"BDO Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement35.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement35.html
new file mode 100644
index 0000000000..e396a94428
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement35.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement35</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement35'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the TT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement35() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement35") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("tt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","TT Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement35</h2>
+<p>&lt;test name='HTMLElement35' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement35&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the TT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"TT Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement36.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement36.html
new file mode 100644
index 0000000000..03c536929b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement36.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement36</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement36'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the I element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement36() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement36") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("i");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","I Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement36</h2>
+<p>&lt;test name='HTMLElement36' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement36&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the I element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"i"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"I Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement37.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement37.html
new file mode 100644
index 0000000000..9d3c38af1d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement37.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement37</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement37'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the B element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement37() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement37") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("b");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","B Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement37</h2>
+<p>&lt;test name='HTMLElement37' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement37&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the B element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"b"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"B Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement38.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement38.html
new file mode 100644
index 0000000000..3475291755
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement38.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement38</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement38'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the U element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement38() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement38") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("u");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","U Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement38</h2>
+<p>&lt;test name='HTMLElement38' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement38&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the U element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"u"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"U Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement39.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement39.html
new file mode 100644
index 0000000000..d1077d2f01
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement39.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement39</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement39'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the S element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement39() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement39") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("s");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","S Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement39</h2>
+<p>&lt;test name='HTMLElement39' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement39&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the S element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"s"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"S Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement40.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement40.html
new file mode 100644
index 0000000000..59068fce67
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement40.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement40</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement40'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the STRIKE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement40() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement40") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strike");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","STRIKE Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement40</h2>
+<p>&lt;test name='HTMLElement40' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement40&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the STRIKE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strike"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"STRIKE Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement41.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement41.html
new file mode 100644
index 0000000000..7585e950fa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement41.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement41</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement41'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the BIG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement41() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement41") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("big");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","BIG Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement41</h2>
+<p>&lt;test name='HTMLElement41' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement41&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the BIG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"big"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"BIG Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement42.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement42.html
new file mode 100644
index 0000000000..329d1cd5f2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement42.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement42</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement42'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SMALL element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement42() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement42") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("small");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","SMALL Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement42</h2>
+<p>&lt;test name='HTMLElement42' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement42&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SMALL element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"small"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"SMALL Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement43.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement43.html
new file mode 100644
index 0000000000..a4ca5977c4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement43.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement43</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement43'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the EM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement43() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement43") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("em");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","EM Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement43</h2>
+<p>&lt;test name='HTMLElement43' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement43&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the EM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"em"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"EM Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement44.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement44.html
new file mode 100644
index 0000000000..56f5e9cbf6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement44.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement44</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement44'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the STRONG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement44() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement44") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strong");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","STRONG Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement44</h2>
+<p>&lt;test name='HTMLElement44' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement44&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the STRONG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strong"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"STRONG Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement45.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement45.html
new file mode 100644
index 0000000000..c0457ff67b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement45.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement45</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement45'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the DFN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement45() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement45") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dfn");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","DFN Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement45</h2>
+<p>&lt;test name='HTMLElement45' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement45&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the DFN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dfn"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"DFN Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement46.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement46.html
new file mode 100644
index 0000000000..ebfb593d13
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement46.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement46</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement46'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the CODE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement46() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement46") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("code");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","CODE Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement46</h2>
+<p>&lt;test name='HTMLElement46' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement46&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the CODE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"code"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"CODE Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement47.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement47.html
new file mode 100644
index 0000000000..7d01dfb3f2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement47.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement47</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement47'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SAMP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement47() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement47") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("samp");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","SAMP Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement47</h2>
+<p>&lt;test name='HTMLElement47' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement47&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the SAMP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"samp"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"SAMP Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement48.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement48.html
new file mode 100644
index 0000000000..bf2535a366
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement48.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement48</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement48'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the KBD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement48() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement48") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("kbd");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","KBD Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement48</h2>
+<p>&lt;test name='HTMLElement48' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement48&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the KBD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"kbd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"KBD Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement49.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement49.html
new file mode 100644
index 0000000000..6fa0e76e02
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement49.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement49</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement49'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the VAR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement49() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement49") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("var");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","VAR Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement49</h2>
+<p>&lt;test name='HTMLElement49' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement49&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the VAR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"var"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"VAR Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement50.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement50.html
new file mode 100644
index 0000000000..dbea976bec
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement50.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement50</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement50'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the CITE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement50() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement50") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("cite");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","CITE Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement50</h2>
+<p>&lt;test name='HTMLElement50' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement50&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the CITE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"cite"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"CITE Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement51.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement51.html
new file mode 100644
index 0000000000..9d48ce5d04
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement51.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement51</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement51'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the ACRONYM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement51() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement51") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("acronym");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","ACRONYM Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement51</h2>
+<p>&lt;test name='HTMLElement51' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement51&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the ACRONYM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"acronym"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"ACRONYM Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement52.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement52.html
new file mode 100644
index 0000000000..c76b615a16
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement52.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement52</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement52'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the ABBR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement52() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement52") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("abbr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","ABBR Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement52</h2>
+<p>&lt;test name='HTMLElement52' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement52&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the ABBR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"abbr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"ABBR Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement53.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement53.html
new file mode 100644
index 0000000000..92d168a89f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement53.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement53</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement53'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the DD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement53() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement53") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dd");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","DD Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement53</h2>
+<p>&lt;test name='HTMLElement53' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement53&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the DD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"DD Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement54.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement54.html
new file mode 100644
index 0000000000..2916e0187c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement54.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement54</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement54'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the DT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement54() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement54") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","DT Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement54</h2>
+<p>&lt;test name='HTMLElement54' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement54&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the DT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"DT Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement55.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement55.html
new file mode 100644
index 0000000000..532e13f69f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement55.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement55</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement55'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the NOFRAMES element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement55() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement55") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noframes");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","NOFRAMES Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement55</h2>
+<p>&lt;test name='HTMLElement55' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement55&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the NOFRAMES element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noframes"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"NOFRAMES Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement56.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement56.html
new file mode 100644
index 0000000000..f839b6bf1b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement56.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement56</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement56'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the NOSCRIPT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement56() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement56") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noscript");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","NOSCRIPT Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement56</h2>
+<p>&lt;test name='HTMLElement56' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement56&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the NOSCRIPT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noscript"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"NOSCRIPT Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement57.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement57.html
new file mode 100644
index 0000000000..e075ab5f2a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement57.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement57</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement57'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the ADDRESS element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement57() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement57") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("address");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","ADDRESS Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement57</h2>
+<p>&lt;test name='HTMLElement57' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement57&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the ADDRESS element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"address"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"ADDRESS Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement58.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement58.html
new file mode 100644
index 0000000000..cc793c9a1e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement58.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement58</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement58'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the CENTER element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
+*/
+function HTMLElement58() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement58") != null) return;
+ var nodeList;
+ var testNode;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("center");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtitle = testNode.title;
+
+ assertEquals("titleLink","CENTER Element",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement58</h2>
+<p>&lt;test name='HTMLElement58' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement58&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The title attribute specifies the elements advisory title.
+
+ Retrieve the title attribute of the CENTER element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"center"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLElement' obj='testNode' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"CENTER Element"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement59.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement59.html
new file mode 100644
index 0000000000..61a12495aa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement59.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement59</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement59'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the HEAD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement59() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement59") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("head");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement59</h2>
+<p>&lt;test name='HTMLElement59' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement59&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the HEAD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"head"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement60.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement60.html
new file mode 100644
index 0000000000..ec9fa2e8ce
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement60.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement60</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement60'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SUB element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement60() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement60") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sub");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement60</h2>
+<p>&lt;test name='HTMLElement60' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement60&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SUB element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sub"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement61.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement61.html
new file mode 100644
index 0000000000..5960690bb8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement61.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement61</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement61'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SUP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement61() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement61") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement61</h2>
+<p>&lt;test name='HTMLElement61' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement61&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SUP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement62.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement62.html
new file mode 100644
index 0000000000..43f4d603ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement62.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement62</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement62'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SPAN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement62() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement62") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("span");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement62</h2>
+<p>&lt;test name='HTMLElement62' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement62&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SPAN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"span"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement63.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement63.html
new file mode 100644
index 0000000000..619ac4cba5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement63.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement63</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement63'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the BDO element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement63() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement63") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("bdo");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement63</h2>
+<p>&lt;test name='HTMLElement63' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement63&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the BDO element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"bdo"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement64.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement64.html
new file mode 100644
index 0000000000..36af3dc1af
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement64.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement64</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement64'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the TT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement64() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement64") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("tt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement64</h2>
+<p>&lt;test name='HTMLElement64' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement64&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the TT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement65.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement65.html
new file mode 100644
index 0000000000..2b885c7b31
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement65.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement65</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement65'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the I element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement65() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement65") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("i");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement65</h2>
+<p>&lt;test name='HTMLElement65' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement65&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the I element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"i"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement66.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement66.html
new file mode 100644
index 0000000000..9fe2113f1d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement66.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement66</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement66'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the B element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement66() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement66") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("b");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement66</h2>
+<p>&lt;test name='HTMLElement66' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement66&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the B element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"b"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement67.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement67.html
new file mode 100644
index 0000000000..9da62642c0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement67.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement67</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement67'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the U element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement67() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement67") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("u");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement67</h2>
+<p>&lt;test name='HTMLElement67' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement67&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the U element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"u"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement68.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement68.html
new file mode 100644
index 0000000000..1ba4fdeea6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement68.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement68</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement68'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the S element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement68() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement68") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("s");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement68</h2>
+<p>&lt;test name='HTMLElement68' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement68&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the S element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"s"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement69.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement69.html
new file mode 100644
index 0000000000..3eec8ec8ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement69.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement69</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement69'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the STRIKE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement69() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement69") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strike");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement69</h2>
+<p>&lt;test name='HTMLElement69' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement69&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the STRIKE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strike"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement70.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement70.html
new file mode 100644
index 0000000000..8247d2fc63
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement70.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement70</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement70'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the BIG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement70() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement70") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("big");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement70</h2>
+<p>&lt;test name='HTMLElement70' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement70&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the BIG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"big"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement71.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement71.html
new file mode 100644
index 0000000000..3faa251eae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement71.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement71</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement71'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SMALL element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement71() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement71") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("small");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement71</h2>
+<p>&lt;test name='HTMLElement71' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement71&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SMALL element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"small"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement72.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement72.html
new file mode 100644
index 0000000000..ae85358b29
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement72.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement72</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement72'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the EM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement72() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement72") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("em");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement72</h2>
+<p>&lt;test name='HTMLElement72' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement72&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the EM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"em"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement73.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement73.html
new file mode 100644
index 0000000000..8f0334f13f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement73.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement73</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement73'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the STRONG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement73() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement73") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strong");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement73</h2>
+<p>&lt;test name='HTMLElement73' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement73&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the STRONG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strong"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement74.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement74.html
new file mode 100644
index 0000000000..be11da8aaa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement74.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement74</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement74'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the DFN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement74() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement74") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dfn");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement74</h2>
+<p>&lt;test name='HTMLElement74' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement74&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the DFN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dfn"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement75.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement75.html
new file mode 100644
index 0000000000..7f351ac550
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement75.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement75</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement75'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the CODE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement75() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement75") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("code");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement75</h2>
+<p>&lt;test name='HTMLElement75' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement75&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the CODE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"code"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement76.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement76.html
new file mode 100644
index 0000000000..3e821ac7f9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement76.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement76</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement76'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SAMP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement76() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement76") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("samp");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement76</h2>
+<p>&lt;test name='HTMLElement76' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement76&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the SAMP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"samp"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement77.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement77.html
new file mode 100644
index 0000000000..b5fff09002
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement77.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement77</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement77'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the KBD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement77() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement77") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("kbd");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement77</h2>
+<p>&lt;test name='HTMLElement77' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement77&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the KBD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"kbd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement78.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement78.html
new file mode 100644
index 0000000000..dae8008331
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement78.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement78</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement78'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the VAR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement78() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement78") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("var");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement78</h2>
+<p>&lt;test name='HTMLElement78' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement78&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the VAR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"var"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement79.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement79.html
new file mode 100644
index 0000000000..3cab31d8d0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement79.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement79</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement79'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the CITE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement79() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement79") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("cite");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement79</h2>
+<p>&lt;test name='HTMLElement79' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement79&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the CITE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"cite"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement80.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement80.html
new file mode 100644
index 0000000000..a064e4cff0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement80.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement80</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement80'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the ACRONYM element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement80() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement80") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("acronym");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement80</h2>
+<p>&lt;test name='HTMLElement80' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement80&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the ACRONYM element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"acronym"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement81.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement81.html
new file mode 100644
index 0000000000..da67f24eae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement81.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement81</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement81'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the ABBR element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement81() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement81") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("abbr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement81</h2>
+<p>&lt;test name='HTMLElement81' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement81&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the ABBR element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"abbr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement82.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement82.html
new file mode 100644
index 0000000000..7a5ca9ee3c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement82.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement82</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement82'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the DD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement82() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement82") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dd");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement82</h2>
+<p>&lt;test name='HTMLElement82' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement82&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the DD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dd"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement83.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement83.html
new file mode 100644
index 0000000000..da5d9aff84
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement83.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement83</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement83'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the DT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement83() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement83") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("dt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement83</h2>
+<p>&lt;test name='HTMLElement83' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement83&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the DT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement84.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement84.html
new file mode 100644
index 0000000000..f40fdf3c87
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement84.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement84</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement84'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the NOFRAMES element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement84() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement84") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noframes");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement84</h2>
+<p>&lt;test name='HTMLElement84' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement84&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the NOFRAMES element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noframes"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement85.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement85.html
new file mode 100644
index 0000000000..d6373f3978
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement85.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement85</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement85'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the NOSCRIPT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement85() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement85") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("noscript");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement85</h2>
+<p>&lt;test name='HTMLElement85' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement85&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the NOSCRIPT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"noscript"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement86.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement86.html
new file mode 100644
index 0000000000..d509540c80
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement86.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement86</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement86'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the ADDRESS element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement86() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement86") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("address");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement86</h2>
+<p>&lt;test name='HTMLElement86' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement86&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the ADDRESS element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"address"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement87.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement87.html
new file mode 100644
index 0000000000..cf14b95c9d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement87.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement87</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement87'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the CENTER element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807
+*/
+function HTMLElement87() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement87") != null) return;
+ var nodeList;
+ var testNode;
+ var vlang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("center");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vlang = testNode.lang;
+
+ assertEquals("langLink","en",vlang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement87</h2>
+<p>&lt;test name='HTMLElement87' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement87&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The lang attribute specifies the language code defined in RFC 1766.
+
+ Retrieve the lang attribute of the CENTER element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"center"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang interface='HTMLElement' obj='testNode' var='vlang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlang' expected='"en"' <a id="langLink">id='langLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement88.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement88.html
new file mode 100644
index 0000000000..092b098c1b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement88.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement88</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement88'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the HEAD element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement88() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement88") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("head");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement88</h2>
+<p>&lt;test name='HTMLElement88' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement88&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the HEAD element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"head"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement89.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement89.html
new file mode 100644
index 0000000000..e4ad0850e8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement89.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement89</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement89'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SUB element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement89() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement89") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sub");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement89</h2>
+<p>&lt;test name='HTMLElement89' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement89&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SUB element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sub"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement90.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement90.html
new file mode 100644
index 0000000000..38feff556f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement90.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement90</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement90'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SUP element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement90() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement90") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("sup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement90</h2>
+<p>&lt;test name='HTMLElement90' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement90&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SUP element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"sup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement91.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement91.html
new file mode 100644
index 0000000000..5e4a617c0b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement91.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement91</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement91'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SPAN element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement91() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement91") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("span");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement91</h2>
+<p>&lt;test name='HTMLElement91' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement91&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the SPAN element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"span"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement92.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement92.html
new file mode 100644
index 0000000000..faf54c2759
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement92.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement92</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement92'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the BDO element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement92() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement92") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("bdo");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement92</h2>
+<p>&lt;test name='HTMLElement92' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement92&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the BDO element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"bdo"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement93.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement93.html
new file mode 100644
index 0000000000..a9ee0d3ddb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement93.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement93</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement93'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the TT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement93() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement93") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("tt");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement93</h2>
+<p>&lt;test name='HTMLElement93' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement93&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the TT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tt"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement94.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement94.html
new file mode 100644
index 0000000000..27f9d9a140
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement94.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement94</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement94'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the I element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement94() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement94") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("i");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement94</h2>
+<p>&lt;test name='HTMLElement94' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement94&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the I element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"i"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement95.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement95.html
new file mode 100644
index 0000000000..2979e1c77f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement95.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement95</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement95'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the B element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement95() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement95") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("b");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement95</h2>
+<p>&lt;test name='HTMLElement95' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement95&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the B element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"b"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement96.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement96.html
new file mode 100644
index 0000000000..b8b0b915d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement96.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement96</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement96'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the U element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement96() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement96") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("u");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement96</h2>
+<p>&lt;test name='HTMLElement96' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement96&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the U element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"u"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement97.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement97.html
new file mode 100644
index 0000000000..af72e7a4ba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement97.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement97</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement97'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the S element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement97() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement97") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("s");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement97</h2>
+<p>&lt;test name='HTMLElement97' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement97&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the S element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"s"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement98.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement98.html
new file mode 100644
index 0000000000..0e54b74031
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement98.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement98</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement98'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the STRIKE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement98() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement98") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("strike");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement98</h2>
+<p>&lt;test name='HTMLElement98' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement98&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the STRIKE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"strike"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLElement99.html b/dom/tests/mochitest/dom-level2-html/test_HTMLElement99.html
new file mode 100644
index 0000000000..20d47bbc0f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLElement99.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement99</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLElement99'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "element");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the BIG element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740
+*/
+function HTMLElement99() {
+ var success;
+ if(checkInitialization(builder, "HTMLElement99") != null) return;
+ var nodeList;
+ var testNode;
+ var vdir;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "element");
+ nodeList = doc.getElementsByTagName("big");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdir = testNode.dir;
+
+ assertEquals("dirLink","ltr",vdir);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement99</h2>
+<p>&lt;test name='HTMLElement99' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLElement99&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dir attribute specifies the base direction of directionally neutral text and the directionality of tables.
+
+ Retrieve the dir attribute of the BIG element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdir' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='element' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"big"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dir interface='HTMLElement' obj='testNode' var='vdir'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdir' expected='"ltr"' <a id="dirLink">id='dirLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/element.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement01.html
new file mode 100644
index 0000000000..99fb8119a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement01.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFieldSetElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFieldSetElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "fieldset");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630
+*/
+function HTMLFieldSetElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLFieldSetElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var fNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "fieldset");
+ nodeList = doc.getElementsByTagName("fieldset");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form2",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFieldSetElement01</h2>
+<p>&lt;test name='HTMLFieldSetElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFieldSetElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='fieldset' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"fieldset"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLFieldSetElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form2"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/fieldset.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement02.html
new file mode 100644
index 0000000000..e4b21432f4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFieldSetElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFieldSetElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFieldSetElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "fieldset");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630
+*/
+function HTMLFieldSetElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLFieldSetElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "fieldset");
+ nodeList = doc.getElementsByTagName("fieldset");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFieldSetElement02</h2>
+<p>&lt;test name='HTMLFieldSetElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFieldSetElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='fieldset' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"fieldset"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLFieldSetElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/fieldset.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement01.html
new file mode 100644
index 0000000000..0b29d8be1c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFontElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFontElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "font");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The color attribute specifies the font's color.
+
+ Retrieve the color attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53532975
+*/
+function HTMLFontElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLFontElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "font");
+ nodeList = doc.getElementsByTagName("font");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcolor = testNode.color;
+
+ assertEquals("colorLink","#000000",vcolor);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFontElement01</h2>
+<p>&lt;test name='HTMLFontElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFontElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The color attribute specifies the font's color.
+
+ Retrieve the color attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53532975">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53532975</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='font' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"font"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;color interface='HTMLFontElement' obj='testNode' var='vcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcolor' expected='"#000000"' <a id="colorLink">id='colorLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/font.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement02.html
new file mode 100644
index 0000000000..be9b470e18
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFontElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFontElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "font");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The face attribute specifies the font's face identifier.
+
+ Retrieve the face attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55715655
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length
+*/
+function HTMLFontElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLFontElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vface;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "font");
+ nodeList = doc.getElementsByTagName("font");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vface = testNode.face;
+
+ assertEquals("faceLink","arial,helvetica",vface);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFontElement02</h2>
+<p>&lt;test name='HTMLFontElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFontElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The face attribute specifies the font's face identifier.
+
+ Retrieve the face attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55715655">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55715655</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vface' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='font' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"font"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;face interface='HTMLFontElement' obj='testNode' var='vface'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vface' expected='"arial,helvetica"' <a id="faceLink">id='faceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/font.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement03.html
new file mode 100644
index 0000000000..055a52d10a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFontElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFontElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFontElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "font");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The size attribute specifies the font's size.
+
+ Retrieve the size attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90127284
+*/
+function HTMLFontElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLFontElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vsize;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "font");
+ nodeList = doc.getElementsByTagName("font");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vsize = testNode.size;
+
+ assertEquals("sizeLink","4",vsize);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFontElement03</h2>
+<p>&lt;test name='HTMLFontElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFontElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The size attribute specifies the font's size.
+
+ Retrieve the size attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90127284">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90127284</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsize' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='font' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"font"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size interface='HTMLFontElement' obj='testNode' var='vsize'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsize' expected='"4"' <a id="sizeLink">id='sizeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/font.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement01.html
new file mode 100644
index 0000000000..6915eeffd4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement01.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The elements attribute specifies a collection of all control element
+ in the form.
+
+ Retrieve the elements attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479
+*/
+function HTMLFormElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement01") != null) return;
+ var nodeList;
+ var elementnodeList;
+ var testNode;
+ var velements;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ elementnodeList = testNode.elements;
+
+ velements = elementnodeList.length;
+
+ assertEquals("elementsLink",3,velements);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement01</h2>
+<p>&lt;test name='HTMLFormElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The elements attribute specifies a collection of all control element
+ in the form.
+
+ Retrieve the elements attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='elementnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='velements' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='elementnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='elementnodeList' var='velements'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='velements' expected='3' <a id="elementsLink">id='elementsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement02.html
new file mode 100644
index 0000000000..109a308a6d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The length attribute specifies the number of form controls
+ in the form.
+
+ Retrieve the length attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40002357
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length
+*/
+function HTMLFormElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlength = testNode.length;
+
+ assertEquals("lengthLink",3,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement02</h2>
+<p>&lt;test name='HTMLFormElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The length attribute specifies the number of form controls
+ in the form.
+
+ Retrieve the length attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40002357">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40002357</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLFormElement' obj='testNode' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='3' <a id="lengthLink">id='lengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement03.html
new file mode 100644
index 0000000000..a014f1fbc6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The id(name) attribute specifies the name of the form.
+
+ Retrieve the id attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22051454
+*/
+function HTMLFormElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.id;
+
+ assertEquals("nameLink","form1",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement03</h2>
+<p>&lt;test name='HTMLFormElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The id(name) attribute specifies the name of the form.
+
+ Retrieve the id attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22051454">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22051454</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"form1"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement04.html
new file mode 100644
index 0000000000..7c5b42a1e9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The acceptCharset attribute specifies the list of character sets
+ supported by the server.
+
+ Retrieve the acceptCharset attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19661795
+*/
+function HTMLFormElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vacceptcharset;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vacceptcharset = testNode.acceptCharset;
+
+ assertEquals("acceptCharsetLink","US-ASCII",vacceptcharset);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement04</h2>
+<p>&lt;test name='HTMLFormElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The acceptCharset attribute specifies the list of character sets
+ supported by the server.
+
+ Retrieve the acceptCharset attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19661795">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19661795</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vacceptcharset' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;acceptCharset interface='HTMLFormElement' obj='testNode' var='vacceptcharset'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vacceptcharset' expected='"US-ASCII"' <a id="acceptCharsetLink">id='acceptCharsetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement05.html
new file mode 100644
index 0000000000..975cc5274f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The action attribute specifies the server-side form handler.
+
+ Retrieve the action attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74049184
+*/
+function HTMLFormElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vaction;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vaction = testNode.action;
+
+ assertURIEquals("actionLink",null,null,null,"getData.pl",null,null,null,null,vaction);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement05</h2>
+<p>&lt;test name='HTMLFormElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The action attribute specifies the server-side form handler.
+
+ Retrieve the action attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74049184">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74049184</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaction' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;action interface='HTMLFormElement' obj='testNode' var='vaction'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vaction' file='"getData.pl"' <a id="actionLink">id='actionLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement06.html
new file mode 100644
index 0000000000..da41587654
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The enctype attribute specifies the content of the submitted form.
+
+ Retrieve the enctype attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84227810
+*/
+function HTMLFormElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var venctype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ venctype = testNode.enctype;
+
+ assertEquals("enctypeLink","application/x-www-form-urlencoded",venctype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement06</h2>
+<p>&lt;test name='HTMLFormElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The enctype attribute specifies the content of the submitted form.
+
+ Retrieve the enctype attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84227810">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84227810</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='venctype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;enctype interface='HTMLFormElement' obj='testNode' var='venctype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='venctype' expected='"application/x-www-form-urlencoded"' <a id="enctypeLink">id='enctypeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement07.html
new file mode 100644
index 0000000000..d9467ffc09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The method attribute specifies the HTTP method used to submit the form.
+
+ Retrieve the method attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82545539
+*/
+function HTMLFormElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vmethod;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vmethod = testNode.method;
+
+ assertEquals("methodLink","post",vmethod);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement07</h2>
+<p>&lt;test name='HTMLFormElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The method attribute specifies the HTTP method used to submit the form.
+
+ Retrieve the method attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82545539">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82545539</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmethod' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;method interface='HTMLFormElement' obj='testNode' var='vmethod'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmethod' expected='"post"' <a id="methodLink">id='methodLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement08.html
new file mode 100644
index 0000000000..e22ff74842
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement08.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The target attribute specifies the frame to render the resource in.
+
+ Retrieve the target attribute and examine it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6512890
+*/
+function HTMLFormElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vtarget;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form2");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtarget = testNode.target;
+
+ assertEquals("targetLink","dynamic",vtarget);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement08</h2>
+<p>&lt;test name='HTMLFormElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The target attribute specifies the frame to render the resource in.
+
+ Retrieve the target attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6512890">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6512890</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtarget' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target interface='HTMLFormElement' obj='testNode' var='vtarget'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtarget' expected='"dynamic"' <a id="targetLink">id='targetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement09.html
new file mode 100644
index 0000000000..f4f4a8c4da
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement09.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLFormElement.reset restores the forms default values.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76767677
+*/
+function HTMLFormElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form2");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ testNode.reset();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement09</h2>
+<p>&lt;test name='HTMLFormElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLFormElement.reset restores the forms default values.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76767677">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76767677</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form2' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;reset interface='HTMLFormElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement10.html
new file mode 100644
index 0000000000..584a43b8c8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFormElement10.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFormElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "form3");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLFormElement.submit submits the form.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76767676
+*/
+function HTMLFormElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLFormElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "form3");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ testNode.submit();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFormElement10</h2>
+<p>&lt;test name='HTMLFormElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFormElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLFormElement.submit submits the form.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76767676">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76767676</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='form3' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;submit interface='HTMLFormElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/form3.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement01.html
new file mode 100644
index 0000000000..f871ac85de
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement01.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The frameBorder attribute specifies the request for frame borders.
+ (frameBorder=1 A border is drawn)
+ (FrameBorder=0 A border is not drawn)
+
+ Retrieve the frameBorder attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11858633
+*/
+function HTMLFrameElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vframeborder;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vframeborder = testNode.frameBorder;
+
+ assertEquals("frameborderLink","1",vframeborder);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement01</h2>
+<p>&lt;test name='HTMLFrameElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The frameBorder attribute specifies the request for frame borders.
+ (frameBorder=1 A border is drawn)
+ (FrameBorder=0 A border is not drawn)
+
+ Retrieve the frameBorder attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11858633">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11858633</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vframeborder' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frameBorder interface='HTMLFrameElement' obj='testNode' var='vframeborder'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vframeborder' expected='"1"' <a id="frameborderLink">id='frameborderLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement02.html
new file mode 100644
index 0000000000..4a6a00fccf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The longDesc attribute specifies a URI designating a long description
+ of this image or frame.
+
+ Retrieve the longDesc attribute of the first FRAME element and examine
+ its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7836998
+*/
+function HTMLFrameElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vlongdesc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vlongdesc = testNode.longDesc;
+
+ assertEquals("longdescLink","about:blank",vlongdesc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement02</h2>
+<p>&lt;test name='HTMLFrameElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The longDesc attribute specifies a URI designating a long description
+ of this image or frame.
+
+ Retrieve the longDesc attribute of the first FRAME element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7836998">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7836998</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlongdesc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;longDesc interface='HTMLFrameElement' obj='testNode' var='vlongdesc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlongdesc' expected='"about:blank"' ignoreCase='false' <a id="longdescLink">id='longdescLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement03.html
new file mode 100644
index 0000000000..b39e74e197
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The marginHeight attribute specifies the frame margin height, in pixels.
+
+ Retrieve the marginHeight attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55569778
+*/
+function HTMLFrameElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vmarginheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vmarginheight = testNode.marginHeight;
+
+ assertEquals("marginheightLink","10",vmarginheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement03</h2>
+<p>&lt;test name='HTMLFrameElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The marginHeight attribute specifies the frame margin height, in pixels.
+
+ Retrieve the marginHeight attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55569778">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55569778</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmarginheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;marginHeight interface='HTMLFrameElement' obj='testNode' var='vmarginheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmarginheight' expected='"10"' <a id="marginheightLink">id='marginheightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement04.html
new file mode 100644
index 0000000000..3bc2423d0c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The marginWidth attribute specifies the frame margin width, in pixels.
+
+ Retrieve the marginWidth attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8369969
+*/
+function HTMLFrameElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vmarginwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vmarginwidth = testNode.marginWidth;
+
+ assertEquals("marginwidthLink","5",vmarginwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement04</h2>
+<p>&lt;test name='HTMLFrameElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The marginWidth attribute specifies the frame margin width, in pixels.
+
+ Retrieve the marginWidth attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8369969">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8369969</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmarginwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;marginWidth interface='HTMLFrameElement' obj='testNode' var='vmarginwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmarginwidth' expected='"5"' <a id="marginwidthLink">id='marginwidthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement05.html
new file mode 100644
index 0000000000..d027d6e38e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement05.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies the frame name(object of the target
+ attribute).
+
+ Retrieve the name attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91128709
+*/
+function HTMLFrameElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","Frame1",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement05</h2>
+<p>&lt;test name='HTMLFrameElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies the frame name(object of the target
+ attribute).
+
+ Retrieve the name attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91128709">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91128709</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLFrameElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"Frame1"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement06.html
new file mode 100644
index 0000000000..571774cead
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The noResize attribute specifies if the user can resize the frame. When
+ true, forbid user from resizing frame.
+
+ Retrieve the noResize attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80766578
+*/
+function HTMLFrameElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vnoresize;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vnoresize = testNode.noResize;
+
+ assertTrue("noresizeLink",vnoresize);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement06</h2>
+<p>&lt;test name='HTMLFrameElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The noResize attribute specifies if the user can resize the frame. When
+ true, forbid user from resizing frame.
+
+ Retrieve the noResize attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80766578">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80766578</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vnoresize' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;noResize interface='HTMLFrameElement' obj='testNode' var='vnoresize'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vnoresize' <a id="noresizeLink">id='noresizeLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement07.html
new file mode 100644
index 0000000000..9fb425376c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The scrolling attribute specifies whether or not the frame should have
+ scrollbars.
+
+ Retrieve the scrolling attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-45411424
+*/
+function HTMLFrameElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vscrolling;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vscrolling = testNode.scrolling;
+
+ assertEquals("scrollingLink","yes",vscrolling);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement07</h2>
+<p>&lt;test name='HTMLFrameElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The scrolling attribute specifies whether or not the frame should have
+ scrollbars.
+
+ Retrieve the scrolling attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-45411424">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-45411424</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vscrolling' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scrolling interface='HTMLFrameElement' obj='testNode' var='vscrolling'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vscrolling' expected='"yes"' <a id="scrollingLink">id='scrollingLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement08.html
new file mode 100644
index 0000000000..f2a74c41ba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The src attribute specifies a URI designating the initial frame contents.
+
+ Retrieve the src attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78799535
+*/
+function HTMLFrameElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vsrc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame");
+ nodeList = doc.getElementsByTagName("frame");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vsrc = testNode.src;
+
+ assertURIEquals("srcLink",null,null,null,null,"right",null,null,null,vsrc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement08</h2>
+<p>&lt;test name='HTMLFrameElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The src attribute specifies a URI designating the initial frame contents.
+
+ Retrieve the src attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78799535">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78799535</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsrc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frame"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;src interface='HTMLFrameElement' obj='testNode' var='vsrc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vsrc' name='"right"' <a id="srcLink">id='srcLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement09.html
new file mode 100644
index 0000000000..344df70670
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameElement09.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frame2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The contentDocument attribute specifies the document this frame contains,
+ if there is any and it is available, or null otherwise.
+
+ Retrieve the contentDocument attribute of the first FRAME element
+ and examine its TITLE value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-78799536
+*/
+function HTMLFrameElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameElement09") != null) return;
+ var testNode;
+ var cd;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frame2");
+ testNode = doc.getElementById("Frame1");
+ cd = testNode.contentDocument;
+
+ vtitle = cd.title;
+
+ assertEquals("titleLink","NIST DOM HTML Test - FRAME",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameElement09</h2>
+<p>&lt;test name='HTMLFrameElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The contentDocument attribute specifies the document this frame contains,
+ if there is any and it is available, or null otherwise.
+
+ Retrieve the contentDocument attribute of the first FRAME element
+ and examine its TITLE value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-03&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-78799536">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-78799536</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cd' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frame2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementById interface='Document' obj='doc' var='testNode' elementId='"Frame1"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentDocument interface='HTMLFrameElement' obj='testNode' var='cd'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLDocument' obj='cd' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"NIST DOM HTML Test - FRAMESET"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frame2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement01.html
new file mode 100644
index 0000000000..06f52a0873
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameSetElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameSetElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frameset");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cols attribute specifies the number of columns of frames in the
+ frameset.
+
+ Retrieve the cols attribute of the first FRAMESET element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98869594
+*/
+function HTMLFrameSetElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameSetElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcols;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frameset");
+ nodeList = doc.getElementsByTagName("frameset");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vcols = testNode.cols;
+
+ assertEquals("colsLink","20, 80",vcols);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameSetElement01</h2>
+<p>&lt;test name='HTMLFrameSetElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameSetElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cols attribute specifies the number of columns of frames in the
+ frameset.
+
+ Retrieve the cols attribute of the first FRAMESET element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98869594">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98869594</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcols' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frameset' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frameset"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cols interface='HTMLFrameSetElement' obj='testNode' var='vcols'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcols' expected='"20, 80"' <a id="colsLink">id='colsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frameset.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement02.html
new file mode 100644
index 0000000000..4a767a9d6b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLFrameSetElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameSetElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLFrameSetElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "frameset");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rows attribute specifies the number of rows of frames in the
+ frameset.
+
+ Retrieve the rows attribute of the second FRAMESET element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19739247
+*/
+function HTMLFrameSetElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLFrameSetElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "frameset");
+ nodeList = doc.getElementsByTagName("frameset");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vrows = testNode.rows;
+
+ assertEquals("rowsLink","100, 200",vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLFrameSetElement02</h2>
+<p>&lt;test name='HTMLFrameSetElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLFrameSetElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rows attribute specifies the number of rows of frames in the
+ frameset.
+
+ Retrieve the rows attribute of the second FRAMESET element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19739247">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19739247</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='frameset' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"frameset"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLFrameSetElement' obj='testNode' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='"100, 200"' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/frameset.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement01.html
new file mode 100644
index 0000000000..1eadba1215
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHRElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hr");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the rule alignment on the page.
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15235012
+*/
+function HTMLHRElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLHRElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hr");
+ nodeList = doc.getElementsByTagName("hr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement01</h2>
+<p>&lt;test name='HTMLHRElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHRElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the rule alignment on the page.
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15235012">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15235012</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='hr' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"hr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLHRElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/hr.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement02.html
new file mode 100644
index 0000000000..18ad685e81
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHRElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hr");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The noShade attribute specifies that the rule should be drawn as
+ a solid color.
+
+ Retrieve the noShade attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79813978
+*/
+function HTMLHRElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLHRElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vnoshade;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hr");
+ nodeList = doc.getElementsByTagName("hr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vnoshade = testNode.noShade;
+
+ assertTrue("noShadeLink",vnoshade);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement02</h2>
+<p>&lt;test name='HTMLHRElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHRElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The noShade attribute specifies that the rule should be drawn as
+ a solid color.
+
+ Retrieve the noShade attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79813978">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79813978</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vnoshade' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='hr' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"hr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;noShade interface='HTMLHRElement' obj='testNode' var='vnoshade'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vnoshade' <a id="noShadeLink">id='noShadeLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/hr.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement03.html
new file mode 100644
index 0000000000..2820932898
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHRElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hr");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The size attribute specifies the height of the rule.
+
+ Retrieve the size attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77612587
+*/
+function HTMLHRElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLHRElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vsize;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hr");
+ nodeList = doc.getElementsByTagName("hr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vsize = testNode.size;
+
+ assertEquals("sizeLink","5",vsize);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement03</h2>
+<p>&lt;test name='HTMLHRElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHRElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The size attribute specifies the height of the rule.
+
+ Retrieve the size attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77612587">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77612587</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsize' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='hr' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"hr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size interface='HTMLHRElement' obj='testNode' var='vsize'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsize' expected='"5"' <a id="sizeLink">id='sizeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/hr.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement04.html
new file mode 100644
index 0000000000..301edc1bdb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHRElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHRElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "hr");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the width of the rule.
+
+ Retrieve the width attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87744198
+*/
+function HTMLHRElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLHRElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "hr");
+ nodeList = doc.getElementsByTagName("hr");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","400",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHRElement04</h2>
+<p>&lt;test name='HTMLHRElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHRElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the width of the rule.
+
+ Retrieve the width attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87744198">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87744198</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='hr' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"hr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLHRElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"400"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/hr.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement01.html
new file mode 100644
index 0000000000..df5f7d886a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHeadingElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "heading");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment(H1).
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462
+*/
+function HTMLHeadingElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLHeadingElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "heading");
+ nodeList = doc.getElementsByTagName("h1");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement01</h2>
+<p>&lt;test name='HTMLHeadingElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHeadingElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment(H1).
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='heading' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"h1"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLHeadingElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/heading.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement02.html
new file mode 100644
index 0000000000..e6e8d3b264
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHeadingElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "heading");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment(H2).
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462
+*/
+function HTMLHeadingElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLHeadingElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "heading");
+ nodeList = doc.getElementsByTagName("h2");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","left",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement02</h2>
+<p>&lt;test name='HTMLHeadingElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHeadingElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment(H2).
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='heading' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"h2"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLHeadingElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"left"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/heading.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement03.html
new file mode 100644
index 0000000000..72d16f779f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHeadingElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "heading");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment(H3).
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462
+*/
+function HTMLHeadingElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLHeadingElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "heading");
+ nodeList = doc.getElementsByTagName("h3");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","right",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement03</h2>
+<p>&lt;test name='HTMLHeadingElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHeadingElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment(H3).
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='heading' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"h3"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLHeadingElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"right"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/heading.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement04.html
new file mode 100644
index 0000000000..e50f4dce72
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHeadingElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "heading");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment(H4).
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462
+*/
+function HTMLHeadingElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLHeadingElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "heading");
+ nodeList = doc.getElementsByTagName("h4");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","justify",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement04</h2>
+<p>&lt;test name='HTMLHeadingElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHeadingElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment(H4).
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='heading' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"h4"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLHeadingElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"justify"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/heading.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement05.html
new file mode 100644
index 0000000000..1ea1487337
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHeadingElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "heading");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment(H5).
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462
+*/
+function HTMLHeadingElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLHeadingElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "heading");
+ nodeList = doc.getElementsByTagName("h5");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement05</h2>
+<p>&lt;test name='HTMLHeadingElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHeadingElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment(H5).
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='heading' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"h5"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLHeadingElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/heading.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement06.html
new file mode 100644
index 0000000000..f93610a501
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHeadingElement06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHeadingElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "heading");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment(H6).
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462
+*/
+function HTMLHeadingElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLHeadingElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "heading");
+ nodeList = doc.getElementsByTagName("h6");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","left",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadingElement06</h2>
+<p>&lt;test name='HTMLHeadingElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHeadingElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment(H6).
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='heading' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"h6"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLHeadingElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"left"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/heading.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLHtmlElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLHtmlElement01.html
new file mode 100644
index 0000000000..69c90c2adc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLHtmlElement01.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHtmlElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLHtmlElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "html");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The version attribute specifies version information about the document's
+ DTD.
+
+ Retrieve the version attribute and examine its value.
+
+ Test is only applicable to HTML, version attribute is not supported in XHTML.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9383775
+*/
+function HTMLHtmlElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLHtmlElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vversion;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "html");
+ nodeList = doc.getElementsByTagName("html");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vversion = testNode.version;
+
+
+ if(
+
+ (builder.contentType == "text/html")
+
+ ) {
+ assertEquals("versionLink","-//W3C//DTD HTML 4.01 Transitional//EN",vversion);
+
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHtmlElement01</h2>
+<p>&lt;test name='HTMLHtmlElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHtmlElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The version attribute specifies version information about the document's
+ DTD.
+
+ Retrieve the version attribute and examine its value.
+
+ Test is only applicable to HTML, version attribute is not supported in XHTML.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9383775">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9383775</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vversion' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='html' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"html"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;version interface='HTMLHtmlElement' obj='testNode' var='vversion'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentType type='text/html'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vversion' expected='"-//W3C//DTD HTML 4.01 Transitional//EN"' <a id="versionLink">id='versionLink'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/if&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/html.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement01.html
new file mode 100644
index 0000000000..74bc9e5bf3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute aligns this object(vertically or horizontally with
+ respect to its surrounding text.
+
+ Retrieve the align attribute of the first IFRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11309947
+*/
+function HTMLIFrameElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","top",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement01</h2>
+<p>&lt;test name='HTMLIFrameElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute aligns this object(vertically or horizontally with
+ respect to its surrounding text.
+
+ Retrieve the align attribute of the first IFRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11309947">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11309947</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLIFrameElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"top"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement02.html
new file mode 100644
index 0000000000..161b4264e6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement02.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The frameBorder attribute specifies the request for frame borders.
+ (frameBorder=1 A border is drawn)
+ (FrameBorder=0 A border is not drawn)
+
+ Retrieve the frameBorder attribute of the first IFRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22463410
+*/
+function HTMLIFrameElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vframeborder;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vframeborder = testNode.frameBorder;
+
+ assertEquals("frameborderLink","1",vframeborder);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement02</h2>
+<p>&lt;test name='HTMLIFrameElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The frameBorder attribute specifies the request for frame borders.
+ (frameBorder=1 A border is drawn)
+ (FrameBorder=0 A border is not drawn)
+
+ Retrieve the frameBorder attribute of the first IFRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22463410">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22463410</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vframeborder' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frameBorder interface='HTMLIFrameElement' obj='testNode' var='vframeborder'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vframeborder' expected='"1"' <a id="frameborderLink">id='frameborderLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement03.html
new file mode 100644
index 0000000000..c84981f86b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The height attribute specifies the frame height.
+
+ Retrieve the height attribute of the first IFRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1678118
+*/
+function HTMLIFrameElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vheight = testNode.height;
+
+ assertEquals("heightLink","50",vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement03</h2>
+<p>&lt;test name='HTMLIFrameElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The height attribute specifies the frame height.
+
+ Retrieve the height attribute of the first IFRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1678118">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1678118</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height interface='HTMLIFrameElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='"50"' <a id="heightLink">id='heightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement04.html
new file mode 100644
index 0000000000..c8e09efefc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The longDesc attribute specifies a URI designating a long description
+ of this image or frame.
+
+ Retrieve the longDesc attribute of the first IFRAME element and examine
+ its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70472105
+*/
+function HTMLIFrameElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vlongdesc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlongdesc = testNode.longDesc;
+
+ assertEquals("longdescLink","about:blank",vlongdesc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement04</h2>
+<p>&lt;test name='HTMLIFrameElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The longDesc attribute specifies a URI designating a long description
+ of this image or frame.
+
+ Retrieve the longDesc attribute of the first IFRAME element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70472105">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70472105</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlongdesc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;longDesc interface='HTMLIFrameElement' obj='testNode' var='vlongdesc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlongdesc' expected='"about:blank"' ignoreCase='false' <a id="longdescLink">id='longdescLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement05.html
new file mode 100644
index 0000000000..66fb0fc39d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement05.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The marginWidth attribute specifies the frame margin width, in pixels.
+
+ Retrieve the marginWidth attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66486595
+*/
+function HTMLIFrameElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vmarginwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vmarginwidth = testNode.marginWidth;
+
+ assertEquals("marginwidthLink","5",vmarginwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement05</h2>
+<p>&lt;test name='HTMLIFrameElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The marginWidth attribute specifies the frame margin width, in pixels.
+
+ Retrieve the marginWidth attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66486595">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66486595</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmarginwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;marginWidth interface='HTMLIFrameElement' obj='testNode' var='vmarginwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmarginwidth' expected='"5"' <a id="marginwidthLink">id='marginwidthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement06.html
new file mode 100644
index 0000000000..8efbabba8f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement06.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The marginHeight attribute specifies the frame margin height, in pixels.
+
+ Retrieve the marginHeight attribute of the first IFRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91371294
+*/
+function HTMLIFrameElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vmarginheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vmarginheight = testNode.marginHeight;
+
+ assertEquals("marginheightLink","10",vmarginheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement06</h2>
+<p>&lt;test name='HTMLIFrameElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The marginHeight attribute specifies the frame margin height, in pixels.
+
+ Retrieve the marginHeight attribute of the first IFRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91371294">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91371294</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmarginheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;marginHeight interface='HTMLIFrameElement' obj='testNode' var='vmarginheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmarginheight' expected='"10"' <a id="marginheightLink">id='marginheightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement07.html
new file mode 100644
index 0000000000..4bb0465f4d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies the frame name(object of the target
+ attribute).
+
+ Retrieve the name attribute of the first IFRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96819659
+*/
+function HTMLIFrameElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","Iframe1",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement07</h2>
+<p>&lt;test name='HTMLIFrameElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies the frame name(object of the target
+ attribute).
+
+ Retrieve the name attribute of the first IFRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96819659">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96819659</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLIFrameElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"Iframe1"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement08.html
new file mode 100644
index 0000000000..78d8445ce5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement08.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The scrolling attribute specifies whether or not the frame should have
+ scrollbars.
+
+ Retrieve the scrolling attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36369822
+*/
+function HTMLIFrameElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vscrolling;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vscrolling = testNode.scrolling;
+
+ assertEquals("scrollingLink","yes",vscrolling);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement08</h2>
+<p>&lt;test name='HTMLIFrameElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The scrolling attribute specifies whether or not the frame should have
+ scrollbars.
+
+ Retrieve the scrolling attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36369822">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36369822</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vscrolling' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scrolling interface='HTMLIFrameElement' obj='testNode' var='vscrolling'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vscrolling' expected='"yes"' <a id="scrollingLink">id='scrollingLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement09.html
new file mode 100644
index 0000000000..c44d2a9a82
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The src attribute specifies a URI designating the initial frame contents.
+
+ Retrieve the src attribute of the first FRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-43933957
+*/
+function HTMLIFrameElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vsrc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vsrc = testNode.src;
+
+ assertURIEquals("srcLink",null,null,null,null,"right",null,null,null,vsrc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement09</h2>
+<p>&lt;test name='HTMLIFrameElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The src attribute specifies a URI designating the initial frame contents.
+
+ Retrieve the src attribute of the first FRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-43933957">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-43933957</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsrc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;src interface='HTMLIFrameElement' obj='testNode' var='vsrc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vsrc' name='"right"' <a id="srcLink">id='srcLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement10.html
new file mode 100644
index 0000000000..241740df36
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement10.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the frame width.
+
+ Retrieve the width attribute of the first IFRAME element and examine
+ it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67133005
+*/
+function HTMLIFrameElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe");
+ nodeList = doc.getElementsByTagName("iframe");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","60",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement10</h2>
+<p>&lt;test name='HTMLIFrameElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the frame width.
+
+ Retrieve the width attribute of the first IFRAME element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67133005">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67133005</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"iframe"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLIFrameElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"60"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement11.html
new file mode 100644
index 0000000000..a53e0cab28
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLIFrameElement11.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLIFrameElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "iframe2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ Retrieve the contentDocument attribute of the second IFRAME element
+ and examine its title.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-67133006
+*/
+function HTMLIFrameElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLIFrameElement11") != null) return;
+ var testNode;
+ var cd;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "iframe2");
+ testNode = doc.getElementById("Iframe2");
+ cd = testNode.contentDocument;
+
+ vtitle = cd.title;
+
+ assertEquals("titleLink","NIST DOM HTML Test - FRAME",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLIFrameElement11</h2>
+<p>&lt;test name='HTMLIFrameElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLIFrameElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ Retrieve the contentDocument attribute of the second IFRAME element
+ and examine its title.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-03&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-67133006">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-67133006</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cd' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='iframe2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementById interface='Document' obj='doc' var='testNode' elementId='"Iframe2"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentDocument interface='HTMLIFrameElement' obj='testNode' var='cd'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLDocument' obj='cd' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"NIST DOM HTML Test - FRAME"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/iframe2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement01.html
new file mode 100644
index 0000000000..187152d5a6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies the name of the element.
+
+ Retrieve the name attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47534097
+*/
+function HTMLImageElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","IMAGE-1",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement01</h2>
+<p>&lt;test name='HTMLImageElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies the name of the element.
+
+ Retrieve the name attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47534097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47534097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLImageElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"IMAGE-1"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement02.html
new file mode 100644
index 0000000000..73fdaa3a84
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute aligns this object with respect to its surrounding
+ text.
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3211094
+*/
+function HTMLImageElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","middle",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement02</h2>
+<p>&lt;test name='HTMLImageElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute aligns this object with respect to its surrounding
+ text.
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3211094">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3211094</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLImageElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"middle"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement03.html
new file mode 100644
index 0000000000..cb1c741426
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The alt attribute specifies an alternative text for user agenst not
+ rendering the normal content of this element.
+
+ Retrieve the alt attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95636861
+*/
+function HTMLImageElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var valt;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valt = testNode.alt;
+
+ assertEquals("altLink","DTS IMAGE LOGO",valt);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement03</h2>
+<p>&lt;test name='HTMLImageElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The alt attribute specifies an alternative text for user agenst not
+ rendering the normal content of this element.
+
+ Retrieve the alt attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95636861">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95636861</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valt' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;alt interface='HTMLImageElement' obj='testNode' var='valt'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valt' expected='"DTS IMAGE LOGO"' <a id="altLink">id='altLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement04.html
new file mode 100644
index 0000000000..704a4baeaf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The border attribute specifies the width of the border around the image.
+
+ Retrieve the border attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-136671
+*/
+function HTMLImageElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vborder;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vborder = testNode.border;
+
+ assertEquals("borderLink","0",vborder);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement04</h2>
+<p>&lt;test name='HTMLImageElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The border attribute specifies the width of the border around the image.
+
+ Retrieve the border attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-136671">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-136671</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vborder' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;border interface='HTMLImageElement' obj='testNode' var='vborder'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vborder' expected='"0"' <a id="borderLink">id='borderLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement05.html
new file mode 100644
index 0000000000..f67477065f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The height attribute overrides the natural "height" of the image.
+
+ Retrieve the height attribute and examine it's value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-91561496
+*/
+function HTMLImageElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vheight = testNode.height;
+
+ assertEquals("heightLink",47,vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement05</h2>
+<p>&lt;test name='HTMLImageElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The height attribute overrides the natural "height" of the image.
+
+ Retrieve the height attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2001-12-26&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-91561496">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-91561496</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheight' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height interface='HTMLImageElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='47' <a id="heightLink">id='heightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement06.html
new file mode 100644
index 0000000000..0f977f2932
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement06.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The hspace attribute specifies the horizontal space to the left and
+ right of this image.
+
+ Retrieve the hspace attribute and examine it's value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-53675471
+*/
+function HTMLImageElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vhspace;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vhspace = testNode.hspace;
+
+ assertEquals("hspaceLink",4,vhspace);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement06</h2>
+<p>&lt;test name='HTMLImageElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The hspace attribute specifies the horizontal space to the left and
+ right of this image.
+
+ Retrieve the hspace attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2001-12-26&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-53675471">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-53675471</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhspace' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hspace interface='HTMLImageElement' obj='testNode' var='vhspace'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhspace' expected='4' <a id="hspaceLink">id='hspaceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement07.html
new file mode 100644
index 0000000000..60d513edeb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The isMap attribute indicates the use of server-side image map.
+
+ Retrieve the isMap attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58983880
+*/
+function HTMLImageElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vismap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vismap = testNode.isMap;
+
+ assertFalse("isMapLink",vismap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement07</h2>
+<p>&lt;test name='HTMLImageElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The isMap attribute indicates the use of server-side image map.
+
+ Retrieve the isMap attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58983880">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58983880</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vismap' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;isMap interface='HTMLImageElement' obj='testNode' var='vismap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertFalse actual='vismap' <a id="isMapLink">id='isMapLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement08.html
new file mode 100644
index 0000000000..2f12bac200
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The longDesc attribute contains an URI designating a long description
+ of this image or frame.
+
+ Retrieve the longDesc attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77376969
+*/
+function HTMLImageElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vlongdesc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vlongdesc = testNode.longDesc;
+
+ assertURIEquals("longDescLink",null,null,null,"desc.html",null,null,null,null,vlongdesc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement08</h2>
+<p>&lt;test name='HTMLImageElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The longDesc attribute contains an URI designating a long description
+ of this image or frame.
+
+ Retrieve the longDesc attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77376969">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77376969</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlongdesc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;longDesc interface='HTMLImageElement' obj='testNode' var='vlongdesc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vlongdesc' file='"desc.html"' <a id="longDescLink">id='longDescLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement09.html
new file mode 100644
index 0000000000..f3a648d680
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement09.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The src attribute contains an URI designating the source of this image.
+
+ Retrieve the src attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87762984
+*/
+function HTMLImageElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vsrc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vsrc = testNode.src;
+
+ assertURIEquals("srcLink",null,null,null,"dts.gif",null,null,null,null,vsrc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement09</h2>
+<p>&lt;test name='HTMLImageElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The src attribute contains an URI designating the source of this image.
+
+ Retrieve the src attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87762984">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87762984</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsrc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;src interface='HTMLImageElement' obj='testNode' var='vsrc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vsrc' file='"dts.gif"' <a id="srcLink">id='srcLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement10.html
new file mode 100644
index 0000000000..b1b64db783
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement10.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The useMap attribute specifies to use the client-side image map.
+
+ Retrieve the useMap attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35981181
+*/
+function HTMLImageElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vusemap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vusemap = testNode.useMap;
+
+ assertEquals("useMapLink","#DTS-MAP",vusemap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement10</h2>
+<p>&lt;test name='HTMLImageElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The useMap attribute specifies to use the client-side image map.
+
+ Retrieve the useMap attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35981181">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35981181</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vusemap' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;useMap interface='HTMLImageElement' obj='testNode' var='vusemap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vusemap' expected='"#DTS-MAP"' <a id="useMapLink">id='useMapLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement11.html
new file mode 100644
index 0000000000..56b654d7ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement11.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vspace attribute specifies the vertical space above and below this
+ image.
+
+ Retrieve the vspace attribute and examine it's value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-85374897
+*/
+function HTMLImageElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vvspace;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvspace = testNode.vspace;
+
+ assertEquals("vspaceLink",10,vvspace);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement11</h2>
+<p>&lt;test name='HTMLImageElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vspace attribute specifies the vertical space above and below this
+ image.
+
+ Retrieve the vspace attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2001-12-26&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-85374897">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-85374897</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvspace' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vspace interface='HTMLImageElement' obj='testNode' var='vvspace'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvspace' expected='10' <a id="vspaceLink">id='vspaceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement12.html
new file mode 100644
index 0000000000..0861258fc2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLImageElement12.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLImageElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "img");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute overrides the natural "width" of the image.
+
+ Retrieve the width attribute and examine it's value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13839076
+*/
+function HTMLImageElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLImageElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "img");
+ nodeList = doc.getElementsByTagName("img");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink",115,vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLImageElement12</h2>
+<p>&lt;test name='HTMLImageElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLImageElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute overrides the natural "width" of the image.
+
+ Retrieve the width attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2001-12-07&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13839076">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13839076</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='img' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"img"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLImageElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='115' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/img.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement01.html
new file mode 100644
index 0000000000..98919e5427
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The defaultValue attribute represents the HTML value of the attribute
+ when the type attribute has the value of "Text", "File" or "Password".
+
+ Retrieve the defaultValue attribute of the 1st INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26091157
+*/
+function HTMLInputElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vdefaultvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ vdefaultvalue = testNode.defaultValue;
+
+ assertEquals("defaultValueLink","Password",vdefaultvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement01</h2>
+<p>&lt;test name='HTMLInputElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The defaultValue attribute represents the HTML value of the attribute
+ when the type attribute has the value of "Text", "File" or "Password".
+
+ Retrieve the defaultValue attribute of the 1st INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26091157">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26091157</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdefaultvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;defaultValue interface='HTMLInputElement' obj='testNode' var='vdefaultvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdefaultvalue' expected='"Password"' <a id="defaultValueLink">id='defaultValueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement02.html
new file mode 100644
index 0000000000..12fda82550
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The defaultChecked attribute represents the HTML checked attribute of
+ the element when the type attribute has the value checkbox or radio.
+
+ Retrieve the defaultValue attribute of the 4th INPUT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20509171
+*/
+function HTMLInputElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vdefaultchecked;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(3);
+ vdefaultchecked = testNode.defaultChecked;
+
+ assertTrue("defaultCheckedLink",vdefaultchecked);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement02</h2>
+<p>&lt;test name='HTMLInputElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The defaultChecked attribute represents the HTML checked attribute of
+ the element when the type attribute has the value checkbox or radio.
+
+ Retrieve the defaultValue attribute of the 4th INPUT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20509171">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20509171</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdefaultchecked' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;defaultChecked interface='HTMLInputElement' obj='testNode' var='vdefaultchecked'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdefaultchecked' <a id="defaultCheckedLink">id='defaultCheckedLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement03.html
new file mode 100644
index 0000000000..94b46e3d19
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement03.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute of the 1st INPUT element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63239895
+*/
+function HTMLInputElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var fNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form1",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement03</h2>
+<p>&lt;test name='HTMLInputElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute of the 1st INPUT element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63239895">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63239895</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLInputElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form1"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement04.html
new file mode 100644
index 0000000000..e74f1547ca
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accept attribute is a comma-seperated list of content types that
+ a server processing this form will handle correctly.
+
+ Retrieve the accept attribute of the 9th INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15328520
+*/
+function HTMLInputElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccept;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(8);
+ vaccept = testNode.accept;
+
+ assertEquals("acceptLink","GIF,JPEG",vaccept);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement04</h2>
+<p>&lt;test name='HTMLInputElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accept attribute is a comma-seperated list of content types that
+ a server processing this form will handle correctly.
+
+ Retrieve the accept attribute of the 9th INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15328520">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15328520</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccept' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='8'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accept interface='HTMLInputElement' obj='testNode' var='vaccept'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccept' expected='"GIF,JPEG"' <a id="acceptLink">id='acceptLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement05.html
new file mode 100644
index 0000000000..369add7bd0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement05.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accessKey attribute is a single character access key to give access
+ to the form control.
+
+ Retrieve the accessKey attribute of the 2nd INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59914154
+*/
+function HTMLInputElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(1);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accesskeyLink","c",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement05</h2>
+<p>&lt;test name='HTMLInputElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accessKey attribute is a single character access key to give access
+ to the form control.
+
+ Retrieve the accessKey attribute of the 2nd INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59914154">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59914154</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLInputElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"c"' <a id="accesskeyLink">id='accesskeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement06.html
new file mode 100644
index 0000000000..354c90cee2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute aligns this object(vertically or horizontally)
+ with respect to the surrounding text.
+
+ Retrieve the align attribute of the 4th INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96991182
+*/
+function HTMLInputElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(3);
+ valign = testNode.align;
+
+ assertEquals("alignLink","bottom".toLowerCase(),valign.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement06</h2>
+<p>&lt;test name='HTMLInputElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute aligns this object(vertically or horizontally)
+ with respect to the surrounding text.
+
+ Retrieve the align attribute of the 4th INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96991182">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96991182</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLInputElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"bottom"' <a id="alignLink">id='alignLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement07.html
new file mode 100644
index 0000000000..37068e9d64
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The alt attribute alternates text for user agents not rendering the
+ normal content of this element.
+
+ Retrieve the alt attribute of the 1st INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92701314
+*/
+function HTMLInputElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var valt;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ valt = testNode.alt;
+
+ assertEquals("altLink","Password entry",valt);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement07</h2>
+<p>&lt;test name='HTMLInputElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The alt attribute alternates text for user agents not rendering the
+ normal content of this element.
+
+ Retrieve the alt attribute of the 1st INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92701314">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92701314</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valt' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;alt interface='HTMLInputElement' obj='testNode' var='valt'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valt' expected='"Password entry"' <a id="altLink">id='altLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement08.html
new file mode 100644
index 0000000000..0147f10ec1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement08.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The checked attribute represents the current state of the corresponding
+ form control when type has the value Radio or Checkbox.
+
+ Retrieve the accept attribute of the 3rd INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30233917
+*/
+function HTMLInputElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vchecked;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(2);
+ vchecked = testNode.checked;
+
+ assertTrue("checkedLink",vchecked);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement08</h2>
+<p>&lt;test name='HTMLInputElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The checked attribute represents the current state of the corresponding
+ form control when type has the value Radio or Checkbox.
+
+ Retrieve the accept attribute of the 3rd INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30233917">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30233917</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchecked' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;checked interface='HTMLInputElement' obj='testNode' var='vchecked'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vchecked' <a id="checkedLink">id='checkedLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement09.html
new file mode 100644
index 0000000000..fbc9383e41
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute has a TRUE value if it is explicitly set.
+
+ Retrieve the disabled attribute of the 7th INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50886781
+*/
+function HTMLInputElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(6);
+ vdisabled = testNode.disabled;
+
+ assertTrue("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement09</h2>
+<p>&lt;test name='HTMLInputElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute has a TRUE value if it is explicitly set.
+
+ Retrieve the disabled attribute of the 7th INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50886781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50886781</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLInputElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement10.html
new file mode 100644
index 0000000000..545c5a3bf6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The maxLength attribute is the maximum number of text characters for text
+ fields, when type has the value of Text or Password.
+
+ Retrieve the maxLenght attribute of the 1st INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-54719353
+*/
+function HTMLInputElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vmaxlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ vmaxlength = testNode.maxLength;
+
+ assertEquals("maxlengthLink",5,vmaxlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement10</h2>
+<p>&lt;test name='HTMLInputElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The maxLength attribute is the maximum number of text characters for text
+ fields, when type has the value of Text or Password.
+
+ Retrieve the maxLenght attribute of the 1st INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-54719353">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-54719353</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmaxlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;maxLength interface='HTMLInputElement' obj='testNode' var='vmaxlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmaxlength' expected='5' <a id="maxlengthLink">id='maxlengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement11.html
new file mode 100644
index 0000000000..384fc3f42b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement11.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute is the form control or object name when submitted with
+ a form.
+
+ Retrieve the name attribute of the 1st INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89658498
+*/
+function HTMLInputElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","Password",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement11</h2>
+<p>&lt;test name='HTMLInputElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute is the form control or object name when submitted with
+ a form.
+
+ Retrieve the name attribute of the 1st INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89658498">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89658498</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLInputElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"Password"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement12.html
new file mode 100644
index 0000000000..7045d724c2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement12.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The readOnly attribute indicates that this control is read-only when
+ type has a value of text or password only.
+
+ Retrieve the readOnly attribute of the 1st INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88461592
+*/
+function HTMLInputElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vreadonly;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ vreadonly = testNode.readOnly;
+
+ assertTrue("readonlyLink",vreadonly);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement12</h2>
+<p>&lt;test name='HTMLInputElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The readOnly attribute indicates that this control is read-only when
+ type has a value of text or password only.
+
+ Retrieve the readOnly attribute of the 1st INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88461592">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88461592</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vreadonly' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;readOnly interface='HTMLInputElement' obj='testNode' var='vreadonly'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vreadonly' <a id="readonlyLink">id='readonlyLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement13.html
new file mode 100644
index 0000000000..643d392553
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement13.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The size attribute contains the size information. Its precise meaning
+ is specific to each type of field.
+
+ Retrieve the size attribute of the 1st INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-79659438
+*/
+function HTMLInputElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var vsize;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ vsize = testNode.size;
+
+ assertEquals("size",25,vsize);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement13</h2>
+<p>&lt;test name='HTMLInputElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The size attribute contains the size information. Its precise meaning
+ is specific to each type of field.
+
+ Retrieve the size attribute of the 1st INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2001-12-26&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-79659438">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-79659438</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsize' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size interface='HTMLInputElement' obj='testNode' var='vsize'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsize' expected='25' <a id="size">id='size'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement14.html
new file mode 100644
index 0000000000..ebc2c0402a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement14.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The src attribute specifies the location of the image to decorate the
+ graphical submit button when the type has the value Image.
+
+ Retrieve the src attribute of the 8th INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-97320704
+*/
+function HTMLInputElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var vsrc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(7);
+ vsrc = testNode.src;
+
+ assertURIEquals("srcLink",null,null,null,"submit.gif",null,null,null,null,vsrc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement14</h2>
+<p>&lt;test name='HTMLInputElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The src attribute specifies the location of the image to decorate the
+ graphical submit button when the type has the value Image.
+
+ Retrieve the src attribute of the 8th INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-97320704">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-97320704</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsrc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='7'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;src interface='HTMLInputElement' obj='testNode' var='vsrc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vsrc' file='"submit.gif"' <a id="srcLink">id='srcLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement15.html
new file mode 100644
index 0000000000..51ce20e629
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement15.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tabIndex attribute is an index that represents the elements position
+ in the tabbing order.
+
+ Retrieve the tabIndex attribute of the 3rd INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62176355
+*/
+function HTMLInputElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(2);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabindexLink",9,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement15</h2>
+<p>&lt;test name='HTMLInputElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tabIndex attribute is an index that represents the elements position
+ in the tabbing order.
+
+ Retrieve the tabIndex attribute of the 3rd INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62176355">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62176355</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLInputElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='9' <a id="tabindexLink">id='tabindexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement16.html
new file mode 100644
index 0000000000..c88e2497d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement16.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute is the type of control created.
+
+ Retrieve the type attribute of the 1st INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62883744
+*/
+function HTMLInputElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","password",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement16</h2>
+<p>&lt;test name='HTMLInputElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute is the type of control created.
+
+ Retrieve the type attribute of the 1st INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62883744">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62883744</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLInputElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"password"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement17.html
new file mode 100644
index 0000000000..924a3b7a1b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement17.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The useMap attribute specifies the use of the client-side image map.
+
+ Retrieve the useMap attribute of the 8th INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32463706
+*/
+function HTMLInputElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var vusemap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(7);
+ vusemap = testNode.useMap;
+
+ assertEquals("usemapLink","#submit-map",vusemap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement17</h2>
+<p>&lt;test name='HTMLInputElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The useMap attribute specifies the use of the client-side image map.
+
+ Retrieve the useMap attribute of the 8th INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32463706">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32463706</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vusemap' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='7'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;useMap interface='HTMLInputElement' obj='testNode' var='vusemap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vusemap' expected='"#submit-map"' <a id="usemapLink">id='usemapLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement18.html
new file mode 100644
index 0000000000..d95f9845c4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement18.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The value attribute is the current content of the corresponding form
+ control when the type attribute has the value Text, File or Password.
+
+ Retrieve the value attribute of the 2nd INPUT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49531485
+*/
+function HTMLInputElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(1);
+ vvalue = testNode.value;
+
+ assertEquals("valueLink","ReHire",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement18</h2>
+<p>&lt;test name='HTMLInputElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The value attribute is the current content of the corresponding form
+ control when the type attribute has the value Text, File or Password.
+
+ Retrieve the value attribute of the 2nd INPUT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49531485">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49531485</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLInputElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"ReHire"' <a id="valueLink">id='valueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement19.html
new file mode 100644
index 0000000000..75436630a8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement19.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLInputElement.blur should surrender input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26838235
+*/
+function HTMLInputElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(1);
+ testNode.blur();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement19</h2>
+<p>&lt;test name='HTMLInputElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLInputElement.blur should surrender input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26838235">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26838235</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;blur interface='HTMLInputElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement20.html
new file mode 100644
index 0000000000..81345a94f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement20.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLInputElement.focus should capture input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65996295
+*/
+function HTMLInputElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement20") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(1);
+ testNode.focus();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement20</h2>
+<p>&lt;test name='HTMLInputElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLInputElement.focus should capture input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65996295">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65996295</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;focus interface='HTMLInputElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement21.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement21.html
new file mode 100644
index 0000000000..6e2d0ac5da
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement21.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLInputElement.click should change the state of checked on a radio button.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-2651361
+*/
+function HTMLInputElement21() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement21") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+ var checked;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(1);
+ checked = testNode.checked;
+
+ assertFalse("notCheckedBeforeClick",checked);
+testNode.click();
+ checked = testNode.checked;
+
+ assertTrue("checkedAfterClick",checked);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement21</h2>
+<p>&lt;test name='HTMLInputElement21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLInputElement.click should change the state of checked on a radio button.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-2651361">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-2651361</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='checked' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;checked var='checked' obj='testNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertFalse actual='checked' <a id="notCheckedBeforeClick">id='notCheckedBeforeClick'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;click interface='HTMLInputElement' obj='testNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;checked var='checked' obj='testNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='checked' <a id="checkedAfterClick">id='checkedAfterClick'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement22.html b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement22.html
new file mode 100644
index 0000000000..68da44c48c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLInputElement22.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement22</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLInputElement22'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "input");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+HTMLInputElement.select should select the contents of a text area.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34677168
+*/
+function HTMLInputElement22() {
+ var success;
+ if(checkInitialization(builder, "HTMLInputElement22") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+ var checked;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "input");
+ nodeList = doc.getElementsByTagName("input");
+ assertSize("Asize",9,nodeList);
+testNode = nodeList.item(0);
+ testNode.select();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLInputElement22</h2>
+<p>&lt;test name='HTMLInputElement22' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLInputElement22&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+HTMLInputElement.select should select the contents of a text area.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34677168">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34677168</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='checked' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='input' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"input"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='9' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;select interface='HTMLInputElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/input.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLIElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLIElement01.html
new file mode 100644
index 0000000000..c4cbcf4fba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLIElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLIElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLIElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "li");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute is a list item bullet style.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52387668
+*/
+function HTMLLIElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLLIElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "li");
+ nodeList = doc.getElementsByTagName("li");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","square",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLIElement01</h2>
+<p>&lt;test name='HTMLLIElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLIElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute is a list item bullet style.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52387668">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52387668</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='li' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"li"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLLIElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"square"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/li.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLIElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLIElement02.html
new file mode 100644
index 0000000000..d4a1fb7ad0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLIElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLIElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLIElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "li");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The value attribute is a reset sequence number when used in OL.
+
+ Retrieve the value attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-45496263
+*/
+function HTMLLIElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLLIElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "li");
+ nodeList = doc.getElementsByTagName("li");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vvalue = testNode.value;
+
+ assertEquals("valueLink",2,vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLIElement02</h2>
+<p>&lt;test name='HTMLLIElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLIElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The value attribute is a reset sequence number when used in OL.
+
+ Retrieve the value attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-45496263">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-45496263</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='li' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"li"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLLIElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='2' <a id="valueLink">id='valueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/li.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement01.html
new file mode 100644
index 0000000000..769273fd2c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement01.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLabelElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "label");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32480901
+*/
+function HTMLLabelElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLLabelElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var fNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "label");
+ nodeList = doc.getElementsByTagName("label");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form1",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement01</h2>
+<p>&lt;test name='HTMLLabelElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLabelElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32480901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32480901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='label' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"label"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLLabelElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form1"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/label.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement02.html
new file mode 100644
index 0000000000..bbeb70fc05
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLabelElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "label");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32480901
+*/
+function HTMLLabelElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLLabelElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "label");
+ nodeList = doc.getElementsByTagName("label");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement02</h2>
+<p>&lt;test name='HTMLLabelElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLabelElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32480901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32480901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='label' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"label"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLLabelElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/label.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement03.html
new file mode 100644
index 0000000000..b6adb084c2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLabelElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "label");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accessKey attribute is a single character access key to give access
+ to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-43589892
+*/
+function HTMLLabelElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLLabelElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "label");
+ nodeList = doc.getElementsByTagName("label");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accesskeyLink","b",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement03</h2>
+<p>&lt;test name='HTMLLabelElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLabelElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accessKey attribute is a single character access key to give access
+ to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-43589892">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-43589892</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='label' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"label"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLLabelElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"b"' <a id="accesskeyLink">id='accesskeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/label.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement04.html
new file mode 100644
index 0000000000..52b287f56f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLabelElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLabelElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "label");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The htmlFor attribute links this label with another form control by
+ id attribute.
+
+ Retrieve the htmlFor attribute of the first LABEL element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96509813
+*/
+function HTMLLabelElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLLabelElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vhtmlfor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "label");
+ nodeList = doc.getElementsByTagName("label");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vhtmlfor = testNode.htmlFor;
+
+ assertEquals("htmlForLink","input1",vhtmlfor);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLabelElement04</h2>
+<p>&lt;test name='HTMLLabelElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLabelElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The htmlFor attribute links this label with another form control by
+ id attribute.
+
+ Retrieve the htmlFor attribute of the first LABEL element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96509813">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96509813</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhtmlfor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='label' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"label"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;htmlFor interface='HTMLLabelElement' obj='testNode' var='vhtmlfor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhtmlfor' expected='"input1"' <a id="htmlForLink">id='htmlForLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/label.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement01.html
new file mode 100644
index 0000000000..fe5dca94f2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement01.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLegendElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "legend");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first LEGEND element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-29594519
+*/
+function HTMLLegendElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLLegendElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var fNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "legend");
+ nodeList = doc.getElementsByTagName("legend");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form1",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement01</h2>
+<p>&lt;test name='HTMLLegendElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLLegendElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first LEGEND element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-29594519">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-29594519</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='legend' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"legend"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLLegendElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form1"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/legend.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement02.html
new file mode 100644
index 0000000000..5d7895685b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLegendElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "legend");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the second ELEMENT and examine its form element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-29594519
+*/
+function HTMLLegendElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLLegendElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "legend");
+ nodeList = doc.getElementsByTagName("legend");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement02</h2>
+<p>&lt;test name='HTMLLegendElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLegendElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the second ELEMENT and examine its form element.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-29594519">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-29594519</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='legend' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"legend"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLLegendElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/legend.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement03.html
new file mode 100644
index 0000000000..50694fc20a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLegendElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "legend");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accessKey attribute is a single character access key to give access
+ to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11297832
+*/
+function HTMLLegendElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLLegendElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "legend");
+ nodeList = doc.getElementsByTagName("legend");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accesskeyLink","b",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement03</h2>
+<p>&lt;test name='HTMLLegendElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLegendElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accessKey attribute is a single character access key to give access
+ to the form control.
+
+ Retrieve the accessKey attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11297832">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11297832</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='legend' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"legend"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLLegendElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"b"' <a id="accesskeyLink">id='accesskeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/legend.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement04.html
new file mode 100644
index 0000000000..a1fae91dce
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLegendElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLegendElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "legend");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the text alignment relative to FIELDSET.
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79538067
+*/
+function HTMLLegendElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLLegendElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "legend");
+ nodeList = doc.getElementsByTagName("legend");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","top",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLegendElement04</h2>
+<p>&lt;test name='HTMLLegendElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLegendElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the text alignment relative to FIELDSET.
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79538067">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79538067</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='legend' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"legend"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLLegendElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"top"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/legend.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement01.html
new file mode 100644
index 0000000000..646f0c0de2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute enables/disables the link.
+
+ Retrieve the disabled attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87355129
+*/
+function HTMLLinkElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vdisabled = testNode.disabled;
+
+ assertFalse("disabled",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement01</h2>
+<p>&lt;test name='HTMLLinkElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute enables/disables the link.
+
+ Retrieve the disabled attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87355129">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87355129</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLLinkElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertFalse actual='vdisabled' <a id="disabled">id='disabled'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement02.html
new file mode 100644
index 0000000000..f2563cdfa2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The charset attribute indicates the character encoding of the linked
+ resource.
+
+ Retrieve the charset attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63954491
+*/
+function HTMLLinkElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharset;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vcharset = testNode.charset;
+
+ assertEquals("charsetLink","Latin-1",vcharset);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement02</h2>
+<p>&lt;test name='HTMLLinkElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The charset attribute indicates the character encoding of the linked
+ resource.
+
+ Retrieve the charset attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63954491">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63954491</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharset' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;charset interface='HTMLLinkElement' obj='testNode' var='vcharset'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharset' expected='"Latin-1"' <a id="charsetLink">id='charsetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement03.html
new file mode 100644
index 0000000000..6abc60f5d6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The href attribute specifies the URI of the linked resource.
+
+ Retrieve the href attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33532588
+*/
+function HTMLLinkElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vhref;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vhref = testNode.href;
+
+ assertURIEquals("hrefLink",null,null,null,"glossary.html",null,null,null,null,vhref);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement03</h2>
+<p>&lt;test name='HTMLLinkElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The href attribute specifies the URI of the linked resource.
+
+ Retrieve the href attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33532588">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33532588</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhref' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;href interface='HTMLLinkElement' obj='testNode' var='vhref'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vhref' file='"glossary.html"' <a id="hrefLink">id='hrefLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement04.html
new file mode 100644
index 0000000000..9589ded343
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The hreflang attribute specifies the language code of the linked resource.
+
+ Retrieve the hreflang attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85145682
+*/
+function HTMLLinkElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vhreflang;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vhreflang = testNode.hreflang;
+
+ assertEquals("hreflangLink","en",vhreflang);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement04</h2>
+<p>&lt;test name='HTMLLinkElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The hreflang attribute specifies the language code of the linked resource.
+
+ Retrieve the hreflang attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85145682">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85145682</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhreflang' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hreflang interface='HTMLLinkElement' obj='testNode' var='vhreflang'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhreflang' expected='"en"' <a id="hreflangLink">id='hreflangLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement05.html
new file mode 100644
index 0000000000..f5e21e3f1e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The media attribute specifies the targeted media.
+
+ Retrieve the media attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75813125
+*/
+function HTMLLinkElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vmedia;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vmedia = testNode.media;
+
+ assertEquals("mediaLink","screen",vmedia);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement05</h2>
+<p>&lt;test name='HTMLLinkElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The media attribute specifies the targeted media.
+
+ Retrieve the media attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75813125">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75813125</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmedia' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;media interface='HTMLLinkElement' obj='testNode' var='vmedia'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmedia' expected='"screen"' <a id="mediaLink">id='mediaLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement06.html
new file mode 100644
index 0000000000..151fcd50c5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rel attribute specifies the forward link type.
+
+ Retrieve the rel attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41369587
+*/
+function HTMLLinkElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vrel;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vrel = testNode.rel;
+
+ assertEquals("relLink","Glossary",vrel);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement06</h2>
+<p>&lt;test name='HTMLLinkElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rel attribute specifies the forward link type.
+
+ Retrieve the rel attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41369587">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41369587</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrel' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rel interface='HTMLLinkElement' obj='testNode' var='vrel'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrel' expected='"Glossary"' <a id="relLink">id='relLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement07.html
new file mode 100644
index 0000000000..28b2f7794a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement07.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rev attribute specifies the reverse link type.
+
+ Retrieve the rev attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40715461
+*/
+function HTMLLinkElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vrev;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vrev = testNode.rev;
+
+ assertEquals("revLink","stylesheet",vrev);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement07</h2>
+<p>&lt;test name='HTMLLinkElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rev attribute specifies the reverse link type.
+
+ Retrieve the rev attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40715461">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40715461</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrev' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rev interface='HTMLLinkElement' obj='testNode' var='vrev'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrev' expected='"stylesheet"' <a id="revLink">id='revLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement08.html
new file mode 100644
index 0000000000..fe8373ad84
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement08.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the advisory content type.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32498296
+*/
+function HTMLLinkElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","text/html",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement08</h2>
+<p>&lt;test name='HTMLLinkElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the advisory content type.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32498296">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32498296</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLLinkElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"text/html"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement09.html
new file mode 100644
index 0000000000..9e1f95129e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLLinkElement09.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLLinkElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "link2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The target attribute specifies the frame to render the resource in.
+
+ Retrieve the target attribute and examine it's value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84183095
+*/
+function HTMLLinkElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLLinkElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vtarget;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "link2");
+ nodeList = doc.getElementsByTagName("link");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtarget = testNode.target;
+
+ assertEquals("targetLink","dynamic",vtarget);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLLinkElement09</h2>
+<p>&lt;test name='HTMLLinkElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLLinkElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The target attribute specifies the frame to render the resource in.
+
+ Retrieve the target attribute and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84183095">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84183095</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtarget' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='link2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"link"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target interface='HTMLLinkElement' obj='testNode' var='vtarget'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtarget' expected='"dynamic"' <a id="targetLink">id='targetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/link2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLMapElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLMapElement01.html
new file mode 100644
index 0000000000..1ced2c0995
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLMapElement01.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMapElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLMapElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "map");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The areas attribute is a list of areas defined for the image map.
+
+ Retrieve the areas attribute and find the number of areas defined.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71838730
+*/
+function HTMLMapElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLMapElement01") != null) return;
+ var nodeList;
+ var areasnodeList;
+ var testNode;
+ var vareas;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "map");
+ nodeList = doc.getElementsByTagName("map");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ areasnodeList = testNode.areas;
+
+ vareas = areasnodeList.length;
+
+ assertEquals("areasLink",3,vareas);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMapElement01</h2>
+<p>&lt;test name='HTMLMapElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLMapElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The areas attribute is a list of areas defined for the image map.
+
+ Retrieve the areas attribute and find the number of areas defined.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71838730">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71838730</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='areasnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vareas' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='map' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"map"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;areas interface='HTMLMapElement' obj='testNode' var='areasnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='areasnodeList' var='vareas'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vareas' expected='3' <a id="areasLink">id='areasLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/map.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLMapElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLMapElement02.html
new file mode 100644
index 0000000000..d65deb3956
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLMapElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMapElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLMapElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "map");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute names the map(for use with usemap).
+
+ Retrieve the name attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52696514
+*/
+function HTMLMapElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLMapElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "map");
+ nodeList = doc.getElementsByTagName("map");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("mapLink","mapid",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMapElement02</h2>
+<p>&lt;test name='HTMLMapElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLMapElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute names the map(for use with usemap).
+
+ Retrieve the name attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52696514">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52696514</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='map' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"map"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLMapElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"mapid"' <a id="mapLink">id='mapLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/map.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLMenuElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLMenuElement01.html
new file mode 100644
index 0000000000..0f37aff79c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLMenuElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMenuElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLMenuElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "menu");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68436464
+*/
+function HTMLMenuElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLMenuElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcompact;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "menu");
+ nodeList = doc.getElementsByTagName("menu");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcompact = testNode.compact;
+
+ assertTrue("compactLink",vcompact);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMenuElement01</h2>
+<p>&lt;test name='HTMLMenuElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLMenuElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68436464">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68436464</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcompact' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='menu' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"menu"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;compact interface='HTMLMenuElement' obj='testNode' var='vcompact'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vcompact' <a id="compactLink">id='compactLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/menu.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement01.html
new file mode 100644
index 0000000000..bc84b775b1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLMetaElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "meta");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The content attribute specifies associated information.
+
+ Retrieve the content attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87670826
+*/
+function HTMLMetaElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLMetaElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcontent;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "meta");
+ nodeList = doc.getElementsByTagName("meta");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcontent = testNode.content;
+
+ assertEquals("contentLink","text/html; CHARSET=utf-8",vcontent);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement01</h2>
+<p>&lt;test name='HTMLMetaElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLMetaElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The content attribute specifies associated information.
+
+ Retrieve the content attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87670826">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87670826</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcontent' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='meta' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"meta"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;content interface='HTMLMetaElement' obj='testNode' var='vcontent'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcontent' expected='"text/html; CHARSET=utf-8"' <a id="contentLink">id='contentLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/meta.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement02.html
new file mode 100644
index 0000000000..dbea6bcf10
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLMetaElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "meta");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The httpEquiv attribute specifies an HTTP respnse header name.
+
+ Retrieve the httpEquiv attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77289449
+*/
+function HTMLMetaElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLMetaElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vhttpequiv;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "meta");
+ nodeList = doc.getElementsByTagName("meta");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vhttpequiv = testNode.httpEquiv;
+
+ assertEquals("httpEquivLink","Content-Type",vhttpequiv);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement02</h2>
+<p>&lt;test name='HTMLMetaElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLMetaElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The httpEquiv attribute specifies an HTTP respnse header name.
+
+ Retrieve the httpEquiv attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77289449">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77289449</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhttpequiv' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='meta' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"meta"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;httpEquiv interface='HTMLMetaElement' obj='testNode' var='vhttpequiv'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhttpequiv' expected='"Content-Type"' <a id="httpEquivLink">id='httpEquivLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/meta.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement03.html
new file mode 100644
index 0000000000..12925a90ac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLMetaElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "meta");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies the meta information name.
+
+ Retrieve the name attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31037081
+*/
+function HTMLMetaElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLMetaElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "meta");
+ nodeList = doc.getElementsByTagName("meta");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","Meta-Name",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement03</h2>
+<p>&lt;test name='HTMLMetaElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLMetaElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies the meta information name.
+
+ Retrieve the name attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31037081">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31037081</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='meta' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"meta"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLMetaElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"Meta-Name"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/meta.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement04.html
new file mode 100644
index 0000000000..23f0f286e3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLMetaElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLMetaElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "meta");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The scheme attribute specifies a select form of content.
+
+ Retrieve the scheme attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35993789
+*/
+function HTMLMetaElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLMetaElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vscheme;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "meta");
+ nodeList = doc.getElementsByTagName("meta");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vscheme = testNode.scheme;
+
+ assertEquals("schemeLink","NIST",vscheme);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLMetaElement04</h2>
+<p>&lt;test name='HTMLMetaElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLMetaElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The scheme attribute specifies a select form of content.
+
+ Retrieve the scheme attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35993789">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35993789</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vscheme' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='meta' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"meta"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scheme interface='HTMLMetaElement' obj='testNode' var='vscheme'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vscheme' expected='"NIST"' <a id="schemeLink">id='schemeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/meta.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLModElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement01.html
new file mode 100644
index 0000000000..cbe1693e45
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLModElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "mod");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cite attribute specifies an URI designating a document that describes
+ the reason for the change.
+
+ Retrieve the cite attribute of the INS element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75101708
+*/
+function HTMLModElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLModElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcite;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "mod");
+ nodeList = doc.getElementsByTagName("ins");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcite = testNode.cite;
+
+ assertURIEquals("citeLink",null,null,null,"ins-reasons.html",null,null,null,null,vcite);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement01</h2>
+<p>&lt;test name='HTMLModElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLModElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cite attribute specifies an URI designating a document that describes
+ the reason for the change.
+
+ Retrieve the cite attribute of the INS element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75101708">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75101708</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcite' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='mod' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"ins"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cite interface='HTMLModElement' obj='testNode' var='vcite'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vcite' file='"ins-reasons.html"' <a id="citeLink">id='citeLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/mod.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLModElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement02.html
new file mode 100644
index 0000000000..5d4a7213f5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLModElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "mod");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dateTime attribute specifies the date and time of the change.
+
+ Retrieve the dateTime attribute of the INS element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88432678
+*/
+function HTMLModElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLModElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vdatetime;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "mod");
+ nodeList = doc.getElementsByTagName("ins");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdatetime = testNode.dateTime;
+
+ assertEquals("dateTimeLink","January 1, 2002",vdatetime);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement02</h2>
+<p>&lt;test name='HTMLModElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLModElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dateTime attribute specifies the date and time of the change.
+
+ Retrieve the dateTime attribute of the INS element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88432678">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88432678</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdatetime' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='mod' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"ins"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dateTime interface='HTMLModElement' obj='testNode' var='vdatetime'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdatetime' expected='"January 1, 2002"' <a id="dateTimeLink">id='dateTimeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/mod.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLModElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement03.html
new file mode 100644
index 0000000000..35dcdd3376
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLModElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "mod");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cite attribute specifies an URI designating a document that describes
+ the reason for the change.
+
+ Retrieve the cite attribute of the DEL element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75101708
+*/
+function HTMLModElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLModElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vcite;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "mod");
+ nodeList = doc.getElementsByTagName("del");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcite = testNode.cite;
+
+ assertURIEquals("citeLink",null,null,null,"del-reasons.html",null,null,null,null,vcite);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement03</h2>
+<p>&lt;test name='HTMLModElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLModElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cite attribute specifies an URI designating a document that describes
+ the reason for the change.
+
+ Retrieve the cite attribute of the DEL element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75101708">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75101708</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcite' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='mod' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"del"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cite interface='HTMLModElement' obj='testNode' var='vcite'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vcite' file='"del-reasons.html"' <a id="citeLink">id='citeLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/mod.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLModElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement04.html
new file mode 100644
index 0000000000..c5eb3ac39e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLModElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLModElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "mod");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The dateTime attribute specifies the date and time of the change.
+
+ Retrieve the dateTime attribute of the DEL element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88432678
+*/
+function HTMLModElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLModElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vdatetime;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "mod");
+ nodeList = doc.getElementsByTagName("del");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdatetime = testNode.dateTime;
+
+ assertEquals("dateTimeLink","January 2, 2002",vdatetime);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLModElement04</h2>
+<p>&lt;test name='HTMLModElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLModElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The dateTime attribute specifies the date and time of the change.
+
+ Retrieve the dateTime attribute of the DEL element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88432678">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88432678</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdatetime' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='mod' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"del"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dateTime interface='HTMLModElement' obj='testNode' var='vdatetime'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdatetime' expected='"January 2, 2002"' <a id="dateTimeLink">id='dateTimeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/mod.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement01.html
new file mode 100644
index 0000000000..f3cef3fec0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOListElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOListElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "olist");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76448506
+*/
+function HTMLOListElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLOListElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcompact;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "olist");
+ nodeList = doc.getElementsByTagName("ol");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcompact = testNode.compact;
+
+ assertTrue("compactLink",vcompact);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOListElement01</h2>
+<p>&lt;test name='HTMLOListElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOListElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The compact attribute specifies a boolean value on whether to display
+ the list more compactly.
+
+ Retrieve the compact attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76448506">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76448506</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcompact' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='olist' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"ol"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;compact interface='HTMLOListElement' obj='testNode' var='vcompact'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vcompact' <a id="compactLink">id='compactLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/olist.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement02.html
new file mode 100644
index 0000000000..6dee163987
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOListElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOListElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "olist");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The start attribute specifies the starting sequence number.
+
+ Retrieve the start attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14793325
+*/
+function HTMLOListElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLOListElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vstart;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "olist");
+ nodeList = doc.getElementsByTagName("ol");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vstart = testNode.start;
+
+ assertEquals("startLink",1,vstart);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOListElement02</h2>
+<p>&lt;test name='HTMLOListElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOListElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The start attribute specifies the starting sequence number.
+
+ Retrieve the start attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14793325">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14793325</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vstart' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='olist' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"ol"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;start interface='HTMLOListElement' obj='testNode' var='vstart'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vstart' expected='1' <a id="startLink">id='startLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/olist.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement03.html
new file mode 100644
index 0000000000..4fb9f4fda5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOListElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOListElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOListElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "olist");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the numbering style.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40971103
+*/
+function HTMLOListElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLOListElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "olist");
+ nodeList = doc.getElementsByTagName("ol");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","1",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOListElement03</h2>
+<p>&lt;test name='HTMLOListElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOListElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the numbering style.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40971103">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40971103</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='olist' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"ol"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLOListElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"1"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/olist.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement01.html
new file mode 100644
index 0000000000..4c4f3eee04
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement01.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773
+*/
+function HTMLObjectElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var fNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object2");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("idLink","object2",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement01</h2>
+<p>&lt;test name='HTMLObjectElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-19&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLObjectElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"object2"' <a id="idLink">id='idLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement02.html
new file mode 100644
index 0000000000..371b72bc78
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The code attribute specifies an Applet class file.
+
+Retrieve the code attribute of the second OBJECT element and examine
+its value. Should be "" since CODE is not a valid attribute for OBJECT.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75241146
+*/
+function HTMLObjectElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vcode = testNode.code;
+
+ assertEquals("codeLink","",vcode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement02</h2>
+<p>&lt;test name='HTMLObjectElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The code attribute specifies an Applet class file.
+
+Retrieve the code attribute of the second OBJECT element and examine
+its value. Should be "" since CODE is not a valid attribute for OBJECT.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75241146">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75241146</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcode' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;code interface='HTMLObjectElement' obj='testNode' var='vcode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcode' expected='""' <a id="codeLink">id='codeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement03.html
new file mode 100644
index 0000000000..57f9cb397f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement03.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the alignment of this object with respect
+ to its surrounding text.
+
+ Retrieve the align attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16962097
+*/
+function HTMLObjectElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","middle",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement03</h2>
+<p>&lt;test name='HTMLObjectElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the alignment of this object with respect
+ to its surrounding text.
+
+ Retrieve the align attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16962097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16962097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLObjectElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"middle"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement04.html
new file mode 100644
index 0000000000..e453aa6d6d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The archive attribute specifies a space-separated list of archives.
+
+ Retrieve the archive attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47783837
+*/
+function HTMLObjectElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var varchive;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ varchive = testNode.archive;
+
+ assertEquals("archiveLink","",varchive);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement04</h2>
+<p>&lt;test name='HTMLObjectElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The archive attribute specifies a space-separated list of archives.
+
+ Retrieve the archive attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47783837">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47783837</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='varchive' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;archive interface='HTMLObjectElement' obj='testNode' var='varchive'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='varchive' expected='""' <a id="archiveLink">id='archiveLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement05.html
new file mode 100644
index 0000000000..1201d96652
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement05.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The border attribute specifies the width of the border around the object.
+
+ Retrieve the border attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82818419
+*/
+function HTMLObjectElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vborder;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vborder = testNode.border;
+
+ assertEquals("borderLink","0",vborder);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement05</h2>
+<p>&lt;test name='HTMLObjectElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The border attribute specifies the widht of the border around the object.
+
+ Retrieve the border attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82818419">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82818419</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vborder' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;border interface='HTMLObjectElement' obj='testNode' var='vborder'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vborder' expected='"0"' <a id="borderLink">id='borderLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement06.html
new file mode 100644
index 0000000000..eccc553d57
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The codeBase attribute specifies the base URI for the classid, data and
+ archive attributes.
+
+ Retrieve the codeBase attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25709136
+*/
+function HTMLObjectElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vcodebase;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vcodebase = testNode.codeBase;
+
+ assertURIEquals("codebaseLink",null,"//example.org/",null,null,null,null,null,null,vcodebase);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement06</h2>
+<p>&lt;test name='HTMLObjectElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The codeBase attribute specifies the base URI for the classid, data and
+ archive attributes.
+
+ Retrieve the codeBase attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25709136">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25709136</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcodebase' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;codeBase interface='HTMLObjectElement' obj='testNode' var='vcodebase'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vcodebase' path='"//xw2k.sdct.itl.nist.gov/brady/dom/"' <a id="codebaseLink">id='codebaseLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement07.html
new file mode 100644
index 0000000000..80f88e5125
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The codeType attribute specifies the data downloaded via the classid
+ attribute.
+
+ Retrieve the codeType attribute of the second OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19945008
+*/
+function HTMLObjectElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vcodetype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vcodetype = testNode.codeType;
+
+ assertEquals("codetypeLink","image/gif",vcodetype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement07</h2>
+<p>&lt;test name='HTMLObjectElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The codeType attribute specifies the data downloaded via the classid
+ attribute.
+
+ Retrieve the codeType attribute of the second OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19945008">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19945008</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcodetype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;codeType interface='HTMLObjectElement' obj='testNode' var='vcodetype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcodetype' expected='"image/gif"' <a id="codetypeLink">id='codetypeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement08.html
new file mode 100644
index 0000000000..c02fdbe664
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The data attribute specifies the URI of the location of the objects data.
+
+ Retrieve the data attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-81766986
+*/
+function HTMLObjectElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vdata;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vdata = testNode.data;
+
+ assertURIEquals("dataLink",null,null,null,"logo.gif",null,null,null,null,vdata);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement08</h2>
+<p>&lt;test name='HTMLObjectElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The data attribute specifies the URI of the location of the objects data.
+
+ Retrieve the data attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-81766986">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-81766986</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdata' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;data interface='HTMLObjectElement' obj='testNode' var='vdata'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vdata' file='"logo.gif"' <a id="dataLink">id='dataLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement09.html
new file mode 100644
index 0000000000..f73724ed54
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement09.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The declare attribute specifies this object should be declared only and
+ no instance of it should be created.
+
+ Retrieve the declare attribute of the second OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-942770
+*/
+function HTMLObjectElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vdeclare;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vdeclare = testNode.declare;
+
+ assertTrue("declareLink",vdeclare);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement09</h2>
+<p>&lt;test name='HTMLObjectElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The declare attribute specifies this object should be declared only and
+ no instance of it should be created.
+
+ Retrieve the declare attribute of the second OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-942770">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-942770</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdeclare' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;declare interface='HTMLObjectElement' obj='testNode' var='vdeclare'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdeclare' <a id="declareLink">id='declareLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement10.html
new file mode 100644
index 0000000000..1d29317784
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The height attribute overrides the value of the actual height of the
+ object.
+
+ Retrieve the height attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88925838
+*/
+function HTMLObjectElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vheight = testNode.height;
+
+ assertEquals("heightLink","60",vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement10</h2>
+<p>&lt;test name='HTMLObjectElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The height attribute overrides the value of the actual height of the
+ object.
+
+ Retrieve the height attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88925838">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88925838</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height interface='HTMLObjectElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='"60"' <a id="heightLink">id='heightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement11.html
new file mode 100644
index 0000000000..13f6d5903a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement11.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The hspace attribute specifies the horizontal space to the left and right
+ of this image, applet or object.
+
+ Retrieve the hspace attribute of the first OBJECT element and examine
+ it's value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-17085376
+*/
+function HTMLObjectElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vhspace;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vhspace = testNode.hspace;
+
+ assertEquals("hspaceLink",0,vhspace);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement11</h2>
+<p>&lt;test name='HTMLObjectElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The hspace attribute specifies the horizontal space to the left and right
+ of this image, applet or object.
+
+ Retrieve the hspace attribute of the first OBJECT element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-01-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-17085376">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-17085376</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhspace' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hspace interface='HTMLObjectElement' obj='testNode' var='vhspace'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhspace' expected='0' <a id="hspaceLink">id='hspaceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement12.html
new file mode 100644
index 0000000000..536cf8e0c0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement12.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The standby attribute specifies a message to render while loading the
+ object.
+
+ Retrieve the standby attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25039673
+*/
+function HTMLObjectElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vstandby;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vstandby = testNode.standby;
+
+ assertEquals("alignLink","Loading Image ...",vstandby);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement12</h2>
+<p>&lt;test name='HTMLObjectElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The standby attribute specifies a message to render while loading the
+ object.
+
+ Retrieve the standby attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25039673">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25039673</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vstandby' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;standby interface='HTMLObjectElement' obj='testNode' var='vstandby'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vstandby' expected='"Loading Image ..."' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement13.html
new file mode 100644
index 0000000000..c0ef4ff6cd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement13.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tabIndex attribute specifies the elements position in the tabbing
+ order.
+
+ Retrieve the tabIndex attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27083787
+*/
+function HTMLObjectElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",0,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement13</h2>
+<p>&lt;test name='HTMLObjectElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tabIndex attribute specifies the elements position in the tabbing
+ order.
+
+ Retrieve the tabIndex attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27083787">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27083787</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLObjectElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='0' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement14.html
new file mode 100644
index 0000000000..e29e05f06e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement14.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the content type for data downloaded via
+ the data attribute.
+
+ Retrieve the type attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91665621
+*/
+function HTMLObjectElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","image/gif",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement14</h2>
+<p>&lt;test name='HTMLObjectElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the content type for data downloaded via
+ the data attribute.
+
+ Retrieve the type attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91665621">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91665621</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLObjectElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"image/gif"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement15.html
new file mode 100644
index 0000000000..ce452d6b01
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement15.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The useMap attribute specifies the used client-side image map.
+
+ Retrieve the useMap attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6649772
+*/
+function HTMLObjectElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var vusemap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vusemap = testNode.useMap;
+
+ assertEquals("useMapLink","#DivLogo-map",vusemap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement15</h2>
+<p>&lt;test name='HTMLObjectElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The useMap attribute specifies the used client-side image map.
+
+ Retrieve the useMap attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6649772">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6649772</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vusemap' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;useMap interface='HTMLObjectElement' obj='testNode' var='vusemap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vusemap' expected='"#DivLogo-map"' <a id="useMapLink">id='useMapLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement16.html
new file mode 100644
index 0000000000..2f2739b6e9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement16.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vspace attribute specifies the vertical space above or below this
+ image, applet or object.
+
+ Retrieve the vspace attribute of the first OBJECT element and examine
+ it's value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-8682483
+*/
+function HTMLObjectElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var vvspace;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vvspace = testNode.vspace;
+
+ assertEquals("vspaceLink",0,vvspace);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement16</h2>
+<p>&lt;test name='HTMLObjectElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vspace attribute specifies the vertical space above or below this
+ image, applet or object.
+
+ Retrieve the vspace attribute of the first OBJECT element and examine
+ it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-01-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-8682483">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-8682483</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvspace' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vspace interface='HTMLObjectElement' obj='testNode' var='vvspace'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvspace' expected='0' <a id="vspaceLink">id='vspaceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement17.html
new file mode 100644
index 0000000000..f0a8ff1707
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement17.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute overrides the original width value.
+
+ Retrieve the width attribute of the first OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38538620
+*/
+function HTMLObjectElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","550",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement17</h2>
+<p>&lt;test name='HTMLObjectElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute overrides the original width value.
+
+ Retrieve the width attribute of the first OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38538620">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38538620</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLObjectElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"550"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement18.html
new file mode 100644
index 0000000000..eaac546f83
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement18.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies form control or object name when submitted
+ with a form.
+
+ Retrieve the name attribute of the second OBJECT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20110362
+*/
+function HTMLObjectElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vname = testNode.name;
+
+ assertEquals("vspaceLink","OBJECT2",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement18</h2>
+<p>&lt;test name='HTMLObjectElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies form control or object name when submitted
+ with a form.
+
+ Retrieve the name attribute of the second OBJECT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20110362">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20110362</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLObjectElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"OBJECT2"' <a id="vspaceLink">id='vspaceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement19.html
new file mode 100644
index 0000000000..1ca95e5223
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement19.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773
+*/
+function HTMLObjectElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object2");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement19</h2>
+<p>&lt;test name='HTMLObjectElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ form.
+
+ Retrieve the form attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-19&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLObjectElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement20.html
new file mode 100644
index 0000000000..aca8fe3cc5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLObjectElement20.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLObjectElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The contentDocument attribute specifies the document this object contains,
+ if there is any and it is available, or null otherwise.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-38538621
+*/
+function HTMLObjectElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLObjectElement20") != null) return;
+ var testNode;
+ var cd;
+ var vtitle;
+ var doc;
+ var nodeList;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object2");
+ nodeList = doc.getElementsByTagName("object");
+ testNode = nodeList.item(1);
+ cd = testNode.contentDocument;
+
+ assertNull("noContentDocument",cd);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLObjectElement20</h2>
+<p>&lt;test name='HTMLObjectElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLObjectElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The contentDocument attribute specifies the document this object contains,
+ if there is any and it is available, or null otherwise.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-07-03&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-38538621">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-38538621</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cd' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName var='nodeList' obj='doc' interface='Document' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item var='testNode' obj='nodeList' index='1' interface='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentDocument interface='HTMLObjectElement' obj='testNode' var='cd'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='cd' <a id="noContentDocument">id='noContentDocument'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object2.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement01.html
new file mode 100644
index 0000000000..a009cf9044
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptGroupElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptGroupElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optgroup");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute indicates that the control is unavailable in
+ this context.
+
+ Retrieve the disabled attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15518803
+*/
+function HTMLOptGroupElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptGroupElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optgroup");
+ nodeList = doc.getElementsByTagName("optgroup");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vdisabled = testNode.disabled;
+
+ assertTrue("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptGroupElement01</h2>
+<p>&lt;test name='HTMLOptGroupElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptGroupElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute indicates that the control is unavailable in
+ this context.
+
+ Retrieve the disabled attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15518803">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15518803</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optgroup' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"optgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLOptGroupElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optgroup.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement02.html
new file mode 100644
index 0000000000..f1dc5e2c33
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptGroupElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptGroupElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptGroupElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optgroup");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The label attribute specifies the label assigned to this option group.
+
+ Retrieve the label attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95806054
+*/
+function HTMLOptGroupElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptGroupElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vlabel;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optgroup");
+ nodeList = doc.getElementsByTagName("optgroup");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vlabel = testNode.label;
+
+ assertEquals("labelLink","Regular Employees",vlabel);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptGroupElement02</h2>
+<p>&lt;test name='HTMLOptGroupElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptGroupElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The label attribute specifies the label assigned to this option group.
+
+ Retrieve the label attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95806054">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95806054</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlabel' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optgroup' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"optgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;label interface='HTMLOptGroupElement' obj='testNode' var='vlabel'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlabel' expected='"Regular Employees"' <a id="labelLink">id='labelLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optgroup.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement01.html
new file mode 100644
index 0000000000..a5bfd416f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement01.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first SELECT element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-17116503
+*/
+function HTMLOptionElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var fNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form1",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement01</h2>
+<p>&lt;test name='HTMLOptionElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first SELECT element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-17116503">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-17116503</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLOptionElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form1"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement02.html
new file mode 100644
index 0000000000..d5b9c605ed
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ a form.
+
+ Retrieve the first OPTION attribute from the second select element and
+ examine its form element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-17116503
+*/
+function HTMLOptionElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(6);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement02</h2>
+<p>&lt;test name='HTMLOptionElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ a form.
+
+ Retrieve the first OPTION attribute from the second select element and
+ examine its form element.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-17116503">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-17116503</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLOptionElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement03.html
new file mode 100644
index 0000000000..45e90fe106
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement03.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The defaultSelected attribute contains the value of the selected
+ attribute.
+
+ Retrieve the defaultSelected attribute from the first OPTION element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-37770574
+*/
+function HTMLOptionElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vdefaultselected;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(0);
+ vdefaultselected = testNode.defaultSelected;
+
+ assertTrue("defaultSelectedLink",vdefaultselected);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement03</h2>
+<p>&lt;test name='HTMLOptionElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The defaultSelected attribute contains the value of the selected
+ attribute.
+
+ Retrieve the defaultSelected attribute from the first OPTION element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-37770574">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-37770574</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdefaultselected' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;defaultSelected interface='HTMLOptionElement' obj='testNode' var='vdefaultselected'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdefaultselected' <a id="defaultSelectedLink">id='defaultSelectedLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement04.html
new file mode 100644
index 0000000000..e85f2aced9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The text attribute contains the text contained within the option element.
+
+ Retrieve the text attribute from the second OPTION element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48154426
+*/
+function HTMLOptionElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vtext;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(1);
+ vtext = testNode.text;
+
+ assertEquals("textLink","EMP10002",vtext);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement04</h2>
+<p>&lt;test name='HTMLOptionElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The text attribute contains the text contained within the option element.
+
+ Retrieve the text attribute from the second OPTION element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48154426">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48154426</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtext' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;text interface='HTMLOptionElement' obj='testNode' var='vtext'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtext' expected='"EMP10002"' <a id="textLink">id='textLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement05.html
new file mode 100644
index 0000000000..4ddfab2f72
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement05.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The index attribute indicates th index of this OPTION in ints parent
+ SELECT.
+
+ Retrieve the index attribute from the seventh OPTION element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14038413
+*/
+function HTMLOptionElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(6);
+ vindex = testNode.index;
+
+ assertEquals("indexLink",1,vindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement05</h2>
+<p>&lt;test name='HTMLOptionElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The index attribute indicates th index of this OPTION in ints parent
+ SELECT.
+
+ Retrieve the index attribute from the seventh OPTION element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14038413">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14038413</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;index interface='HTMLOptionElement' obj='testNode' var='vindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vindex' expected='1' <a id="indexLink">id='indexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement06.html
new file mode 100644
index 0000000000..2e27c7dc71
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute indicates that this control is not available
+ within this context.
+
+ Retrieve the disabled attribute from the last OPTION element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23482473
+*/
+function HTMLOptionElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(9);
+ vdisabled = testNode.disabled;
+
+ assertTrue("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement06</h2>
+<p>&lt;test name='HTMLOptionElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute indicates that this control is not available
+ within this context.
+
+ Retrieve the disabled attribute from the last OPTION element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23482473">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23482473</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='9'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLOptionElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement07.html
new file mode 100644
index 0000000000..0d85407a62
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The label attribute is used in hierarchical menus. It specifies
+ a shorter label for an option that the content of the OPTION element.
+
+ Retrieve the label attribute from the second OPTION element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40736115
+*/
+function HTMLOptionElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vlabel;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(1);
+ vlabel = testNode.label;
+
+ assertEquals("labelLink","l1",vlabel);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement07</h2>
+<p>&lt;test name='HTMLOptionElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The label attribute is used in hierarchical menus. It specifies
+ a shorter label for an option that the content of the OPTION element.
+
+ Retrieve the label attribute from the second OPTION element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40736115">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40736115</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlabel' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;label interface='HTMLOptionElement' obj='testNode' var='vlabel'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlabel' expected='"l1"' <a id="labelLink">id='labelLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement08.html
new file mode 100644
index 0000000000..8d82008f85
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement08.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The selected attribute indicates the current state of the corresponding
+ form control in an interactive user-agent.
+
+ Retrieve the selected attribute from the first OPTION element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70874476
+*/
+function HTMLOptionElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vselected;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(0);
+ vselected = testNode.defaultSelected;
+
+ assertTrue("selectedLink",vselected);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement08</h2>
+<p>&lt;test name='HTMLOptionElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The selected attribute indicates the current state of the corresponding
+ form control in an interactive user-agent.
+
+ Retrieve the selected attribute from the first OPTION element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70874476">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70874476</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vselected' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;defaultSelected interface='HTMLOptionElement' obj='testNode' var='vselected'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vselected' <a id="selectedLink">id='selectedLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement09.html
new file mode 100644
index 0000000000..692da1686f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionElement09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "option");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The value attribute contains the current form control value.
+
+ Retrieve the value attribute from the first OPTION element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6185554
+*/
+function HTMLOptionElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "option");
+ nodeList = doc.getElementsByTagName("option");
+ assertSize("Asize",10,nodeList);
+testNode = nodeList.item(0);
+ vvalue = testNode.value;
+
+ assertEquals("valueLink","10001",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionElement09</h2>
+<p>&lt;test name='HTMLOptionElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The value attribute contains the current form control value.
+
+ Retrieve the value attribute from the first OPTION element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6185554">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6185554</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='option' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='10' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLOptionElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"10001"' <a id="valueLink">id='valueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/option.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection01.html
new file mode 100644
index 0000000000..01fd99e8ae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection01.html
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionsCollection01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optionscollection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ The length attribute specifies the length or size of the list.
+
+ Retrieve the first SELECT element and create a HTMLOptionsCollection
+ of the OPTION elements. Check the size of the length of OPTION elements.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-length
+*/
+function HTMLOptionsCollection01() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionsCollection01") != null) return;
+ var nodeList;
+ var testNode;
+ var optionsList;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optionscollection");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ optionsList = testNode.options;
+
+ vlength = optionsList.length;
+
+ assertEquals("lengthLink",5,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection01</h2>
+<p>&lt;test name='HTMLOptionsCollection01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionsCollection01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ The length attribute specifies the length or size of the list.
+
+ Retrieve the first SELECT element and create a HTMLOptionsCollection
+ of the OPTION elements. Check the size of the length of OPTION elements.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-08-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-length">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-length</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsList' type='HTMLOptionsCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optionscollection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options interface='HTMLSelectElement' obj='testNode' var='optionsList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLOptionsCollection' obj='optionsList' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='5' <a id="lengthLink">id='lengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optionscollection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection02.html
new file mode 100644
index 0000000000..c08d936743
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection02.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionsCollection02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optionscollection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index=3).
+ The item() method retrieves a node specified by ordinal index.
+ Nodes are numbered in tree order. The index origin is 0.
+
+ Retrieve the first SELECT element. Create a HTMLOptionsCollection.
+ Retrieve the fourth item in the list and examine its firstChild's
+ nodeValue.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item
+*/
+function HTMLOptionsCollection02() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionsCollection02") != null) return;
+ var nodeList;
+ var testNode;
+ var optionsNode;
+ var optionsValueNode;
+ var optionsList;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optionscollection");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ optionsList = testNode.options;
+
+ optionsNode = optionsList.item(3);
+ optionsValueNode = optionsNode.firstChild;
+
+ vvalue = optionsValueNode.nodeValue;
+
+ assertEquals("valueIndexLink","EMP10004",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection02</h2>
+<p>&lt;test name='HTMLOptionsCollection02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionsCollection02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index=3).
+ The item() method retrieves a node specified by ordinal index.
+ Nodes are numbered in tree order. The index origin is 0.
+
+ Retrieve the first SELECT element. Create a HTMLOptionsCollection.
+ Retrieve the fourth item in the list and examine its firstChild's
+ nodeValue.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-08-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsValueNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsList' type='HTMLOptionsCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optionscollection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options interface='HTMLSelectElement' obj='testNode' var='optionsList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLOptionsCollection' obj='optionsList' var='optionsNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='optionsNode' var='optionsValueNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='optionsValueNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"EMP10004"' <a id="valueIndexLink">id='valueIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optionscollection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection03.html
new file mode 100644
index 0000000000..5796b4878f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection03.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionsCollection03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optionscollection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+ The namedItem method retrieves a Node using a name. It first searches
+ for a node with a matching id attribute. If it doesn't find one, it
+ then searches for a Node with a matching name attribute, but only
+ those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element. Create a HTMLCollection of the elements.
+ Search for an element that has select1 as the value for the name attribute.
+ Get the nodeName of that element.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem
+*/
+function HTMLOptionsCollection03() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionsCollection03") != null) return;
+ var nodeList;
+ var testNode;
+ var optionsNode;
+ var formsnodeList;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optionscollection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ optionsNode = formsnodeList.namedItem("select1");
+ vname = optionsNode.nodeName;
+
+ assertEqualsAutoCase("element", "nameIndexLink","select",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection03</h2>
+<p>&lt;test name='HTMLOptionsCollection03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionsCollection03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+ The namedItem method retrieves a Node using a name. It first searches
+ for a node with a matching id attribute. If it doesn't find one, it
+ then searches for a Node with a matching name attribute, but only
+ those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element. Create a HTMLCollection of the elements.
+ Search for an element that has select1 as the value for the name attribute.
+ Get the nodeName of that element.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-08-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optionscollection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem interface='HTMLOptionsCollection' obj='formsnodeList' var='optionsNode' name='"select1"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='optionsNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"select"' <a id="nameIndexLink">id='nameIndexLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optionscollection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection04.html
new file mode 100644
index 0000000000..a759055091
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection04.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionsCollection04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optionscollection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+ The namedItem method retrieves a Node using a name. It first searches
+ for a node with a matching id attribute. If it doesn't find one, it
+ then searches for a Node with a matching name attribute, but only
+ those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element. Create a HTMLCollection of the elements.
+ Search for an element that has selectId as the value for the id attribute.
+ Get the nodeName of that element.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem
+*/
+function HTMLOptionsCollection04() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionsCollection04") != null) return;
+ var nodeList;
+ var testNode;
+ var optionsNode;
+ var formsnodeList;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optionscollection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ optionsNode = formsnodeList.namedItem("selectId");
+ vname = optionsNode.nodeName;
+
+ assertEqualsAutoCase("element", "nameIndexLink","select",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection04</h2>
+<p>&lt;test name='HTMLOptionsCollection04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionsCollection04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+ The namedItem method retrieves a Node using a name. It first searches
+ for a node with a matching id attribute. If it doesn't find one, it
+ then searches for a Node with a matching name attribute, but only
+ those elements that are allowed a name attribute.
+
+ Retrieve the first FORM element. Create a HTMLCollection of the elements.
+ Search for an element that has selectId as the value for the id attribute.
+ Get the nodeName of that element.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-08-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optionscollection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem interface='HTMLOptionsCollection' obj='formsnodeList' var='optionsNode' name='"selectId"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='optionsNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"select"' <a id="nameIndexLink">id='nameIndexLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optionscollection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection05.html
new file mode 100644
index 0000000000..46922420f9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection05.html
@@ -0,0 +1,160 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionsCollection05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optionscollection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+ The namedItem method retrieves a Node using a name. It first searches
+ for a node with a matching id attribute. If it doesn't find one, it
+ then searches for a Node with a matching name attribute, but only
+ those elements that are allowed a name attribute. Upon failure(e.q., no
+ node with this name exists), returns null.
+
+ Retrieve the first FORM element. Create a HTMLCollection of the elements.
+ Search for an element that has select9 as the value for the name attribute.
+ Null should be returned since there is not any name or id attribute with
+ select9 as a value.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem
+*/
+function HTMLOptionsCollection05() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionsCollection05") != null) return;
+ var nodeList;
+ var testNode;
+ var optionsNode;
+ var formsnodeList;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optionscollection");
+ nodeList = doc.getElementsByTagName("form");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ formsnodeList = testNode.elements;
+
+ optionsNode = formsnodeList.namedItem("select9");
+ assertNull("nameIndexLink",optionsNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection05</h2>
+<p>&lt;test name='HTMLOptionsCollection05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionsCollection05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test node name).
+ The namedItem method retrieves a Node using a name. It first searches
+ for a node with a matching id attribute. If it doesn't find one, it
+ then searches for a Node with a matching name attribute, but only
+ those elements that are allowed a name attribute. Upon failure(e.q., no
+ node with this name exists), returns null.
+
+ Retrieve the first FORM element. Create a HTMLCollection of the elements.
+ Search for an element that has select9 as the value for the name attribute.
+ Null should be returned since there is not any name or id attribute with
+ select9 as a value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-08-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-namedItem</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optionscollection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"form"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;elements interface='HTMLFormElement' obj='testNode' var='formsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;namedItem interface='HTMLOptionsCollection' obj='formsnodeList' var='optionsNode' name='"select9"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='optionsNode' <a id="nameIndexLink">id='nameIndexLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optionscollection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection06.html
new file mode 100644
index 0000000000..d3638d4d00
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection06.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionsCollection06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optionscollection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index).
+ The item() method retrieves a node specified by ordinal index.
+ A value of null is returned if the index is out of range.
+
+ Retrieve the first SELECT element. Create a HTMLOptionsCollection.
+ Retrieve the tenth item in the list - null should be returned since
+ there are not 10 items in the list.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item
+*/
+function HTMLOptionsCollection06() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionsCollection06") != null) return;
+ var nodeList;
+ var testNode;
+ var optionsNode;
+ var optionsValueNode;
+ var optionsList;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optionscollection");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ optionsList = testNode.options;
+
+ optionsNode = optionsList.item(10);
+ assertNull("optionsIndexLink",optionsNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection06</h2>
+<p>&lt;test name='HTMLOptionsCollection06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionsCollection06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index).
+ The item() method retrieves a node specified by ordinal index.
+ A value of null is returned if the index is out of range.
+
+ Retrieve the first SELECT element. Create a HTMLOptionsCollection.
+ Retrieve the tenth item in the list - null should be returned since
+ there are not 10 items in the list.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-08-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsValueNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsList' type='HTMLOptionsCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optionscollection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options interface='HTMLSelectElement' obj='testNode' var='optionsList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLOptionsCollection' obj='optionsList' var='optionsNode' index='10'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='optionsNode' <a id="optionsIndexLink">id='optionsIndexLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optionscollection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection07.html
new file mode 100644
index 0000000000..b41c12c6b9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLOptionsCollection07.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLOptionsCollection07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "optionscollection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index=0).
+ The item() method retrieves a node specified by ordinal index. Nodes
+ are numbered in tree order. The index origin is 0.
+
+ Retrieve the first SELECT element. Create a HTMLOptionsCollection.
+ Retrieve the first item in the list and examine its firstChild's
+ nodeValue.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item
+*/
+function HTMLOptionsCollection07() {
+ var success;
+ if(checkInitialization(builder, "HTMLOptionsCollection07") != null) return;
+ var nodeList;
+ var testNode;
+ var optionsNode;
+ var optionsValueNode;
+ var optionsList;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "optionscollection");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ optionsList = testNode.options;
+
+ optionsNode = optionsList.item(0);
+ optionsValueNode = optionsNode.firstChild;
+
+ vvalue = optionsValueNode.nodeValue;
+
+ assertEquals("valueIndexLink","EMP10001",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLOptionsCollection07</h2>
+<p>&lt;test name='HTMLOptionsCollection07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLOptionsCollection07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ An HTMLOptionsCollection is a list of nodes representing HTML option
+ element.
+ An individual node may be accessed by either ordinal index, the node's
+ name or id attributes. (Test ordinal index=0).
+ The item() method retrieves a node specified by ordinal index. Nodes
+ are numbered in tree order. The index origin is 0.
+
+ Retrieve the first SELECT element. Create a HTMLOptionsCollection.
+ Retrieve the first item in the list and examine its firstChild's
+ nodeValue.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-08-01&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTMLOptionsCollection-item</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsValueNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsList' type='HTMLOptionsCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='optionscollection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options interface='HTMLSelectElement' obj='testNode' var='optionsList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLOptionsCollection' obj='optionsList' var='optionsNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='optionsNode' var='optionsValueNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='optionsValueNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"EMP10001"' <a id="valueIndexLink">id='valueIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/optionscollection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLParagraphElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLParagraphElement01.html
new file mode 100644
index 0000000000..3c47050e96
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLParagraphElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParagraphElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLParagraphElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "paragraph");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal text alignment.
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53465507
+*/
+function HTMLParagraphElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLParagraphElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "paragraph");
+ nodeList = doc.getElementsByTagName("p");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParagraphElement01</h2>
+<p>&lt;test name='HTMLParagraphElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLParagraphElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal text alignment.
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53465507">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53465507</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='paragraph' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"p"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLParagraphElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/paragraph.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement01.html
new file mode 100644
index 0000000000..ba01514f72
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLParamElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "param");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies the name of the run-time parameter.
+
+ Retrieve the name attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59871447
+*/
+function HTMLParamElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLParamElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "param");
+ nodeList = doc.getElementsByTagName("param");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","image3",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement01</h2>
+<p>&lt;test name='HTMLParamElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLParamElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies the name of the run-time parameter.
+
+ Retrieve the name attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59871447">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59871447</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='param' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"param"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLParamElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"image3"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/param.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement02.html
new file mode 100644
index 0000000000..c79cac1946
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLParamElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "param");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The value attribute specifies the value of the run-time parameter.
+
+ Retrieve the value attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77971357
+*/
+function HTMLParamElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLParamElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "param");
+ nodeList = doc.getElementsByTagName("param");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvalue = testNode.value;
+
+ assertURIEquals("valueLink",null,null,null,"file.gif",null,null,null,null,vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement02</h2>
+<p>&lt;test name='HTMLParamElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLParamElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The value attribute specifies the value of the run-time parameter.
+
+ Retrieve the value attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77971357">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77971357</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='param' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"param"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLParamElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vvalue' file='"file.gif"' <a id="valueLink">id='valueLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/param.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement03.html
new file mode 100644
index 0000000000..5a65288e1f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLParamElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "param");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The valueType attribute specifies information about the meaning of the
+ value specified by the value attribute.
+
+ Retrieve the valueType attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23931872
+*/
+function HTMLParamElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLParamElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vvaluetype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "param");
+ nodeList = doc.getElementsByTagName("param");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvaluetype = testNode.valueType;
+
+ assertEquals("valueTypeLink","ref",vvaluetype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement03</h2>
+<p>&lt;test name='HTMLParamElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLParamElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The valueType attribute specifies information about the meaning of the
+ value specified by the value attribute.
+
+ Retrieve the valueType attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23931872">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23931872</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvaluetype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='param' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"param"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;valueType interface='HTMLParamElement' obj='testNode' var='vvaluetype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvaluetype' expected='"ref"' <a id="valueTypeLink">id='valueTypeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/param.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement04.html
new file mode 100644
index 0000000000..a22a8f6982
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLParamElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLParamElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "param");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the content type for the value attribute
+ when valuetype has the value ref.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18179888
+*/
+function HTMLParamElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLParamElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "param");
+ nodeList = doc.getElementsByTagName("param");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","image/gif",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLParamElement04</h2>
+<p>&lt;test name='HTMLParamElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLParamElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the content type for the value attribute
+ when valuetype has the value ref.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18179888">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18179888</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='param' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"param"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLParamElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"image/gif"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/param.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLPreElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLPreElement01.html
new file mode 100644
index 0000000000..806a0b4544
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLPreElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLPreElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLPreElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "pre");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the fixed width for content.
+
+ Retrieve the width attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13894083
+*/
+function HTMLPreElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLPreElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "pre");
+ nodeList = doc.getElementsByTagName("pre");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink",277,vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLPreElement01</h2>
+<p>&lt;test name='HTMLPreElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLPreElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the fixed width for content.
+
+ Retrieve the width attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13894083">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13894083</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='pre' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"pre"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLPreElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='277' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/pre.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement01.html
new file mode 100644
index 0000000000..7a18ed3b89
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLQuoteElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLQuoteElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "quote");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cite attribute specifies a URI designating a source document
+ or message.
+
+ Retrieve the cite attribute from the Q element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53895598
+*/
+function HTMLQuoteElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLQuoteElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcite;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "quote");
+ nodeList = doc.getElementsByTagName("q");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcite = testNode.cite;
+
+ assertURIEquals("citeLink",null,null,null,"Q.html",null,null,null,null,vcite);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLQuoteElement01</h2>
+<p>&lt;test name='HTMLQuoteElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLQuoteElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cite attribute specifies a URI designating a source document
+ or message.
+
+ Retrieve the cite attribute from the Q element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53895598">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53895598</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcite' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='quote' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"q"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cite interface='HTMLQuoteElement' obj='testNode' var='vcite'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vcite' file='"Q.html"' <a id="citeLink">id='citeLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/quote.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement02.html
new file mode 100644
index 0000000000..d26872b8f8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLQuoteElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLQuoteElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLQuoteElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "quote");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cite attribute specifies a URI designating a source document
+ or message.
+
+ Retrieve the cite attribute from the BLOCKQUOTE element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53895598
+*/
+function HTMLQuoteElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLQuoteElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcite;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "quote");
+ nodeList = doc.getElementsByTagName("blockquote");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcite = testNode.cite;
+
+ assertURIEquals("citeLink",null,null,null,"BLOCKQUOTE.html",null,null,null,null,vcite);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLQuoteElement02</h2>
+<p>&lt;test name='HTMLQuoteElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLQuoteElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cite attribute specifies a URI designating a source document
+ or message.
+
+ Retrieve the cite attribute from the BLOCKQUOTE element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53895598">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53895598</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcite' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='quote' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"blockquote"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cite interface='HTMLQuoteElement' obj='testNode' var='vcite'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vcite' file='"BLOCKQUOTE.html"' <a id="citeLink">id='citeLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/quote.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement01.html
new file mode 100644
index 0000000000..43e488f372
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLScriptElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "script");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The text attribute specifies the script content of the element.
+
+ Retrieve the text attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46872999
+*/
+function HTMLScriptElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLScriptElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vtext;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "script");
+ nodeList = doc.getElementsByTagName("script");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtext = testNode.text;
+
+ assertEquals("textLink","var a=2;",vtext);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement01</h2>
+<p>&lt;test name='HTMLScriptElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLScriptElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The text attribute specifies the script content of the element.
+
+ Retrieve the text attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46872999">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46872999</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtext' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='script' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"script"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;text interface='HTMLScriptElement' obj='testNode' var='vtext'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtext' expected='"var a=2;"' <a id="textLink">id='textLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/script.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement02.html
new file mode 100644
index 0000000000..45613a60f0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLScriptElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "script");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The charset attribute specifies the character encoding of the linked
+ resource.
+
+ Retrieve the charset attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35305677
+*/
+function HTMLScriptElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLScriptElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharset;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "script");
+ nodeList = doc.getElementsByTagName("script");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcharset = testNode.charset;
+
+ assertEquals("charsetLink","US-ASCII",vcharset);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement02</h2>
+<p>&lt;test name='HTMLScriptElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLScriptElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The charset attribute specifies the character encoding of the linked
+ resource.
+
+ Retrieve the charset attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35305677">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35305677</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharset' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='script' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"script"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;charset interface='HTMLScriptElement' obj='testNode' var='vcharset'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharset' expected='"US-ASCII"' <a id="charsetLink">id='charsetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/script.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement03.html
new file mode 100644
index 0000000000..db02ff8e4e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLScriptElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "script");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The defer attribute specifies the user agent can defer processing of
+ the script.
+
+ Retrieve the defer attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93788534
+*/
+function HTMLScriptElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLScriptElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vdefer;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "script");
+ nodeList = doc.getElementsByTagName("script");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdefer = testNode.defer;
+
+ assertTrue("deferLink",vdefer);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement03</h2>
+<p>&lt;test name='HTMLScriptElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLScriptElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The defer attribute specifies the user agent can defer processing of
+ the script.
+
+ Retrieve the defer attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93788534">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93788534</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdefer' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='script' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"script"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;defer interface='HTMLScriptElement' obj='testNode' var='vdefer'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdefer' <a id="deferLink">id='deferLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/script.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement04.html
new file mode 100644
index 0000000000..5d509e4982
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLScriptElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "script");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The src attribute specifies a URI designating an external script.
+
+ Retrieve the src attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75147231
+*/
+function HTMLScriptElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLScriptElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vsrc;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "script");
+ nodeList = doc.getElementsByTagName("script");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vsrc = testNode.src;
+
+ assertURIEquals("srcLink",null,null,null,"script1.js",null,null,null,null,vsrc);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement04</h2>
+<p>&lt;test name='HTMLScriptElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLScriptElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The src attribute specifies a URI designating an external script.
+
+ Retrieve the src attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75147231">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75147231</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsrc' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='script' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"script"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;src interface='HTMLScriptElement' obj='testNode' var='vsrc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vsrc' file='"script1.js"' <a id="srcLink">id='srcLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/script.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement05.html
new file mode 100644
index 0000000000..a36529b3e1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement05.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLScriptElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "script");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the content of the script language.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30534818
+*/
+function HTMLScriptElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLScriptElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "script");
+ nodeList = doc.getElementsByTagName("script");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","text/javaScript",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement05</h2>
+<p>&lt;test name='HTMLScriptElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLScriptElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the content of the script language.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30534818">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30534818</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='script' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"script"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLScriptElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"text/javaScript"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/script.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement06.html
new file mode 100644
index 0000000000..9609977cbc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement06.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLScriptElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "script");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+htmlFor is described as for future use. Test accesses the value, but makes no assertions about its value.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66979266
+*/
+function HTMLScriptElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLScriptElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var htmlFor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "script");
+ nodeList = doc.getElementsByTagName("script");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ htmlFor = testNode.htmlFor;
+
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement06</h2>
+<p>&lt;test name='HTMLScriptElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLScriptElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+htmlFor is described as for future use. Test accesses the value, but makes no assertions about its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66979266">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66979266</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='htmlFor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='script' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"script"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;htmlFor interface='HTMLScriptElement' obj='testNode' var='htmlFor'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/script.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement07.html
new file mode 100644
index 0000000000..6fad56b2f0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLScriptElement07.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLScriptElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "script");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+event is described as for future use. Test accesses the value, but makes no assertions about its value.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-56700403
+*/
+function HTMLScriptElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLScriptElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var event;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "script");
+ nodeList = doc.getElementsByTagName("script");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ event = testNode.event;
+
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLScriptElement07</h2>
+<p>&lt;test name='HTMLScriptElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLScriptElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+event is described as for future use. Test accesses the value, but makes no assertions about its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-56700403">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-56700403</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='event' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='script' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"script"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;event interface='HTMLScriptElement' obj='testNode' var='event'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/script.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement01.html
new file mode 100644
index 0000000000..3c2d78628e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute is the string "select-multiple" when multiple
+ attribute is true.
+
+ Retrieve the type attribute from the first SELECT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58783172
+*/
+function HTMLSelectElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","select-multiple",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement01</h2>
+<p>&lt;test name='HTMLSelectElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute is the string "select-multiple" when multiple
+ attribute is true.
+
+ Retrieve the type attribute from the first SELECT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58783172">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58783172</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLSelectElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"select-multiple"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement02.html
new file mode 100644
index 0000000000..ca1d52fc03
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The selectedIndex attribute specifies the ordinal index of the selected
+ option.
+
+ Retrieve the selectedIndex attribute from the first SELECT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85676760
+*/
+function HTMLSelectElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vselectedindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vselectedindex = testNode.selectedIndex;
+
+ assertEquals("selectedIndexLink",0,vselectedindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement02</h2>
+<p>&lt;test name='HTMLSelectElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The selectedIndex attribute specifies the ordinal index of the selected
+ option.
+
+ Retrieve the selectedIndex attribute from the first SELECT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85676760">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85676760</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vselectedindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;selectedIndex interface='HTMLSelectElement' obj='testNode' var='vselectedindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vselectedindex' expected='0' <a id="selectedIndexLink">id='selectedIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement03.html
new file mode 100644
index 0000000000..3fed838e63
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement03.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The selectedIndex attribute specifies the ordinal index of the selected
+ option. If no element is selected -1 is returned.
+
+ Retrieve the selectedIndex attribute from the second SELECT element and
+ examine its value.
+
+ Per http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1,
+ without an explicit selected attribute, user agent behavior is
+ undefined. There is no way to coerce no option to be selected.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85676760
+*/
+function HTMLSelectElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vselectedindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vselectedindex = testNode.selectedIndex;
+
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement03</h2>
+<p>&lt;test name='HTMLSelectElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The selectedIndex attribute specifies the ordinal index of the selected
+ option. If no element is selected -1 is returned.
+
+ Retrieve the selectedIndex attribute from the second SELECT element and
+ examine its value.
+
+ Per http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1,
+ without an explicit selected attribute, user agent behavior is
+ undefined. There is no way to coerce no option to be selected.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85676760">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85676760</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vselectedindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;selectedIndex interface='HTMLSelectElement' obj='testNode' var='vselectedindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- Commented assertion per section 17.6.3 --&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- assertEquals actual="vselectedindex" expected="-1" id="selectedIndexLink" ignoreCase="false"/ --&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement04.html
new file mode 100644
index 0000000000..6300196dd9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The value attribute specifies the current form control value.
+
+ Retrieve the value attribute from the first SELECT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59351919
+*/
+function HTMLSelectElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vvalue = testNode.value;
+
+ assertEquals("valueLink","EMP1",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement04</h2>
+<p>&lt;test name='HTMLSelectElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The value attribute specifies the current form control value.
+
+ Retrieve the value attribute from the first SELECT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59351919">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59351919</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLSelectElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"EMP1"' <a id="valueLink">id='valueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement05.html
new file mode 100644
index 0000000000..a81c6bca81
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement05.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The length attribute specifies the number of options in this select.
+
+ Retrieve the length attribute from the first SELECT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5933486
+*/
+function HTMLSelectElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vlength = testNode.length;
+
+ assertEquals("lengthLink",5,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement05</h2>
+<p>&lt;test name='HTMLSelectElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The length attribute specifies the number of options in this select.
+
+ Retrieve the length attribute from the first SELECT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5933486">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5933486</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vlength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLSelectElement' obj='testNode' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='5' <a id="lengthLink">id='lengthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement06.html
new file mode 100644
index 0000000000..bf90e3aa10
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement06.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first SELECT element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20489458
+*/
+function HTMLSelectElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var fNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form1",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement06</h2>
+<p>&lt;test name='HTMLSelectElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first SELECT element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20489458">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20489458</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLSelectElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form1"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement07.html
new file mode 100644
index 0000000000..0bcaef7c5b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ a form.
+
+ Retrieve the second SELECT element and
+ examine its form element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20489458
+*/
+function HTMLSelectElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement07</h2>
+<p>&lt;test name='HTMLSelectElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ a form.
+
+ Retrieve the second SELECT element and
+ examine its form element.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20489458">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20489458</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLSelectElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement08.html
new file mode 100644
index 0000000000..05d58530ef
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement08.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The options attribute returns a collection of OPTION elements contained
+ by this element.
+
+ Retrieve the options attribute from the first SELECT element and
+ examine the items of the returned collection.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30606413
+*/
+function HTMLSelectElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement08") != null) return;
+ var nodeList;
+ var optionsnodeList;
+ var testNode;
+ var vareas;
+ var doc;
+ var optionName;
+ var voption;
+ var result = new Array();
+
+ expectedOptions = new Array();
+ expectedOptions[0] = "option";
+ expectedOptions[1] = "option";
+ expectedOptions[2] = "option";
+ expectedOptions[3] = "option";
+ expectedOptions[4] = "option";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ optionsnodeList = testNode.options;
+
+ for(var indexN10070 = 0;indexN10070 < optionsnodeList.length; indexN10070++) {
+ voption = optionsnodeList.item(indexN10070);
+ optionName = voption.nodeName;
+
+ result[result.length] = optionName;
+
+ }
+ assertEqualsListAutoCase("element", "optionsLink",expectedOptions,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement08</h2>
+<p>&lt;test name='HTMLSelectElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The options attribute returns a collection of OPTION elements contained
+ by this element.
+
+ Retrieve the options attribute from the first SELECT element and
+ examine the items of the returned collection.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30606413">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30606413</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vareas' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optionName' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='voption' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='result' type='List'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='expectedOptions' type='List'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/var&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options interface='HTMLSelectElement' obj='testNode' var='optionsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;for-each collection='optionsnodeList' member='voption'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='voption' var='optionName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='optionName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/for-each&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='result' expected='expectedOptions' <a id="optionsLink">id='optionsLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement09.html
new file mode 100644
index 0000000000..268628c7f0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement09.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute indicates that this control is not available
+ within this context.
+
+ Retrieve the disabled attribute from the third SELECT element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79102918
+*/
+function HTMLSelectElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(2);
+ vdisabled = testNode.disabled;
+
+ assertTrue("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement09</h2>
+<p>&lt;test name='HTMLSelectElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute indicates that this control is not available
+ within this context.
+
+ Retrieve the disabled attribute from the third SELECT element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79102918">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79102918</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLSelectElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement10.html
new file mode 100644
index 0000000000..875bed5983
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The multiple attribute(if true) indicates that multiple OPTION elements
+ may be selected
+
+ Retrieve the multiple attribute from the first SELECT element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13246613
+*/
+function HTMLSelectElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vmultiple;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vmultiple = testNode.multiple;
+
+ assertTrue("multipleLink",vmultiple);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement10</h2>
+<p>&lt;test name='HTMLSelectElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The multiple attribute(if true) indicates that multiple OPTION elements
+ may be selected
+
+ Retrieve the multiple attribute from the first SELECT element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13246613">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13246613</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmultiple' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;multiple interface='HTMLSelectElement' obj='testNode' var='vmultiple'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vmultiple' <a id="multipleLink">id='multipleLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement11.html
new file mode 100644
index 0000000000..7594a3bb72
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement11.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies the form control or object name when
+ submitted with a form.
+
+ Retrieve the name attribute from the first SELECT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41636323
+*/
+function HTMLSelectElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","select1",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement11</h2>
+<p>&lt;test name='HTMLSelectElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies the form control or object name when
+ submitted with a form.
+
+ Retrieve the name attribute from the first SELECT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41636323">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41636323</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLSelectElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"select1"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement12.html
new file mode 100644
index 0000000000..803b7953d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement12.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The size attribute specifies the number of visible rows.
+
+ Retrieve the size attribute from the first SELECT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18293826
+*/
+function HTMLSelectElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vsize;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vsize = testNode.size;
+
+ assertEquals("sizeLink",1,vsize);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement12</h2>
+<p>&lt;test name='HTMLSelectElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The size attribute specifies the number of visible rows.
+
+ Retrieve the size attribute from the first SELECT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18293826">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18293826</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsize' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size interface='HTMLSelectElement' obj='testNode' var='vsize'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsize' expected='1' <a id="sizeLink">id='sizeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement13.html
new file mode 100644
index 0000000000..7e79e15d11
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement13.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tabIndex attribute specifies an index that represents the elements
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute from the first SELECT element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40676705
+*/
+function HTMLSelectElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",7,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement13</h2>
+<p>&lt;test name='HTMLSelectElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tabIndex attribute specifies an index that represents the elements
+ position in the tabbing order.
+
+ Retrieve the tabIndex attribute from the first SELECT element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40676705">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40676705</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLSelectElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='7' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement14.html
new file mode 100644
index 0000000000..cf63a9f0c4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement14.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+focus should give the select element input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32130014
+*/
+function HTMLSelectElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ testNode.focus();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement14</h2>
+<p>&lt;test name='HTMLSelectElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+focus should give the select element input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32130014">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32130014</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;focus interface='HTMLSelectElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement15.html
new file mode 100644
index 0000000000..ada148e6d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement15.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+blur should surrender input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-28216144
+*/
+function HTMLSelectElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ testNode.blur();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement15</h2>
+<p>&lt;test name='HTMLSelectElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+blur should surrender input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-28216144">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-28216144</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;blur interface='HTMLSelectElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement16.html
new file mode 100644
index 0000000000..f829270ce0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement16.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Removes an option using HTMLSelectElement.remove.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33404570
+*/
+function HTMLSelectElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+ var optLength;
+ var selected;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ testNode.remove(0);
+ optLength = testNode.length;
+
+ assertEquals("optLength",4,optLength);
+ selected = testNode.selectedIndex;
+
+ assertEquals("selected",-1,selected);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement16</h2>
+<p>&lt;test name='HTMLSelectElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Removes an option using HTMLSelectElement.remove.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33404570">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33404570</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optLength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='selected' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;remove interface='HTMLSelectElement' obj='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLSelectElement' obj='testNode' var='optLength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='optLength' expected='4' <a id="optLength">id='optLength'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;selectedIndex interface='HTMLSelectElement' obj='testNode' var='selected'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='selected' expected='-1' <a id="selected">id='selected'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement17.html
new file mode 100644
index 0000000000..8090af6a93
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement17.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Removes a non-existant option using HTMLSelectElement.remove.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33404570
+*/
+function HTMLSelectElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+ var optLength;
+ var selected;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ testNode.remove(6);
+ optLength = testNode.length;
+
+ assertEquals("optLength",5,optLength);
+ selected = testNode.selectedIndex;
+
+ assertEquals("selected",0,selected);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement17</h2>
+<p>&lt;test name='HTMLSelectElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Removes a non-existant option using HTMLSelectElement.remove.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33404570">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33404570</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optLength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='selected' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;remove interface='HTMLSelectElement' obj='testNode' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLSelectElement' obj='testNode' var='optLength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='optLength' expected='5' <a id="optLength">id='optLength'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;selectedIndex interface='HTMLSelectElement' obj='testNode' var='selected'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='selected' expected='0' <a id="selected">id='selected'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement18.html
new file mode 100644
index 0000000000..c5839fcfa9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement18.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Add a new option at the end of an select using HTMLSelectElement.add.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14493106
+*/
+function HTMLSelectElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+ var optLength;
+ var selected;
+ var newOpt;
+ var newOptText;
+ var opt;
+ var optText;
+ var optValue;
+ var retNode;
+ var nullNode = null;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ newOpt = doc.createElement("option");
+ newOptText = doc.createTextNode("EMP31415");
+ retNode = newOpt.appendChild(newOptText);
+ testNode.add(newOpt,nullNode);
+ optLength = testNode.length;
+
+ assertEquals("optLength",6,optLength);
+ selected = testNode.selectedIndex;
+
+ assertEquals("selected",0,selected);
+ opt = testNode.lastChild;
+
+ optText = opt.firstChild;
+
+ optValue = optText.nodeValue;
+
+ assertEquals("lastValue","EMP31415",optValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement18</h2>
+<p>&lt;test name='HTMLSelectElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Add a new option at the end of an select using HTMLSelectElement.add.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14493106">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14493106</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optLength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='selected' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newOpt' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newOptText' type='Text'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='opt' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optText' type='Text'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optValue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='retNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nullNode' type='Node' isNull='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createElement var='newOpt' obj='doc' tagName='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createTextNode var='newOptText' obj='doc' data='"EMP31415"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;appendChild var='retNode' obj='newOpt' newChild='newOptText'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add interface='HTMLSelectElement' obj='testNode' element='newOpt' before='nullNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLSelectElement' obj='testNode' var='optLength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='optLength' expected='6' <a id="optLength">id='optLength'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;selectedIndex interface='HTMLSelectElement' obj='testNode' var='selected'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='selected' expected='0' <a id="selected">id='selected'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lastChild var='opt' obj='testNode' interface='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild var='optText' obj='opt' interface='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue var='optValue' obj='optText'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='optValue' expected='"EMP31415"' <a id="lastValue">id='lastValue'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement19.html
new file mode 100644
index 0000000000..ea8b546d84
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement19.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Add a new option before the selected node using HTMLSelectElement.add.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14493106
+*/
+function HTMLSelectElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+ var optLength;
+ var selected;
+ var newOpt;
+ var newOptText;
+ var opt;
+ var optText;
+ var optValue;
+ var retNode;
+ var options;
+ var selectedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ newOpt = doc.createElement("option");
+ newOptText = doc.createTextNode("EMP31415");
+ retNode = newOpt.appendChild(newOptText);
+ options = testNode.options;
+
+ selectedNode = options.item(0);
+ testNode.add(newOpt,selectedNode);
+ optLength = testNode.length;
+
+ assertEquals("optLength",6,optLength);
+ selected = testNode.selectedIndex;
+
+ assertEquals("selected",1,selected);
+ options = testNode.options;
+
+ opt = options.item(0);
+ optText = opt.firstChild;
+
+ optValue = optText.nodeValue;
+
+ assertEquals("lastValue","EMP31415",optValue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement19</h2>
+<p>&lt;test name='HTMLSelectElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Add a new option before the selected node using HTMLSelectElement.add.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14493106">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14493106</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optLength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='selected' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newOpt' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newOptText' type='Text'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='opt' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optText' type='Text'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optValue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='retNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='options' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='selectedNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createElement var='newOpt' obj='doc' tagName='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createTextNode var='newOptText' obj='doc' data='"EMP31415"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;appendChild var='retNode' obj='newOpt' newChild='newOptText'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options var='options' obj='testNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item var='selectedNode' obj='options' index='0' interface='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add interface='HTMLSelectElement' obj='testNode' element='newOpt' before='selectedNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLSelectElement' obj='testNode' var='optLength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='optLength' expected='6' <a id="optLength">id='optLength'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;selectedIndex interface='HTMLSelectElement' obj='testNode' var='selected'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='selected' expected='1' <a id="selected">id='selected'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options var='options' obj='testNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item var='opt' obj='options' index='0' interface='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild var='optText' obj='opt' interface='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue var='optValue' obj='optText'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='optValue' expected='"EMP31415"' <a id="lastValue">id='lastValue'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement20.html
new file mode 100644
index 0000000000..328319679d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLSelectElement20.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLSelectElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "select");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Attempting to add an new option using HTMLSelectElement.add before a node that is not a child of the select
+element should raise a NOT_FOUND_ERR.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-14493106
+*/
+function HTMLSelectElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLSelectElement20") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+ var optLength;
+ var selected;
+ var newOpt;
+ var newOptText;
+ var retNode;
+ var options;
+ var otherSelect;
+ var selectedNode;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "select");
+ nodeList = doc.getElementsByTagName("select");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ otherSelect = nodeList.item(1);
+ newOpt = doc.createElement("option");
+ newOptText = doc.createTextNode("EMP31415");
+ retNode = newOpt.appendChild(newOptText);
+ options = otherSelect.options;
+
+ selectedNode = options.item(0);
+
+ {
+ success = false;
+ try {
+ testNode.add(newOpt,selectedNode);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 8);
+ }
+ assertTrue("throw_NOT_FOUND_ERR",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement20</h2>
+<p>&lt;test name='HTMLSelectElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLSelectElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Attempting to add an new option using HTMLSelectElement.add before a node that is not a child of the select
+element should raise a NOT_FOUND_ERR.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-14493106">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-14493106</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='optLength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='selected' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newOpt' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newOptText' type='Text'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='retNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='options' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='otherSelect' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='selectedNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='select' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"select"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='otherSelect' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createElement var='newOpt' obj='doc' tagName='"option"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createTextNode var='newOptText' obj='doc' data='"EMP31415"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;appendChild var='retNode' obj='newOpt' newChild='newOptText'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;options var='options' obj='otherSelect'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item var='selectedNode' obj='options' index='0' interface='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="throw_NOT_FOUND_ERR">id='throw_NOT_FOUND_ERR'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;NOT_FOUND_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add interface='HTMLSelectElement' obj='testNode' element='newOpt' before='selectedNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/NOT_FOUND_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/select.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement01.html
new file mode 100644
index 0000000000..d7d0299df3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLStyleElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLStyleElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "style");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute enables/disables the stylesheet.
+
+ Retrieve the disabled attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-51162010
+*/
+function HTMLStyleElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLStyleElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "style");
+ nodeList = doc.getElementsByTagName("style");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vdisabled = testNode.disabled;
+
+ assertFalse("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLStyleElement01</h2>
+<p>&lt;test name='HTMLStyleElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLStyleElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute enables/disables the stylesheet.
+
+ Retrieve the disabled attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-51162010">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-51162010</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='style' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"style"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLStyleElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertFalse actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/style.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement02.html
new file mode 100644
index 0000000000..2d3836e30a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLStyleElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLStyleElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "style");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The media attribute identifies the intended medium of the style info.
+
+ Retrieve the media attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76412738
+*/
+function HTMLStyleElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLStyleElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vmedia;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "style");
+ nodeList = doc.getElementsByTagName("style");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vmedia = testNode.media;
+
+ assertEquals("mediaLink","screen",vmedia);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLStyleElement02</h2>
+<p>&lt;test name='HTMLStyleElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLStyleElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The media attribute identifies the intended medium of the style info.
+
+ Retrieve the media attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76412738">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76412738</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vmedia' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='style' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"style"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;media interface='HTMLStyleElement' obj='testNode' var='vmedia'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vmedia' expected='"screen"' <a id="mediaLink">id='mediaLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/style.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement03.html
new file mode 100644
index 0000000000..085162e8a2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLStyleElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLStyleElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLStyleElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "style");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the style sheet language(Internet media type).
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22472002
+*/
+function HTMLStyleElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLStyleElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "style");
+ nodeList = doc.getElementsByTagName("style");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","text/css",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLStyleElement03</h2>
+<p>&lt;test name='HTMLStyleElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLStyleElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the style sheet language(Internet media type).
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22472002">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22472002</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='style' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"style"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLStyleElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"text/css"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/style.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCaptionElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCaptionElement01.html
new file mode 100644
index 0000000000..1c14c4efe7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCaptionElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCaptionElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCaptionElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecaption");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the caption alignment with respect to
+ the table.
+
+ Retrieve the align attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79875068
+*/
+function HTMLTableCaptionElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCaptionElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecaption");
+ nodeList = doc.getElementsByTagName("caption");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","top",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCaptionElement01</h2>
+<p>&lt;test name='HTMLTableCaptionElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCaptionElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the caption alignment with respect to
+ the table.
+
+ Retrieve the align attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79875068">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79875068</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecaption' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"caption"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableCaptionElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"top"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecaption.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement01.html
new file mode 100644
index 0000000000..6ba550abcb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cellIndex attribute specifies the index of this cell in the row(TH).
+
+ Retrieve the cellIndex attribute of the first TH element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363
+*/
+function HTMLTableCellElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcellindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(0);
+ vcellindex = testNode.cellIndex;
+
+ assertEquals("cellIndexLink",0,vcellindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement01</h2>
+<p>&lt;test name='HTMLTableCellElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cellIndex attribute specifies the index of this cell in the row(TH).
+
+ Retrieve the cellIndex attribute of the first TH element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcellindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cellIndex interface='HTMLTableCellElement' obj='testNode' var='vcellindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcellindex' expected='0' <a id="cellIndexLink">id='cellIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement02.html
new file mode 100644
index 0000000000..ae0f5cc064
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement02.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cellIndex attribute specifies the index of this cell in the row(TD).
+
+ Retrieve the cellIndex attribute of the first TD element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363
+*/
+function HTMLTableCellElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcellindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(0);
+ vcellindex = testNode.cellIndex;
+
+ assertEquals("cellIndexLink",0,vcellindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement02</h2>
+<p>&lt;test name='HTMLTableCellElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cellIndex attribute specifies the index of this cell in the row(TD).
+
+ Retrieve the cellIndex attribute of the first TD element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcellindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cellIndex interface='HTMLTableCellElement' obj='testNode' var='vcellindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcellindex' expected='0' <a id="cellIndexLink">id='cellIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement03.html
new file mode 100644
index 0000000000..f4f4ecacbe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement03.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The abbr attribute specifies the abbreviation for table header cells(TH).
+
+ Retrieve the abbr attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037
+*/
+function HTMLTableCellElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vabbr;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vabbr = testNode.abbr;
+
+ assertEquals("abbrLink","hd1",vabbr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement03</h2>
+<p>&lt;test name='HTMLTableCellElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The abbr attribute specifies the abbreviation for table header cells(TH).
+
+ Retrieve the abbr attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vabbr' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;abbr interface='HTMLTableCellElement' obj='testNode' var='vabbr'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vabbr' expected='"hd1"' <a id="abbrLink">id='abbrLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement04.html
new file mode 100644
index 0000000000..0a4bc172a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement04.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The abbr attribute specifies the abbreviation for table data cells(TD).
+
+ Retrieve the abbr attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037
+*/
+function HTMLTableCellElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vabbr;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vabbr = testNode.abbr;
+
+ assertEquals("abbrLink","hd2",vabbr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement04</h2>
+<p>&lt;test name='HTMLTableCellElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The abbr attribute specifies the abbreviation for table data cells(TD).
+
+ Retrieve the abbr attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vabbr' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;abbr interface='HTMLTableCellElement' obj='testNode' var='vabbr'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vabbr' expected='"hd2"' <a id="abbrLink">id='abbrLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement05.html
new file mode 100644
index 0000000000..2bc8733184
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement05.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment for table
+ header cells(TH).
+
+ Retrieve the align attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879
+*/
+function HTMLTableCellElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement05</h2>
+<p>&lt;test name='HTMLTableCellElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment for table
+ header cells(TH).
+
+ Retrieve the align attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableCellElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement06.html
new file mode 100644
index 0000000000..bca537692b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment for table
+ data cells(TD).
+
+ Retrieve the align attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879
+*/
+function HTMLTableCellElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement06</h2>
+<p>&lt;test name='HTMLTableCellElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment for table
+ data cells(TD).
+
+ Retrieve the align attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableCellElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement07.html
new file mode 100644
index 0000000000..56ff764300
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The axis attribute specifies the names group of related headers for table
+ header cells(TH).
+
+ Retrieve the align attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418
+*/
+function HTMLTableCellElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vaxis;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vaxis = testNode.axis;
+
+ assertEquals("axisLink","center",vaxis);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement07</h2>
+<p>&lt;test name='HTMLTableCellElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The axis attribute specifies the names group of related headers for table
+ header cells(TH).
+
+ Retrieve the align attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaxis' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;axis interface='HTMLTableCellElement' obj='testNode' var='vaxis'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaxis' expected='"center"' <a id="axisLink">id='axisLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement08.html
new file mode 100644
index 0000000000..d8ef6e2c7b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement08.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The axis attribute specifies the names group of related headers for table
+ data cells(TD).
+
+ Retrieve the axis attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418
+*/
+function HTMLTableCellElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vaxis;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vaxis = testNode.axis;
+
+ assertEquals("axisLink","center",vaxis);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement08</h2>
+<p>&lt;test name='HTMLTableCellElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The axis attribute specifies the names group of related headers for table
+ data cells(TD).
+
+ Retrieve the axis attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaxis' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;axis interface='HTMLTableCellElement' obj='testNode' var='vaxis'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaxis' expected='"center"' <a id="axisLink">id='axisLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement09.html
new file mode 100644
index 0000000000..8e1f04a6b8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement09.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The bgColor attribute specifies the cells background color for
+ table header cells(TH).
+
+ Retrieve the bgColor attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431
+*/
+function HTMLTableCellElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgColorLink","#00FFFF".toLowerCase(),vbgcolor.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement09</h2>
+<p>&lt;test name='HTMLTableCellElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The bgColor attribute specifies the cells background color for
+ table header cells(TH).
+
+ Retrieve the bgColor attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLTableCellElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#00FFFF"' <a id="bgColorLink">id='bgColorLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement10.html
new file mode 100644
index 0000000000..032bdb4877
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The bgColor attribute specifies the cells background color for table
+ data cells(TD).
+
+ Retrieve the bgColor attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431
+*/
+function HTMLTableCellElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgColorLink","#FF0000".toLowerCase(),vbgcolor.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement10</h2>
+<p>&lt;test name='HTMLTableCellElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The bgColor attribute specifies the cells background color for table
+ data cells(TD).
+
+ Retrieve the bgColor attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLTableCellElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#FF0000"' <a id="bgColorLink">id='bgColorLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement11.html
new file mode 100644
index 0000000000..f2ebe30902
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement11.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The char attribute specifies the alignment character for cells in a column
+ of table header cells(TH).
+
+ Retrieve the char attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780
+*/
+function HTMLTableCellElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vch = testNode.ch;
+
+ assertEquals("chLink",":",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement11</h2>
+<p>&lt;test name='HTMLTableCellElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The char attribute specifies the alignment character for cells in a column
+ of table header cells(TH).
+
+ Retrieve the char attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableCellElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='":"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement12.html
new file mode 100644
index 0000000000..7b72839190
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement12.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The char attribute specifies the alignment character for cells in a column
+ of table data cells(TD).
+
+ Retrieve the char attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780
+*/
+function HTMLTableCellElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vch = testNode.ch;
+
+ assertEquals("chLink",":",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement12</h2>
+<p>&lt;test name='HTMLTableCellElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The char attribute specifies the alignment character for cells in a column
+ of table data cells(TD).
+
+ Retrieve the char attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableCellElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='":"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement13.html
new file mode 100644
index 0000000000..89bee078a6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement13.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The charoff attribute specifies the offset of alignment characacter
+ of table header cells(TH).
+
+ Retrieve the charoff attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310
+*/
+function HTMLTableCellElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vcharoff = testNode.chOff;
+
+ assertEquals("chOffLink","1",vcharoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement13</h2>
+<p>&lt;test name='HTMLTableCellElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The charoff attribute specifies the offset of alignment characacter
+ of table header cells(TH).
+
+ Retrieve the charoff attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableCellElement' obj='testNode' var='vcharoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharoff' expected='"1"' <a id="chOffLink">id='chOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement14.html
new file mode 100644
index 0000000000..96e0286baf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement14.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The charoff attribute specifies the offset of alignment character
+ of table data cells(TD).
+
+ Retrieve the charoff attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310
+*/
+function HTMLTableCellElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vcharoff = testNode.chOff;
+
+ assertEquals("chOffLink","1",vcharoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement14</h2>
+<p>&lt;test name='HTMLTableCellElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The charoff attribute specifies the offset of alignment character
+ of table data cells(TD).
+
+ Retrieve the charoff attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableCellElement' obj='testNode' var='vcharoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharoff' expected='"1"' <a id="chOffLink">id='chOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement15.html
new file mode 100644
index 0000000000..278bb4d8f4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement15.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The colSpan attribute specifies the number of columns spanned by a table
+ header(TH) cell.
+
+ Retrieve the colspan attribute of the second TH element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244
+*/
+function HTMLTableCellElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var vcolspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vcolspan = testNode.colSpan;
+
+ assertEquals("colSpanLink",1,vcolspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement15</h2>
+<p>&lt;test name='HTMLTableCellElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The colSpan attribute specifies the number of columns spanned by a table
+ header(TH) cell.
+
+ Retrieve the colspan attribute of the second TH element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcolspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;colSpan interface='HTMLTableCellElement' obj='testNode' var='vcolspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcolspan' expected='1' <a id="colSpanLink">id='colSpanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement16.html
new file mode 100644
index 0000000000..935cb0300e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement16.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The colSpan attribute specifies the number of columns spanned by a
+ table data(TD) cell.
+
+ Retrieve the colSpan attribute of the second TD element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244
+*/
+function HTMLTableCellElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var vcolspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vcolspan = testNode.colSpan;
+
+ assertEquals("colSpanLink",1,vcolspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement16</h2>
+<p>&lt;test name='HTMLTableCellElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The colSpan attribute specifies the number of columns spanned by a
+ table data(TD) cell.
+
+ Retrieve the colSpan attribute of the second TD element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcolspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;colSpan interface='HTMLTableCellElement' obj='testNode' var='vcolspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcolspan' expected='1' <a id="colSpanLink">id='colSpanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement17.html
new file mode 100644
index 0000000000..67d5ac17b8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement17.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The headers attribute specifies a list of id attribute values for
+ table header cells(TH).
+
+ Retrieve the headers attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817
+*/
+function HTMLTableCellElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var vheaders;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vheaders = testNode.headers;
+
+ assertEquals("headersLink","header-1",vheaders);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement17</h2>
+<p>&lt;test name='HTMLTableCellElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The headers attribute specifies a list of id attribute values for
+ table header cells(TH).
+
+ Retrieve the headers attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheaders' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;headers interface='HTMLTableCellElement' obj='testNode' var='vheaders'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheaders' expected='"header-1"' <a id="headersLink">id='headersLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement18.html
new file mode 100644
index 0000000000..8e61c56593
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement18.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The headers attribute specifies a list of id attribute values for
+ table data cells(TD).
+
+ Retrieve the headers attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817
+*/
+function HTMLTableCellElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var vheaders;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vheaders = testNode.headers;
+
+ assertEquals("headersLink","header-3",vheaders);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement18</h2>
+<p>&lt;test name='HTMLTableCellElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The headers attribute specifies a list of id attribute values for
+ table data cells(TD).
+
+ Retrieve the headers attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheaders' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;headers interface='HTMLTableCellElement' obj='testNode' var='vheaders'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheaders' expected='"header-3"' <a id="headersLink">id='headersLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement19.html
new file mode 100644
index 0000000000..7d13255cd0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement19.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The height attribute specifies the cell height.
+
+ Retrieve the height attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212
+*/
+function HTMLTableCellElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var vheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vheight = testNode.height;
+
+ assertEquals("heightLink","50",vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement19</h2>
+<p>&lt;test name='HTMLTableCellElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The height attribute specifies the cell height.
+
+ Retrieve the height attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height interface='HTMLTableCellElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='"50"' <a id="heightLink">id='heightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement20.html
new file mode 100644
index 0000000000..249c18aba1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement20.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The height attribute specifies the cell height.
+
+ Retrieve the height attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212
+*/
+function HTMLTableCellElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement20") != null) return;
+ var nodeList;
+ var testNode;
+ var vheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vheight = testNode.height;
+
+ assertEquals("heightLink","50",vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement20</h2>
+<p>&lt;test name='HTMLTableCellElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The height attribute specifies the cell height.
+
+ Retrieve the height attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height interface='HTMLTableCellElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='"50"' <a id="heightLink">id='heightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement21.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement21.html
new file mode 100644
index 0000000000..639ff2218a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement21.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The noWrap attribute supresses word wrapping.
+
+ Retrieve the noWrap attribute of the second TH Element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045
+*/
+function HTMLTableCellElement21() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement21") != null) return;
+ var nodeList;
+ var testNode;
+ var vnowrap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vnowrap = testNode.noWrap;
+
+ assertTrue("noWrapLink",vnowrap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement21</h2>
+<p>&lt;test name='HTMLTableCellElement21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The noWrap attribute supresses word wrapping.
+
+ Retrieve the noWrap attribute of the second TH Element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vnowrap' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;noWrap interface='HTMLTableCellElement' obj='testNode' var='vnowrap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vnowrap' <a id="noWrapLink">id='noWrapLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement22.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement22.html
new file mode 100644
index 0000000000..fb390e2968
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement22.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement22</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement22'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The noWrap attribute supresses word wrapping.
+
+ Retrieve the noWrap attribute of the second TD Element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045
+*/
+function HTMLTableCellElement22() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement22") != null) return;
+ var nodeList;
+ var testNode;
+ var vnowrap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vnowrap = testNode.noWrap;
+
+ assertTrue("noWrapLink",vnowrap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement22</h2>
+<p>&lt;test name='HTMLTableCellElement22' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement22&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The noWrap attribute supresses word wrapping.
+
+ Retrieve the noWrap attribute of the second TD Element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vnowrap' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;noWrap interface='HTMLTableCellElement' obj='testNode' var='vnowrap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vnowrap' <a id="noWrapLink">id='noWrapLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement23.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement23.html
new file mode 100644
index 0000000000..7c885c712e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement23.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement23</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement23'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rowSpan attribute specifies the number of rows spanned by a table
+ header(TH) cell.
+
+ Retrieve the rowSpan attribute of the second TH element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625
+*/
+function HTMLTableCellElement23() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement23") != null) return;
+ var nodeList;
+ var testNode;
+ var vrowspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vrowspan = testNode.rowSpan;
+
+ assertEquals("rowSpanLink",1,vrowspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement23</h2>
+<p>&lt;test name='HTMLTableCellElement23' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement23&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rowSpan attribute specifies the number of rows spanned by a table
+ header(TH) cell.
+
+ Retrieve the rowSpan attribute of the second TH element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowSpan interface='HTMLTableCellElement' obj='testNode' var='vrowspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowspan' expected='1' <a id="rowSpanLink">id='rowSpanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement24.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement24.html
new file mode 100644
index 0000000000..1031269e79
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement24.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement24</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement24'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rowSpan attribute specifies the number of rows spanned by a
+ table data(TD) cell.
+
+ Retrieve the rowSpan attribute of the second TD element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625
+*/
+function HTMLTableCellElement24() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement24") != null) return;
+ var nodeList;
+ var testNode;
+ var vrowspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vrowspan = testNode.rowSpan;
+
+ assertEquals("rowSpanLink",1,vrowspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement24</h2>
+<p>&lt;test name='HTMLTableCellElement24' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement24&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rowSpan attribute specifies the number of rows spanned by a
+ table data(TD) cell.
+
+ Retrieve the rowSpan attribute of the second TD element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowSpan interface='HTMLTableCellElement' obj='testNode' var='vrowspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowspan' expected='1' <a id="rowSpanLink">id='rowSpanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement25.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement25.html
new file mode 100644
index 0000000000..b32dec2f73
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement25.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement25</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement25'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The scope attribute specifies the scope covered by header cells.
+
+ Retrieve the scope attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952
+*/
+function HTMLTableCellElement25() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement25") != null) return;
+ var nodeList;
+ var testNode;
+ var vscope;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vscope = testNode.scope;
+
+ assertEquals("scopeLink","col",vscope);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement25</h2>
+<p>&lt;test name='HTMLTableCellElement25' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement25&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The scope attribute specifies the scope covered by header cells.
+
+ Retrieve the scope attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vscope' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scope interface='HTMLTableCellElement' obj='testNode' var='vscope'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vscope' expected='"col"' <a id="scopeLink">id='scopeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement26.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement26.html
new file mode 100644
index 0000000000..4d1f179aee
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement26.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement26</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement26'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The scope attribute specifies the scope covered by data cells.
+
+ Retrieve the scope attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952
+*/
+function HTMLTableCellElement26() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement26") != null) return;
+ var nodeList;
+ var testNode;
+ var vscope;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vscope = testNode.scope;
+
+ assertEquals("scopeLink","col",vscope);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement26</h2>
+<p>&lt;test name='HTMLTableCellElement26' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement26&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The scope attribute specifies the scope covered by data cells.
+
+ Retrieve the scope attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vscope' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scope interface='HTMLTableCellElement' obj='testNode' var='vscope'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vscope' expected='"col"' <a id="scopeLink">id='scopeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement27.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement27.html
new file mode 100644
index 0000000000..4eae8b05cd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement27.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement27</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement27'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of data in cell.
+
+ Retrieve the vAlign attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221
+*/
+function HTMLTableCellElement27() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement27") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement27</h2>
+<p>&lt;test name='HTMLTableCellElement27' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement27&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of data in cell.
+
+ Retrieve the vAlign attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableCellElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement28.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement28.html
new file mode 100644
index 0000000000..d017964239
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement28.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement28</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement28'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of data in cell.
+
+ Retrieve the vAlign attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221
+*/
+function HTMLTableCellElement28() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement28") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement28</h2>
+<p>&lt;test name='HTMLTableCellElement28' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement28&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of data in cell.
+
+ Retrieve the vAlign attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableCellElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement29.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement29.html
new file mode 100644
index 0000000000..22d5db0034
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement29.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement29</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement29'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the cells width.
+
+ Retrieve the width attribute from the second TH element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795
+*/
+function HTMLTableCellElement29() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement29") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("th");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","170",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement29</h2>
+<p>&lt;test name='HTMLTableCellElement29' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement29&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the cells width.
+
+ Retrieve the width attribute from the second TH element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"th"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableCellElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"170"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement30.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement30.html
new file mode 100644
index 0000000000..834a3c4f3f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableCellElement30.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement30</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableCellElement30'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the cells width.
+
+ Retrieve the width attribute from the second TD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795
+*/
+function HTMLTableCellElement30() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableCellElement30") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","175",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableCellElement30</h2>
+<p>&lt;test name='HTMLTableCellElement30' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableCellElement30&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the cells width.
+
+ Retrieve the width attribute from the second TD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableCellElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"175"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement01.html
new file mode 100644
index 0000000000..917fc4f830
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment of cell data
+ in column(COL).
+
+ Retrieve the align attribute from the COL element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31128447
+*/
+function HTMLTableColElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement01</h2>
+<p>&lt;test name='HTMLTableColElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment of cell data
+ in column(COL).
+
+ Retrieve the align attribute from the COL element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31128447">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31128447</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableColElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement02.html
new file mode 100644
index 0000000000..e6795a2ec3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment of cell data
+ in column(COLGROUP).
+
+ Retrieve the align attribute from the COLGROUP element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31128447
+*/
+function HTMLTableColElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("colgroup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement02</h2>
+<p>&lt;test name='HTMLTableColElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment of cell data
+ in column(COLGROUP).
+
+ Retrieve the align attribute from the COLGROUP element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31128447">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-31128447</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"colgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableColElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement03.html
new file mode 100644
index 0000000000..b1e692809e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement03.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The char attribute specifies the alignment character for cells
+ in a column(COL).
+
+ Retrieve the char attribute from the COL element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9447412
+*/
+function HTMLTableColElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vch = testNode.ch;
+
+ assertEquals("chLink","*",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement03</h2>
+<p>&lt;test name='HTMLTableColElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The char attribute specifies the alignment character for cells
+ in a column(COL).
+
+ Retrieve the char attribute from the COL element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9447412">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9447412</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableColElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"*"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement04.html
new file mode 100644
index 0000000000..45d6f725b1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The char attribute specifies the alignment character for cells
+ in a column(COLGROUP).
+
+ Retrieve the char attribute from the COLGROUP element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9447412
+*/
+function HTMLTableColElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("colgroup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vch = testNode.ch;
+
+ assertEquals("chLink","$",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement04</h2>
+<p>&lt;test name='HTMLTableColElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The char attribute specifies the alignment character for cells
+ in a column(COLGROUP).
+
+ Retrieve the char attribute from the COLGROUP element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9447412">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9447412</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"colgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableColElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"$"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement05.html
new file mode 100644
index 0000000000..737760b5ba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement05.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The charoff attribute specifies offset of alignment character(COL).
+
+ Retrieve the charoff attribute from the COL element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57779225
+*/
+function HTMLTableColElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vchoff = testNode.chOff;
+
+ assertEquals("chLink","20",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement05</h2>
+<p>&lt;test name='HTMLTableColElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The charoff attribute specifies offset of alignment character(COL).
+
+ Retrieve the charoff attribute from the COL element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57779225">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57779225</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableColElement' obj='testNode' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"20"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement06.html
new file mode 100644
index 0000000000..c485b5f797
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement06.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The charoff attribute specifies offset of alignment character(COLGROUP).
+
+ Retrieve the charoff attribute from the COLGROUP element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57779225
+*/
+function HTMLTableColElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("colgroup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vchoff = testNode.chOff;
+
+ assertEquals("chLink","15",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement06</h2>
+<p>&lt;test name='HTMLTableColElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The charoff attribute specifies offset of alignment character(COLGROUP).
+
+ Retrieve the charoff attribute from the COLGROUP element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57779225">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57779225</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"colgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableColElement' obj='testNode' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"15"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement07.html
new file mode 100644
index 0000000000..090fb95a7c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The span attribute indicates the number of columns in a group or affected
+ by a grouping(COL).
+
+ Retrieve the span attribute of the COL element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335
+*/
+function HTMLTableColElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vspan = testNode.span;
+
+ assertEquals("spanLink",1,vspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement07</h2>
+<p>&lt;test name='HTMLTableColElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The span attribute indicates the number of columns in a group or affected
+ by a grouping(COL).
+
+ Retrieve the span attribute of the COL element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span interface='HTMLTableColElement' obj='testNode' var='vspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vspan' expected='1' <a id="spanLink">id='spanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement08.html
new file mode 100644
index 0000000000..1ab84ef4b0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement08.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The span attribute indicates the number of columns in a group or affected
+ by a grouping(COLGROUP).
+
+ Retrieve the span attribute of the COLGROUP element and examine its
+ value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335
+*/
+function HTMLTableColElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("colgroup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vspan = testNode.span;
+
+ assertEquals("spanLink",2,vspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement08</h2>
+<p>&lt;test name='HTMLTableColElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The span attribute indicates the number of columns in a group or affected
+ by a grouping(COLGROUP).
+
+ Retrieve the span attribute of the COLGROUP element and examine its
+ value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"colgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span interface='HTMLTableColElement' obj='testNode' var='vspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vspan' expected='2' <a id="spanLink">id='spanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement09.html
new file mode 100644
index 0000000000..9c5294b9ba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement09.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of cell data
+ in column(COL).
+
+ Retrieve the vAlign attribute from the COL element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710
+*/
+function HTMLTableColElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement09</h2>
+<p>&lt;test name='HTMLTableColElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of cell data
+ in column(COL).
+
+ Retrieve the vAlign attribute from the COL element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableColElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement10.html
new file mode 100644
index 0000000000..1d0dbf023d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of cell data
+ in column(COLGROUP).
+
+ Retrieve the vAlign attribute from the COLGROUP element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710
+*/
+function HTMLTableColElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("colgroup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement10</h2>
+<p>&lt;test name='HTMLTableColElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of cell data
+ in column(COLGROUP).
+
+ Retrieve the vAlign attribute from the COLGROUP element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"colgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableColElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement11.html
new file mode 100644
index 0000000000..f4e07af382
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement11.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the default column width(COL).
+
+ Retrieve the width attribute from the COL element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799
+*/
+function HTMLTableColElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","20",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement11</h2>
+<p>&lt;test name='HTMLTableColElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the default column width(COL).
+
+ Retrieve the width attribute from the COL element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableColElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"20"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement12.html
new file mode 100644
index 0000000000..685a037ca7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableColElement12.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableColElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the default column width(COLGORUP).
+
+ Retrieve the width attribute from the COLGROUP element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799
+*/
+function HTMLTableColElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableColElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("colgroup");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","20",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableColElement12</h2>
+<p>&lt;test name='HTMLTableColElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the default column width(COLGORUP).
+
+ Retrieve the width attribute from the COLGROUP element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"colgroup"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableColElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"20"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement01.html
new file mode 100644
index 0000000000..7f3f16605c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement01.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The caption attribute returns the tables CAPTION.
+
+ Retrieve the align attribute of the CAPTION element from the second
+ TABLE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520
+*/
+function HTMLTableElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcaption;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vcaption = testNode.caption;
+
+ valign = vcaption.align;
+
+ assertEquals("alignLink","top",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement01</h2>
+<p>&lt;test name='HTMLTableElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The caption attribute returns the tables CAPTION.
+
+ Retrieve the align attribute of the CAPTION element from the second
+ TABLE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcaption' type='HTMLTableCaptionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vcaption'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableCaptionElement' obj='vcaption' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"top"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement02.html
new file mode 100644
index 0000000000..8a888ce495
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The caption attribute returns the tables CAPTION or void if it does not
+ exist.
+
+ Retrieve the CAPTION element from within the first TABLE element.
+ Since one does not exist it should be void.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520
+*/
+function HTMLTableElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcaption;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vcaption = testNode.caption;
+
+ assertNull("captionLink",vcaption);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement02</h2>
+<p>&lt;test name='HTMLTableElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The caption attribute returns the tables CAPTION or void if it does not
+ exist.
+
+ Retrieve the CAPTION element from within the first TABLE element.
+ Since one does not exist it should be void.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcaption' type='HTMLTableCaptionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vcaption'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vcaption' <a id="captionLink">id='captionLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement03.html
new file mode 100644
index 0000000000..9ddb9ee6b5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement03.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tHead attribute returns the tables THEAD.
+
+ Retrieve the align attribute of the THEAD element from the second
+ TABLE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944
+*/
+function HTMLTableElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tHead;
+
+ valign = vsection.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement03</h2>
+<p>&lt;test name='HTMLTableElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tHead attribute returns the tables THEAD.
+
+ Retrieve the align attribute of the THEAD element from the second
+ TABLE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='vsection' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement04.html
new file mode 100644
index 0000000000..4d2ec31874
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tHead attribute returns the tables THEAD or null if it does not
+ exist.
+
+ Retrieve the THEAD element from within the first TABLE element.
+ Since one does not exist it should be null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944
+*/
+function HTMLTableElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vsection = testNode.tHead;
+
+ assertNull("sectionLink",vsection);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement04</h2>
+<p>&lt;test name='HTMLTableElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tHead attribute returns the tables THEAD or null if it does not
+ exist.
+
+ Retrieve the THEAD element from within the first TABLE element.
+ Since one does not exist it should be null.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vsection' <a id="sectionLink">id='sectionLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement05.html
new file mode 100644
index 0000000000..98c07400f8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement05.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tFoot attribute returns the tables TFOOT.
+
+ Retrieve the align attribute of the TFOOT element from the second
+ TABLE element and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function HTMLTableElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tFoot;
+
+ valign = vsection.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement05</h2>
+<p>&lt;test name='HTMLTableElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tFoot attribute returns the tables TFOOT.
+
+ Retrieve the align attribute of the TFOOT element from the second
+ TABLE element and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='vsection' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement06.html
new file mode 100644
index 0000000000..d78abe3fa8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tFoot attribute returns the tables TFOOT or null if it does not
+ exist.
+
+ Retrieve the TFOOT element from within the first TABLE element.
+ Since one does not exist it should be null.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function HTMLTableElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vsection = testNode.tFoot;
+
+ assertNull("sectionLink",vsection);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement06</h2>
+<p>&lt;test name='HTMLTableElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tFoot attribute returns the tables TFOOT or null if it does not
+ exist.
+
+ Retrieve the TFOOT element from within the first TABLE element.
+ Since one does not exist it should be null.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vsection' <a id="sectionLink">id='sectionLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement07.html
new file mode 100644
index 0000000000..d8d352c141
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement07.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rows attribute returns a collection of all the rows in the table,
+ including al in THEAD, TFOOT, all TBODY elements.
+
+ Retrieve the rows attribute from the second TABLE element and
+ examine the items of the returned collection.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6156016
+*/
+function HTMLTableElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement07") != null) return;
+ var nodeList;
+ var rowsnodeList;
+ var testNode;
+ var doc;
+ var rowName;
+ var vrow;
+ var result = new Array();
+
+ expectedOptions = new Array();
+ expectedOptions[0] = "tr";
+ expectedOptions[1] = "tr";
+ expectedOptions[2] = "tr";
+ expectedOptions[3] = "tr";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ for(var indexN10069 = 0;indexN10069 < rowsnodeList.length; indexN10069++) {
+ vrow = rowsnodeList.item(indexN10069);
+ rowName = vrow.nodeName;
+
+ result[result.length] = rowName;
+
+ }
+ assertEqualsListAutoCase("element", "rowsLink",expectedOptions,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement07</h2>
+<p>&lt;test name='HTMLTableElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rows attribute returns a collection of all the rows in the table,
+ including al in THEAD, TFOOT, all TBODY elements.
+
+ Retrieve the rows attribute from the second TABLE element and
+ examine the items of the returned collection.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6156016">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6156016</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowName' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrow' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='result' type='List'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='expectedOptions' type='List'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/var&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;for-each collection='rowsnodeList' member='vrow'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='vrow' var='rowName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='rowName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/for-each&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='result' expected='expectedOptions' <a id="rowsLink">id='rowsLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement08.html
new file mode 100644
index 0000000000..4863f471f3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement08.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tBodies attribute returns a collection of all the defined
+ table bodies.
+
+ Retrieve the tBodies attribute from the second TABLE element and
+ examine the items of the returned collection.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63206416
+*/
+function HTMLTableElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement08") != null) return;
+ var nodeList;
+ var tbodiesnodeList;
+ var testNode;
+ var doc;
+ var tbodiesName;
+ var vtbodies;
+ var result = new Array();
+
+ expectedOptions = new Array();
+ expectedOptions[0] = "tbody";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ tbodiesnodeList = testNode.tBodies;
+
+ for(var indexN10060 = 0;indexN10060 < tbodiesnodeList.length; indexN10060++) {
+ vtbodies = tbodiesnodeList.item(indexN10060);
+ tbodiesName = vtbodies.nodeName;
+
+ result[result.length] = tbodiesName;
+
+ }
+ assertEqualsListAutoCase("element", "tbodiesLink",expectedOptions,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement08</h2>
+<p>&lt;test name='HTMLTableElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tBodies attribute returns a collection of all the defined
+ table bodies.
+
+ Retrieve the tBodies attribute from the second TABLE element and
+ examine the items of the returned collection.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63206416">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63206416</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesName' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtbodies' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='result' type='List'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='expectedOptions' type='List'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/var&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;for-each collection='tbodiesnodeList' member='vtbodies'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='vtbodies' var='tbodiesName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='tbodiesName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/for-each&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='result' expected='expectedOptions' <a id="tbodiesLink">id='tbodiesLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement09.html
new file mode 100644
index 0000000000..3a971c920d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement09.html
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tBodies attribute returns a collection of all the defined
+ table bodies.
+
+ Retrieve the tBodies attribute from the third TABLE element and
+ examine the items of the returned collection. Tests multiple TBODY
+ elements.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63206416
+*/
+function HTMLTableElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement09") != null) return;
+ var nodeList;
+ var tbodiesnodeList;
+ var testNode;
+ var doc;
+ var tbodiesName;
+ var vtbodies;
+ var result = new Array();
+
+ expectedOptions = new Array();
+ expectedOptions[0] = "tbody";
+ expectedOptions[1] = "tbody";
+ expectedOptions[2] = "tbody";
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(2);
+ tbodiesnodeList = testNode.tBodies;
+
+ for(var indexN10066 = 0;indexN10066 < tbodiesnodeList.length; indexN10066++) {
+ vtbodies = tbodiesnodeList.item(indexN10066);
+ tbodiesName = vtbodies.nodeName;
+
+ result[result.length] = tbodiesName;
+
+ }
+ assertEqualsListAutoCase("element", "tbodiesLink",expectedOptions,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement09</h2>
+<p>&lt;test name='HTMLTableElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tBodies attribute returns a collection of all the defined
+ table bodies.
+
+ Retrieve the tBodies attribute from the third TABLE element and
+ examine the items of the returned collection. Tests multiple TBODY
+ elements.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63206416">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63206416</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesName' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtbodies' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='result' type='List'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='expectedOptions' type='List'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/var&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;for-each collection='tbodiesnodeList' member='vtbodies'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeName obj='vtbodies' var='tbodiesName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='tbodiesName'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/for-each&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='result' expected='expectedOptions' <a id="tbodiesLink">id='tbodiesLink'</a> ignoreCase='auto'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement10.html
new file mode 100644
index 0000000000..b070679933
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the table's position with respect to the
+ rest of the document.
+
+ Retrieve the align attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23180977
+*/
+function HTMLTableElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement10</h2>
+<p>&lt;test name='HTMLTableElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the table's position with respect to the
+ rest of the document.
+
+ Retrieve the align attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23180977">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23180977</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement11.html
new file mode 100644
index 0000000000..08dcfb0cc8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement11.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The bgColor attribute specifies cell background color.
+
+ Retrieve the bgColor attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83532985
+*/
+function HTMLTableElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgColorLink","#ff0000",vbgcolor);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement11</h2>
+<p>&lt;test name='HTMLTableElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The bgColor attribute specifies cell background color.
+
+ Retrieve the bgColor attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83532985">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83532985</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLTableElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#ff0000"' <a id="bgColorLink">id='bgColorLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement12.html
new file mode 100644
index 0000000000..773d84d638
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement12.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The border attribute specifies the width of the border around the table.
+
+ Retrieve the border attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50969400
+*/
+function HTMLTableElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vborder;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vborder = testNode.border;
+
+ assertEquals("borderLink","4",vborder);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement12</h2>
+<p>&lt;test name='HTMLTableElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The border attribute specifies the width of the border around the table.
+
+ Retrieve the border attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50969400">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50969400</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vborder' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;border interface='HTMLTableElement' obj='testNode' var='vborder'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vborder' expected='"4"' <a id="borderLink">id='borderLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement13.html
new file mode 100644
index 0000000000..68c78c1389
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement13.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cellpadding attribute specifies the horizontal and vertical space
+ between cell content and cell borders.
+
+ Retrieve the cellpadding attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59162158
+*/
+function HTMLTableElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var vcellpadding;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vcellpadding = testNode.cellPadding;
+
+ assertEquals("cellPaddingLink","2",vcellpadding);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement13</h2>
+<p>&lt;test name='HTMLTableElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cellpadding attribute specifies the horizontal and vertical space
+ between cell content and cell borders.
+
+ Retrieve the cellpadding attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59162158">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59162158</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcellpadding' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cellPadding interface='HTMLTableElement' obj='testNode' var='vcellpadding'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcellpadding' expected='"2"' <a id="cellPaddingLink">id='cellPaddingLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement14.html
new file mode 100644
index 0000000000..c63ba0faea
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement14.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cellSpacing attribute specifies the horizontal and vertical separation
+ between cells.
+
+ Retrieve the cellSpacing attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68907883
+*/
+function HTMLTableElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var cellSpacing;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ cellSpacing = testNode.cellSpacing;
+
+ assertEquals("cellSpacingLink","2",cellSpacing);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement14</h2>
+<p>&lt;test name='HTMLTableElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cellSpacing attribute specifies the horizontal and vertical separation
+ between cells.
+
+ Retrieve the cellSpacing attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68907883">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68907883</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellSpacing' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cellSpacing interface='HTMLTableElement' obj='testNode' var='cellSpacing'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='cellSpacing' expected='"2"' <a id="cellSpacingLink">id='cellSpacingLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement15.html
new file mode 100644
index 0000000000..8d1b2f7604
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement15.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The frame attribute specifies which external table borders to render.
+
+ Retrieve the frame attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64808476
+*/
+function HTMLTableElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var vframe;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vframe = testNode.frame;
+
+ assertEquals("frameLink","border",vframe);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement15</h2>
+<p>&lt;test name='HTMLTableElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The frame attribute specifies which external table borders to render.
+
+ Retrieve the frame attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64808476">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64808476</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vframe' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame interface='HTMLTableElement' obj='testNode' var='vframe'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vframe' expected='"border"' <a id="frameLink">id='frameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement16.html
new file mode 100644
index 0000000000..872086b3e2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement16.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rules attribute specifies which internal table borders to render.
+
+ Retrieve the rules attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26347553
+*/
+function HTMLTableElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var vrules;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vrules = testNode.rules;
+
+ assertEquals("rulesLink","all",vrules);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement16</h2>
+<p>&lt;test name='HTMLTableElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rules attribute specifies which internal table borders to render.
+
+ Retrieve the rules attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26347553">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26347553</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrules' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rules interface='HTMLTableElement' obj='testNode' var='vrules'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrules' expected='"all"' <a id="rulesLink">id='rulesLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement17.html
new file mode 100644
index 0000000000..afb9bd3f75
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement17.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The summary attribute is a description about the purpose or structure
+ of a table.
+
+ Retrieve the summary attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-44998528
+*/
+function HTMLTableElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var vsummary;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsummary = testNode.summary;
+
+ assertEquals("summaryLink","HTML Control Table",vsummary);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement17</h2>
+<p>&lt;test name='HTMLTableElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The summary attribute is a description about the purpose or structure
+ of a table.
+
+ Retrieve the summary attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-44998528">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-44998528</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsummary' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;summary interface='HTMLTableElement' obj='testNode' var='vsummary'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsummary' expected='"HTML Control Table"' <a id="summaryLink">id='summaryLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement18.html
new file mode 100644
index 0000000000..47825f49b8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement18.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The width attribute specifies the desired table width.
+
+ Retrieve the width attribute of the first TABLE element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77447361
+*/
+function HTMLTableElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","680",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement18</h2>
+<p>&lt;test name='HTMLTableElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The width attribute specifies the desired table width.
+
+ Retrieve the width attribute of the first TABLE element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77447361">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77447361</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"680"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement19.html
new file mode 100644
index 0000000000..572d2b963c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement19.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The createTHead() method creates a table header row or returns
+ an existing one.
+
+ Create a new THEAD element on the first TABLE element. The first
+ TABLE element should return null to make sure one doesn't exist.
+ After creation of the THEAD element the value is once again
+ checked and should not be null.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70313345
+*/
+function HTMLTableElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection1;
+ var vsection2;
+ var newHead;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vsection1 = testNode.tHead;
+
+ assertNull("vsection1Id",vsection1);
+ newHead = testNode.createTHead();
+ vsection2 = testNode.tHead;
+
+ assertNotNull("vsection2Id",vsection2);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement19</h2>
+<p>&lt;test name='HTMLTableElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The createTHead() method creates a table header row or returns
+ an existing one.
+
+ Create a new THEAD element on the first TABLE element. The first
+ TABLE element should return null to make sure one doesn't exist.
+ After creation of the THEAD element the value is once again
+ checked and should not be null.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70313345">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70313345</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newHead' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vsection1' <a id="vsection1Id">id='vsection1Id'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createTHead interface='HTMLTableElement' obj='testNode' var='newHead'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNotNull actual='vsection2' <a id="vsection2Id">id='vsection2Id'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement20.html
new file mode 100644
index 0000000000..ba10424562
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement20.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The createTHead() method creates a table header row or returns
+ an existing one.
+
+ Try to create a new THEAD element on the second TABLE element.
+ Since a THEAD element already exists in the TABLE element a new
+ THEAD element is not created and information from the already
+ existing THEAD element is returned.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70313345
+*/
+function HTMLTableElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement20") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var newHead;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ newHead = testNode.createTHead();
+ vsection = testNode.tHead;
+
+ valign = vsection.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement20</h2>
+<p>&lt;test name='HTMLTableElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The createTHead() method creates a table header row or returns
+ an existing one.
+
+ Try to create a new THEAD element on the second TABLE element.
+ Since a THEAD element already exists in the TABLE element a new
+ THEAD element is not created and information from the already
+ existing THEAD element is returned.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70313345">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70313345</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newHead' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createTHead interface='HTMLTableElement' obj='testNode' var='newHead'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='vsection' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement21.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement21.html
new file mode 100644
index 0000000000..a10acbf56e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement21.html
@@ -0,0 +1,164 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteTHead() method deletes the header from the table.
+
+ The deleteTHead() method will delete the THEAD Element from the
+ second TABLE element. First make sure that the THEAD element exists
+ and then count the number of rows. After the THEAD element is
+ deleted there should be one less row.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38310198
+*/
+function HTMLTableElement21() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement21") != null) return;
+ var nodeList;
+ var rowsnodeList;
+ var testNode;
+ var vsection1;
+ var vsection2;
+ var vrows;
+ var doc;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = 4;
+ expectedResult[1] = 3;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsection1 = testNode.tHead;
+
+ assertNotNull("vsection1Id",vsection1);
+rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ result[result.length] = vrows;
+testNode.deleteTHead();
+ vsection2 = testNode.tHead;
+
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ result[result.length] = vrows;
+assertEqualsList("rowsLink",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement21</h2>
+<p>&lt;test name='HTMLTableElement21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteTHead() method deletes the header from the table.
+
+ The deleteTHead() method will delete the THEAD Element from the
+ second TABLE element. First make sure that the THEAD element exists
+ and then count the number of rows. After the THEAD element is
+ deleted there should be one less row.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38310198">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38310198</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='result' type='List'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='expectedResult' type='List'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/var&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNotNull actual='vsection1' <a id="vsection1Id">id='vsection1Id'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteTHead obj='testNode' interface='HTMLTableElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='result' expected='expectedResult' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement22.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement22.html
new file mode 100644
index 0000000000..234280236a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement22.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement22</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement22'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The createTFoot() method creates a table footer row or returns
+ an existing one.
+
+ Create a new TFOOT element on the first TABLE element. The first
+ TABLE element should return null to make sure one doesn't exist.
+ After creation of the TFOOT element the value is once again
+ checked and should not be null.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8453710
+*/
+function HTMLTableElement22() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement22") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection1;
+ var vsection2;
+ var newFoot;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vsection1 = testNode.tFoot;
+
+ assertNull("vsection1Id",vsection1);
+ newFoot = testNode.createTFoot();
+ vsection2 = testNode.tFoot;
+
+ assertNotNull("vsection2Id",vsection2);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement22</h2>
+<p>&lt;test name='HTMLTableElement22' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement22&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The createTFoot() method creates a table footer row or returns
+ an existing one.
+
+ Create a new TFOOT element on the first TABLE element. The first
+ TABLE element should return null to make sure one doesn't exist.
+ After creation of the TFOOT element the value is once again
+ checked and should not be null.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8453710">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8453710</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newFoot' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vsection1' <a id="vsection1Id">id='vsection1Id'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createTFoot interface='HTMLTableElement' obj='testNode' var='newFoot'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNotNull actual='vsection2' <a id="vsection2Id">id='vsection2Id'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement23.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement23.html
new file mode 100644
index 0000000000..773012256e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement23.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement23</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement23'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The createTFoot() method creates a table footer row or returns
+ an existing one.
+
+ Try to create a new TFOOT element on the second TABLE element.
+ Since a TFOOT element already exists in the TABLE element a new
+ TFOOT element is not created and information from the already
+ existing TFOOT element is returned.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8453710
+*/
+function HTMLTableElement23() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement23") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var newFoot;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ newFoot = testNode.createTFoot();
+ vsection = testNode.tFoot;
+
+ valign = vsection.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement23</h2>
+<p>&lt;test name='HTMLTableElement23' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement23&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The createTFoot() method creates a table footer row or returns
+ an existing one.
+
+ Try to create a new TFOOT element on the second TABLE element.
+ Since a TFOOT element already exists in the TABLE element a new
+ TFOOT element is not created and information from the already
+ existing TFOOT element is returned.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8453710">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8453710</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newFoot' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createTFoot interface='HTMLTableElement' obj='testNode' var='newFoot'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='vsection' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement24.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement24.html
new file mode 100644
index 0000000000..c87461a1ab
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement24.html
@@ -0,0 +1,164 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement24</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement24'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteTFoot() method deletes the footer from the table.
+
+ The deleteTFoot() method will delete the TFOOT Element from the
+ second TABLE element. First make sure that the TFOOT element exists
+ and then count the number of rows. After the TFOOT element is
+ deleted there should be one less row.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78363258
+*/
+function HTMLTableElement24() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement24") != null) return;
+ var nodeList;
+ var rowsnodeList;
+ var testNode;
+ var vsection1;
+ var vsection2;
+ var vrows;
+ var doc;
+ var result = new Array();
+
+ expectedResult = new Array();
+ expectedResult[0] = 4;
+ expectedResult[1] = 3;
+
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsection1 = testNode.tFoot;
+
+ assertNotNull("vsection1Id",vsection1);
+rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ result[result.length] = vrows;
+testNode.deleteTFoot();
+ vsection2 = testNode.tFoot;
+
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ result[result.length] = vrows;
+assertEqualsList("rowsLink",expectedResult,result);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement24</h2>
+<p>&lt;test name='HTMLTableElement24' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement24&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteTFoot() method deletes the footer from the table.
+
+ The deleteTFoot() method will delete the TFOOT Element from the
+ second TABLE element. First make sure that the TFOOT element exists
+ and then count the number of rows. After the TFOOT element is
+ deleted there should be one less row.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78363258">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78363258</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='result' type='List'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='expectedResult' type='List'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;member/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/var&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNotNull actual='vsection1' <a id="vsection1Id">id='vsection1Id'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteTFoot obj='testNode' interface='HTMLTableElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;append collection='result' item='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='result' expected='expectedResult' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement25.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement25.html
new file mode 100644
index 0000000000..5b0c03ee2e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement25.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement25</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement25'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The createCaption() method creates a new table caption object or returns
+ an existing one.
+
+ Create a new CAPTION element on the first TABLE element. Since
+ one does not currently exist the CAPTION element is created.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96920263
+*/
+function HTMLTableElement25() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement25") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection1;
+ var vsection2;
+ var newCaption;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vsection1 = testNode.caption;
+
+ assertNull("vsection1Id",vsection1);
+ newCaption = testNode.createCaption();
+ vsection2 = testNode.caption;
+
+ assertNotNull("vsection2Id",vsection2);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement25</h2>
+<p>&lt;test name='HTMLTableElement25' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement25&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The createCaption() method creates a new table caption object or returns
+ an existing one.
+
+ Create a new CAPTION element on the first TABLE element. Since
+ one does not currently exist the CAPTION element is created.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96920263">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96920263</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableCaptionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableCaptionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newCaption' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vsection1' <a id="vsection1Id">id='vsection1Id'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createCaption interface='HTMLTableElement' obj='testNode' var='newCaption'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vsection2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNotNull actual='vsection2' <a id="vsection2Id">id='vsection2Id'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement26.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement26.html
new file mode 100644
index 0000000000..68807e72aa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement26.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement26</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement26'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The createCaption() method creates a new table caption object or returns
+ an existing one.
+
+ Create a new CAPTION element on the first TABLE element. Since
+ one currently exists the CAPTION element is not created and you
+ can get the align attribute from the CAPTION element that exists.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96920263
+*/
+function HTMLTableElement26() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement26") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection1;
+ var vcaption;
+ var newCaption;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsection1 = testNode.caption;
+
+ assertNotNull("vsection1Id",vsection1);
+newCaption = testNode.createCaption();
+ vcaption = testNode.caption;
+
+ valign = vcaption.align;
+
+ assertEquals("alignLink","top",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement26</h2>
+<p>&lt;test name='HTMLTableElement26' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement26&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The createCaption() method creates a new table caption object or returns
+ an existing one.
+
+ Create a new CAPTION element on the first TABLE element. Since
+ one currently exists the CAPTION element is not created and you
+ can get the align attribute from the CAPTION element that exists.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96920263">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96920263</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcaption' type='HTMLTableCaptionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newCaption' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNotNull actual='vsection1' <a id="vsection1Id">id='vsection1Id'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createCaption interface='HTMLTableElement' obj='testNode' var='newCaption'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vcaption'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableCaptionElement' obj='vcaption' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"top"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement27.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement27.html
new file mode 100644
index 0000000000..33a09d04c2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement27.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement27</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement27'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteCaption() method deletes the table caption.
+
+ Delete the CAPTION element on the second TABLE element.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22930071
+*/
+function HTMLTableElement27() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement27") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection1;
+ var vsection2;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsection1 = testNode.caption;
+
+ assertNotNull("vsection1Id",vsection1);
+testNode.deleteCaption();
+ vsection2 = testNode.caption;
+
+ assertNull("vsection2Id",vsection2);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement27</h2>
+<p>&lt;test name='HTMLTableElement27' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement27&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteCaption() method deletes the table caption.
+
+ Delete the CAPTION element on the second TABLE element.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22930071">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22930071</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNotNull actual='vsection1' <a id="vsection1Id">id='vsection1Id'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteCaption interface='HTMLTableElement' obj='testNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vsection2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vsection2' <a id="vsection2Id">id='vsection2Id'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement28.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement28.html
new file mode 100644
index 0000000000..5be023fcad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement28.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement28</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement28'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of 0. Currently the zero indexed row is in the THEAD
+ section of the TABLE. The number of rows in the THEAD section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the THEAD section is two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903
+*/
+function HTMLTableElement28() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement28") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vsection1;
+ var vsection2;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsection1 = testNode.tHead;
+
+ rowsnodeList = vsection1.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ newRow = testNode.insertRow(0);
+ vsection2 = testNode.tHead;
+
+ rowsnodeList = vsection2.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement28</h2>
+<p>&lt;test name='HTMLTableElement28' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement28&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of 0. Currently the zero indexed row is in the THEAD
+ section of the TABLE. The number of rows in the THEAD section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the THEAD section is two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='vsection1' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='vsection2' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement29.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement29.html
new file mode 100644
index 0000000000..7dc54e90e3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement29.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement29</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement29'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of two. Currently the 2nd indexed row is in the TBODY
+ section of the TABLE. The number of rows in the TBODY section before
+ insertion of the new row is two. After the new row is inserted the number
+ of rows in the TBODY section is three.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903
+*/
+function HTMLTableElement29() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement29") != null) return;
+ var nodeList;
+ var tbodiesnodeList;
+ var testNode;
+ var bodyNode;
+ var newRow;
+ var rowsnodeList;
+ var vsection1;
+ var vsection2;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ tbodiesnodeList = testNode.tBodies;
+
+ bodyNode = tbodiesnodeList.item(0);
+ rowsnodeList = bodyNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",2,vrows);
+ newRow = testNode.insertRow(2);
+ tbodiesnodeList = testNode.tBodies;
+
+ bodyNode = tbodiesnodeList.item(0);
+ rowsnodeList = bodyNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",3,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement29</h2>
+<p>&lt;test name='HTMLTableElement29' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement29&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of two. Currently the 2nd indexed row is in the TBODY
+ section of the TABLE. The number of rows in the TBODY section before
+ insertion of the new row is two. After the new row is inserted the number
+ of rows in the TBODY section is three.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='bodyNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='tbodiesnodeList' var='bodyNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='bodyNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='tbodiesnodeList' var='bodyNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='bodyNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement30.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement30.html
new file mode 100644
index 0000000000..5dd3835ae3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement30.html
@@ -0,0 +1,171 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement30</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement30'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of four. After the new row is inserted the number of rows
+ in the table should be five.
+ Also the number of rows in the TFOOT section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the TFOOT section is two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903
+*/
+function HTMLTableElement30() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement30") != null) return;
+ var nodeList;
+ var tbodiesnodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vsection1;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",4,vrows);
+ vsection1 = testNode.tFoot;
+
+ rowsnodeList = vsection1.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink",1,vrows);
+ newRow = testNode.insertRow(4);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",5,vrows);
+ vsection1 = testNode.tFoot;
+
+ rowsnodeList = vsection1.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink3",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement30</h2>
+<p>&lt;test name='HTMLTableElement30' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement30&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of four. After the new row is inserted the number of rows
+ in the table should be five.
+ Also the number of rows in the TFOOT section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the TFOOT section is two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='4' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='vsection1' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='4'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='5' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='vsection1' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink3">id='rowsLink3'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement31.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement31.html
new file mode 100644
index 0000000000..6d6138c774
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement31.html
@@ -0,0 +1,169 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement31</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement31'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table1");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row. In addition, when
+ the table is empty the row is inserted into a TBODY which is created
+ and inserted into the table.
+
+ Load the table1 file which has a non-empty table element.
+ Create an empty TABLE element and append to the document.
+ Check to make sure that the empty TABLE element doesn't
+ have a TBODY element. Insert a new row into the empty
+ TABLE element. Check for existence of the a TBODY element
+ in the table.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903
+* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Aug/0019.html
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=502
+*/
+function HTMLTableElement31() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement31") != null) return;
+ var nodeList;
+ var testNode;
+ var tableNode;
+ var tbodiesnodeList;
+ var newRow;
+ var doc;
+ var table;
+ var tbodiesLength;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table1");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("tableSize1",1,nodeList);
+testNode = nodeList.item(0);
+ table = doc.createElement("table");
+ tableNode = testNode.appendChild(table);
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("tableSize2",2,nodeList);
+tbodiesnodeList = tableNode.tBodies;
+
+ tbodiesLength = tbodiesnodeList.length;
+
+ assertEquals("Asize3",0,tbodiesLength);
+ newRow = tableNode.insertRow(0);
+ tbodiesnodeList = tableNode.tBodies;
+
+ tbodiesLength = tbodiesnodeList.length;
+
+ assertEquals("Asize4",1,tbodiesLength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement31</h2>
+<p>&lt;test name='HTMLTableElement31' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement31&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row. In addition, when
+ the table is empty the row is inserted into a TBODY which is created
+ and inserted into the table.
+
+ Load the table1 file which has a non-empty table element.
+ Create an empty TABLE element and append to the document.
+ Check to make sure that the empty TABLE element doesn't
+ have a TBODY element. Insert a new row into the empty
+ TABLE element. Check for existence of the a TBODY element
+ in the table.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Aug/0019.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Aug/0019.html</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=502">http://www.w3.org/Bugs/Public/show_bug.cgi?id=502</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tableNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='table' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesLength' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table1' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="tableSize1">id='tableSize1'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' index='0' var='testNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createElement obj='doc' var='table' tagName='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;appendChild obj='testNode' newChild='table' var='tableNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="tableSize2">id='tableSize2'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='tableNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length var='tbodiesLength' obj='tbodiesnodeList' interface='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='tbodiesLength' expected='0' <a id="Asize3">id='Asize3'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='tableNode' var='newRow' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='tableNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length var='tbodiesLength' obj='tbodiesnodeList' interface='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='tbodiesLength' expected='1' <a id="Asize4">id='Asize4'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table1.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement32.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement32.html
new file mode 100644
index 0000000000..5368c9788b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement32.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement32</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement32'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method deletes a table row.
+
+ Retrieve the second TABLE element and invoke the deleteRow() method
+ with an index of 0(first row). Currently there are four rows in the
+ table. After the deleteRow() method is called there should be
+ three rows in the table.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13114938
+*/
+function HTMLTableElement32() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement32") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",4,vrows);
+ testNode.deleteRow(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",3,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement32</h2>
+<p>&lt;test name='HTMLTableElement32' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement32&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method deletes a table row.
+
+ Retrieve the second TABLE element and invoke the deleteRow() method
+ with an index of 0(first row). Currently there are four rows in the
+ table. After the deleteRow() method is called there should be
+ three rows in the table.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13114938">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13114938</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='4' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableElement' obj='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement33.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement33.html
new file mode 100644
index 0000000000..b418ededb7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement33.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement33</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement33'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method deletes a table row.
+
+ Retrieve the second TABLE element and invoke the deleteRow() method
+ with an index of 3(last row). Currently there are four rows in the
+ table. The deleteRow() method is called and now there should be three.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13114938
+*/
+function HTMLTableElement33() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement33") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",4,vrows);
+ testNode.deleteRow(3);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",3,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement33</h2>
+<p>&lt;test name='HTMLTableElement33' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement33&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method deletes a table row.
+
+ Retrieve the second TABLE element and invoke the deleteRow() method
+ with an index of 3(last row). Currently there are four rows in the
+ table. The deleteRow() method is called and now there should be three.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13114938">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-13114938</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='4' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableElement' obj='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement34.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement34.html
new file mode 100644
index 0000000000..e43e8e8236
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement34.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement34</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement34'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to insert a new row using an index of five. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only four rows.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-39872903')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableElement34() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement34") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+
+ {
+ success = false;
+ try {
+ newRow = testNode.insertRow(5);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableElement34",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement34</h2>
+<p>&lt;test name='HTMLTableElement34' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement34&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to insert a new row using an index of five. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only four rows.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-39872903')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableElement34">id='HTMLTableElement34'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement35.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement35.html
new file mode 100644
index 0000000000..b1a942ca5e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement35.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement35</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement35'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to insert a new row using an index of negative five. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-39872903')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableElement35() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement35") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+
+ {
+ success = false;
+ try {
+ newRow = testNode.insertRow(-5);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableElement35",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement35</h2>
+<p>&lt;test name='HTMLTableElement35' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement35&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to insert a new row using an index of negative five. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-39872903')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableElement35">id='HTMLTableElement35'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='-5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement36.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement36.html
new file mode 100644
index 0000000000..8cd5111f86
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement36.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement36</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement36'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to delete a new row using an index of five. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only four rows.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-13114938')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableElement36() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement36") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+
+ {
+ success = false;
+ try {
+ testNode.deleteRow(5);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableElement36",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement36</h2>
+<p>&lt;test name='HTMLTableElement36' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement36&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to delete a new row using an index of five. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only four rows.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-13114938')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableElement36">id='HTMLTableElement36'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableElement' obj='testNode' index='5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement37.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement37.html
new file mode 100644
index 0000000000..896786dfb2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement37.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement37</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement37'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is equal the number of rows.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to delete a new row using an index of four. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is equal to the
+ number of rows.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-13114938')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableElement37() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement37") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+
+ {
+ success = false;
+ try {
+ testNode.deleteRow(4);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableElement37",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement37</h2>
+<p>&lt;test name='HTMLTableElement37' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement37&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is equal the number of rows.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to delete a new row using an index of four. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is equal to the
+ number of rows.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-13114938')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableElement37">id='HTMLTableElement37'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableElement' obj='testNode' index='4'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement38.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement38.html
new file mode 100644
index 0000000000..0b7db508f5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement38.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement38</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement38'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to delete a new row using an index of negative five. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-13114938')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableElement38() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement38") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+
+ {
+ success = false;
+ try {
+ testNode.deleteRow(-5);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableElement38",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement38</h2>
+<p>&lt;test name='HTMLTableElement38' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement38&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the second TABLE element which has four rows. Try
+ to delete a new row using an index of negative five. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-13114938')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableElement38">id='HTMLTableElement38'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableElement' obj='testNode' index='-5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement39.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement39.html
new file mode 100644
index 0000000000..61fabe6308
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement39.html
@@ -0,0 +1,177 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement39</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement39'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+ If index is -1 or equal to the number of rows, the new row
+ is appended.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of negative one.
+ The number of rows in the TBODY section before insertion with an index
+ of negative one is two. After the new row is inserted the number
+ of rows in the TBODY section is three.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903
+*/
+function HTMLTableElement39() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement39") != null) return;
+ var nodeList;
+ var tbodiesnodeList;
+ var testNode;
+ var bodyNode;
+ var newRow;
+ var rowsnodeList;
+ var vsection1;
+ var vsection2;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ tbodiesnodeList = testNode.tBodies;
+
+ bodyNode = tbodiesnodeList.item(0);
+ rowsnodeList = bodyNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",2,vrows);
+ newRow = testNode.insertRow(-1);
+/* the following assumes that the row is appended to tbody
+* this is obviously wrong it should be appended to tfoot which is the end
+* of the table
+* tbodiesnodeList = testNode.tBodies;
+*
+* bodyNode = tbodiesnodeList.item(0);
+* rowsnodeList = bodyNode.rows;
+*
+* vrows = rowsnodeList.length;
+*
+* assertEquals("rowsLink2",3,vrows);
+*/
+
+ tfootNode = testNode.tFoot;
+ rowsnodeList = tfootNode.rows;
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement39</h2>
+<p>&lt;test name='HTMLTableElement39' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement39&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+ If index is -1 or equal to the number of rows, the new row
+ is appended.
+
+ Retrieve the second TABLE element and invoke the insertRow() method
+ with an index of negative one.
+ The number of rows in the TBODY section before insertion with an index
+ of negative one is two. After the new row is inserted the number
+ of rows in the TBODY section is three.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-11-07&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-39872903</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='tbodiesnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='bodyNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection1' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection2' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='tbodiesnodeList' var='bodyNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='bodyNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='-1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='tbodiesnodeList' var='bodyNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='bodyNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement40.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement40.html
new file mode 100644
index 0000000000..f2b3344003
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableElement40.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement40</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableElement40'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method deletes a table row. If the index is -1
+ the last row of the table is deleted.
+
+ Retrieve the second TABLE element and invoke the deleteRow() method
+ with an index of negative one. Currently there are four rows in the
+ table. The deleteRow() method is called and now there should be three.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938
+*/
+function HTMLTableElement40() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableElement40") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",4,vrows);
+ testNode.deleteRow(-1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",3,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement40</h2>
+<p>&lt;test name='HTMLTableElement40' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableElement40&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method deletes a table row. If the index is -1
+ the last row of the table is deleted.
+
+ Retrieve the second TABLE element and invoke the deleteRow() method
+ with an index of negative one. Currently there are four rows in the
+ table. The deleteRow() method is called and now there should be three.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-11-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13114938</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='4' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableElement' obj='testNode' index='-1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement01.html
new file mode 100644
index 0000000000..2364932865
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement01.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rowIndex attribute specifies the index of the row, relative to the
+ entire table, starting from 0. This is in document tree order and
+ not display order. The rowIndex does not take into account sections
+ (THEAD, TFOOT, or TBODY) within the table.
+
+ Retrieve the third TR element within the document and examine
+ its rowIndex value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67347567
+*/
+function HTMLTableRowElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ vrowindex = testNode.rowIndex;
+
+ assertEquals("rowIndexLink",1,vrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement01</h2>
+<p>&lt;test name='HTMLTableRowElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rowIndex attribute specifies the index of the row, relative to the
+ entire table, starting from 0. This is in document tree order and
+ not display order. The rowIndex does not take into account sections
+ (THEAD, TFOOT, or TBODY) within the table.
+
+ Retrieve the third TR element within the document and examine
+ its rowIndex value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67347567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67347567</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowIndex interface='HTMLTableRowElement' obj='testNode' var='vrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowindex' expected='1' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement02.html
new file mode 100644
index 0000000000..d97296143f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The sectionRowIndex attribute specifies the index of this row, relative
+ to the current section(THEAD, TFOOT, or TBODY),starting from 0.
+
+ Retrieve the second TR(1st In THEAD) element within the document and
+ examine its sectionRowIndex value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901
+*/
+function HTMLTableRowElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vsectionrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ vsectionrowindex = testNode.sectionRowIndex;
+
+ assertEquals("sectionRowIndexLink",0,vsectionrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement02</h2>
+<p>&lt;test name='HTMLTableRowElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The sectionRowIndex attribute specifies the index of this row, relative
+ to the current section(THEAD, TFOOT, or TBODY),starting from 0.
+
+ Retrieve the second TR(1st In THEAD) element within the document and
+ examine its sectionRowIndex value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsectionrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sectionRowIndex interface='HTMLTableRowElement' obj='testNode' var='vsectionrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsectionrowindex' expected='0' <a id="sectionRowIndexLink">id='sectionRowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement03.html
new file mode 100644
index 0000000000..94e1b4cb23
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement03.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The sectionRowIndex attribute specifies the index of this row, relative
+ to the current section(THEAD, TFOOT, or TBODY),starting from 0.
+
+ Retrieve the third TR(1st In TFOOT) element within the document and
+ examine its sectionRowIndex value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901
+*/
+function HTMLTableRowElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vsectionrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(2);
+ vsectionrowindex = testNode.sectionRowIndex;
+
+ assertEquals("sectionRowIndexLink",0,vsectionrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement03</h2>
+<p>&lt;test name='HTMLTableRowElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The sectionRowIndex attribute specifies the index of this row, relative
+ to the current section(THEAD, TFOOT, or TBODY),starting from 0.
+
+ Retrieve the third TR(1st In TFOOT) element within the document and
+ examine its sectionRowIndex value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsectionrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sectionRowIndex interface='HTMLTableRowElement' obj='testNode' var='vsectionrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsectionrowindex' expected='0' <a id="sectionRowIndexLink">id='sectionRowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement04.html
new file mode 100644
index 0000000000..00cde3b3a4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The sectionRowIndex attribute specifies the index of this row, relative
+ to the current section(THEAD, TFOOT, or TBODY),starting from 0.
+
+ Retrieve the fifth TR(2nd In TBODY) element within the document and
+ examine its sectionRowIndex value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901
+*/
+function HTMLTableRowElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vsectionrowindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(4);
+ vsectionrowindex = testNode.sectionRowIndex;
+
+ assertEquals("sectionRowIndexLink",1,vsectionrowindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement04</h2>
+<p>&lt;test name='HTMLTableRowElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The sectionRowIndex attribute specifies the index of this row, relative
+ to the current section(THEAD, TFOOT, or TBODY),starting from 0.
+
+ Retrieve the fifth TR(2nd In TBODY) element within the document and
+ examine its sectionRowIndex value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79105901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsectionrowindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='4'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sectionRowIndex interface='HTMLTableRowElement' obj='testNode' var='vsectionrowindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsectionrowindex' expected='1' <a id="sectionRowIndexLink">id='sectionRowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement05.html
new file mode 100644
index 0000000000..4a41966ed2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement05.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cells attribute specifies the collection of cells in this row.
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67349879
+*/
+function HTMLTableRowElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement05") != null) return;
+ var nodeList;
+ var cellsnodeList;
+ var testNode;
+ var vcells;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink",6,vcells);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement05</h2>
+<p>&lt;test name='HTMLTableRowElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cells attribute specifies the collection of cells in this row.
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67349879">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67349879</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcells' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='6' <a id="cellsLink">id='cellsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement06.html
new file mode 100644
index 0000000000..31c48480a2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment of data within
+ cells of this row.
+
+ Retrieve the align attribute of the second TR element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257
+*/
+function HTMLTableRowElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement06</h2>
+<p>&lt;test name='HTMLTableRowElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment of data within
+ cells of this row.
+
+ Retrieve the align attribute of the second TR element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableRowElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement07.html
new file mode 100644
index 0000000000..0ad342c73f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement07.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The bgColor attribute specifies the background color of rows.
+
+ Retrieve the bgColor attribute of the second TR element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18161327
+*/
+function HTMLTableRowElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgColorLink","#00FFFF".toLowerCase(),vbgcolor.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement07</h2>
+<p>&lt;test name='HTMLTableRowElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The bgColor attribute specifies the background color of rows.
+
+ Retrieve the bgColor attribute of the second TR element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18161327">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18161327</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLTableRowElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#00FFFF"' <a id="bgColorLink">id='bgColorLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement08.html
new file mode 100644
index 0000000000..851c288de6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The ch attribute specifies the alignment character for cells in a column.
+
+ Retrieve the char attribute of the second TR element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502
+*/
+function HTMLTableRowElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ vch = testNode.ch;
+
+ assertEquals("chLink","*",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement08</h2>
+<p>&lt;test name='HTMLTableRowElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The ch attribute specifies the alignment character for cells in a column.
+
+ Retrieve the char attribute of the second TR element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableRowElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"*"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement09.html
new file mode 100644
index 0000000000..8e4cd60f95
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the second TR element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461
+*/
+function HTMLTableRowElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ vchoff = testNode.chOff;
+
+ assertEquals("charOffLink","1",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement09</h2>
+<p>&lt;test name='HTMLTableRowElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the second TR element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableRowElement' obj='testNode' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"1"' <a id="charOffLink">id='charOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement10.html
new file mode 100644
index 0000000000..9cbaee53f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of data within
+ cells of this row.
+
+ Retrieve the vAlign attribute of the second TR element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90000058
+*/
+function HTMLTableRowElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement10</h2>
+<p>&lt;test name='HTMLTableRowElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of data within
+ cells of this row.
+
+ Retrieve the vAlign attribute of the second TR element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90000058">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90000058</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableRowElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement11.html
new file mode 100644
index 0000000000..c938cb0125
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement11.html
@@ -0,0 +1,173 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertCell() method inserts an empty TD cell into this row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the first TD element. Invoke the
+ insertCell() which will create an empty TD cell at the
+ zero index position. Check the value of the newly created
+ cell and make sure it is null and also the numbers of cells
+ should now be seven.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68927016
+*/
+function HTMLTableRowElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement11") != null) return;
+ var nodeList;
+ var cellsnodeList;
+ var testNode;
+ var trNode;
+ var cellNode;
+ var value;
+ var newCell;
+ var vcells;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink1",6,vcells);
+ trNode = cellsnodeList.item(0);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value1Link","EMP0001",value);
+ newCell = testNode.insertCell(0);
+ testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink2",7,vcells);
+ trNode = cellsnodeList.item(0);
+ cellNode = trNode.firstChild;
+
+ assertNull("value2Link",cellNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement11</h2>
+<p>&lt;test name='HTMLTableRowElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertCell() method inserts an empty TD cell into this row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the first TD element. Invoke the
+ insertCell() which will create an empty TD cell at the
+ zero index position. Check the value of the newly created
+ cell and make sure it is null and also the numbers of cells
+ should now be seven.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-06&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68927016">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68927016</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='trNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='value' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newCell' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcells' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='6' <a id="cellsLink1">id='cellsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"EMP0001"' <a id="value1Link">id='value1Link'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertCell interface='HTMLTableRowElement' obj='testNode' var='newCell' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='7' <a id="cellsLink2">id='cellsLink2'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='cellNode' <a id="value2Link">id='value2Link'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement12.html
new file mode 100644
index 0000000000..3f208f88a3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement12.html
@@ -0,0 +1,171 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertCell() method inserts an empty TD cell into this row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the last TD element. Invoke the
+ insertCell() which will append the empty cell to the end of the list.
+ Check the value of the newly created cell and make sure it is null
+ and also the numbers of cells should now be seven.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68927016
+*/
+function HTMLTableRowElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement12") != null) return;
+ var nodeList;
+ var cellsnodeList;
+ var testNode;
+ var trNode;
+ var cellNode;
+ var value;
+ var newCell;
+ var vcells;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink1",6,vcells);
+ trNode = cellsnodeList.item(5);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value1Link","1230 North Ave. Dallas, Texas 98551",value);
+ newCell = testNode.insertCell(6);
+ testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink2",7,vcells);
+ trNode = cellsnodeList.item(6);
+ cellNode = trNode.firstChild;
+
+ assertNull("value2Link",cellNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement12</h2>
+<p>&lt;test name='HTMLTableRowElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertCell() method inserts an empty TD cell into this row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the last TD element. Invoke the
+ insertCell() which will append the empty cell to the end of the list.
+ Check the value of the newly created cell and make sure it is null
+ and also the numbers of cells should now be seven.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-06&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68927016">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68927016</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='trNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='value' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newCell' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcells' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='6' <a id="cellsLink1">id='cellsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"1230 North Ave. Dallas, Texas 98551"' <a id="value1Link">id='value1Link'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertCell interface='HTMLTableRowElement' obj='testNode' var='newCell' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='7' <a id="cellsLink2">id='cellsLink2'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='cellNode' <a id="value2Link">id='value2Link'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement13.html
new file mode 100644
index 0000000000..56f71638a4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement13.html
@@ -0,0 +1,172 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteCell() method deletes a cell from the current row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the first TD element. Invoke the
+ deleteCell() method which will delete a cell from the current row.
+ Check the value of the cell at the zero index and also check
+ the number of cells which should now be five.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11738598
+*/
+function HTMLTableRowElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement13") != null) return;
+ var nodeList;
+ var cellsnodeList;
+ var testNode;
+ var trNode;
+ var cellNode;
+ var value;
+ var vcells;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink1",6,vcells);
+ trNode = cellsnodeList.item(0);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value1Link","EMP0001",value);
+ testNode.deleteCell(0);
+ testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink2",5,vcells);
+ trNode = cellsnodeList.item(0);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value2Link","Margaret Martin",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement13</h2>
+<p>&lt;test name='HTMLTableRowElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteCell() method deletes a cell from the current row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the first TD element. Invoke the
+ deleteCell() method which will delete a cell from the current row.
+ Check the value of the cell at the zero index and also check
+ the number of cells which should now be five.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-06&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11738598">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11738598</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='trNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='value' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcells' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='6' <a id="cellsLink1">id='cellsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"EMP0001"' <a id="value1Link">id='value1Link'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteCell interface='HTMLTableRowElement' obj='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='5' <a id="cellsLink2">id='cellsLink2'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"Margaret Martin"' <a id="value2Link">id='value2Link'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement14.html
new file mode 100644
index 0000000000..4faad2ce5c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement14.html
@@ -0,0 +1,172 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteCell() method deletes a cell from the current row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the third(index 2) TD element. Invoke the
+ deleteCell() method which will delete a cell from the current row.
+ Check the value of the third cell(index 2) and also check
+ the number of cells which should now be five.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11738598
+*/
+function HTMLTableRowElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement14") != null) return;
+ var nodeList;
+ var cellsnodeList;
+ var testNode;
+ var trNode;
+ var cellNode;
+ var value;
+ var vcells;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink1",6,vcells);
+ trNode = cellsnodeList.item(2);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value1Link","Accountant",value);
+ testNode.deleteCell(2);
+ testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink2",5,vcells);
+ trNode = cellsnodeList.item(2);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value2Link","56,000",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement14</h2>
+<p>&lt;test name='HTMLTableRowElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteCell() method deletes a cell from the current row.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the third(index 2) TD element. Invoke the
+ deleteCell() method which will delete a cell from the current row.
+ Check the value of the third cell(index 2) and also check
+ the number of cells which should now be five.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-06&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11738598">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11738598</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='trNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='value' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcells' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='6' <a id="cellsLink1">id='cellsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"Accountant"' <a id="value1Link">id='value1Link'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteCell interface='HTMLTableRowElement' obj='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='5' <a id="cellsLink2">id='cellsLink2'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"56,000"' <a id="value2Link">id='value2Link'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement15.html
new file mode 100644
index 0000000000..3cf3ed2819
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement15.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of cells.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to insert a cell using an index of seven. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only six cells.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-68927016')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableRowElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var newCell;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+
+ {
+ success = false;
+ try {
+ newCell = testNode.insertCell(7);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableRowElement15",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement15</h2>
+<p>&lt;test name='HTMLTableRowElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of cells.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to insert a cell using an index of seven. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only six cells.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-68927016')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newCell' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableRowElement15">id='HTMLTableRowElement15'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertCell interface='HTMLTableRowElement' obj='testNode' var='newCell' index='7'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement16.html
new file mode 100644
index 0000000000..fc63764ef1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement16.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to insert a cell using an index of negative seven. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-68927016')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableRowElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var newCell;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+
+ {
+ success = false;
+ try {
+ newCell = testNode.insertCell(-7);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableRowElement16",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement16</h2>
+<p>&lt;test name='HTMLTableRowElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to insert a cell using an index of negative seven. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-68927016')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newCell' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableRowElement16">id='HTMLTableRowElement16'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertCell interface='HTMLTableRowElement' obj='testNode' var='newCell' index='-7'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement17.html
new file mode 100644
index 0000000000..9321704af8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement17.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of cells.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to delete a cell using an index of seven. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only six cells.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-11738598')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableRowElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+
+ {
+ success = false;
+ try {
+ testNode.deleteCell(7);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableRowElement17",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement17</h2>
+<p>&lt;test name='HTMLTableRowElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of cells.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to delete a cell using an index of seven. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only six cells.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-11738598')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableRowElement17">id='HTMLTableRowElement17'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteCell interface='HTMLTableRowElement' obj='testNode' index='7'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement18.html
new file mode 100644
index 0000000000..ec7bb985f4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement18.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is equal to the number of cells.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to delete a cell using an index of six. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only six cells.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-11738598')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableRowElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+
+ {
+ success = false;
+ try {
+ testNode.deleteCell(6);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableRowElement18",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement18</h2>
+<p>&lt;test name='HTMLTableRowElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is equal to the number of cells.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to delete a cell using an index of six. This should throw
+ a INDEX_SIZE_ERR DOMException since there are only six cells.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-11738598')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableRowElement18">id='HTMLTableRowElement18'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteCell interface='HTMLTableRowElement' obj='testNode' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement19.html
new file mode 100644
index 0000000000..6d277d373d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement19.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to delete a cell using an index of negative six. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-11738598')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableRowElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+
+ {
+ success = false;
+ try {
+ testNode.deleteCell(-6);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableRowElement19",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement19</h2>
+<p>&lt;test name='HTMLTableRowElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteCell() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the fourth TR element which has six cells. Try
+ to delete a cell using an index of negative six. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-11738598')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableRowElement19">id='HTMLTableRowElement19'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteCell interface='HTMLTableRowElement' obj='testNode' index='-6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement20.html
new file mode 100644
index 0000000000..672b3f2033
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement20.html
@@ -0,0 +1,177 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertCell() method inserts an empty TD cell into this row.
+ If index is -1 or equal to the number of cells, the new cell is
+ appended.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the last TD element. Invoke the
+ insertCell() with an index of negative one
+ which will append the empty cell to the end of the list.
+ Check the value of the newly created cell and make sure it is null
+ and also the numbers of cells should now be seven.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016
+*/
+function HTMLTableRowElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement20") != null) return;
+ var nodeList;
+ var cellsnodeList;
+ var testNode;
+ var trNode;
+ var cellNode;
+ var value;
+ var newCell;
+ var vcells;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink1",6,vcells);
+ trNode = cellsnodeList.item(5);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value1Link","1230 North Ave. Dallas, Texas 98551",value);
+ newCell = testNode.insertCell(-1);
+ testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink2",7,vcells);
+ trNode = cellsnodeList.item(6);
+ cellNode = trNode.firstChild;
+
+ assertNull("value2Link",cellNode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement20</h2>
+<p>&lt;test name='HTMLTableRowElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertCell() method inserts an empty TD cell into this row.
+ If index is -1 or equal to the number of cells, the new cell is
+ appended.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the last TD element. Invoke the
+ insertCell() with an index of negative one
+ which will append the empty cell to the end of the list.
+ Check the value of the newly created cell and make sure it is null
+ and also the numbers of cells should now be seven.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-11-07&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='trNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='value' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newCell' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcells' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='6' <a id="cellsLink1">id='cellsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"1230 North Ave. Dallas, Texas 98551"' <a id="value1Link">id='value1Link'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertCell interface='HTMLTableRowElement' obj='testNode' var='newCell' index='-1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='7' <a id="cellsLink2">id='cellsLink2'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='6'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='cellNode' <a id="value2Link">id='value2Link'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement21.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement21.html
new file mode 100644
index 0000000000..65e859bd0a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement21.html
@@ -0,0 +1,176 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableRowElement21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteCell() method deletes a cell from the currtent row. If
+ the index is -1 the last cell in the row is deleted.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the last TD element. Invoke the
+ deleteCell() with an index of negative one
+ which will delete the last cell in the row.
+ Check the value of the of the last cell
+ and also the numbers of cells should now be five.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598
+*/
+function HTMLTableRowElement21() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableRowElement21") != null) return;
+ var nodeList;
+ var cellsnodeList;
+ var testNode;
+ var trNode;
+ var cellNode;
+ var value;
+ var vcells;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink1",6,vcells);
+ trNode = cellsnodeList.item(5);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value1Link","1230 North Ave. Dallas, Texas 98551",value);
+ testNode.deleteCell(-1);
+ testNode = nodeList.item(3);
+ cellsnodeList = testNode.cells;
+
+ vcells = cellsnodeList.length;
+
+ assertEquals("cellsLink2",5,vcells);
+ trNode = cellsnodeList.item(4);
+ cellNode = trNode.firstChild;
+
+ value = cellNode.nodeValue;
+
+ assertEquals("value2Link","Female",value);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement21</h2>
+<p>&lt;test name='HTMLTableRowElement21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableRowElement21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteCell() method deletes a cell from the currtent row. If
+ the index is -1 the last cell in the row is deleted.
+
+
+ Retrieve the fourth TR element and examine the value of
+ the cells length attribute which should be set to six.
+ Check the value of the last TD element. Invoke the
+ deleteCell() with an index of negative one
+ which will delete the last cell in the row.
+ Check the value of the of the last cell
+ and also the numbers of cells should now be five.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-11-07&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-11738598</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='trNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='cellNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='value' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcells' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='6' <a id="cellsLink1">id='cellsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='5'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"1230 North Ave. Dallas, Texas 98551"' <a id="value1Link">id='value1Link'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteCell interface='HTMLTableRowElement' obj='testNode' index='-1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='3'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcells' expected='5' <a id="cellsLink2">id='cellsLink2'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='4'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;firstChild interface='Node' obj='trNode' var='cellNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nodeValue obj='cellNode' var='value'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='value' expected='"Female"' <a id="value2Link">id='value2Link'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement01.html
new file mode 100644
index 0000000000..e0cbd5d1d3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment of data within
+ cells.
+
+ Retrieve the align attribute of the first THEAD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119
+*/
+function HTMLTableSectionElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement01</h2>
+<p>&lt;test name='HTMLTableSectionElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment of data within
+ cells.
+
+ Retrieve the align attribute of the first THEAD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement02.html
new file mode 100644
index 0000000000..c55881bfcd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement02.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment of data within
+ cells.
+
+ Retrieve the align attribute of the first TFOOT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119
+*/
+function HTMLTableSectionElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement02</h2>
+<p>&lt;test name='HTMLTableSectionElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment of data within
+ cells.
+
+ Retrieve the align attribute of the first TFOOT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement03.html
new file mode 100644
index 0000000000..787e25b046
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement03.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The align attribute specifies the horizontal alignment of data within
+ cells.
+
+ Retrieve the align attribute of the first TBODY element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119
+*/
+function HTMLTableSectionElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement03</h2>
+<p>&lt;test name='HTMLTableSectionElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The align attribute specifies the horizontal alignment of data within
+ cells.
+
+ Retrieve the align attribute of the first TBODY element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40530119</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement04.html
new file mode 100644
index 0000000000..b0fb6a4bf8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The ch attribute specifies the alignment character for cells in a
+ column.
+
+ Retrieve the char attribute of the first THEAD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012
+*/
+function HTMLTableSectionElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vch = testNode.ch;
+
+ assertEquals("chLink","*",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement04</h2>
+<p>&lt;test name='HTMLTableSectionElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The ch attribute specifies the alignment character for cells in a
+ column.
+
+ Retrieve the char attribute of the first THEAD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableSectionElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"*"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement05.html
new file mode 100644
index 0000000000..a185d0aea1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement05.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The ch attribute specifies the alignment character for cells in a
+ column.
+
+ Retrieve the char attribute of the first TFOOT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012
+*/
+function HTMLTableSectionElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vch = testNode.ch;
+
+ assertEquals("chLink","+",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement05</h2>
+<p>&lt;test name='HTMLTableSectionElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The ch attribute specifies the alignment character for cells in a
+ column.
+
+ Retrieve the char attribute of the first TFOOT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableSectionElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"+"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement06.html
new file mode 100644
index 0000000000..110bfacf50
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The ch attribute specifies the alignment character for cells in a
+ column.
+
+ Retrieve the char attribute of the first TBODY element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012
+*/
+function HTMLTableSectionElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vch = testNode.ch;
+
+ assertEquals("chLink","$",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement06</h2>
+<p>&lt;test name='HTMLTableSectionElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The ch attribute specifies the alignment character for cells in a
+ column.
+
+ Retrieve the char attribute of the first TBODY element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83470012</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableSectionElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"$"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement07.html
new file mode 100644
index 0000000000..c7f63a5b25
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement07.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the first THEAD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732
+*/
+function HTMLTableSectionElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcharoff = testNode.chOff;
+
+ assertEquals("chOffLink","1",vcharoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement07</h2>
+<p>&lt;test name='HTMLTableSectionElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the first THEAD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableSectionElement' obj='testNode' var='vcharoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharoff' expected='"1"' <a id="chOffLink">id='chOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement08.html
new file mode 100644
index 0000000000..6adfbdc0f7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the first TFOOT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732
+*/
+function HTMLTableSectionElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcharoff = testNode.chOff;
+
+ assertEquals("chOffLink","2",vcharoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement08</h2>
+<p>&lt;test name='HTMLTableSectionElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the first TFOOT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableSectionElement' obj='testNode' var='vcharoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharoff' expected='"2"' <a id="chOffLink">id='chOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement09.html
new file mode 100644
index 0000000000..20db3cd3d9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the first TBODY element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732
+*/
+function HTMLTableSectionElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vcharoff = testNode.chOff;
+
+ assertEquals("chOffLink","3",vcharoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement09</h2>
+<p>&lt;test name='HTMLTableSectionElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The chOff attribute specifies the offset of alignment character.
+
+ Retrieve the charoff attribute of the first TBODY element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53459732</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableSectionElement' obj='testNode' var='vcharoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharoff' expected='"3"' <a id="chOffLink">id='chOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement10.html
new file mode 100644
index 0000000000..756fa15fba
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of cell data in
+ column.
+
+ Retrieve the vAlign attribute of the first THEAD element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116
+*/
+function HTMLTableSectionElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement10</h2>
+<p>&lt;test name='HTMLTableSectionElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of cell data in
+ column.
+
+ Retrieve the vAlign attribute of the first THEAD element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableSectionElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement11.html
new file mode 100644
index 0000000000..a42b1adea9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement11.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of cell data in
+ column.
+
+ Retrieve the vAlign attribute of the first TFOOT element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116
+*/
+function HTMLTableSectionElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement11</h2>
+<p>&lt;test name='HTMLTableSectionElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of cell data in
+ column.
+
+ Retrieve the vAlign attribute of the first TFOOT element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableSectionElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement12.html
new file mode 100644
index 0000000000..e14140aa1e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement12.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The vAlign attribute specifies the vertical alignment of cell data in
+ column.
+
+ Retrieve the vAlign attribute of the first TBODY element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116
+*/
+function HTMLTableSectionElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement12</h2>
+<p>&lt;test name='HTMLTableSectionElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The vAlign attribute specifies the vertical alignment of cell data in
+ column.
+
+ Retrieve the vAlign attribute of the first TBODY element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-4379116</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableSectionElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement13.html
new file mode 100644
index 0000000000..ea72e4f4c9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement13.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rows attribute specifies the collection of rows in this table section.
+
+ Retrieve the first THEAD element and examine the value of
+ the rows length attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650
+*/
+function HTMLTableSectionElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement13") != null) return;
+ var nodeList;
+ var rowsnodeList;
+ var testNode;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink",1,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement13</h2>
+<p>&lt;test name='HTMLTableSectionElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rows attribute specifies the collection of rows in this table section.
+
+ Retrieve the first THEAD element and examine the value of
+ the rows length attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement14.html
new file mode 100644
index 0000000000..71955d803e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement14.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rows attribute specifies the collection of rows in this table section.
+
+ Retrieve the first TFOOT element and examine the value of
+ the rows length attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650
+*/
+function HTMLTableSectionElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement14") != null) return;
+ var nodeList;
+ var rowsnodeList;
+ var testNode;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink",1,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement14</h2>
+<p>&lt;test name='HTMLTableSectionElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rows attribute specifies the collection of rows in this table section.
+
+ Retrieve the first TFOOT element and examine the value of
+ the rows length attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement15.html
new file mode 100644
index 0000000000..464e10219e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement15.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rows attribute specifies the collection of rows in this table section.
+
+ Retrieve the first TBODY element and examine the value of
+ the rows length attribute.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650
+*/
+function HTMLTableSectionElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement15") != null) return;
+ var nodeList;
+ var rowsnodeList;
+ var testNode;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement15</h2>
+<p>&lt;test name='HTMLTableSectionElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rows attribute specifies the collection of rows in this table section.
+
+ Retrieve the first TBODY element and examine the value of
+ the rows length attribute.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52092650</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement16.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement16.html
new file mode 100644
index 0000000000..7845ad66f4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement16.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement16</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement16'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first THEAD element and invoke the insertRow() method
+ with an index of 0. The nuber of rows in the THEAD section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the THEAD section is two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626
+*/
+function HTMLTableSectionElement16() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement16") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ newRow = testNode.insertRow(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement16</h2>
+<p>&lt;test name='HTMLTableSectionElement16' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement16&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first THEAD element and invoke the insertRow() method
+ with an index of 0. The nuber of rows in the THEAD section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the THEAD section is two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement17.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement17.html
new file mode 100644
index 0000000000..51cb27c421
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement17.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TFOOT element and invoke the insertRow() method
+ with an index of 0. The nuber of rows in the TFOOT section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the TFOOT section is two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626
+*/
+function HTMLTableSectionElement17() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement17") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ newRow = testNode.insertRow(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement17</h2>
+<p>&lt;test name='HTMLTableSectionElement17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TFOOT element and invoke the insertRow() method
+ with an index of 0. The nuber of rows in the TFOOT section before
+ insertion of the new row is one. After the new row is inserted the number
+ of rows in the TFOOT section is two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement18.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement18.html
new file mode 100644
index 0000000000..b4fffa75b2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement18.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TBODY element and invoke the insertRow() method
+ with an index of 0. The nuber of rows in the TBODY section before
+ insertion of the new row is two. After the new row is inserted the number
+ of rows in the TBODY section is three.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626
+*/
+function HTMLTableSectionElement18() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement18") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",2,vrows);
+ newRow = testNode.insertRow(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",3,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement18</h2>
+<p>&lt;test name='HTMLTableSectionElement18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TBODY element and invoke the insertRow() method
+ with an index of 0. The nuber of rows in the TBODY section before
+ insertion of the new row is two. After the new row is inserted the number
+ of rows in the TBODY section is three.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement19.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement19.html
new file mode 100644
index 0000000000..cdc90cd894
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement19.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first THEAD element and invoke the insertRow() method
+ with an index of 1. The nuber of rows in the THEAD section before
+ insertion of the new row is one therefore the new row is appended.
+ After the new row is inserted the number of rows in the THEAD
+ section is two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626
+*/
+function HTMLTableSectionElement19() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement19") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ newRow = testNode.insertRow(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement19</h2>
+<p>&lt;test name='HTMLTableSectionElement19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first THEAD element and invoke the insertRow() method
+ with an index of 1. The nuber of rows in the THEAD section before
+ insertion of the new row is one therefore the new row is appended.
+ After the new row is inserted the number of rows in the THEAD
+ section is two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement20.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement20.html
new file mode 100644
index 0000000000..4992bf58f5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement20.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TFOOT element and invoke the insertRow() method
+ with an index of one. The nuber of rows in the TFOOT section before
+ insertion of the new row is one therefore the new row is appended.
+ After the new row is inserted the number of rows in the TFOOT section
+ is two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626
+*/
+function HTMLTableSectionElement20() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement20") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ newRow = testNode.insertRow(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement20</h2>
+<p>&lt;test name='HTMLTableSectionElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TFOOT element and invoke the insertRow() method
+ with an index of one. The nuber of rows in the TFOOT section before
+ insertion of the new row is one therefore the new row is appended.
+ After the new row is inserted the number of rows in the TFOOT section
+ is two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement21.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement21.html
new file mode 100644
index 0000000000..b75311295f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement21.html
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TBODY element and invoke the insertRow() method
+ with an index of two. The number of rows in the TBODY section before
+ insertion of the new row is two therefore the row is appended.
+ After the new row is inserted the number of rows in the TBODY section is
+ three.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626
+* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=502
+*/
+function HTMLTableSectionElement21() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement21") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",2,vrows);
+ newRow = testNode.insertRow(2);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",3,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement21</h2>
+<p>&lt;test name='HTMLTableSectionElement21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row.
+
+ Retrieve the first TBODY element and invoke the insertRow() method
+ with an index of two. The number of rows in the TBODY section before
+ insertion of the new row is two therefore the row is appended.
+ After the new row is inserted the number of rows in the TBODY section is
+ three.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93995626</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=502">http://www.w3.org/Bugs/Public/show_bug.cgi?id=502</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement22.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement22.html
new file mode 100644
index 0000000000..08d024c80b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement22.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement22</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement22'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method deletes a row from this section.
+
+ Retrieve the first THEAD element and invoke the deleteRow() method
+ with an index of 0. The nuber of rows in the THEAD section before
+ the deletion of the row is one. After the row is deleted the number
+ of rows in the THEAD section is zero.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626
+*/
+function HTMLTableSectionElement22() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement22") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ testNode.deleteRow(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",0,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement22</h2>
+<p>&lt;test name='HTMLTableSectionElement22' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement22&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method deletes a row from this section.
+
+ Retrieve the first THEAD element and invoke the deleteRow() method
+ with an index of 0. The nuber of rows in the THEAD section before
+ the deletion of the row is one. After the row is deleted the number
+ of rows in the THEAD section is zero.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableSectionElement' obj='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='0' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement23.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement23.html
new file mode 100644
index 0000000000..18e65d2921
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement23.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement23</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement23'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method deletes a row from this section.
+
+ Retrieve the first TFOOT element and invoke the deleteRow() method
+ with an index of 0. The nuber of rows in the TFOOT section before
+ the deletion of the row is one. After the row is deleted the number
+ of rows in the TFOOT section is zero.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626
+*/
+function HTMLTableSectionElement23() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement23") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tfoot");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ testNode.deleteRow(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",0,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement23</h2>
+<p>&lt;test name='HTMLTableSectionElement23' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement23&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method deletes a row from this section.
+
+ Retrieve the first TFOOT element and invoke the deleteRow() method
+ with an index of 0. The nuber of rows in the TFOOT section before
+ the deletion of the row is one. After the row is deleted the number
+ of rows in the TFOOT section is zero.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tfoot"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableSectionElement' obj='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='0' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement24.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement24.html
new file mode 100644
index 0000000000..fc6c22bdb1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement24.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement24</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement24'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method deletes a row from this section.
+
+ Retrieve the first TBODY element and invoke the deleteRow() method
+ with an index of 0. The nuber of rows in the TBODY section before
+ the deletion of the row is two. After the row is deleted the number
+ of rows in the TBODY section is one.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626
+*/
+function HTMLTableSectionElement24() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement24") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",2,vrows);
+ testNode.deleteRow(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",1,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement24</h2>
+<p>&lt;test name='HTMLTableSectionElement24' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement24&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method deletes a row from this section.
+
+ Retrieve the first TBODY element and invoke the deleteRow() method
+ with an index of 0. The nuber of rows in the TBODY section before
+ the deletion of the row is two. After the row is deleted the number
+ of rows in the TBODY section is one.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-5625626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableSectionElement' obj='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement25.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement25.html
new file mode 100644
index 0000000000..b83549acbd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement25.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement25</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement25'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the first THEAD element which has one row. Try
+ to insert a new row using an index of two. This should throw
+ a INDEX_SIZE_ERR DOMException since there is only one row.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-93995626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableSectionElement25() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement25") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+
+ {
+ success = false;
+ try {
+ newRow = testNode.insertRow(2);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableSectionElement25",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement25</h2>
+<p>&lt;test name='HTMLTableSectionElement25' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement25&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the first THEAD element which has one row. Try
+ to insert a new row using an index of two. This should throw
+ a INDEX_SIZE_ERR DOMException since there is only one row.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-93995626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableSectionElement25">id='HTMLTableSectionElement25'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement26.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement26.html
new file mode 100644
index 0000000000..6937d9840f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement26.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement26</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement26'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the first THEAD element which has one row. Try
+ to insert a new row using an index of negative two. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-93995626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableSectionElement26() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement26") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+
+ {
+ success = false;
+ try {
+ newRow = testNode.insertRow(-2);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableSectionElement26",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement26</h2>
+<p>&lt;test name='HTMLTableSectionElement26' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement26&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the first THEAD element which has one row. Try
+ to insert a new row using an index of negative two. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-93995626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableSectionElement26">id='HTMLTableSectionElement26'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='-2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement27.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement27.html
new file mode 100644
index 0000000000..ecf41f818c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement27.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement27</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement27'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the first THEAD element which has one row. Try
+ to delete a row using an index of two. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is greater than the
+ number of rows.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-5625626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableSectionElement27() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement27") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+
+ {
+ success = false;
+ try {
+ testNode.deleteRow(2);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableSectionElement27",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement27</h2>
+<p>&lt;test name='HTMLTableSectionElement27' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement27&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is greater than the number of rows.
+
+ Retrieve the first THEAD element which has one row. Try
+ to delete a row using an index of two. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is greater than the
+ number of rows.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-5625626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableSectionElement27">id='HTMLTableSectionElement27'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableSectionElement' obj='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement28.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement28.html
new file mode 100644
index 0000000000..aee22a0d75
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement28.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement28</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement28'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is equal to the number of rows.
+
+ Retrieve the first THEAD element which has one row. Try
+ to delete a row using an index of 1. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is equal to the
+ number of rows.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-5625626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableSectionElement28() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement28") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+
+ {
+ success = false;
+ try {
+ testNode.deleteRow(1);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableSectionElement28",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement28</h2>
+<p>&lt;test name='HTMLTableSectionElement28' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement28&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is equal to the number of rows.
+
+ Retrieve the first THEAD element which has one row. Try
+ to delete a row using an index of 1. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is equal to the
+ number of rows.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-5625626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableSectionElement28">id='HTMLTableSectionElement28'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableSectionElement' obj='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement29.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement29.html
new file mode 100644
index 0000000000..8339ee5c7b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement29.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement29</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement29'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the first THEAD element which has one row. Try
+ to delete a row using an index of negative two. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-5625626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
+*/
+function HTMLTableSectionElement29() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement29") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+
+ {
+ success = false;
+ try {
+ testNode.deleteRow(-2);
+ }
+ catch(ex) {
+ success = (typeof(ex.code) != 'undefined' && ex.code == 1);
+ }
+ assertTrue("HTMLTableSectionElement29",success);
+ }
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement29</h2>
+<p>&lt;test name='HTMLTableSectionElement29' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement29&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method throws a INDEX_SIZE_ERR DOMException
+ if the specified index is negative.
+
+ Retrieve the first THEAD element which has one row. Try
+ to delete a row using an index of negative two. This should throw
+ a INDEX_SIZE_ERR DOMException since the index is negative.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-05-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626">http://www.w3.org/TR/DOM-Level-2-HTML/html#xpointer(id('ID-5625626')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertDOMException <a id="HTMLTableSectionElement29">id='HTMLTableSectionElement29'</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableSectionElement' obj='testNode' index='-2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/INDEX_SIZE_ERR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assertDOMException&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement30.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement30.html
new file mode 100644
index 0000000000..2790c58f31
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement30.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement30</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement30'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The insertRow() method inserts a new empty table row. The new
+ row is inserted immediately before the current indexth row in this
+ section. If index is -1 or equal to the number of rows in this section,
+ the new row is appended.
+
+ Retrieve the first THEAD element and invoke the insertRow() method
+ with an index of negative one. Since the index is negative one the
+ new row is appended.
+ After the new row is appended the number of rows in the THEAD
+ section is two.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626
+*/
+function HTMLTableSectionElement30() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement30") != null) return;
+ var nodeList;
+ var testNode;
+ var newRow;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("thead");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",1,vrows);
+ newRow = testNode.insertRow(-1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",2,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement30</h2>
+<p>&lt;test name='HTMLTableSectionElement30' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement30&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The insertRow() method inserts a new empty table row. The new
+ row is inserted immediately before the current indexth row in this
+ section. If index is -1 or equal to the number of rows in this section,
+ the new row is appended.
+
+ Retrieve the first THEAD element and invoke the insertRow() method
+ with an index of negative one. Since the index is negative one the
+ new row is appended.
+ After the new row is appended the number of rows in the THEAD
+ section is two.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-11-07&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='newRow' type='HTMLElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"thead"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;insertRow interface='HTMLTableSectionElement' obj='testNode' var='newRow' index='-1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement31.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement31.html
new file mode 100644
index 0000000000..e43feb2d07
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableSectionElement31.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement31</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTableSectionElement31'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The deleteRow() method deletes a row from this section. The index
+ starts from 0 and is relative only to the rows contained inside
+ this section, not all the rows in the table. If the index is -1
+ the last row will be deleted.
+
+ Retrieve the second TBODY element and invoke the deleteRow() method
+ with an index of -1. The nuber of rows in the THEAD section before
+ the deletion of the row is two. After the row is deleted the number
+ of rows in the TBODY section is one.
+
+* @author NIST
+* @author Rick Rivello
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626
+*/
+function HTMLTableSectionElement31() {
+ var success;
+ if(checkInitialization(builder, "HTMLTableSectionElement31") != null) return;
+ var nodeList;
+ var testNode;
+ var rowsnodeList;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("tbody");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink1",2,vrows);
+ testNode.deleteRow(-1);
+ rowsnodeList = testNode.rows;
+
+ vrows = rowsnodeList.length;
+
+ assertEquals("rowsLink2",1,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableSectionElement31</h2>
+<p>&lt;test name='HTMLTableSectionElement31' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableSectionElement31&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The deleteRow() method deletes a row from this section. The index
+ starts from 0 and is relative only to the rows contained inside
+ this section, not all the rows in the table. If the index is -1
+ the last row will be deleted.
+
+ Retrieve the second TBODY element and invoke the deleteRow() method
+ with an index of -1. The nuber of rows in the THEAD section before
+ the deletion of the row is two. After the row is deleted the number
+ of rows in the TBODY section is one.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Rick Rivello&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-11-07&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='rowsnodeList' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tbody"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='2' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteRow interface='HTMLTableSectionElement' obj='testNode' index='-1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='testNode' var='rowsnodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement01.html
new file mode 100644
index 0000000000..dd0a7504e5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement01.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The defaultValue attribute represents the HTML value of the attribute
+ when the type attribute has the value of "Text", "File" or "Password".
+
+ Retrieve the defaultValue attribute of the 2nd TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36152213
+*/
+function HTMLTextAreaElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vdefaultvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vdefaultvalue = testNode.defaultValue;
+
+ assertEquals("defaultValueLink","TEXTAREA2",vdefaultvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement01</h2>
+<p>&lt;test name='HTMLTextAreaElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The defaultValue attribute represents the HTML value of the attribute
+ when the type attribute has the value of "Text", "File" or "Password".
+
+ Retrieve the defaultValue attribute of the 2nd TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36152213">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36152213</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdefaultvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;defaultValue interface='HTMLTextAreaElement' obj='testNode' var='vdefaultvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdefaultvalue' expected='"TEXTAREA2"' <a id="defaultValueLink">id='defaultValueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement02.html
new file mode 100644
index 0000000000..af9f31a9e3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement02.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first TEXTAREA element
+ and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18911464
+*/
+function HTMLTextAreaElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var fNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ fNode = testNode.form;
+
+ vform = fNode.id;
+
+ assertEquals("formLink","form1",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement02</h2>
+<p>&lt;test name='HTMLTextAreaElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns the FORM element containing this control.
+
+ Retrieve the form attribute from the first TEXTAREA element
+ and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18911464">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18911464</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='fNode' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLTextAreaElement' obj='testNode' var='fNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id obj='fNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vform' expected='"form1"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement03.html
new file mode 100644
index 0000000000..13c9df10ec
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement03.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The form attribute returns null if control in not within the context of
+ a form.
+
+ Retrieve the second TEXTAREA element and
+ examine its form element.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18911464
+*/
+function HTMLTextAreaElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement03") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vform = testNode.form;
+
+ assertNull("formNullLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement03</h2>
+<p>&lt;test name='HTMLTextAreaElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The form attribute returns null if control in not within the context of
+ a form.
+
+ Retrieve the second TEXTAREA element and
+ examine its form element.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18911464">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18911464</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLTextAreaElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formNullLink">id='formNullLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement04.html
new file mode 100644
index 0000000000..08d3f82673
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement04.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The accessKey attribute specifies a single character access key to
+ give access to the form control.
+
+ Retrieve the accessKey attribute of the 1st TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93102991
+*/
+function HTMLTextAreaElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement04") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accessKeyLink","c",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement04</h2>
+<p>&lt;test name='HTMLTextAreaElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The accessKey attribute specifies a single character access key to
+ give access to the form control.
+
+ Retrieve the accessKey attribute of the 1st TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93102991">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93102991</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLTextAreaElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"c"' <a id="accessKeyLink">id='accessKeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement05.html
new file mode 100644
index 0000000000..4acdbf740b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement05.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The cols attribute specifies the width of control(in characters).
+
+ Retrieve the cols attribute of the 1st TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-51387225
+*/
+function HTMLTextAreaElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement05") != null) return;
+ var nodeList;
+ var testNode;
+ var vcols;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vcols = testNode.cols;
+
+ assertEquals("colsLink",20,vcols);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement05</h2>
+<p>&lt;test name='HTMLTextAreaElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The cols attribute specifies the width of control(in characters).
+
+ Retrieve the cols attribute of the 1st TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-51387225">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-51387225</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcols' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cols interface='HTMLTextAreaElement' obj='testNode' var='vcols'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcols' expected='20' <a id="colsLink">id='colsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement06.html
new file mode 100644
index 0000000000..3049fd2d12
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement06.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The disabled attribute specifies the control is unavailable in this
+ context.
+
+ Retrieve the disabled attribute from the 2nd TEXTAREA element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98725443
+*/
+function HTMLTextAreaElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement06") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vdisabled = testNode.disabled;
+
+ assertTrue("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement06</h2>
+<p>&lt;test name='HTMLTextAreaElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The disabled attribute specifies the control is unavailable in this
+ context.
+
+ Retrieve the disabled attribute from the 2nd TEXTAREA element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98725443">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98725443</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLTextAreaElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement07.html
new file mode 100644
index 0000000000..ae49b1668d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The name attribute specifies the form control or object name when
+ submitted with a form.
+
+ Retrieve the name attribute of the 1st TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70715578
+*/
+function HTMLTextAreaElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement07") != null) return;
+ var nodeList;
+ var testNode;
+ var vname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","text1",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement07</h2>
+<p>&lt;test name='HTMLTextAreaElement07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The name attribute specifies the form control or object name when
+ submitted with a form.
+
+ Retrieve the name attribute of the 1st TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70715578">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70715578</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name interface='HTMLTextAreaElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"text1"' <a id="nameLink">id='nameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement08.html
new file mode 100644
index 0000000000..615758b6d8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement08.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The readOnly attribute specifies this control is read-only.
+
+ Retrieve the readOnly attribute from the 3rd TEXTAREA element and
+ examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39131423
+*/
+function HTMLTextAreaElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement08") != null) return;
+ var nodeList;
+ var testNode;
+ var vreadonly;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(2);
+ vreadonly = testNode.readOnly;
+
+ assertTrue("readOnlyLink",vreadonly);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement08</h2>
+<p>&lt;test name='HTMLTextAreaElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The readOnly attribute specifies this control is read-only.
+
+ Retrieve the readOnly attribute from the 3rd TEXTAREA element and
+ examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39131423">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39131423</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vreadonly' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='2'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;readOnly interface='HTMLTextAreaElement' obj='testNode' var='vreadonly'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vreadonly' <a id="readOnlyLink">id='readOnlyLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement09.html
new file mode 100644
index 0000000000..e15e92d010
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement09.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The rows attribute specifies the number of text rowns.
+
+ Retrieve the rows attribute of the 1st TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46975887
+*/
+function HTMLTextAreaElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement09") != null) return;
+ var nodeList;
+ var testNode;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vrows = testNode.rows;
+
+ assertEquals("rowsLink",7,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement09</h2>
+<p>&lt;test name='HTMLTextAreaElement09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The rows attribute specifies the number of text rowns.
+
+ Retrieve the rows attribute of the 1st TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46975887">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46975887</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTextAreaElement' obj='testNode' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='7' <a id="rowsLink">id='rowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement10.html
new file mode 100644
index 0000000000..e747e55045
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement10.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The tabIndex attribute is an index that represents the element's position
+ in the tabbing order.
+
+ Retrieve the tabIndex attribute of the 1st TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-60363303
+*/
+function HTMLTextAreaElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement10") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",5,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement10</h2>
+<p>&lt;test name='HTMLTextAreaElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The tabIndex attribute is an index that represents the element's position
+ in the tabbing order.
+
+ Retrieve the tabIndex attribute of the 1st TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-60363303">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-60363303</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLTextAreaElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='5' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement11.html
new file mode 100644
index 0000000000..4c0f067b09
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement11.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the type of this form control.
+
+ Retrieve the type attribute of the 1st TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-24874179
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLTextAreaElement-type
+*/
+function HTMLTextAreaElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","textarea",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement11</h2>
+<p>&lt;test name='HTMLTextAreaElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the type of this form control.
+
+ Retrieve the type attribute of the 1st TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-24874179">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-24874179</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLTextAreaElement-type">http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLTextAreaElement-type</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLTextAreaElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"textarea"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement12.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement12.html
new file mode 100644
index 0000000000..9f3684e80d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement12.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The value attribute represents the current contents of the corresponding
+ form control, in an interactive user agent.
+
+ Retrieve the value attribute of the 1st TEXTAREA element and examine
+ its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70715579
+*/
+function HTMLTextAreaElement12() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement12") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ vvalue = testNode.value;
+
+ assertEquals("valueLink","TEXTAREA1",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement12</h2>
+<p>&lt;test name='HTMLTextAreaElement12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The value attribute represents the current contents of the corresponding
+ form control, in an interactive user agent.
+
+ Retrieve the value attribute of the 1st TEXTAREA element and examine
+ its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70715579">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70715579</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLTextAreaElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"TEXTAREA1"' <a id="valueLink">id='valueLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement13.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement13.html
new file mode 100644
index 0000000000..d1d32f2af1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement13.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Calling HTMLTextAreaElement.blur should surrender input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6750689
+*/
+function HTMLTextAreaElement13() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement13") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ testNode.blur();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement13</h2>
+<p>&lt;test name='HTMLTextAreaElement13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Calling HTMLTextAreaElement.blur should surrender input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6750689">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6750689</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;blur interface='HTMLTextAreaElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement14.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement14.html
new file mode 100644
index 0000000000..548028cd66
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement14.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Calling HTMLTextAreaElement.focus should capture input focus.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39055426
+*/
+function HTMLTextAreaElement14() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement14") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ testNode.focus();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement14</h2>
+<p>&lt;test name='HTMLTextAreaElement14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Calling HTMLTextAreaElement.focus should capture input focus.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39055426">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39055426</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;focus interface='HTMLTextAreaElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement15.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement15.html
new file mode 100644
index 0000000000..879b6208ef
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTextAreaElement15.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTextAreaElement15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "textarea");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Calling HTMLTextAreaElement.select should select the text area.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48880622
+*/
+function HTMLTextAreaElement15() {
+ var success;
+ if(checkInitialization(builder, "HTMLTextAreaElement15") != null) return;
+ var nodeList;
+ var testNode;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "textarea");
+ nodeList = doc.getElementsByTagName("textarea");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(0);
+ testNode.select();
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTextAreaElement15</h2>
+<p>&lt;test name='HTMLTextAreaElement15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTextAreaElement15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Calling HTMLTextAreaElement.select should select the text area.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48880622">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48880622</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='textarea' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"textarea"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;select interface='HTMLTextAreaElement' obj='testNode'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/textarea.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLTitleElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLTitleElement01.html
new file mode 100644
index 0000000000..f71ce5975c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTitleElement01.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTitleElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLTitleElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "title");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The text attribute is the specified title as a string.
+
+ Retrieve the text attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77500413
+*/
+function HTMLTitleElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLTitleElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vtext;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "title");
+ nodeList = doc.getElementsByTagName("title");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtext = testNode.text;
+
+ assertEquals("textLink","NIST DOM HTML Test - TITLE",vtext);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTitleElement01</h2>
+<p>&lt;test name='HTMLTitleElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTitleElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The text attribute is the specified title as a string.
+
+ Retrieve the text attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77500413">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77500413</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtext' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='title' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"title"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;text interface='HTMLTitleElement' obj='testNode' var='vtext'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtext' expected='"NIST DOM HTML Test - TITLE"' <a id="textLink">id='textLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/title.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLUListElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLUListElement01.html
new file mode 100644
index 0000000000..a3913a0e23
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLUListElement01.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLUListElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLUListElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "ulist");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The compact attribute specifies whether to reduce spacing between list
+ items.
+
+ Retrieve the compact attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39864178
+*/
+function HTMLUListElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLUListElement01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcompact;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "ulist");
+ nodeList = doc.getElementsByTagName("ul");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vcompact = testNode.compact;
+
+ assertTrue("compactLink",vcompact);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLUListElement01</h2>
+<p>&lt;test name='HTMLUListElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLUListElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The compact attribute specifies whether to reduce spacing between list
+ items.
+
+ Retrieve the compact attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39864178">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39864178</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcompact' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='ulist' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"ul"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;compact interface='HTMLUListElement' obj='testNode' var='vcompact'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vcompact' <a id="compactLink">id='compactLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/ulist.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLUListElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLUListElement02.html
new file mode 100644
index 0000000000..0ab6be828a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLUListElement02.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLUListElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLUListElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "ulist");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The type attribute specifies the bullet style.
+
+ Retrieve the type attribute and examine its value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96874670
+*/
+function HTMLUListElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLUListElement02") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "ulist");
+ nodeList = doc.getElementsByTagName("ul");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","disc",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLUListElement02</h2>
+<p>&lt;test name='HTMLUListElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLUListElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The type attribute specifies the bullet style.
+
+ Retrieve the type attribute and examine its value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96874670">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96874670</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='ulist' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"ul"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLUListElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"disc"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/ulist.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_alltests.html b/dom/tests/mochitest/dom-level2-html/test_alltests.html
new file mode 100644
index 0000000000..2ad21a3fcd
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_alltests.html
@@ -0,0 +1,3933 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/alltests</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script src="DOMTestSuite.js" type="text/javascript"></script>
+<script type="text/javascript">
+
+function suite() {
+ var newsuite = new top.jsUnitTestSuite();
+ var suiteBuilder = createConfiguredBuilder();
+ var isHTML = (suiteBuilder.contentType == "text/html") || (suiteBuilder.contentType == "application/xhtml+xml");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLAnchorElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLAppletElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLAreaElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLBRElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLBaseElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLBaseElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLBodyElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLButtonElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection01.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection02.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection03.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection04.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection05.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection06.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection07.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection08.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection09.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection10.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection11.html");
+ newsuite.addTestPage("../level2/html/HTMLCollection12.html");
+ newsuite.addTestPage("../level2/html/HTMLDirectoryElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLDivElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLDlistElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument01.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument02.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument03.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument04.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument05.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument07.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument08.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument09.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument10.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument11.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument12.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument13.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument14.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument15.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument16.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument17.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument18.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument19.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument20.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument21.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument22.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument23.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument24.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument25.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument26.html");
+ newsuite.addTestPage("../level2/html/HTMLDocument27.html");
+ newsuite.addTestPage("../level2/html/HTMLElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLElement100.html");
+ newsuite.addTestPage("../level2/html/HTMLElement101.html");
+ newsuite.addTestPage("../level2/html/HTMLElement102.html");
+ newsuite.addTestPage("../level2/html/HTMLElement103.html");
+ newsuite.addTestPage("../level2/html/HTMLElement104.html");
+ newsuite.addTestPage("../level2/html/HTMLElement105.html");
+ newsuite.addTestPage("../level2/html/HTMLElement106.html");
+ newsuite.addTestPage("../level2/html/HTMLElement107.html");
+ newsuite.addTestPage("../level2/html/HTMLElement108.html");
+ newsuite.addTestPage("../level2/html/HTMLElement109.html");
+ newsuite.addTestPage("../level2/html/HTMLElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLElement110.html");
+ newsuite.addTestPage("../level2/html/HTMLElement111.html");
+ newsuite.addTestPage("../level2/html/HTMLElement112.html");
+ newsuite.addTestPage("../level2/html/HTMLElement113.html");
+ newsuite.addTestPage("../level2/html/HTMLElement114.html");
+ newsuite.addTestPage("../level2/html/HTMLElement115.html");
+ newsuite.addTestPage("../level2/html/HTMLElement116.html");
+ newsuite.addTestPage("../level2/html/HTMLElement117.html");
+ newsuite.addTestPage("../level2/html/HTMLElement118.html");
+ newsuite.addTestPage("../level2/html/HTMLElement119.html");
+ newsuite.addTestPage("../level2/html/HTMLElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLElement120.html");
+ newsuite.addTestPage("../level2/html/HTMLElement121.html");
+ newsuite.addTestPage("../level2/html/HTMLElement122.html");
+ newsuite.addTestPage("../level2/html/HTMLElement123.html");
+ newsuite.addTestPage("../level2/html/HTMLElement124.html");
+ newsuite.addTestPage("../level2/html/HTMLElement125.html");
+ newsuite.addTestPage("../level2/html/HTMLElement126.html");
+ newsuite.addTestPage("../level2/html/HTMLElement127.html");
+ newsuite.addTestPage("../level2/html/HTMLElement128.html");
+ newsuite.addTestPage("../level2/html/HTMLElement129.html");
+ newsuite.addTestPage("../level2/html/HTMLElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLElement130.html");
+ newsuite.addTestPage("../level2/html/HTMLElement131.html");
+ newsuite.addTestPage("../level2/html/HTMLElement132.html");
+ newsuite.addTestPage("../level2/html/HTMLElement133.html");
+ newsuite.addTestPage("../level2/html/HTMLElement134.html");
+ newsuite.addTestPage("../level2/html/HTMLElement135.html");
+ newsuite.addTestPage("../level2/html/HTMLElement136.html");
+ newsuite.addTestPage("../level2/html/HTMLElement137.html");
+ newsuite.addTestPage("../level2/html/HTMLElement138.html");
+ newsuite.addTestPage("../level2/html/HTMLElement139.html");
+ newsuite.addTestPage("../level2/html/HTMLElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLElement140.html");
+ newsuite.addTestPage("../level2/html/HTMLElement141.html");
+ newsuite.addTestPage("../level2/html/HTMLElement142.html");
+ newsuite.addTestPage("../level2/html/HTMLElement143.html");
+ newsuite.addTestPage("../level2/html/HTMLElement144.html");
+ newsuite.addTestPage("../level2/html/HTMLElement145.html");
+ newsuite.addTestPage("../level2/html/HTMLElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLElement21.html");
+ newsuite.addTestPage("../level2/html/HTMLElement22.html");
+ newsuite.addTestPage("../level2/html/HTMLElement23.html");
+ newsuite.addTestPage("../level2/html/HTMLElement24.html");
+ newsuite.addTestPage("../level2/html/HTMLElement25.html");
+ newsuite.addTestPage("../level2/html/HTMLElement26.html");
+ newsuite.addTestPage("../level2/html/HTMLElement27.html");
+ newsuite.addTestPage("../level2/html/HTMLElement28.html");
+ newsuite.addTestPage("../level2/html/HTMLElement29.html");
+ newsuite.addTestPage("../level2/html/HTMLElement30.html");
+ newsuite.addTestPage("../level2/html/HTMLElement31.html");
+ newsuite.addTestPage("../level2/html/HTMLElement32.html");
+ newsuite.addTestPage("../level2/html/HTMLElement33.html");
+ newsuite.addTestPage("../level2/html/HTMLElement34.html");
+ newsuite.addTestPage("../level2/html/HTMLElement35.html");
+ newsuite.addTestPage("../level2/html/HTMLElement36.html");
+ newsuite.addTestPage("../level2/html/HTMLElement37.html");
+ newsuite.addTestPage("../level2/html/HTMLElement38.html");
+ newsuite.addTestPage("../level2/html/HTMLElement39.html");
+ newsuite.addTestPage("../level2/html/HTMLElement40.html");
+ newsuite.addTestPage("../level2/html/HTMLElement41.html");
+ newsuite.addTestPage("../level2/html/HTMLElement42.html");
+ newsuite.addTestPage("../level2/html/HTMLElement43.html");
+ newsuite.addTestPage("../level2/html/HTMLElement44.html");
+ newsuite.addTestPage("../level2/html/HTMLElement45.html");
+ newsuite.addTestPage("../level2/html/HTMLElement46.html");
+ newsuite.addTestPage("../level2/html/HTMLElement47.html");
+ newsuite.addTestPage("../level2/html/HTMLElement48.html");
+ newsuite.addTestPage("../level2/html/HTMLElement49.html");
+ newsuite.addTestPage("../level2/html/HTMLElement50.html");
+ newsuite.addTestPage("../level2/html/HTMLElement51.html");
+ newsuite.addTestPage("../level2/html/HTMLElement52.html");
+ newsuite.addTestPage("../level2/html/HTMLElement53.html");
+ newsuite.addTestPage("../level2/html/HTMLElement54.html");
+ newsuite.addTestPage("../level2/html/HTMLElement55.html");
+ newsuite.addTestPage("../level2/html/HTMLElement56.html");
+ newsuite.addTestPage("../level2/html/HTMLElement57.html");
+ newsuite.addTestPage("../level2/html/HTMLElement58.html");
+ newsuite.addTestPage("../level2/html/HTMLElement59.html");
+ newsuite.addTestPage("../level2/html/HTMLElement60.html");
+ newsuite.addTestPage("../level2/html/HTMLElement61.html");
+ newsuite.addTestPage("../level2/html/HTMLElement62.html");
+ newsuite.addTestPage("../level2/html/HTMLElement63.html");
+ newsuite.addTestPage("../level2/html/HTMLElement64.html");
+ newsuite.addTestPage("../level2/html/HTMLElement65.html");
+ newsuite.addTestPage("../level2/html/HTMLElement66.html");
+ newsuite.addTestPage("../level2/html/HTMLElement67.html");
+ newsuite.addTestPage("../level2/html/HTMLElement68.html");
+ newsuite.addTestPage("../level2/html/HTMLElement69.html");
+ newsuite.addTestPage("../level2/html/HTMLElement70.html");
+ newsuite.addTestPage("../level2/html/HTMLElement71.html");
+ newsuite.addTestPage("../level2/html/HTMLElement72.html");
+ newsuite.addTestPage("../level2/html/HTMLElement73.html");
+ newsuite.addTestPage("../level2/html/HTMLElement74.html");
+ newsuite.addTestPage("../level2/html/HTMLElement75.html");
+ newsuite.addTestPage("../level2/html/HTMLElement76.html");
+ newsuite.addTestPage("../level2/html/HTMLElement77.html");
+ newsuite.addTestPage("../level2/html/HTMLElement78.html");
+ newsuite.addTestPage("../level2/html/HTMLElement79.html");
+ newsuite.addTestPage("../level2/html/HTMLElement80.html");
+ newsuite.addTestPage("../level2/html/HTMLElement81.html");
+ newsuite.addTestPage("../level2/html/HTMLElement82.html");
+ newsuite.addTestPage("../level2/html/HTMLElement83.html");
+ newsuite.addTestPage("../level2/html/HTMLElement84.html");
+ newsuite.addTestPage("../level2/html/HTMLElement85.html");
+ newsuite.addTestPage("../level2/html/HTMLElement86.html");
+ newsuite.addTestPage("../level2/html/HTMLElement87.html");
+ newsuite.addTestPage("../level2/html/HTMLElement88.html");
+ newsuite.addTestPage("../level2/html/HTMLElement89.html");
+ newsuite.addTestPage("../level2/html/HTMLElement90.html");
+ newsuite.addTestPage("../level2/html/HTMLElement91.html");
+ newsuite.addTestPage("../level2/html/HTMLElement92.html");
+ newsuite.addTestPage("../level2/html/HTMLElement93.html");
+ newsuite.addTestPage("../level2/html/HTMLElement94.html");
+ newsuite.addTestPage("../level2/html/HTMLElement95.html");
+ newsuite.addTestPage("../level2/html/HTMLElement96.html");
+ newsuite.addTestPage("../level2/html/HTMLElement97.html");
+ newsuite.addTestPage("../level2/html/HTMLElement98.html");
+ newsuite.addTestPage("../level2/html/HTMLElement99.html");
+ newsuite.addTestPage("../level2/html/HTMLFieldSetElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLFieldSetElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLFontElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLFontElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLFontElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLFormElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameSetElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLFrameSetElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLHRElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLHRElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLHRElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLHRElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLHeadElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLHeadingElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLHeadingElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLHeadingElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLHeadingElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLHeadingElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLHeadingElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLHtmlElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLIFrameElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLImageElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement21.html");
+ newsuite.addTestPage("../level2/html/HTMLInputElement22.html");
+ newsuite.addTestPage("../level2/html/HTMLIsIndexElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLIsIndexElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLIsIndexElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLLIElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLLIElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLLabelElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLLabelElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLLabelElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLLabelElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLLegendElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLLegendElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLLegendElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLLegendElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLLinkElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLMapElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLMapElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLMenuElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLMetaElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLMetaElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLMetaElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLMetaElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLModElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLModElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLModElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLModElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLOListElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLOListElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLOListElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLObjectElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLOptGroupElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLOptGroupElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionsCollection01.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionsCollection02.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionsCollection03.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionsCollection04.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionsCollection05.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionsCollection06.html");
+ newsuite.addTestPage("../level2/html/HTMLOptionsCollection07.html");
+ newsuite.addTestPage("../level2/html/HTMLParagraphElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLParamElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLParamElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLParamElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLParamElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLPreElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLQuoteElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLQuoteElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLScriptElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLScriptElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLScriptElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLScriptElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLScriptElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLScriptElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLScriptElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLSelectElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLStyleElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLStyleElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLStyleElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCaptionElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement21.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement22.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement23.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement24.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement25.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement26.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement27.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement28.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement29.html");
+ newsuite.addTestPage("../level2/html/HTMLTableCellElement30.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLTableColElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement21.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement22.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement23.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement24.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement25.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement26.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement27.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement28.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement29.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement30.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement31.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement32.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement33.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement34.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement35.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement36.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement37.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement38.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement39.html");
+ newsuite.addTestPage("../level2/html/HTMLTableElement40.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLTableRowElement21.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement16.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement17.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement18.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement19.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement20.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement21.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement22.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement23.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement24.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement25.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement26.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement27.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement28.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement29.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement30.html");
+ newsuite.addTestPage("../level2/html/HTMLTableSectionElement31.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement02.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement03.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement04.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement05.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement06.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement07.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement08.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement09.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement10.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement11.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement12.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement13.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement14.html");
+ newsuite.addTestPage("../level2/html/HTMLTextAreaElement15.html");
+ newsuite.addTestPage("../level2/html/HTMLTitleElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLUListElement01.html");
+ newsuite.addTestPage("../level2/html/HTMLUListElement02.html");
+ newsuite.addTestPage("../level2/html/anchor01.html");
+ newsuite.addTestPage("../level2/html/anchor02.html");
+ newsuite.addTestPage("../level2/html/anchor03.html");
+ newsuite.addTestPage("../level2/html/anchor04.html");
+ newsuite.addTestPage("../level2/html/anchor05.html");
+ newsuite.addTestPage("../level2/html/anchor06.html");
+ newsuite.addTestPage("../level2/html/area01.html");
+ newsuite.addTestPage("../level2/html/area02.html");
+ newsuite.addTestPage("../level2/html/area03.html");
+ newsuite.addTestPage("../level2/html/area04.html");
+ newsuite.addTestPage("../level2/html/body01.html");
+ newsuite.addTestPage("../level2/html/button01.html");
+ newsuite.addTestPage("../level2/html/button02.html");
+ newsuite.addTestPage("../level2/html/button03.html");
+ newsuite.addTestPage("../level2/html/button04.html");
+ newsuite.addTestPage("../level2/html/button05.html");
+ newsuite.addTestPage("../level2/html/button06.html");
+ newsuite.addTestPage("../level2/html/button07.html");
+ newsuite.addTestPage("../level2/html/button08.html");
+ newsuite.addTestPage("../level2/html/button09.html");
+ newsuite.addTestPage("../level2/html/dlist01.html");
+ newsuite.addTestPage("../level2/html/doc01.html");
+ newsuite.addTestPage("../level2/html/hasFeature01.html");
+ newsuite.addTestPage("../level2/html/hasFeature02.html");
+ newsuite.addTestPage("../level2/html/hasFeature03.html");
+ newsuite.addTestPage("../level2/html/hasFeature04.html");
+ newsuite.addTestPage("../level2/html/hasFeature05.html");
+ newsuite.addTestPage("../level2/html/hasFeature06.html");
+ newsuite.addTestPage("../level2/html/object01.html");
+ newsuite.addTestPage("../level2/html/object02.html");
+ newsuite.addTestPage("../level2/html/object03.html");
+ newsuite.addTestPage("../level2/html/object04.html");
+ newsuite.addTestPage("../level2/html/object05.html");
+ newsuite.addTestPage("../level2/html/object06.html");
+ newsuite.addTestPage("../level2/html/object07.html");
+ newsuite.addTestPage("../level2/html/object08.html");
+ newsuite.addTestPage("../level2/html/object09.html");
+ newsuite.addTestPage("../level2/html/object10.html");
+ newsuite.addTestPage("../level2/html/object11.html");
+ newsuite.addTestPage("../level2/html/object12.html");
+ newsuite.addTestPage("../level2/html/object13.html");
+ newsuite.addTestPage("../level2/html/object14.html");
+ newsuite.addTestPage("../level2/html/object15.html");
+ newsuite.addTestPage("../level2/html/table01.html");
+ newsuite.addTestPage("../level2/html/table02.html");
+ newsuite.addTestPage("../level2/html/table03.html");
+ newsuite.addTestPage("../level2/html/table04.html");
+ newsuite.addTestPage("../level2/html/table06.html");
+ newsuite.addTestPage("../level2/html/table07.html");
+ newsuite.addTestPage("../level2/html/table08.html");
+ newsuite.addTestPage("../level2/html/table09.html");
+ newsuite.addTestPage("../level2/html/table10.html");
+ newsuite.addTestPage("../level2/html/table12.html");
+ newsuite.addTestPage("../level2/html/table15.html");
+ newsuite.addTestPage("../level2/html/table17.html");
+ newsuite.addTestPage("../level2/html/table18.html");
+ newsuite.addTestPage("../level2/html/table19.html");
+ newsuite.addTestPage("../level2/html/table20.html");
+ newsuite.addTestPage("../level2/html/table21.html");
+ newsuite.addTestPage("../level2/html/table22.html");
+ newsuite.addTestPage("../level2/html/table23.html");
+ newsuite.addTestPage("../level2/html/table24.html");
+ newsuite.addTestPage("../level2/html/table25.html");
+ newsuite.addTestPage("../level2/html/table26.html");
+ newsuite.addTestPage("../level2/html/table27.html");
+ newsuite.addTestPage("../level2/html/table28.html");
+ newsuite.addTestPage("../level2/html/table29.html");
+ newsuite.addTestPage("../level2/html/table30.html");
+ newsuite.addTestPage("../level2/html/table31.html");
+ newsuite.addTestPage("../level2/html/table32.html");
+ newsuite.addTestPage("../level2/html/table33.html");
+ newsuite.addTestPage("../level2/html/table34.html");
+ newsuite.addTestPage("../level2/html/table35.html");
+ newsuite.addTestPage("../level2/html/table36.html");
+ newsuite.addTestPage("../level2/html/table37.html");
+ newsuite.addTestPage("../level2/html/table38.html");
+ newsuite.addTestPage("../level2/html/table39.html");
+ newsuite.addTestPage("../level2/html/table40.html");
+ newsuite.addTestPage("../level2/html/table41.html");
+ newsuite.addTestPage("../level2/html/table42.html");
+ newsuite.addTestPage("../level2/html/table43.html");
+ newsuite.addTestPage("../level2/html/table44.html");
+ newsuite.addTestPage("../level2/html/table45.html");
+ newsuite.addTestPage("../level2/html/table46.html");
+ newsuite.addTestPage("../level2/html/table47.html");
+ newsuite.addTestPage("../level2/html/table48.html");
+ newsuite.addTestPage("../level2/html/table49.html");
+ newsuite.addTestPage("../level2/html/table50.html");
+ newsuite.addTestPage("../level2/html/table51.html");
+ newsuite.addTestPage("../level2/html/table52.html");
+ newsuite.addTestPage("../level2/html/table53.html");
+
+ return newsuite;
+}
+</script>
+</head>
+<body onload="onImplementationChange()">
+<h1>DOM Level 2 HTML Test Suite</h1>
+<form onsubmit="fixTestPagePath()" action="../../jsunit/testRunner.html" id="configuration">
+<table summary="Configuration" border="1" width="100%">
+<tr>
+<td>
+<table summary="Tests" width="100%">
+<tr>
+<td>Test: </td><td><select size="1" name="testpage"><option value="alltests.html" selected>alltests</option><option value="anchor01.html">anchor01</option>
+
+
+
+
+<option value="anchor02.html">anchor02</option>
+
+
+
+
+<option value="anchor03.html">anchor03</option>
+
+
+
+
+<option value="anchor04.html">anchor04</option>
+
+
+
+
+<option value="anchor05.html">anchor05</option>
+
+
+
+
+<option value="anchor06.html">anchor06</option>
+
+
+
+
+<option value="area01.html">area01</option>
+
+
+
+
+<option value="area02.html">area02</option>
+
+
+
+
+<option value="area03.html">area03</option>
+
+
+
+
+<option value="area04.html">area04</option>
+
+
+
+
+<option value="body01.html">body01</option>
+
+
+
+
+<option value="button01.html">button01</option>
+
+
+
+
+<option value="button02.html">button02</option>
+
+
+
+
+<option value="button03.html">button03</option>
+
+
+
+
+<option value="button04.html">button04</option>
+
+
+
+
+<option value="button05.html">button05</option>
+
+
+
+
+<option value="button06.html">button06</option>
+
+
+
+
+<option value="button07.html">button07</option>
+
+
+
+
+<option value="button08.html">button08</option>
+
+
+
+
+<option value="button09.html">button09</option>
+
+
+
+
+<option value="dlist01.html">dlist01</option>
+
+
+
+
+<option value="doc01.html">doc01</option>
+
+
+
+
+<option value="hasFeature01.html">hasFeature01</option>
+
+
+
+
+<option value="HTMLAnchorElement01.html">HTMLAnchorElement01</option>
+
+
+
+
+<option value="HTMLAnchorElement02.html">HTMLAnchorElement02</option>
+
+
+
+
+<option value="HTMLAnchorElement03.html">HTMLAnchorElement03</option>
+
+
+
+
+<option value="HTMLAnchorElement04.html">HTMLAnchorElement04</option>
+
+
+
+
+<option value="HTMLAnchorElement05.html">HTMLAnchorElement05</option>
+
+
+
+
+<option value="HTMLAnchorElement06.html">HTMLAnchorElement06</option>
+
+
+
+
+<option value="HTMLAnchorElement07.html">HTMLAnchorElement07</option>
+
+
+
+
+<option value="HTMLAnchorElement08.html">HTMLAnchorElement08</option>
+
+
+
+
+<option value="HTMLAnchorElement09.html">HTMLAnchorElement09</option>
+
+
+
+
+<option value="HTMLAnchorElement10.html">HTMLAnchorElement10</option>
+
+
+
+
+<option value="HTMLAnchorElement11.html">HTMLAnchorElement11</option>
+
+
+
+
+<option value="HTMLAnchorElement12.html">HTMLAnchorElement12</option>
+
+
+
+
+<option value="HTMLAnchorElement13.html">HTMLAnchorElement13</option>
+
+
+
+
+<option value="HTMLAnchorElement14.html">HTMLAnchorElement14</option>
+
+
+
+
+<option value="HTMLAppletElement01.html">HTMLAppletElement01</option>
+
+
+
+
+<option value="HTMLAppletElement02.html">HTMLAppletElement02</option>
+
+
+
+
+<option value="HTMLAppletElement03.html">HTMLAppletElement03</option>
+
+
+
+
+<option value="HTMLAppletElement04.html">HTMLAppletElement04</option>
+
+
+
+
+<option value="HTMLAppletElement05.html">HTMLAppletElement05</option>
+
+
+
+
+<option value="HTMLAppletElement06.html">HTMLAppletElement06</option>
+
+
+
+
+<option value="HTMLAppletElement08.html">HTMLAppletElement08</option>
+
+
+
+
+<option value="HTMLAppletElement10.html">HTMLAppletElement10</option>
+
+
+
+
+<option value="HTMLAppletElement11.html">HTMLAppletElement11</option>
+
+
+
+
+<option value="HTMLAreaElement01.html">HTMLAreaElement01</option>
+
+
+
+
+<option value="HTMLAreaElement02.html">HTMLAreaElement02</option>
+
+
+
+
+<option value="HTMLAreaElement03.html">HTMLAreaElement03</option>
+
+
+
+
+<option value="HTMLAreaElement04.html">HTMLAreaElement04</option>
+
+
+
+
+<option value="HTMLAreaElement05.html">HTMLAreaElement05</option>
+
+
+
+
+<option value="HTMLAreaElement06.html">HTMLAreaElement06</option>
+
+
+
+
+<option value="HTMLAreaElement07.html">HTMLAreaElement07</option>
+
+
+
+
+<option value="HTMLAreaElement08.html">HTMLAreaElement08</option>
+
+
+
+
+<option value="HTMLBaseElement01.html">HTMLBaseElement01</option>
+
+
+
+
+<option value="HTMLBaseElement02.html">HTMLBaseElement02</option>
+
+
+
+
+<option value="HTMLBodyElement01.html">HTMLBodyElement01</option>
+
+
+
+
+<option value="HTMLBodyElement02.html">HTMLBodyElement02</option>
+
+
+
+
+<option value="HTMLBodyElement03.html">HTMLBodyElement03</option>
+
+
+
+
+<option value="HTMLBodyElement04.html">HTMLBodyElement04</option>
+
+
+
+
+<option value="HTMLBodyElement05.html">HTMLBodyElement05</option>
+
+
+
+
+<option value="HTMLBodyElement06.html">HTMLBodyElement06</option>
+
+
+
+
+<option value="HTMLBRElement01.html">HTMLBRElement01</option>
+
+
+
+
+<option value="HTMLButtonElement01.html">HTMLButtonElement01</option>
+
+
+
+
+<option value="HTMLButtonElement02.html">HTMLButtonElement02</option>
+
+
+
+
+<option value="HTMLButtonElement03.html">HTMLButtonElement03</option>
+
+
+
+
+<option value="HTMLButtonElement04.html">HTMLButtonElement04</option>
+
+
+
+
+<option value="HTMLButtonElement05.html">HTMLButtonElement05</option>
+
+
+
+
+<option value="HTMLButtonElement06.html">HTMLButtonElement06</option>
+
+
+
+
+<option value="HTMLButtonElement07.html">HTMLButtonElement07</option>
+
+
+
+
+<option value="HTMLButtonElement08.html">HTMLButtonElement08</option>
+
+
+
+
+<option value="HTMLCollection01.html">HTMLCollection01</option>
+
+
+
+
+<option value="HTMLCollection02.html">HTMLCollection02</option>
+
+
+
+
+<option value="HTMLCollection03.html">HTMLCollection03</option>
+
+
+
+
+<option value="HTMLCollection04.html">HTMLCollection04</option>
+
+
+
+
+<option value="HTMLCollection05.html">HTMLCollection05</option>
+
+
+
+
+<option value="HTMLCollection06.html">HTMLCollection06</option>
+
+
+
+
+<option value="HTMLCollection07.html">HTMLCollection07</option>
+
+
+
+
+<option value="HTMLCollection08.html">HTMLCollection08</option>
+
+
+
+
+<option value="HTMLCollection09.html">HTMLCollection09</option>
+
+
+
+
+<option value="HTMLCollection10.html">HTMLCollection10</option>
+
+
+
+
+<option value="HTMLCollection11.html">HTMLCollection11</option>
+
+
+
+
+<option value="HTMLCollection12.html">HTMLCollection12</option>
+
+
+
+
+<option value="HTMLDirectoryElement01.html">HTMLDirectoryElement01</option>
+
+
+
+
+<option value="HTMLDivElement01.html">HTMLDivElement01</option>
+
+
+
+
+<option value="HTMLDlistElement01.html">HTMLDlistElement01</option>
+
+
+
+
+<option value="HTMLDocument01.html">HTMLDocument01</option>
+
+
+
+
+<option value="HTMLDocument02.html">HTMLDocument02</option>
+
+
+
+
+<option value="HTMLDocument03.html">HTMLDocument03</option>
+
+
+
+
+<option value="HTMLDocument04.html">HTMLDocument04</option>
+
+
+
+
+<option value="HTMLDocument05.html">HTMLDocument05</option>
+
+
+
+
+<option value="HTMLDocument07.html">HTMLDocument07</option>
+
+
+
+
+<option value="HTMLDocument08.html">HTMLDocument08</option>
+
+
+
+
+<option value="HTMLDocument09.html">HTMLDocument09</option>
+
+
+
+
+<option value="HTMLDocument10.html">HTMLDocument10</option>
+
+
+
+
+<option value="HTMLDocument11.html">HTMLDocument11</option>
+
+
+
+
+<option value="HTMLDocument12.html">HTMLDocument12</option>
+
+
+
+
+<option value="HTMLDocument13.html">HTMLDocument13</option>
+
+
+
+
+<option value="HTMLDocument14.html">HTMLDocument14</option>
+
+
+
+
+<option value="HTMLDocument15.html">HTMLDocument15</option>
+
+
+
+
+<option value="HTMLDocument16.html">HTMLDocument16</option>
+
+
+
+
+<option value="HTMLDocument17.html">HTMLDocument17</option>
+
+
+
+
+<option value="HTMLDocument18.html">HTMLDocument18</option>
+
+
+
+
+<option value="HTMLDocument19.html">HTMLDocument19</option>
+
+
+
+
+<option value="HTMLDocument20.html">HTMLDocument20</option>
+
+
+
+
+<option value="HTMLDocument21.html">HTMLDocument21</option>
+
+
+
+
+<option value="HTMLElement01.html">HTMLElement01</option>
+
+
+
+
+<option value="HTMLElement02.html">HTMLElement02</option>
+
+
+
+
+<option value="HTMLElement03.html">HTMLElement03</option>
+
+
+
+
+<option value="HTMLElement04.html">HTMLElement04</option>
+
+
+
+
+<option value="HTMLElement05.html">HTMLElement05</option>
+
+
+
+
+<option value="HTMLElement06.html">HTMLElement06</option>
+
+
+
+
+<option value="HTMLElement07.html">HTMLElement07</option>
+
+
+
+
+<option value="HTMLElement08.html">HTMLElement08</option>
+
+
+
+
+<option value="HTMLElement09.html">HTMLElement09</option>
+
+
+
+
+<option value="HTMLElement10.html">HTMLElement10</option>
+
+
+
+
+<option value="HTMLElement100.html">HTMLElement100</option>
+
+
+
+
+<option value="HTMLElement101.html">HTMLElement101</option>
+
+
+
+
+<option value="HTMLElement102.html">HTMLElement102</option>
+
+
+
+
+<option value="HTMLElement103.html">HTMLElement103</option>
+
+
+
+
+<option value="HTMLElement104.html">HTMLElement104</option>
+
+
+
+
+<option value="HTMLElement105.html">HTMLElement105</option>
+
+
+
+
+<option value="HTMLElement106.html">HTMLElement106</option>
+
+
+
+
+<option value="HTMLElement107.html">HTMLElement107</option>
+
+
+
+
+<option value="HTMLElement108.html">HTMLElement108</option>
+
+
+
+
+<option value="HTMLElement109.html">HTMLElement109</option>
+
+
+
+
+<option value="HTMLElement11.html">HTMLElement11</option>
+
+
+
+
+<option value="HTMLElement110.html">HTMLElement110</option>
+
+
+
+
+<option value="HTMLElement111.html">HTMLElement111</option>
+
+
+
+
+<option value="HTMLElement112.html">HTMLElement112</option>
+
+
+
+
+<option value="HTMLElement113.html">HTMLElement113</option>
+
+
+
+
+<option value="HTMLElement114.html">HTMLElement114</option>
+
+
+
+
+<option value="HTMLElement115.html">HTMLElement115</option>
+
+
+
+
+<option value="HTMLElement116.html">HTMLElement116</option>
+
+
+
+
+<option value="HTMLElement117.html">HTMLElement117</option>
+
+
+
+
+<option value="HTMLElement118.html">HTMLElement118</option>
+
+
+
+
+<option value="HTMLElement119.html">HTMLElement119</option>
+
+
+
+
+<option value="HTMLElement12.html">HTMLElement12</option>
+
+
+
+
+<option value="HTMLElement120.html">HTMLElement120</option>
+
+
+
+
+<option value="HTMLElement121.html">HTMLElement121</option>
+
+
+
+
+<option value="HTMLElement122.html">HTMLElement122</option>
+
+
+
+
+<option value="HTMLElement123.html">HTMLElement123</option>
+
+
+
+
+<option value="HTMLElement124.html">HTMLElement124</option>
+
+
+
+
+<option value="HTMLElement125.html">HTMLElement125</option>
+
+
+
+
+<option value="HTMLElement126.html">HTMLElement126</option>
+
+
+
+
+<option value="HTMLElement127.html">HTMLElement127</option>
+
+
+
+
+<option value="HTMLElement128.html">HTMLElement128</option>
+
+
+
+
+<option value="HTMLElement129.html">HTMLElement129</option>
+
+
+
+
+<option value="HTMLElement13.html">HTMLElement13</option>
+
+
+
+
+<option value="HTMLElement130.html">HTMLElement130</option>
+
+
+
+
+<option value="HTMLElement131.html">HTMLElement131</option>
+
+
+
+
+<option value="HTMLElement132.html">HTMLElement132</option>
+
+
+
+
+<option value="HTMLElement133.html">HTMLElement133</option>
+
+
+
+
+<option value="HTMLElement134.html">HTMLElement134</option>
+
+
+
+
+<option value="HTMLElement135.html">HTMLElement135</option>
+
+
+
+
+<option value="HTMLElement136.html">HTMLElement136</option>
+
+
+
+
+<option value="HTMLElement137.html">HTMLElement137</option>
+
+
+
+
+<option value="HTMLElement138.html">HTMLElement138</option>
+
+
+
+
+<option value="HTMLElement139.html">HTMLElement139</option>
+
+
+
+
+<option value="HTMLElement14.html">HTMLElement14</option>
+
+
+
+
+<option value="HTMLElement140.html">HTMLElement140</option>
+
+
+
+
+<option value="HTMLElement141.html">HTMLElement141</option>
+
+
+
+
+<option value="HTMLElement142.html">HTMLElement142</option>
+
+
+
+
+<option value="HTMLElement143.html">HTMLElement143</option>
+
+
+
+
+<option value="HTMLElement144.html">HTMLElement144</option>
+
+
+
+
+<option value="HTMLElement145.html">HTMLElement145</option>
+
+
+
+
+<option value="HTMLElement15.html">HTMLElement15</option>
+
+
+
+
+<option value="HTMLElement16.html">HTMLElement16</option>
+
+
+
+
+<option value="HTMLElement17.html">HTMLElement17</option>
+
+
+
+
+<option value="HTMLElement18.html">HTMLElement18</option>
+
+
+
+
+<option value="HTMLElement19.html">HTMLElement19</option>
+
+
+
+
+<option value="HTMLElement20.html">HTMLElement20</option>
+
+
+
+
+<option value="HTMLElement21.html">HTMLElement21</option>
+
+
+
+
+<option value="HTMLElement22.html">HTMLElement22</option>
+
+
+
+
+<option value="HTMLElement23.html">HTMLElement23</option>
+
+
+
+
+<option value="HTMLElement24.html">HTMLElement24</option>
+
+
+
+
+<option value="HTMLElement25.html">HTMLElement25</option>
+
+
+
+
+<option value="HTMLElement26.html">HTMLElement26</option>
+
+
+
+
+<option value="HTMLElement27.html">HTMLElement27</option>
+
+
+
+
+<option value="HTMLElement28.html">HTMLElement28</option>
+
+
+
+
+<option value="HTMLElement29.html">HTMLElement29</option>
+
+
+
+
+<option value="HTMLElement30.html">HTMLElement30</option>
+
+
+
+
+<option value="HTMLElement31.html">HTMLElement31</option>
+
+
+
+
+<option value="HTMLElement32.html">HTMLElement32</option>
+
+
+
+
+<option value="HTMLElement33.html">HTMLElement33</option>
+
+
+
+
+<option value="HTMLElement34.html">HTMLElement34</option>
+
+
+
+
+<option value="HTMLElement35.html">HTMLElement35</option>
+
+
+
+
+<option value="HTMLElement36.html">HTMLElement36</option>
+
+
+
+
+<option value="HTMLElement37.html">HTMLElement37</option>
+
+
+
+
+<option value="HTMLElement38.html">HTMLElement38</option>
+
+
+
+
+<option value="HTMLElement39.html">HTMLElement39</option>
+
+
+
+
+<option value="HTMLElement40.html">HTMLElement40</option>
+
+
+
+
+<option value="HTMLElement41.html">HTMLElement41</option>
+
+
+
+
+<option value="HTMLElement42.html">HTMLElement42</option>
+
+
+
+
+<option value="HTMLElement43.html">HTMLElement43</option>
+
+
+
+
+<option value="HTMLElement44.html">HTMLElement44</option>
+
+
+
+
+<option value="HTMLElement45.html">HTMLElement45</option>
+
+
+
+
+<option value="HTMLElement46.html">HTMLElement46</option>
+
+
+
+
+<option value="HTMLElement47.html">HTMLElement47</option>
+
+
+
+
+<option value="HTMLElement48.html">HTMLElement48</option>
+
+
+
+
+<option value="HTMLElement49.html">HTMLElement49</option>
+
+
+
+
+<option value="HTMLElement50.html">HTMLElement50</option>
+
+
+
+
+<option value="HTMLElement51.html">HTMLElement51</option>
+
+
+
+
+<option value="HTMLElement52.html">HTMLElement52</option>
+
+
+
+
+<option value="HTMLElement53.html">HTMLElement53</option>
+
+
+
+
+<option value="HTMLElement54.html">HTMLElement54</option>
+
+
+
+
+<option value="HTMLElement55.html">HTMLElement55</option>
+
+
+
+
+<option value="HTMLElement56.html">HTMLElement56</option>
+
+
+
+
+<option value="HTMLElement57.html">HTMLElement57</option>
+
+
+
+
+<option value="HTMLElement58.html">HTMLElement58</option>
+
+
+
+
+<option value="HTMLElement59.html">HTMLElement59</option>
+
+
+
+
+<option value="HTMLElement60.html">HTMLElement60</option>
+
+
+
+
+<option value="HTMLElement61.html">HTMLElement61</option>
+
+
+
+
+<option value="HTMLElement62.html">HTMLElement62</option>
+
+
+
+
+<option value="HTMLElement63.html">HTMLElement63</option>
+
+
+
+
+<option value="HTMLElement64.html">HTMLElement64</option>
+
+
+
+
+<option value="HTMLElement65.html">HTMLElement65</option>
+
+
+
+
+<option value="HTMLElement66.html">HTMLElement66</option>
+
+
+
+
+<option value="HTMLElement67.html">HTMLElement67</option>
+
+
+
+
+<option value="HTMLElement68.html">HTMLElement68</option>
+
+
+
+
+<option value="HTMLElement69.html">HTMLElement69</option>
+
+
+
+
+<option value="HTMLElement70.html">HTMLElement70</option>
+
+
+
+
+<option value="HTMLElement71.html">HTMLElement71</option>
+
+
+
+
+<option value="HTMLElement72.html">HTMLElement72</option>
+
+
+
+
+<option value="HTMLElement73.html">HTMLElement73</option>
+
+
+
+
+<option value="HTMLElement74.html">HTMLElement74</option>
+
+
+
+
+<option value="HTMLElement75.html">HTMLElement75</option>
+
+
+
+
+<option value="HTMLElement76.html">HTMLElement76</option>
+
+
+
+
+<option value="HTMLElement77.html">HTMLElement77</option>
+
+
+
+
+<option value="HTMLElement78.html">HTMLElement78</option>
+
+
+
+
+<option value="HTMLElement79.html">HTMLElement79</option>
+
+
+
+
+<option value="HTMLElement80.html">HTMLElement80</option>
+
+
+
+
+<option value="HTMLElement81.html">HTMLElement81</option>
+
+
+
+
+<option value="HTMLElement82.html">HTMLElement82</option>
+
+
+
+
+<option value="HTMLElement83.html">HTMLElement83</option>
+
+
+
+
+<option value="HTMLElement84.html">HTMLElement84</option>
+
+
+
+
+<option value="HTMLElement85.html">HTMLElement85</option>
+
+
+
+
+<option value="HTMLElement86.html">HTMLElement86</option>
+
+
+
+
+<option value="HTMLElement87.html">HTMLElement87</option>
+
+
+
+
+<option value="HTMLElement88.html">HTMLElement88</option>
+
+
+
+
+<option value="HTMLElement89.html">HTMLElement89</option>
+
+
+
+
+<option value="HTMLElement90.html">HTMLElement90</option>
+
+
+
+
+<option value="HTMLElement91.html">HTMLElement91</option>
+
+
+
+
+<option value="HTMLElement92.html">HTMLElement92</option>
+
+
+
+
+<option value="HTMLElement93.html">HTMLElement93</option>
+
+
+
+
+<option value="HTMLElement94.html">HTMLElement94</option>
+
+
+
+
+<option value="HTMLElement95.html">HTMLElement95</option>
+
+
+
+
+<option value="HTMLElement96.html">HTMLElement96</option>
+
+
+
+
+<option value="HTMLElement97.html">HTMLElement97</option>
+
+
+
+
+<option value="HTMLElement98.html">HTMLElement98</option>
+
+
+
+
+<option value="HTMLElement99.html">HTMLElement99</option>
+
+
+
+
+<option value="HTMLFieldSetElement01.html">HTMLFieldSetElement01</option>
+
+
+
+
+<option value="HTMLFieldSetElement02.html">HTMLFieldSetElement02</option>
+
+
+
+
+<option value="HTMLFontElement01.html">HTMLFontElement01</option>
+
+
+
+
+<option value="HTMLFontElement02.html">HTMLFontElement02</option>
+
+
+
+
+<option value="HTMLFontElement03.html">HTMLFontElement03</option>
+
+
+
+
+<option value="HTMLFormElement01.html">HTMLFormElement01</option>
+
+
+
+
+<option value="HTMLFormElement02.html">HTMLFormElement02</option>
+
+
+
+
+<option value="HTMLFormElement03.html">HTMLFormElement03</option>
+
+
+
+
+<option value="HTMLFormElement04.html">HTMLFormElement04</option>
+
+
+
+
+<option value="HTMLFormElement05.html">HTMLFormElement05</option>
+
+
+
+
+<option value="HTMLFormElement06.html">HTMLFormElement06</option>
+
+
+
+
+<option value="HTMLFormElement07.html">HTMLFormElement07</option>
+
+
+
+
+<option value="HTMLFormElement08.html">HTMLFormElement08</option>
+
+
+
+
+<option value="HTMLFormElement09.html">HTMLFormElement09</option>
+
+
+
+
+<option value="HTMLFormElement10.html">HTMLFormElement10</option>
+
+
+
+
+<option value="HTMLFrameElement01.html">HTMLFrameElement01</option>
+
+
+
+
+<option value="HTMLFrameElement02.html">HTMLFrameElement02</option>
+
+
+
+
+<option value="HTMLFrameElement03.html">HTMLFrameElement03</option>
+
+
+
+
+<option value="HTMLFrameElement04.html">HTMLFrameElement04</option>
+
+
+
+
+<option value="HTMLFrameElement05.html">HTMLFrameElement05</option>
+
+
+
+
+<option value="HTMLFrameElement06.html">HTMLFrameElement06</option>
+
+
+
+
+<option value="HTMLFrameElement07.html">HTMLFrameElement07</option>
+
+
+
+
+<option value="HTMLFrameElement08.html">HTMLFrameElement08</option>
+
+
+
+
+<option value="HTMLFrameSetElement01.html">HTMLFrameSetElement01</option>
+
+
+
+
+<option value="HTMLFrameSetElement02.html">HTMLFrameSetElement02</option>
+
+
+
+
+<option value="HTMLHeadElement01.html">HTMLHeadElement01</option>
+
+
+
+
+<option value="HTMLHeadingElement01.html">HTMLHeadingElement01</option>
+
+
+
+
+<option value="HTMLHeadingElement02.html">HTMLHeadingElement02</option>
+
+
+
+
+<option value="HTMLHeadingElement03.html">HTMLHeadingElement03</option>
+
+
+
+
+<option value="HTMLHeadingElement04.html">HTMLHeadingElement04</option>
+
+
+
+
+<option value="HTMLHeadingElement05.html">HTMLHeadingElement05</option>
+
+
+
+
+<option value="HTMLHeadingElement06.html">HTMLHeadingElement06</option>
+
+
+
+
+<option value="HTMLHRElement01.html">HTMLHRElement01</option>
+
+
+
+
+<option value="HTMLHRElement02.html">HTMLHRElement02</option>
+
+
+
+
+<option value="HTMLHRElement03.html">HTMLHRElement03</option>
+
+
+
+
+<option value="HTMLHRElement04.html">HTMLHRElement04</option>
+
+
+
+
+<option value="HTMLHtmlElement01.html">HTMLHtmlElement01</option>
+
+
+
+
+<option value="HTMLIFrameElement01.html">HTMLIFrameElement01</option>
+
+
+
+
+<option value="HTMLIFrameElement02.html">HTMLIFrameElement02</option>
+
+
+
+
+<option value="HTMLIFrameElement03.html">HTMLIFrameElement03</option>
+
+
+
+
+<option value="HTMLIFrameElement04.html">HTMLIFrameElement04</option>
+
+
+
+
+<option value="HTMLIFrameElement05.html">HTMLIFrameElement05</option>
+
+
+
+
+<option value="HTMLIFrameElement06.html">HTMLIFrameElement06</option>
+
+
+
+
+<option value="HTMLIFrameElement07.html">HTMLIFrameElement07</option>
+
+
+
+
+<option value="HTMLIFrameElement08.html">HTMLIFrameElement08</option>
+
+
+
+
+<option value="HTMLIFrameElement09.html">HTMLIFrameElement09</option>
+
+
+
+
+<option value="HTMLIFrameElement10.html">HTMLIFrameElement10</option>
+
+
+
+
+<option value="HTMLImageElement01.html">HTMLImageElement01</option>
+
+
+
+
+<option value="HTMLImageElement02.html">HTMLImageElement02</option>
+
+
+
+
+<option value="HTMLImageElement03.html">HTMLImageElement03</option>
+
+
+
+
+<option value="HTMLImageElement04.html">HTMLImageElement04</option>
+
+
+
+
+<option value="HTMLImageElement07.html">HTMLImageElement07</option>
+
+
+
+
+<option value="HTMLImageElement08.html">HTMLImageElement08</option>
+
+
+
+
+<option value="HTMLImageElement09.html">HTMLImageElement09</option>
+
+
+
+
+<option value="HTMLImageElement10.html">HTMLImageElement10</option>
+
+
+
+
+<option value="HTMLInputElement01.html">HTMLInputElement01</option>
+
+
+
+
+<option value="HTMLInputElement02.html">HTMLInputElement02</option>
+
+
+
+
+<option value="HTMLInputElement03.html">HTMLInputElement03</option>
+
+
+
+
+<option value="HTMLInputElement04.html">HTMLInputElement04</option>
+
+
+
+
+<option value="HTMLInputElement05.html">HTMLInputElement05</option>
+
+
+
+
+<option value="HTMLInputElement06.html">HTMLInputElement06</option>
+
+
+
+
+<option value="HTMLInputElement07.html">HTMLInputElement07</option>
+
+
+
+
+<option value="HTMLInputElement08.html">HTMLInputElement08</option>
+
+
+
+
+<option value="HTMLInputElement09.html">HTMLInputElement09</option>
+
+
+
+
+<option value="HTMLInputElement10.html">HTMLInputElement10</option>
+
+
+
+
+<option value="HTMLInputElement11.html">HTMLInputElement11</option>
+
+
+
+
+<option value="HTMLInputElement12.html">HTMLInputElement12</option>
+
+
+
+
+<option value="HTMLInputElement14.html">HTMLInputElement14</option>
+
+
+
+
+<option value="HTMLInputElement15.html">HTMLInputElement15</option>
+
+
+
+
+<option value="HTMLInputElement16.html">HTMLInputElement16</option>
+
+
+
+
+<option value="HTMLInputElement17.html">HTMLInputElement17</option>
+
+
+
+
+<option value="HTMLInputElement18.html">HTMLInputElement18</option>
+
+
+
+
+<option value="HTMLInputElement19.html">HTMLInputElement19</option>
+
+
+
+
+<option value="HTMLInputElement20.html">HTMLInputElement20</option>
+
+
+
+
+<option value="HTMLInputElement21.html">HTMLInputElement21</option>
+
+
+
+
+<option value="HTMLInputElement22.html">HTMLInputElement22</option>
+
+
+
+
+<option value="HTMLIsIndexElement01.html">HTMLIsIndexElement01</option>
+
+
+
+
+<option value="HTMLIsIndexElement02.html">HTMLIsIndexElement02</option>
+
+
+
+
+<option value="HTMLIsIndexElement03.html">HTMLIsIndexElement03</option>
+
+
+
+
+<option value="HTMLLabelElement01.html">HTMLLabelElement01</option>
+
+
+
+
+<option value="HTMLLabelElement02.html">HTMLLabelElement02</option>
+
+
+
+
+<option value="HTMLLabelElement03.html">HTMLLabelElement03</option>
+
+
+
+
+<option value="HTMLLabelElement04.html">HTMLLabelElement04</option>
+
+
+
+
+<option value="HTMLLegendElement01.html">HTMLLegendElement01</option>
+
+
+
+
+<option value="HTMLLegendElement02.html">HTMLLegendElement02</option>
+
+
+
+
+<option value="HTMLLegendElement03.html">HTMLLegendElement03</option>
+
+
+
+
+<option value="HTMLLegendElement04.html">HTMLLegendElement04</option>
+
+
+
+
+<option value="HTMLLIElement01.html">HTMLLIElement01</option>
+
+
+
+
+<option value="HTMLLIElement02.html">HTMLLIElement02</option>
+
+
+
+
+<option value="HTMLLinkElement01.html">HTMLLinkElement01</option>
+
+
+
+
+<option value="HTMLLinkElement02.html">HTMLLinkElement02</option>
+
+
+
+
+<option value="HTMLLinkElement03.html">HTMLLinkElement03</option>
+
+
+
+
+<option value="HTMLLinkElement04.html">HTMLLinkElement04</option>
+
+
+
+
+<option value="HTMLLinkElement05.html">HTMLLinkElement05</option>
+
+
+
+
+<option value="HTMLLinkElement06.html">HTMLLinkElement06</option>
+
+
+
+
+<option value="HTMLLinkElement07.html">HTMLLinkElement07</option>
+
+
+
+
+<option value="HTMLLinkElement08.html">HTMLLinkElement08</option>
+
+
+
+
+<option value="HTMLLinkElement09.html">HTMLLinkElement09</option>
+
+
+
+
+<option value="HTMLMapElement01.html">HTMLMapElement01</option>
+
+
+
+
+<option value="HTMLMapElement02.html">HTMLMapElement02</option>
+
+
+
+
+<option value="HTMLMenuElement01.html">HTMLMenuElement01</option>
+
+
+
+
+<option value="HTMLMetaElement01.html">HTMLMetaElement01</option>
+
+
+
+
+<option value="HTMLMetaElement02.html">HTMLMetaElement02</option>
+
+
+
+
+<option value="HTMLMetaElement03.html">HTMLMetaElement03</option>
+
+
+
+
+<option value="HTMLMetaElement04.html">HTMLMetaElement04</option>
+
+
+
+
+<option value="HTMLModElement01.html">HTMLModElement01</option>
+
+
+
+
+<option value="HTMLModElement02.html">HTMLModElement02</option>
+
+
+
+
+<option value="HTMLModElement03.html">HTMLModElement03</option>
+
+
+
+
+<option value="HTMLModElement04.html">HTMLModElement04</option>
+
+
+
+
+<option value="HTMLObjectElement01.html">HTMLObjectElement01</option>
+
+
+
+
+<option value="HTMLObjectElement02.html">HTMLObjectElement02</option>
+
+
+
+
+<option value="HTMLObjectElement03.html">HTMLObjectElement03</option>
+
+
+
+
+<option value="HTMLObjectElement04.html">HTMLObjectElement04</option>
+
+
+
+
+<option value="HTMLObjectElement05.html">HTMLObjectElement05</option>
+
+
+
+
+<option value="HTMLObjectElement06.html">HTMLObjectElement06</option>
+
+
+
+
+<option value="HTMLObjectElement07.html">HTMLObjectElement07</option>
+
+
+
+
+<option value="HTMLObjectElement08.html">HTMLObjectElement08</option>
+
+
+
+
+<option value="HTMLObjectElement09.html">HTMLObjectElement09</option>
+
+
+
+
+<option value="HTMLObjectElement10.html">HTMLObjectElement10</option>
+
+
+
+
+<option value="HTMLObjectElement12.html">HTMLObjectElement12</option>
+
+
+
+
+<option value="HTMLObjectElement13.html">HTMLObjectElement13</option>
+
+
+
+
+<option value="HTMLObjectElement14.html">HTMLObjectElement14</option>
+
+
+
+
+<option value="HTMLObjectElement15.html">HTMLObjectElement15</option>
+
+
+
+
+<option value="HTMLObjectElement17.html">HTMLObjectElement17</option>
+
+
+
+
+<option value="HTMLObjectElement18.html">HTMLObjectElement18</option>
+
+
+
+
+<option value="HTMLObjectElement19.html">HTMLObjectElement19</option>
+
+
+
+
+<option value="HTMLOListElement01.html">HTMLOListElement01</option>
+
+
+
+
+<option value="HTMLOListElement02.html">HTMLOListElement02</option>
+
+
+
+
+<option value="HTMLOListElement03.html">HTMLOListElement03</option>
+
+
+
+
+<option value="HTMLOptGroupElement01.html">HTMLOptGroupElement01</option>
+
+
+
+
+<option value="HTMLOptGroupElement02.html">HTMLOptGroupElement02</option>
+
+
+
+
+<option value="HTMLOptionElement01.html">HTMLOptionElement01</option>
+
+
+
+
+<option value="HTMLOptionElement02.html">HTMLOptionElement02</option>
+
+
+
+
+<option value="HTMLOptionElement03.html">HTMLOptionElement03</option>
+
+
+
+
+<option value="HTMLOptionElement04.html">HTMLOptionElement04</option>
+
+
+
+
+<option value="HTMLOptionElement05.html">HTMLOptionElement05</option>
+
+
+
+
+<option value="HTMLOptionElement06.html">HTMLOptionElement06</option>
+
+
+
+
+<option value="HTMLOptionElement07.html">HTMLOptionElement07</option>
+
+
+
+
+<option value="HTMLOptionElement08.html">HTMLOptionElement08</option>
+
+
+
+
+<option value="HTMLOptionElement09.html">HTMLOptionElement09</option>
+
+
+
+
+<option value="HTMLParagraphElement01.html">HTMLParagraphElement01</option>
+
+
+
+
+<option value="HTMLParamElement01.html">HTMLParamElement01</option>
+
+
+
+
+<option value="HTMLParamElement02.html">HTMLParamElement02</option>
+
+
+
+
+<option value="HTMLParamElement03.html">HTMLParamElement03</option>
+
+
+
+
+<option value="HTMLParamElement04.html">HTMLParamElement04</option>
+
+
+
+
+<option value="HTMLPreElement01.html">HTMLPreElement01</option>
+
+
+
+
+<option value="HTMLQuoteElement01.html">HTMLQuoteElement01</option>
+
+
+
+
+<option value="HTMLQuoteElement02.html">HTMLQuoteElement02</option>
+
+
+
+
+<option value="HTMLScriptElement01.html">HTMLScriptElement01</option>
+
+
+
+
+<option value="HTMLScriptElement02.html">HTMLScriptElement02</option>
+
+
+
+
+<option value="HTMLScriptElement03.html">HTMLScriptElement03</option>
+
+
+
+
+<option value="HTMLScriptElement04.html">HTMLScriptElement04</option>
+
+
+
+
+<option value="HTMLScriptElement05.html">HTMLScriptElement05</option>
+
+
+
+
+<option value="HTMLScriptElement06.html">HTMLScriptElement06</option>
+
+
+
+
+<option value="HTMLScriptElement07.html">HTMLScriptElement07</option>
+
+
+
+
+<option value="HTMLSelectElement01.html">HTMLSelectElement01</option>
+
+
+
+
+<option value="HTMLSelectElement02.html">HTMLSelectElement02</option>
+
+
+
+
+<option value="HTMLSelectElement03.html">HTMLSelectElement03</option>
+
+
+
+
+<option value="HTMLSelectElement04.html">HTMLSelectElement04</option>
+
+
+
+
+<option value="HTMLSelectElement05.html">HTMLSelectElement05</option>
+
+
+
+
+<option value="HTMLSelectElement06.html">HTMLSelectElement06</option>
+
+
+
+
+<option value="HTMLSelectElement07.html">HTMLSelectElement07</option>
+
+
+
+
+<option value="HTMLSelectElement08.html">HTMLSelectElement08</option>
+
+
+
+
+<option value="HTMLSelectElement09.html">HTMLSelectElement09</option>
+
+
+
+
+<option value="HTMLSelectElement10.html">HTMLSelectElement10</option>
+
+
+
+
+<option value="HTMLSelectElement11.html">HTMLSelectElement11</option>
+
+
+
+
+<option value="HTMLSelectElement12.html">HTMLSelectElement12</option>
+
+
+
+
+<option value="HTMLSelectElement13.html">HTMLSelectElement13</option>
+
+
+
+
+<option value="HTMLSelectElement14.html">HTMLSelectElement14</option>
+
+
+
+
+<option value="HTMLSelectElement15.html">HTMLSelectElement15</option>
+
+
+
+
+<option value="HTMLSelectElement16.html">HTMLSelectElement16</option>
+
+
+
+
+<option value="HTMLSelectElement17.html">HTMLSelectElement17</option>
+
+
+
+
+<option value="HTMLSelectElement18.html">HTMLSelectElement18</option>
+
+
+
+
+<option value="HTMLSelectElement19.html">HTMLSelectElement19</option>
+
+
+
+
+<option value="HTMLStyleElement01.html">HTMLStyleElement01</option>
+
+
+
+
+<option value="HTMLStyleElement02.html">HTMLStyleElement02</option>
+
+
+
+
+<option value="HTMLStyleElement03.html">HTMLStyleElement03</option>
+
+
+
+
+<option value="HTMLTableCaptionElement01.html">HTMLTableCaptionElement01</option>
+
+
+
+
+<option value="HTMLTableCellElement01.html">HTMLTableCellElement01</option>
+
+
+
+
+<option value="HTMLTableCellElement02.html">HTMLTableCellElement02</option>
+
+
+
+
+<option value="HTMLTableCellElement03.html">HTMLTableCellElement03</option>
+
+
+
+
+<option value="HTMLTableCellElement04.html">HTMLTableCellElement04</option>
+
+
+
+
+<option value="HTMLTableCellElement05.html">HTMLTableCellElement05</option>
+
+
+
+
+<option value="HTMLTableCellElement06.html">HTMLTableCellElement06</option>
+
+
+
+
+<option value="HTMLTableCellElement07.html">HTMLTableCellElement07</option>
+
+
+
+
+<option value="HTMLTableCellElement08.html">HTMLTableCellElement08</option>
+
+
+
+
+<option value="HTMLTableCellElement09.html">HTMLTableCellElement09</option>
+
+
+
+
+<option value="HTMLTableCellElement10.html">HTMLTableCellElement10</option>
+
+
+
+
+<option value="HTMLTableCellElement11.html">HTMLTableCellElement11</option>
+
+
+
+
+<option value="HTMLTableCellElement12.html">HTMLTableCellElement12</option>
+
+
+
+
+<option value="HTMLTableCellElement13.html">HTMLTableCellElement13</option>
+
+
+
+
+<option value="HTMLTableCellElement14.html">HTMLTableCellElement14</option>
+
+
+
+
+<option value="HTMLTableCellElement15.html">HTMLTableCellElement15</option>
+
+
+
+
+<option value="HTMLTableCellElement16.html">HTMLTableCellElement16</option>
+
+
+
+
+<option value="HTMLTableCellElement17.html">HTMLTableCellElement17</option>
+
+
+
+
+<option value="HTMLTableCellElement18.html">HTMLTableCellElement18</option>
+
+
+
+
+<option value="HTMLTableCellElement19.html">HTMLTableCellElement19</option>
+
+
+
+
+<option value="HTMLTableCellElement20.html">HTMLTableCellElement20</option>
+
+
+
+
+<option value="HTMLTableCellElement21.html">HTMLTableCellElement21</option>
+
+
+
+
+<option value="HTMLTableCellElement22.html">HTMLTableCellElement22</option>
+
+
+
+
+<option value="HTMLTableCellElement23.html">HTMLTableCellElement23</option>
+
+
+
+
+<option value="HTMLTableCellElement24.html">HTMLTableCellElement24</option>
+
+
+
+
+<option value="HTMLTableCellElement25.html">HTMLTableCellElement25</option>
+
+
+
+
+<option value="HTMLTableCellElement26.html">HTMLTableCellElement26</option>
+
+
+
+
+<option value="HTMLTableCellElement27.html">HTMLTableCellElement27</option>
+
+
+
+
+<option value="HTMLTableCellElement28.html">HTMLTableCellElement28</option>
+
+
+
+
+<option value="HTMLTableCellElement29.html">HTMLTableCellElement29</option>
+
+
+
+
+<option value="HTMLTableCellElement30.html">HTMLTableCellElement30</option>
+
+
+
+
+<option value="HTMLTableColElement01.html">HTMLTableColElement01</option>
+
+
+
+
+<option value="HTMLTableColElement02.html">HTMLTableColElement02</option>
+
+
+
+
+<option value="HTMLTableColElement03.html">HTMLTableColElement03</option>
+
+
+
+
+<option value="HTMLTableColElement04.html">HTMLTableColElement04</option>
+
+
+
+
+<option value="HTMLTableColElement05.html">HTMLTableColElement05</option>
+
+
+
+
+<option value="HTMLTableColElement06.html">HTMLTableColElement06</option>
+
+
+
+
+<option value="HTMLTableColElement07.html">HTMLTableColElement07</option>
+
+
+
+
+<option value="HTMLTableColElement08.html">HTMLTableColElement08</option>
+
+
+
+
+<option value="HTMLTableColElement09.html">HTMLTableColElement09</option>
+
+
+
+
+<option value="HTMLTableColElement10.html">HTMLTableColElement10</option>
+
+
+
+
+<option value="HTMLTableColElement11.html">HTMLTableColElement11</option>
+
+
+
+
+<option value="HTMLTableColElement12.html">HTMLTableColElement12</option>
+
+
+
+
+<option value="HTMLTableElement01.html">HTMLTableElement01</option>
+
+
+
+
+<option value="HTMLTableElement02.html">HTMLTableElement02</option>
+
+
+
+
+<option value="HTMLTableElement03.html">HTMLTableElement03</option>
+
+
+
+
+<option value="HTMLTableElement04.html">HTMLTableElement04</option>
+
+
+
+
+<option value="HTMLTableElement05.html">HTMLTableElement05</option>
+
+
+
+
+<option value="HTMLTableElement06.html">HTMLTableElement06</option>
+
+
+
+
+<option value="HTMLTableElement07.html">HTMLTableElement07</option>
+
+
+
+
+<option value="HTMLTableElement08.html">HTMLTableElement08</option>
+
+
+
+
+<option value="HTMLTableElement09.html">HTMLTableElement09</option>
+
+
+
+
+<option value="HTMLTableElement10.html">HTMLTableElement10</option>
+
+
+
+
+<option value="HTMLTableElement11.html">HTMLTableElement11</option>
+
+
+
+
+<option value="HTMLTableElement12.html">HTMLTableElement12</option>
+
+
+
+
+<option value="HTMLTableElement13.html">HTMLTableElement13</option>
+
+
+
+
+<option value="HTMLTableElement14.html">HTMLTableElement14</option>
+
+
+
+
+<option value="HTMLTableElement15.html">HTMLTableElement15</option>
+
+
+
+
+<option value="HTMLTableElement16.html">HTMLTableElement16</option>
+
+
+
+
+<option value="HTMLTableElement17.html">HTMLTableElement17</option>
+
+
+
+
+<option value="HTMLTableElement18.html">HTMLTableElement18</option>
+
+
+
+
+<option value="HTMLTableElement19.html">HTMLTableElement19</option>
+
+
+
+
+<option value="HTMLTableElement20.html">HTMLTableElement20</option>
+
+
+
+
+<option value="HTMLTableElement21.html">HTMLTableElement21</option>
+
+
+
+
+<option value="HTMLTableElement22.html">HTMLTableElement22</option>
+
+
+
+
+<option value="HTMLTableElement23.html">HTMLTableElement23</option>
+
+
+
+
+<option value="HTMLTableElement24.html">HTMLTableElement24</option>
+
+
+
+
+<option value="HTMLTableElement25.html">HTMLTableElement25</option>
+
+
+
+
+<option value="HTMLTableElement26.html">HTMLTableElement26</option>
+
+
+
+
+<option value="HTMLTableElement27.html">HTMLTableElement27</option>
+
+
+
+
+<option value="HTMLTableElement28.html">HTMLTableElement28</option>
+
+
+
+
+<option value="HTMLTableElement29.html">HTMLTableElement29</option>
+
+
+
+
+<option value="HTMLTableElement30.html">HTMLTableElement30</option>
+
+
+
+
+<option value="HTMLTableElement31.html">HTMLTableElement31</option>
+
+
+
+
+<option value="HTMLTableElement32.html">HTMLTableElement32</option>
+
+
+
+
+<option value="HTMLTableElement33.html">HTMLTableElement33</option>
+
+
+
+
+<option value="HTMLTableRowElement01.html">HTMLTableRowElement01</option>
+
+
+
+
+<option value="HTMLTableRowElement02.html">HTMLTableRowElement02</option>
+
+
+
+
+<option value="HTMLTableRowElement03.html">HTMLTableRowElement03</option>
+
+
+
+
+<option value="HTMLTableRowElement04.html">HTMLTableRowElement04</option>
+
+
+
+
+<option value="HTMLTableRowElement05.html">HTMLTableRowElement05</option>
+
+
+
+
+<option value="HTMLTableRowElement06.html">HTMLTableRowElement06</option>
+
+
+
+
+<option value="HTMLTableRowElement07.html">HTMLTableRowElement07</option>
+
+
+
+
+<option value="HTMLTableRowElement08.html">HTMLTableRowElement08</option>
+
+
+
+
+<option value="HTMLTableRowElement09.html">HTMLTableRowElement09</option>
+
+
+
+
+<option value="HTMLTableRowElement10.html">HTMLTableRowElement10</option>
+
+
+
+
+<option value="HTMLTableRowElement11.html">HTMLTableRowElement11</option>
+
+
+
+
+<option value="HTMLTableRowElement12.html">HTMLTableRowElement12</option>
+
+
+
+
+<option value="HTMLTableRowElement13.html">HTMLTableRowElement13</option>
+
+
+
+
+<option value="HTMLTableRowElement14.html">HTMLTableRowElement14</option>
+
+
+
+
+<option value="HTMLTableSectionElement01.html">HTMLTableSectionElement01</option>
+
+
+
+
+<option value="HTMLTableSectionElement02.html">HTMLTableSectionElement02</option>
+
+
+
+
+<option value="HTMLTableSectionElement03.html">HTMLTableSectionElement03</option>
+
+
+
+
+<option value="HTMLTableSectionElement04.html">HTMLTableSectionElement04</option>
+
+
+
+
+<option value="HTMLTableSectionElement05.html">HTMLTableSectionElement05</option>
+
+
+
+
+<option value="HTMLTableSectionElement06.html">HTMLTableSectionElement06</option>
+
+
+
+
+<option value="HTMLTableSectionElement07.html">HTMLTableSectionElement07</option>
+
+
+
+
+<option value="HTMLTableSectionElement08.html">HTMLTableSectionElement08</option>
+
+
+
+
+<option value="HTMLTableSectionElement09.html">HTMLTableSectionElement09</option>
+
+
+
+
+<option value="HTMLTableSectionElement10.html">HTMLTableSectionElement10</option>
+
+
+
+
+<option value="HTMLTableSectionElement11.html">HTMLTableSectionElement11</option>
+
+
+
+
+<option value="HTMLTableSectionElement12.html">HTMLTableSectionElement12</option>
+
+
+
+
+<option value="HTMLTableSectionElement13.html">HTMLTableSectionElement13</option>
+
+
+
+
+<option value="HTMLTableSectionElement14.html">HTMLTableSectionElement14</option>
+
+
+
+
+<option value="HTMLTableSectionElement15.html">HTMLTableSectionElement15</option>
+
+
+
+
+<option value="HTMLTableSectionElement16.html">HTMLTableSectionElement16</option>
+
+
+
+
+<option value="HTMLTableSectionElement17.html">HTMLTableSectionElement17</option>
+
+
+
+
+<option value="HTMLTableSectionElement18.html">HTMLTableSectionElement18</option>
+
+
+
+
+<option value="HTMLTableSectionElement19.html">HTMLTableSectionElement19</option>
+
+
+
+
+<option value="HTMLTableSectionElement20.html">HTMLTableSectionElement20</option>
+
+
+
+
+<option value="HTMLTableSectionElement21.html">HTMLTableSectionElement21</option>
+
+
+
+
+<option value="HTMLTableSectionElement22.html">HTMLTableSectionElement22</option>
+
+
+
+
+<option value="HTMLTableSectionElement23.html">HTMLTableSectionElement23</option>
+
+
+
+
+<option value="HTMLTableSectionElement24.html">HTMLTableSectionElement24</option>
+
+
+
+
+<option value="HTMLTextAreaElement01.html">HTMLTextAreaElement01</option>
+
+
+
+
+<option value="HTMLTextAreaElement02.html">HTMLTextAreaElement02</option>
+
+
+
+
+<option value="HTMLTextAreaElement03.html">HTMLTextAreaElement03</option>
+
+
+
+
+<option value="HTMLTextAreaElement04.html">HTMLTextAreaElement04</option>
+
+
+
+
+<option value="HTMLTextAreaElement05.html">HTMLTextAreaElement05</option>
+
+
+
+
+<option value="HTMLTextAreaElement06.html">HTMLTextAreaElement06</option>
+
+
+
+
+<option value="HTMLTextAreaElement07.html">HTMLTextAreaElement07</option>
+
+
+
+
+<option value="HTMLTextAreaElement08.html">HTMLTextAreaElement08</option>
+
+
+
+
+<option value="HTMLTextAreaElement09.html">HTMLTextAreaElement09</option>
+
+
+
+
+<option value="HTMLTextAreaElement10.html">HTMLTextAreaElement10</option>
+
+
+
+
+<option value="HTMLTextAreaElement11.html">HTMLTextAreaElement11</option>
+
+
+
+
+<option value="HTMLTextAreaElement12.html">HTMLTextAreaElement12</option>
+
+
+
+
+<option value="HTMLTextAreaElement13.html">HTMLTextAreaElement13</option>
+
+
+
+
+<option value="HTMLTextAreaElement14.html">HTMLTextAreaElement14</option>
+
+
+
+
+<option value="HTMLTextAreaElement15.html">HTMLTextAreaElement15</option>
+
+
+
+
+<option value="HTMLTitleElement01.html">HTMLTitleElement01</option>
+
+
+
+
+<option value="HTMLUListElement01.html">HTMLUListElement01</option>
+
+
+
+
+<option value="HTMLUListElement02.html">HTMLUListElement02</option>
+
+
+
+
+<option value="object01.html">object01</option>
+
+
+
+
+<option value="object02.html">object02</option>
+
+
+
+
+<option value="object03.html">object03</option>
+
+
+
+
+<option value="object04.html">object04</option>
+
+
+
+
+<option value="object05.html">object05</option>
+
+
+
+
+<option value="object06.html">object06</option>
+
+
+
+
+<option value="object07.html">object07</option>
+
+
+
+
+<option value="object09.html">object09</option>
+
+
+
+
+<option value="object10.html">object10</option>
+
+
+
+
+<option value="object11.html">object11</option>
+
+
+
+
+<option value="object12.html">object12</option>
+
+
+
+
+<option value="object14.html">object14</option>
+
+
+
+
+<option value="object15.html">object15</option>
+
+
+
+
+<option value="table01.html">table01</option>
+
+
+
+
+<option value="table02.html">table02</option>
+
+
+
+
+<option value="table03.html">table03</option>
+
+
+
+
+<option value="table04.html">table04</option>
+
+
+
+
+<option value="table06.html">table06</option>
+
+
+
+
+<option value="table07.html">table07</option>
+
+
+
+
+<option value="table08.html">table08</option>
+
+
+
+
+<option value="table09.html">table09</option>
+
+
+
+
+<option value="table10.html">table10</option>
+
+
+
+
+<option value="table12.html">table12</option>
+
+
+
+
+<option value="table15.html">table15</option>
+
+
+
+
+<option value="table17.html">table17</option>
+
+
+
+
+<option value="table18.html">table18</option>
+
+
+
+
+<option value="table19.html">table19</option>
+
+
+
+
+<option value="table20.html">table20</option>
+
+
+
+
+<option value="table21.html">table21</option>
+
+
+
+
+<option value="table22.html">table22</option>
+
+
+
+
+<option value="table23.html">table23</option>
+
+
+
+
+<option value="table24.html">table24</option>
+
+
+
+
+<option value="table25.html">table25</option>
+
+
+
+
+<option value="table26.html">table26</option>
+
+
+
+
+<option value="table27.html">table27</option>
+
+
+
+
+<option value="table28.html">table28</option>
+
+
+
+
+<option value="table29.html">table29</option>
+
+
+
+
+<option value="table30.html">table30</option>
+
+
+
+
+<option value="table31.html">table31</option>
+
+
+
+
+<option value="table32.html">table32</option>
+
+
+
+
+<option value="table33.html">table33</option>
+
+
+
+
+<option value="table34.html">table34</option>
+
+
+
+
+<option value="table35.html">table35</option>
+
+
+
+
+<option value="table36.html">table36</option>
+
+
+
+
+<option value="table37.html">table37</option>
+
+
+
+
+<option value="table38.html">table38</option>
+
+
+
+
+<option value="table39.html">table39</option>
+
+
+
+
+<option value="table40.html">table40</option>
+
+
+
+
+<option value="table41.html">table41</option>
+
+
+
+
+<option value="table42.html">table42</option>
+
+
+
+
+<option value="table43.html">table43</option>
+
+
+
+
+<option value="table44.html">table44</option>
+
+
+
+
+<option value="table45.html">table45</option>
+
+
+
+
+<option value="table46.html">table46</option>
+
+
+
+
+<option value="table47.html">table47</option>
+
+
+
+
+<option value="table48.html">table48</option>
+
+
+
+
+<option value="table49.html">table49</option>
+
+
+
+
+<option value="table50.html">table50</option>
+
+
+
+
+<option value="table51.html">table51</option>
+
+
+
+
+<option value="table52.html">table52</option>
+
+
+
+
+<option value="table53.html">table53</option>
+
+
+
+
+<option value="hasFeature02.html">hasFeature02</option>
+<option value="hasFeature03.html">hasFeature03</option>
+<option value="hasFeature04.html">hasFeature04</option>
+<option value="hasFeature05.html">hasFeature05</option>
+<option value="hasFeature06.html">hasFeature06</option>
+<option value="HTMLAppletElement07.html">HTMLAppletElement07</option>
+<option value="HTMLAppletElement09.html">HTMLAppletElement09</option>
+<option value="HTMLBodyElement07.html">HTMLBodyElement07</option>
+<option value="HTMLBodyElement08.html">HTMLBodyElement08</option>
+<option value="HTMLBodyElement09.html">HTMLBodyElement09</option>
+<option value="HTMLBodyElement10.html">HTMLBodyElement10</option>
+<option value="HTMLBodyElement11.html">HTMLBodyElement11</option>
+<option value="HTMLBodyElement12.html">HTMLBodyElement12</option>
+<option value="HTMLDocument22.html">HTMLDocument22</option>
+<option value="HTMLDocument23.html">HTMLDocument23</option>
+<option value="HTMLDocument24.html">HTMLDocument24</option>
+<option value="HTMLDocument25.html">HTMLDocument25</option>
+<option value="HTMLDocument26.html">HTMLDocument26</option>
+<option value="HTMLDocument27.html">HTMLDocument27</option>
+<option value="HTMLFrameElement09.html">HTMLFrameElement09</option>
+<option value="HTMLIFrameElement11.html">HTMLIFrameElement11</option>
+<option value="HTMLImageElement05.html">HTMLImageElement05</option>
+<option value="HTMLImageElement06.html">HTMLImageElement06</option>
+<option value="HTMLImageElement11.html">HTMLImageElement11</option>
+<option value="HTMLImageElement12.html">HTMLImageElement12</option>
+<option value="HTMLInputElement13.html">HTMLInputElement13</option>
+<option value="HTMLObjectElement11.html">HTMLObjectElement11</option>
+<option value="HTMLObjectElement16.html">HTMLObjectElement16</option>
+<option value="HTMLObjectElement20.html">HTMLObjectElement20</option>
+<option value="HTMLOptionsCollection01.html">HTMLOptionsCollection01</option>
+<option value="HTMLOptionsCollection02.html">HTMLOptionsCollection02</option>
+<option value="HTMLOptionsCollection03.html">HTMLOptionsCollection03</option>
+<option value="HTMLOptionsCollection04.html">HTMLOptionsCollection04</option>
+<option value="HTMLOptionsCollection05.html">HTMLOptionsCollection05</option>
+<option value="HTMLOptionsCollection06.html">HTMLOptionsCollection06</option>
+<option value="HTMLOptionsCollection07.html">HTMLOptionsCollection07</option>
+<option value="HTMLSelectElement20.html">HTMLSelectElement20</option>
+<option value="HTMLTableElement34.html">HTMLTableElement34</option>
+<option value="HTMLTableElement35.html">HTMLTableElement35</option>
+<option value="HTMLTableElement36.html">HTMLTableElement36</option>
+<option value="HTMLTableElement37.html">HTMLTableElement37</option>
+<option value="HTMLTableElement38.html">HTMLTableElement38</option>
+<option value="HTMLTableElement39.html">HTMLTableElement39</option>
+<option value="HTMLTableElement40.html">HTMLTableElement40</option>
+<option value="HTMLTableRowElement15.html">HTMLTableRowElement15</option>
+<option value="HTMLTableRowElement16.html">HTMLTableRowElement16</option>
+<option value="HTMLTableRowElement17.html">HTMLTableRowElement17</option>
+<option value="HTMLTableRowElement18.html">HTMLTableRowElement18</option>
+<option value="HTMLTableRowElement19.html">HTMLTableRowElement19</option>
+<option value="HTMLTableRowElement20.html">HTMLTableRowElement20</option>
+<option value="HTMLTableRowElement21.html">HTMLTableRowElement21</option>
+<option value="HTMLTableSectionElement25.html">HTMLTableSectionElement25</option>
+<option value="HTMLTableSectionElement26.html">HTMLTableSectionElement26</option>
+<option value="HTMLTableSectionElement27.html">HTMLTableSectionElement27</option>
+<option value="HTMLTableSectionElement28.html">HTMLTableSectionElement28</option>
+<option value="HTMLTableSectionElement29.html">HTMLTableSectionElement29</option>
+<option value="HTMLTableSectionElement30.html">HTMLTableSectionElement30</option>
+<option value="HTMLTableSectionElement31.html">HTMLTableSectionElement31</option>
+<option value="object08.html">object08</option>
+<option value="object13.html">object13</option>
+</select></td><td align="right"><input value="Load JSUnit" type="submit"></td>
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+<td>
+<table summary="Configuration" width="100%" border="1">
+<tr>
+<th>Implementation</th><th>Configuration</th><th>Content Type</th>
+</tr>
+<tr>
+<td valign="top"><input onclick="onImplementationChange()" checked value="iframe" id="iframeImpl" name="implementation" type="radio"> iframe<br>
+<input onclick="onImplementationChange()" value="dom3ls" id="dom3lsImpl" name="implementation" type="radio"> DOM 3 Load/Save<br>
+ Features: <input disabled name="dom3lsFeatures" type="text">
+<br>
+<input onclick="onImplementationChange()" value="mozillaXML" id="mozillaXMLImpl" name="implementation" type="radio"> Mozilla XML<br>
+<input onclick="onImplementationChange()" value="msxml3" id="msxml3Impl" name="implementation" type="radio"> MSXML 3.0<br>
+<input onclick="onImplementationChange()" value="msxml4" id="msxml4Impl" name="implementation" type="radio"> MSXML 4.0<br>
+<input onclick="onImplementationChange()" value="svgplugin" id="svgpluginImpl" name="implementation" type="radio"> SVG Plugin<br>
+</td><td valign="top"><input disabled checked type="checkbox" name="asynchronous" onclick="setAsynchronous(true)"> Asynchronous<br>
+<input onclick="setImplementationAttribute('expandEntityReferences', true)" disabled value="true" name="expandEntityReferences" type="checkbox"> Expanding Entities<br>
+<input onclick="setImplementationAttribute('ignoringElementContentWhitespace', true)" disabled value="true" name="ignoringElementContentWhitespace" type="checkbox"> Ignoring whitespace<br>
+<input onclick="setImplementationAttribute('validating', true)" disabled value="true" name="validating" type="checkbox"> Validating<br>
+<input onclick="setImplementationAttribute('coalescing', true)" disabled value="true" name="coalescing" type="checkbox"> Coalescing<br>
+<input onclick="setImplementationAttribute('namespaceAware', true)" disabled value="true" name="namespaceAware" type="checkbox"> Namespace aware<br>
+<input onclick="setImplementationAttribute('ignoringComments', true)" checked disabled value="true" name="ignoringComments" type="checkbox"> Ignoring comments<br>
+<input checked value="true" name="skipIncompatibleTests" type="checkbox"> Skip incompatible tests<br>
+<input value="true" checked name="autorun" type="checkbox"> Autorun<br>
+<input onclick="updateTestSubmission()" name="submitCheckbox" type="checkbox"> Submit results<br>
+ Acceptor: http://<input size="35" disabled value="" name="submitresults" type="text">
+<br>
+ Result ID: <input disabled value="" name="resultid" type="text">
+<br>
+</td><td valign="top"><input onclick="setContentType('text/xml')" value="text/xml" id="contentTypeXML" name="contentType" type="radio">XML<br>
+<input onclick="setContentType('text/html')" checked value="text/html" id="contentTypeHTML" name="contentType" type="radio">HTML<br>
+<input onclick="setContentType('application/xhtml+xml')" value="application/xhtml+xml" id="contentTypeXHTML" name="contentType" type="radio">XHTML<br>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+</form>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_anchor01.html b/dom/tests/mochitest/dom-level2-html/test_anchor01.html
new file mode 100644
index 0000000000..60bc37a436
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_anchor01.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['anchor01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+A single character access key to give access to the form control.
+The value of attribute accessKey of the anchor element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89647724
+*/
+function anchor01() {
+ var success;
+ if(checkInitialization(builder, "anchor01") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accessKeyLink","g",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor01</h2>
+<p>&lt;test name='anchor01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;anchor01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+A single character access key to give access to the form control.
+The value of attribute accessKey of the anchor element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89647724">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89647724</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLAnchorElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"g"' <a id="accessKeyLink">id='accessKeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_anchor02.html b/dom/tests/mochitest/dom-level2-html/test_anchor02.html
new file mode 100644
index 0000000000..90a5f26f4e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_anchor02.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['anchor02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The character encoding of the linked resource.
+The value of attribute charset of the anchor element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67619266
+*/
+function anchor02() {
+ var success;
+ if(checkInitialization(builder, "anchor02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcharset;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcharset = testNode.charset;
+
+ assertEquals("charsetLink","US-ASCII",vcharset);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor02</h2>
+<p>&lt;test name='anchor02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;anchor02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The character encoding of the linked resource.
+The value of attribute charset of the anchor element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67619266">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67619266</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcharset' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;charset interface='HTMLAnchorElement' obj='testNode' var='vcharset'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcharset' expected='"US-ASCII"' <a id="charsetLink">id='charsetLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_anchor03.html b/dom/tests/mochitest/dom-level2-html/test_anchor03.html
new file mode 100644
index 0000000000..764561b853
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_anchor03.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['anchor03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Comma-separated list of lengths, defining an active region geometry.
+The value of attribute coords of the anchor element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92079539
+*/
+function anchor03() {
+ var success;
+ if(checkInitialization(builder, "anchor03") != null) return;
+ var nodeList;
+ var testNode;
+ var vcoords;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcoords = testNode.coords;
+
+ assertEquals("coordsLink","0,0,100,100",vcoords);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor03</h2>
+<p>&lt;test name='anchor03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;anchor03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Comma-separated list of lengths, defining an active region geometry.
+The value of attribute coords of the anchor element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92079539">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92079539</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcoords' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;coords interface='HTMLAnchorElement' obj='testNode' var='vcoords'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcoords' expected='"0,0,100,100"' <a id="coordsLink">id='coordsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_anchor04.html b/dom/tests/mochitest/dom-level2-html/test_anchor04.html
new file mode 100644
index 0000000000..8f6fdf5df4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_anchor04.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['anchor04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The URI of the linked resource.
+The value of attribute href of the anchor element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88517319
+*/
+function anchor04() {
+ var success;
+ if(checkInitialization(builder, "anchor04") != null) return;
+ var nodeList;
+ var testNode;
+ var vhref;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vhref = testNode.href;
+
+ assertURIEquals("hrefLink",null,null,null,"submit.gif",null,null,null,true,vhref);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor04</h2>
+<p>&lt;test name='anchor04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;anchor04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The URI of the linked resource.
+The value of attribute href of the anchor element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88517319">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88517319</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhref' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;href interface='HTMLAnchorElement' obj='testNode' var='vhref'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vhref' isAbsolute='true' file='"submit.gif"' <a id="hrefLink">id='hrefLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_anchor05.html b/dom/tests/mochitest/dom-level2-html/test_anchor05.html
new file mode 100644
index 0000000000..d62a04253c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_anchor05.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['anchor05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Advisory content type.
+The value of attribute type of the anchor element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63938221
+*/
+function anchor05() {
+ var success;
+ if(checkInitialization(builder, "anchor05") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","image/gif",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor05</h2>
+<p>&lt;test name='anchor05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;anchor05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Advisory content type.
+The value of attribute type of the anchor element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63938221">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63938221</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLAnchorElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"image/gif"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_anchor06.html b/dom/tests/mochitest/dom-level2-html/test_anchor06.html
new file mode 100644
index 0000000000..1be5b39431
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_anchor06.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['anchor06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The shape of the active area. The coordinates are given by coords
+The value of attribute shape of the anchor element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49899808
+*/
+function anchor06() {
+ var success;
+ if(checkInitialization(builder, "anchor06") != null) return;
+ var nodeList;
+ var testNode;
+ var vshape;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ nodeList = doc.getElementsByTagName("a");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vshape = testNode.shape;
+
+ assertEquals("shapeLink","rect",vshape);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/anchor06</h2>
+<p>&lt;test name='anchor06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;anchor06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The shape of the active area. The coordinates are given by coords
+The value of attribute shape of the anchor element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-02&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49899808">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49899808</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vshape' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"a"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;shape interface='HTMLAnchorElement' obj='testNode' var='vshape'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vshape' expected='"rect"' <a id="shapeLink">id='shapeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_area01.html b/dom/tests/mochitest/dom-level2-html/test_area01.html
new file mode 100644
index 0000000000..6d86909f6d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_area01.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/area01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['area01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66021476
+*/
+function area01() {
+ var success;
+ if(checkInitialization(builder, "area01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcoords;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcoords = testNode.coords;
+
+ assertEquals("coordsLink","0,2,45,45",vcoords);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/area01</h2>
+<p>&lt;test name='area01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;area01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66021476">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66021476</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcoords' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;coords interface='HTMLAreaElement' obj='testNode' var='vcoords'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcoords' expected='"0,2,45,45"' <a id="coordsLink">id='coordsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_area02.html b/dom/tests/mochitest/dom-level2-html/test_area02.html
new file mode 100644
index 0000000000..fb9db8319b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_area02.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/area02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['area02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61826871
+*/
+function area02() {
+ var success;
+ if(checkInitialization(builder, "area02") != null) return;
+ var nodeList;
+ var testNode;
+ var vnohref;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vnohref = testNode.noHref;
+
+ assertFalse("noHrefLink",vnohref);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/area02</h2>
+<p>&lt;test name='area02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;area02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61826871">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61826871</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vnohref' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;noHref interface='HTMLAreaElement' obj='testNode' var='vnohref'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertFalse actual='vnohref' <a id="noHrefLink">id='noHrefLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_area03.html b/dom/tests/mochitest/dom-level2-html/test_area03.html
new file mode 100644
index 0000000000..98dd3e521e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_area03.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/area03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['area03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8722121
+*/
+function area03() {
+ var success;
+ if(checkInitialization(builder, "area03") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",10,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/area03</h2>
+<p>&lt;test name='area03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;area03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8722121">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8722121</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLAreaElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='10' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_area04.html b/dom/tests/mochitest/dom-level2-html/test_area04.html
new file mode 100644
index 0000000000..0c91403e0c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_area04.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/area04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['area04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "area");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57944457
+*/
+function area04() {
+ var success;
+ if(checkInitialization(builder, "area04") != null) return;
+ var nodeList;
+ var testNode;
+ var vaccesskey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "area");
+ nodeList = doc.getElementsByTagName("area");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vaccesskey = testNode.accessKey;
+
+ assertEquals("accessKeyLink","a",vaccesskey);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/area04</h2>
+<p>&lt;test name='area04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;area04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57944457">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57944457</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaccesskey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='area' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"area"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLAreaElement' obj='testNode' var='vaccesskey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaccesskey' expected='"a"' <a id="accessKeyLink">id='accessKeyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/area.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_body01.html b/dom/tests/mochitest/dom-level2-html/test_body01.html
new file mode 100644
index 0000000000..417329e475
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_body01.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/body01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['body01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "body");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Color of active links (after mouse-button down, but before mouse-button up).
+The value of attribute alink of the body element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59424581
+*/
+function body01() {
+ var success;
+ if(checkInitialization(builder, "body01") != null) return;
+ var nodeList;
+ var testNode;
+ var valink;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "body");
+ nodeList = doc.getElementsByTagName("body");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valink = testNode.aLink;
+
+ assertEquals("aLinkLink","#0000ff",valink);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/body01</h2>
+<p>&lt;test name='body01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;body01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Color of active links (after mouse-button down, but before mouse-button up).
+The value of attribute alink of the body element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59424581">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59424581</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valink' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='body' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"body"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;aLink interface='HTMLBodyElement' obj='testNode' var='valink'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valink' expected='"#0000ff"' <a id="aLinkLink">id='aLinkLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/body.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button01.html b/dom/tests/mochitest/dom-level2-html/test_button01.html
new file mode 100644
index 0000000000..cd3bb8f8cc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button01.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Returns the FORM element containing this control. Returns null if this control is not within the context of a form.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493
+*/
+function button01() {
+ var success;
+ if(checkInitialization(builder, "button01") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vform = testNode.form;
+
+ assertNull("formLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button01</h2>
+<p>&lt;test name='button01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Returns the FORM element containing this control. Returns null if this control is not within the context of a form.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLButtonElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formLink">id='formLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button02.html b/dom/tests/mochitest/dom-level2-html/test_button02.html
new file mode 100644
index 0000000000..a4cae627d3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button02.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The value of attribute name of the form element which contains this button is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901
+*/
+function button02() {
+ var success;
+ if(checkInitialization(builder, "button02") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var vfname;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ formNode = testNode.form;
+
+ vfname = formNode.id;
+
+ assertEquals("formLink","form2",vfname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button02</h2>
+<p>&lt;test name='button02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The value of attribute name of the form element which contains this button is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vfname' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLButtonElement' obj='testNode' var='formNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id interface='HTMLElement' obj='formNode' var='vfname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vfname' expected='"form2"' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button03.html b/dom/tests/mochitest/dom-level2-html/test_button03.html
new file mode 100644
index 0000000000..3e81c10024
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button03.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The value of attribute action of the form element which contains this button is read and checked against the expected value
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74049184
+*/
+function button03() {
+ var success;
+ if(checkInitialization(builder, "button03") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var vfaction;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ formNode = testNode.form;
+
+ vfaction = formNode.action;
+
+ // its not clear that this test is valid
+ // mozilla returns a fully expanded uri
+ is(vfaction, formNode.ownerDocument.location.href.replace(/button\.html/, "..."), "formLink");
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button03</h2>
+<p>&lt;test name='button03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The value of attribute action of the form element which contains this button is read and checked against the expected value
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74049184">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74049184</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vfaction' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLButtonElement' obj='testNode' var='formNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;action interface='HTMLFormElement' obj='formNode' var='vfaction'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vfaction' expected='"..."' <a id="formLink">id='formLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button04.html b/dom/tests/mochitest/dom-level2-html/test_button04.html
new file mode 100644
index 0000000000..b34171f23c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button04.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The value of attribute method of the form element which contains this button is read and checked against the expected value
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82545539
+*/
+function button04() {
+ var success;
+ if(checkInitialization(builder, "button04") != null) return;
+ var nodeList;
+ var testNode;
+ var formNode;
+ var vfmethod;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ formNode = testNode.form;
+
+ vfmethod = formNode.method;
+
+ assertEquals("formLink","POST".toLowerCase(),vfmethod.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button04</h2>
+<p>&lt;test name='button04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The value of attribute method of the form element which contains this button is read and checked against the expected value
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493</a>'/&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82545539">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82545539</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='formNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vfmethod' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLButtonElement' obj='testNode' var='formNode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;method interface='HTMLFormElement' obj='formNode' var='vfmethod'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vfmethod' expected='"POST"' <a id="formLink">id='formLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button05.html b/dom/tests/mochitest/dom-level2-html/test_button05.html
new file mode 100644
index 0000000000..2d6b6d7dbc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button05.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+A single character access key to give access to the form control.
+The value of attribute accessKey of the button element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73169431
+*/
+function button05() {
+ var success;
+ if(checkInitialization(builder, "button05") != null) return;
+ var nodeList;
+ var testNode;
+ var vakey;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vakey = testNode.accessKey;
+
+ assertEquals("accessKeyLink","f".toLowerCase(),vakey.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button05</h2>
+<p>&lt;test name='button05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+A single character access key to give access to the form control.
+The value of attribute accessKey of the button element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73169431">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73169431</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vakey' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accessKey interface='HTMLButtonElement' obj='testNode' var='vakey'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vakey' expected='"f"' <a id="accessKeyLink">id='accessKeyLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button06.html b/dom/tests/mochitest/dom-level2-html/test_button06.html
new file mode 100644
index 0000000000..8d11cd16e4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button06.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Index that represents the element's position in the tabbing order.
+The value of attribute tabIndex of the button element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39190908
+*/
+function button06() {
+ var success;
+ if(checkInitialization(builder, "button06") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabIndex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtabIndex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",20,vtabIndex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button06</h2>
+<p>&lt;test name='button06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Index that represents the element's position in the tabbing order.
+The value of attribute tabIndex of the button element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39190908">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39190908</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabIndex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLButtonElement' obj='testNode' var='vtabIndex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabIndex' expected='20' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button07.html b/dom/tests/mochitest/dom-level2-html/test_button07.html
new file mode 100644
index 0000000000..aaae8e6922
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button07.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The type of button
+The value of attribute type of the button element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27430092
+*/
+function button07() {
+ var success;
+ if(checkInitialization(builder, "button07") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","reset",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button07</h2>
+<p>&lt;test name='button07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The type of button
+The value of attribute type of the button element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27430092">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27430092</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLButtonElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"reset"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button08.html b/dom/tests/mochitest/dom-level2-html/test_button08.html
new file mode 100644
index 0000000000..a7a48caa42
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button08.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The control is unavailable in this context.
+The boolean value of attribute disabled of the button element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92757155
+*/
+function button08() {
+ var success;
+ if(checkInitialization(builder, "button08") != null) return;
+ var nodeList;
+ var testNode;
+ var vdisabled;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vdisabled = testNode.disabled;
+
+ assertTrue("disabledLink",vdisabled);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button08</h2>
+<p>&lt;test name='button08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The control is unavailable in this context.
+The boolean value of attribute disabled of the button element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92757155">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92757155</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdisabled' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;disabled interface='HTMLButtonElement' obj='testNode' var='vdisabled'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vdisabled' <a id="disabledLink">id='disabledLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_button09.html b/dom/tests/mochitest/dom-level2-html/test_button09.html
new file mode 100644
index 0000000000..4917f7f78f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_button09.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/button09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['button09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "button");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The current form control value.
+The value of attribute value of the button element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72856782
+*/
+function button09() {
+ var success;
+ if(checkInitialization(builder, "button09") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalue;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "button");
+ nodeList = doc.getElementsByTagName("button");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vvalue = testNode.value;
+
+ assertEquals("typeLink","Reset Disabled Button",vvalue);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/button09</h2>
+<p>&lt;test name='button09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;button09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The current form control value.
+The value of attribute value of the button element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-09&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72856782">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72856782</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalue' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='button' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"button"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value interface='HTMLButtonElement' obj='testNode' var='vvalue'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalue' expected='"Reset Disabled Button"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/button.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_dlist01.html b/dom/tests/mochitest/dom-level2-html/test_dlist01.html
new file mode 100644
index 0000000000..3e756c4ec2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_dlist01.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/dlist01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['dlist01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "dl");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21738539
+*/
+function dlist01() {
+ var success;
+ if(checkInitialization(builder, "dlist01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcompact;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "dl");
+ nodeList = doc.getElementsByTagName("dl");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcompact = testNode.compact;
+
+ assertTrue("compactLink",vcompact);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/dlist01</h2>
+<p>&lt;test name='dlist01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;dlist01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21738539">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21738539</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcompact' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='dl' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"dl"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;compact interface='HTMLDListElement' obj='testNode' var='vcompact'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vcompact' <a id="compactLink">id='compactLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/dl.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_doc01.html b/dom/tests/mochitest/dom-level2-html/test_doc01.html
new file mode 100644
index 0000000000..8e2a0c0eb6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_doc01.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/doc01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['doc01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "anchor");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Retrieve the title attribute of HTMLDocument and examine it's value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18446827
+*/
+function doc01() {
+ var success;
+ if(checkInitialization(builder, "doc01") != null) return;
+ var vtitle;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "anchor");
+ vtitle = doc.title;
+
+ assertEquals("titleLink","NIST DOM HTML Test - Anchor",vtitle);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/doc01</h2>
+<p>&lt;test name='doc01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;doc01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Retrieve the title attribute of HTMLDocument and examine it's value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18446827">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18446827</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtitle' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='anchor' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title interface='HTMLDocument' obj='doc' var='vtitle'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtitle' expected='"NIST DOM HTML Test - Anchor"' <a id="titleLink">id='titleLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/anchor.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_hasFeature01.html b/dom/tests/mochitest/dom-level2-html/test_hasFeature01.html
new file mode 100644
index 0000000000..fa936ddb04
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_hasFeature01.html
@@ -0,0 +1,113 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasFeature01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ if (docsLoaded == 0) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+ runJSUnitTests();
+ SimpleTest.finish();
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 0) {
+ setUpPageStatus = 'complete';
+ }
+}
+
+
+/**
+*
+hasFeature("hTmL", null) should return true.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
+*/
+function hasFeature01() {
+ var success;
+ // if(checkInitialization(builder, "hasFeature01") != null) return;
+ var doc;
+ var domImpl;
+ var version = null;
+
+ var state;
+ domImpl = getImplementation();
+state = domImpl.hasFeature("hTmL",version);
+assertTrue("hasHTMLnull",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature01</h2>
+<p>&lt;test name='hasFeature01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+hasFeature("hTmL", null) should return true.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' isNull='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"hTmL"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='state' <a id="hasHTMLnull">id='hasHTMLnull'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_hasFeature02.html b/dom/tests/mochitest/dom-level2-html/test_hasFeature02.html
new file mode 100644
index 0000000000..6a58ca2818
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_hasFeature02.html
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasFeature02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ if (docsLoaded == 0) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+ runJSUnitTests();
+ SimpleTest.finish();
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 0) {
+ setUpPageStatus = 'complete';
+ }
+}
+
+
+/**
+*
+hasFeature("hTmL", "2.0") should return true.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function hasFeature02() {
+ var success;
+ if(checkInitialization(builder, "hasFeature02") != null) return;
+ var doc;
+ var domImpl;
+ var version = "2.0";
+ var state;
+ domImpl = getImplementation();
+state = domImpl.hasFeature("hTmL",version);
+assertTrue("hasHTML2",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature02</h2>
+<p>&lt;test name='hasFeature02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+hasFeature("hTmL", "2.0") should return true.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' value='"2.0"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"hTmL"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='state' <a id="hasHTML2">id='hasHTML2'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_hasFeature03.html b/dom/tests/mochitest/dom-level2-html/test_hasFeature03.html
new file mode 100644
index 0000000000..25a0cfd8fe
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_hasFeature03.html
@@ -0,0 +1,115 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasFeature03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ if (docsLoaded == 0) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+ runJSUnitTests();
+ SimpleTest.finish();
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 0) {
+ setUpPageStatus = 'complete';
+ }
+}
+
+
+/**
+*
+hasFeature("xhTmL", null) should return true if hasFeature("XML", null) returns true.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function hasFeature03() {
+ var success;
+ if(checkInitialization(builder, "hasFeature03") != null) return;
+ var doc;
+ var domImpl;
+ var version = null;
+
+ var state;
+ var hasXML;
+ domImpl = getImplementation();
+hasXML = domImpl.hasFeature("XML",version);
+state = domImpl.hasFeature("xhTmL",version);
+assertEquals("hasXHTML",hasXML,state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature03</h2>
+<p>&lt;test name='hasFeature03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+hasFeature("xhTmL", null) should return true if hasFeature("XML", null) returns true.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' isNull='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='hasXML' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='hasXML' feature='"XML"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"xhTmL"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='state' expected='hasXML' ignoreCase='false' <a id="hasXHTML">id='hasXHTML'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_hasFeature04.html b/dom/tests/mochitest/dom-level2-html/test_hasFeature04.html
new file mode 100644
index 0000000000..773b999aa7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_hasFeature04.html
@@ -0,0 +1,114 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasFeature04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ if (docsLoaded == 0) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+ runJSUnitTests();
+ SimpleTest.finish();
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 0) {
+ setUpPageStatus = 'complete';
+ }
+}
+
+
+/**
+*
+hasFeature("xhTmL", "2.0") should return true if hasFeature("XML", "2.0") returns true.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function hasFeature04() {
+ var success;
+ if(checkInitialization(builder, "hasFeature04") != null) return;
+ var doc;
+ var domImpl;
+ var version = "2.0";
+ var state;
+ var hasXML;
+ domImpl = getImplementation();
+hasXML = domImpl.hasFeature("XML",version);
+state = domImpl.hasFeature("xhTmL",version);
+assertEquals("hasXHTML",hasXML,state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature04</h2>
+<p>&lt;test name='hasFeature04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+hasFeature("xhTmL", "2.0") should return true if hasFeature("XML", "2.0") returns true.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' value='"2.0"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='hasXML' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='hasXML' feature='"XML"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"xhTmL"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='state' expected='hasXML' ignoreCase='false' <a id="hasXHTML">id='hasXHTML'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_hasFeature05.html b/dom/tests/mochitest/dom-level2-html/test_hasFeature05.html
new file mode 100644
index 0000000000..e765457cf6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_hasFeature05.html
@@ -0,0 +1,113 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasFeature05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ if (docsLoaded == 0) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+ runJSUnitTests();
+ SimpleTest.finish();
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 0) {
+ setUpPageStatus = 'complete';
+ }
+}
+
+
+/**
+*
+hasFeature("cOrE", null) should return true.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function hasFeature05() {
+ var success;
+ if(checkInitialization(builder, "hasFeature05") != null) return;
+ var doc;
+ var domImpl;
+ var version = null;
+
+ var state;
+ domImpl = getImplementation();
+state = domImpl.hasFeature("cOrE",version);
+assertTrue("hasCore",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature05</h2>
+<p>&lt;test name='hasFeature05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+hasFeature("cOrE", null) should return true.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' isNull='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"cOrE"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='state' <a id="hasCore">id='hasCore'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_hasFeature06.html b/dom/tests/mochitest/dom-level2-html/test_hasFeature06.html
new file mode 100644
index 0000000000..596d8e3fff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_hasFeature06.html
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['hasFeature06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ if (docsLoaded == 0) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+ runJSUnitTests();
+ SimpleTest.finish();
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 0) {
+ setUpPageStatus = 'complete';
+ }
+}
+
+
+/**
+*
+hasFeature("cOrE", "2.0") should return true.
+
+* @author Curt Arnold
+* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
+*/
+function hasFeature06() {
+ var success;
+ if(checkInitialization(builder, "hasFeature06") != null) return;
+ var doc;
+ var domImpl;
+ var version = "2.0";
+ var state;
+ domImpl = getImplementation();
+state = domImpl.hasFeature("cOrE",version);
+assertTrue("hasCore",state);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature06</h2>
+<p>&lt;test name='hasFeature06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+hasFeature("cOrE", "2.0") should return true.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' value='"2.0"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"cOrE"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='state' <a id="hasCore">id='hasCore'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object01.html b/dom/tests/mochitest/dom-level2-html/test_object01.html
new file mode 100644
index 0000000000..e3bea15712
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object01.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Returns the FORM element containing this control. Returns null if this control is not within the context of a form.
+The value of attribute form of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773
+*/
+function object01() {
+ var success;
+ if(checkInitialization(builder, "object01") != null) return;
+ var nodeList;
+ var testNode;
+ var vform;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vform = testNode.form;
+
+ assertNull("formLink",vform);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object01</h2>
+<p>&lt;test name='object01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Returns the FORM element containing this control. Returns null if this control is not within the context of a form.
+The value of attribute form of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46094773</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vform' type='HTMLFormElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form interface='HTMLObjectElement' obj='testNode' var='vform'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vform' <a id="formLink">id='formLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object02.html b/dom/tests/mochitest/dom-level2-html/test_object02.html
new file mode 100644
index 0000000000..4cc91da2d2
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object02.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Aligns this object (vertically or horizontally) with respect to its surrounding text.
+The value of attribute align of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16962097
+*/
+function object02() {
+ var success;
+ if(checkInitialization(builder, "object02") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","middle",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object02</h2>
+<p>&lt;test name='object02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Aligns this object (vertically or horizontally) with respect to its surrounding text.
+The value of attribute align of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16962097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16962097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLObjectElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"middle"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object03.html b/dom/tests/mochitest/dom-level2-html/test_object03.html
new file mode 100644
index 0000000000..f3523bcf38
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object03.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Space-separated list of archives
+The value of attribute archive of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47783837
+*/
+function object03() {
+ var success;
+ if(checkInitialization(builder, "object03") != null) return;
+ var nodeList;
+ var testNode;
+ var varchive;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ varchive = testNode.archive;
+
+ assertEquals("archiveLink","",varchive);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object03</h2>
+<p>&lt;test name='object03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Space-separated list of archives
+The value of attribute archive of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47783837">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47783837</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='varchive' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;archive interface='HTMLObjectElement' obj='testNode' var='varchive'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='varchive' expected='""' <a id="archiveLink">id='archiveLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object04.html b/dom/tests/mochitest/dom-level2-html/test_object04.html
new file mode 100644
index 0000000000..0749cf7b4b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object04.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Width of border around the object.
+The value of attribute border of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82818419
+*/
+function object04() {
+ var success;
+ if(checkInitialization(builder, "object04") != null) return;
+ var nodeList;
+ var testNode;
+ var vborder;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vborder = testNode.border;
+
+ assertEquals("borderLink","0",vborder);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object04</h2>
+<p>&lt;test name='object04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Width of border around the object.
+The value of attribute border of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82818419">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82818419</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vborder' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;border interface='HTMLObjectElement' obj='testNode' var='vborder'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vborder' expected='"0"' <a id="borderLink">id='borderLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object05.html b/dom/tests/mochitest/dom-level2-html/test_object05.html
new file mode 100644
index 0000000000..02638b8391
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object05.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Base URI for classid, data, and archive attributes.
+The value of attribute codebase of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25709136
+*/
+function object05() {
+ var success;
+ if(checkInitialization(builder, "object05") != null) return;
+ var nodeList;
+ var testNode;
+ var vcodebase;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vcodebase = testNode.codeBase;
+
+ assertEquals("codebaseLink","http://example.org/",vcodebase);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object05</h2>
+<p>&lt;test name='object05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Base URI for classid, data, and archive attributes.
+The value of attribute codebase of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25709136">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25709136</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcodebase' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;codeBase interface='HTMLObjectElement' obj='testNode' var='vcodebase'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcodebase' expected='"http://xw2k.sdct.itl.nist.gov/brady/dom/"' <a id="codebaseLink">id='codebaseLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object06.html b/dom/tests/mochitest/dom-level2-html/test_object06.html
new file mode 100644
index 0000000000..ba9c065122
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object06.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+A URI specifying the location of the object's data.
+The value of attribute data of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-81766986
+*/
+function object06() {
+ var success;
+ if(checkInitialization(builder, "object06") != null) return;
+ var nodeList;
+ var testNode;
+ var vdata;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vdata = testNode.data;
+ // this test asks for a uri which mozilla fully expands
+ // assertEquals("dataLink","./pix/logo.gif",vdata);
+ todo_is(vdata, "./pix/logo.gif", "dataLink");
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object06</h2>
+<p>&lt;test name='object06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+A URI specifying the location of the object's data.
+The value of attribute data of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-81766986">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-81766986</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vdata' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;data interface='HTMLObjectElement' obj='testNode' var='vdata'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vdata' expected='"./pix/logo.gif"' <a id="dataLink">id='dataLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object07.html b/dom/tests/mochitest/dom-level2-html/test_object07.html
new file mode 100644
index 0000000000..74698fa288
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object07.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The value of attribute height of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88925838
+*/
+function object07() {
+ var success;
+ if(checkInitialization(builder, "object07") != null) return;
+ var nodeList;
+ var testNode;
+ var vheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vheight = testNode.height;
+
+ assertEquals("heightLink","60",vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object07</h2>
+<p>&lt;test name='object07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The value of attribute height of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88925838">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88925838</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height interface='HTMLObjectElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='"60"' <a id="heightLink">id='heightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object08.html b/dom/tests/mochitest/dom-level2-html/test_object08.html
new file mode 100644
index 0000000000..f9196d7efa
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object08.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Horizontal space to the left and right of this image, applet, or object.
+The value of attribute hspace of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-17085376
+*/
+function object08() {
+ var success;
+ if(checkInitialization(builder, "object08") != null) return;
+ var nodeList;
+ var testNode;
+ var vhspace;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vhspace = testNode.hspace;
+
+ assertEquals("hspaceLink",0,vhspace);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object08</h2>
+<p>&lt;test name='object08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Horizontal space to the left and right of this image, applet, or object.
+The value of attribute hspace of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-17085376">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-17085376</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vhspace' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hspace interface='HTMLObjectElement' obj='testNode' var='vhspace'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vhspace' expected='0' <a id="hspaceLink">id='hspaceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object09.html b/dom/tests/mochitest/dom-level2-html/test_object09.html
new file mode 100644
index 0000000000..8f969113f5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object09.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Message to render while loading the object.
+The value of attribute standby of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25039673
+*/
+function object09() {
+ var success;
+ if(checkInitialization(builder, "object09") != null) return;
+ var nodeList;
+ var testNode;
+ var vstandby;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vstandby = testNode.standby;
+
+ assertEquals("standbyLink","Loading Image ...",vstandby);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object09</h2>
+<p>&lt;test name='object09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Message to render while loading the object.
+The value of attribute standby of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25039673">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25039673</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vstandby' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;standby interface='HTMLObjectElement' obj='testNode' var='vstandby'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vstandby' expected='"Loading Image ..."' <a id="standbyLink">id='standbyLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object10.html b/dom/tests/mochitest/dom-level2-html/test_object10.html
new file mode 100644
index 0000000000..c22a7f6991
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object10.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Index that represents the element's position in the tabbing order.
+The value of attribute tabIndex of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27083787
+*/
+function object10() {
+ var success;
+ if(checkInitialization(builder, "object10") != null) return;
+ var nodeList;
+ var testNode;
+ var vtabindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtabindex = testNode.tabIndex;
+
+ assertEquals("tabIndexLink",0,vtabindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object10</h2>
+<p>&lt;test name='object10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Index that represents the element's position in the tabbing order.
+The value of attribute tabIndex of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27083787">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27083787</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtabindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tabIndex interface='HTMLObjectElement' obj='testNode' var='vtabindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtabindex' expected='0' <a id="tabIndexLink">id='tabIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object11.html b/dom/tests/mochitest/dom-level2-html/test_object11.html
new file mode 100644
index 0000000000..a50bba9e59
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object11.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Content type for data downloaded via data attribute.
+The value of attribute type of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91665621
+*/
+function object11() {
+ var success;
+ if(checkInitialization(builder, "object11") != null) return;
+ var nodeList;
+ var testNode;
+ var vtype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vtype = testNode.type;
+
+ assertEquals("typeLink","image/gif",vtype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object11</h2>
+<p>&lt;test name='object11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Content type for data downloaded via data attribute.
+The value of attribute type of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91665621">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91665621</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vtype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type interface='HTMLObjectElement' obj='testNode' var='vtype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vtype' expected='"image/gif"' <a id="typeLink">id='typeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object12.html b/dom/tests/mochitest/dom-level2-html/test_object12.html
new file mode 100644
index 0000000000..9617273351
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object12.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The value of attribute usemap of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6649772
+*/
+function object12() {
+ var success;
+ if(checkInitialization(builder, "object12") != null) return;
+ var nodeList;
+ var testNode;
+ var vusemap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vusemap = testNode.useMap;
+
+ assertEquals("useMapLink","#DivLogo-map",vusemap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object12</h2>
+<p>&lt;test name='object12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The value of attribute usemap of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6649772">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6649772</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vusemap' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;useMap interface='HTMLObjectElement' obj='testNode' var='vusemap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vusemap' expected='"#DivLogo-map"' <a id="useMapLink">id='useMapLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object13.html b/dom/tests/mochitest/dom-level2-html/test_object13.html
new file mode 100644
index 0000000000..93b5a79372
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object13.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object13</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object13'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Vertical space above and below this image, applet, or object.
+The value of attribute vspace of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-8682483
+*/
+function object13() {
+ var success;
+ if(checkInitialization(builder, "object13") != null) return;
+ var nodeList;
+ var testNode;
+ var vvspace;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vvspace = testNode.vspace;
+
+ assertEquals("vspaceLink",0,vvspace);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object13</h2>
+<p>&lt;test name='object13' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object13&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Vertical space above and below this image, applet, or object.
+The value of attribute vspace of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-8682483">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-8682483</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvspace' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vspace interface='HTMLObjectElement' obj='testNode' var='vvspace'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvspace' expected='0' <a id="vspaceLink">id='vspaceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object14.html b/dom/tests/mochitest/dom-level2-html/test_object14.html
new file mode 100644
index 0000000000..888a48e123
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object14.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object14</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object14'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The value of attribute width of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38538620
+*/
+function object14() {
+ var success;
+ if(checkInitialization(builder, "object14") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","550",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object14</h2>
+<p>&lt;test name='object14' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object14&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The value of attribute width of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38538620">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-38538620</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLObjectElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"550"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_object15.html b/dom/tests/mochitest/dom-level2-html/test_object15.html
new file mode 100644
index 0000000000..0e3bb673e4
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_object15.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/object15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['object15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "object");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Content type for data downloaded via classid attribute.
+The value of attribute codetype of the object element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19945008
+*/
+function object15() {
+ var success;
+ if(checkInitialization(builder, "object15") != null) return;
+ var nodeList;
+ var testNode;
+ var vcodetype;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "object");
+ nodeList = doc.getElementsByTagName("object");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vcodetype = testNode.codeType;
+
+ assertEquals("codeTypeLink","image/gif",vcodetype);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/object15</h2>
+<p>&lt;test name='object15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;object15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Content type for data downloaded via classid attribute.
+The value of attribute codetype of the object element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19945008">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19945008</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcodetype' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='object' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"object"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;codeType interface='HTMLObjectElement' obj='testNode' var='vcodetype'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcodetype' expected='"image/gif"' <a id="codeTypeLink">id='codeTypeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/object.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table01.html b/dom/tests/mochitest/dom-level2-html/test_table01.html
new file mode 100644
index 0000000000..bbc83b2d81
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table01.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table1");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Returns the table's CAPTION, or void if none exists.
+The value of attribute caption of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520
+*/
+function table01() {
+ var success;
+ if(checkInitialization(builder, "table01") != null) return;
+ var nodeList;
+ var testNode;
+ var vcaption;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table1");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcaption = testNode.caption;
+
+ assertNull("captionLink",vcaption);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table01</h2>
+<p>&lt;test name='table01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Returns the table's CAPTION, or void if none exists.
+The value of attribute caption of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcaption' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table1' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vcaption'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertNull actual='vcaption' <a id="captionLink">id='captionLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table1.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table02.html b/dom/tests/mochitest/dom-level2-html/test_table02.html
new file mode 100644
index 0000000000..a9e34590c0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table02.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Caption alignment with respect to the table.
+The value of attribute align of the tablecaption element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520
+*/
+function table02() {
+ var success;
+ if(checkInitialization(builder, "table02") != null) return;
+ var nodeList;
+ var testNode;
+ var vcaption;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vcaption = testNode.caption;
+
+ valign = vcaption.align;
+
+ assertEquals("alignLink","top",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table02</h2>
+<p>&lt;test name='table02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Caption alignment with respect to the table.
+The value of attribute align of the tablecaption element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14594520</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcaption' type='HTMLTableCaptionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption interface='HTMLTableElement' obj='testNode' var='vcaption'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableCaptionElement' obj='vcaption' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"top"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table03.html b/dom/tests/mochitest/dom-level2-html/test_table03.html
new file mode 100644
index 0000000000..f7ad75f43d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table03.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Alignment character for cells in a column.
+The value of attribute ch of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944
+*/
+function table03() {
+ var success;
+ if(checkInitialization(builder, "table03") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tHead;
+
+ vch = vsection.ch;
+
+ assertEquals("chLink","*",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table03</h2>
+<p>&lt;test name='table03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Alignment character for cells in a column.
+The value of attribute ch of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableSectionElement' obj='vsection' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"*"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table04.html b/dom/tests/mochitest/dom-level2-html/test_table04.html
new file mode 100644
index 0000000000..464b901b23
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table04.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Horizontal alignment of data in cells.
+The value of attribute align of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944
+*/
+function table04() {
+ var success;
+ if(checkInitialization(builder, "table04") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tHead;
+
+ valign = vsection.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table04</h2>
+<p>&lt;test name='table04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Horizontal alignment of data in cells.
+The value of attribute align of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='vsection' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table06.html b/dom/tests/mochitest/dom-level2-html/test_table06.html
new file mode 100644
index 0000000000..d0d9bff3ae
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table06.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Vertical alignment of data in cells.
+The value of attribute valign of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function table06() {
+ var success;
+ if(checkInitialization(builder, "table06") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vvAlign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tFoot;
+
+ vvAlign = vsection.vAlign;
+
+ assertEquals("vAlignLink","middle",vvAlign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table06</h2>
+<p>&lt;test name='table06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Vertical alignment of data in cells.
+The value of attribute valign of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvAlign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableSectionElement' obj='vsection' var='vvAlign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvAlign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table07.html b/dom/tests/mochitest/dom-level2-html/test_table07.html
new file mode 100644
index 0000000000..e81ac9e402
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table07.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The collection of rows in this table section.
+The value of attribute rows of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function table07() {
+ var success;
+ if(checkInitialization(builder, "table07") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vcollection;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tFoot;
+
+ vcollection = vsection.rows;
+
+ vrows = vcollection.length;
+
+ assertEquals("vrowsLink",1,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table07</h2>
+<p>&lt;test name='table07' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The collection of rows in this table section.
+The value of attribute rows of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcollection' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='vsection' var='vcollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='vcollection' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="vrowsLink">id='vrowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table08.html b/dom/tests/mochitest/dom-level2-html/test_table08.html
new file mode 100644
index 0000000000..9d13c84819
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table08.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Horizontal alignment of data in cells.
+The value of attribute align of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function table08() {
+ var success;
+ if(checkInitialization(builder, "table08") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tFoot;
+
+ valign = vsection.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table08</h2>
+<p>&lt;test name='table08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Horizontal alignment of data in cells.
+The value of attribute align of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableSectionElement' obj='vsection' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table09.html b/dom/tests/mochitest/dom-level2-html/test_table09.html
new file mode 100644
index 0000000000..1812d575fb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table09.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Vertical alignment of data in cells.
+The value of attribute valign of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944
+*/
+function table09() {
+ var success;
+ if(checkInitialization(builder, "table09") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tHead;
+
+ vvalign = vsection.vAlign;
+
+ assertEquals("alignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table09</h2>
+<p>&lt;test name='table09' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Vertical alignment of data in cells.
+The value of attribute valign of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9530944</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableSectionElement' obj='vsection' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table10.html b/dom/tests/mochitest/dom-level2-html/test_table10.html
new file mode 100644
index 0000000000..63981731dc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table10.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Alignment character for cells in a column.
+The value of attribute ch of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function table10() {
+ var success;
+ if(checkInitialization(builder, "table10") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tFoot;
+
+ vch = vsection.ch;
+
+ assertEquals("chLink","+",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table10</h2>
+<p>&lt;test name='table10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Alignment character for cells in a column.
+The value of attribute ch of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableSectionElement' obj='vsection' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"+"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table12.html b/dom/tests/mochitest/dom-level2-html/test_table12.html
new file mode 100644
index 0000000000..862d52b080
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table12.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table12</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table12'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Offset of alignment character.
+The value of attribute choff of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function table12() {
+ var success;
+ if(checkInitialization(builder, "table12") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tHead;
+
+ vchoff = vsection.chOff;
+
+ assertEquals("choffLink","1",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table12</h2>
+<p>&lt;test name='table12' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table12&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Offset of alignment character.
+The value of attribute choff of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableSectionElement' obj='vsection' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"1"' <a id="choffLink">id='choffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table15.html b/dom/tests/mochitest/dom-level2-html/test_table15.html
new file mode 100644
index 0000000000..ee40383e13
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table15.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table15</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table15'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The collection of rows in this table section.
+The value of attribute rows of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function table15() {
+ var success;
+ if(checkInitialization(builder, "table15") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vcollection;
+ var vrows;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tHead;
+
+ vcollection = vsection.rows;
+
+ vrows = vcollection.length;
+
+ assertEquals("vrowsLink",1,vrows);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table15</h2>
+<p>&lt;test name='table15' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table15&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The collection of rows in this table section.
+The value of attribute rows of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcollection' type='HTMLCollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrows' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tHead interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rows interface='HTMLTableSectionElement' obj='vsection' var='vcollection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='vcollection' var='vrows'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrows' expected='1' <a id="vrowsLink">id='vrowsLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table17.html b/dom/tests/mochitest/dom-level2-html/test_table17.html
new file mode 100644
index 0000000000..0fb4d56159
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table17.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table17</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table17'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablesection");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Offset of alignment character.
+The value of attribute chOff of the tablesection element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097
+*/
+function table17() {
+ var success;
+ if(checkInitialization(builder, "table17") != null) return;
+ var nodeList;
+ var testNode;
+ var vsection;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablesection");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",2,nodeList);
+testNode = nodeList.item(1);
+ vsection = testNode.tFoot;
+
+ vchoff = vsection.chOff;
+
+ assertEquals("choffLink","2",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table17</h2>
+<p>&lt;test name='table17' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table17&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Offset of alignment character.
+The value of attribute chOff of the tablesection element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64197097</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsection' type='HTMLTableSectionElement'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablesection' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='2' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tFoot interface='HTMLTableElement' obj='testNode' var='vsection'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableSectionElement' obj='vsection' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"2"' <a id="choffLink">id='choffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablesection.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table18.html b/dom/tests/mochitest/dom-level2-html/test_table18.html
new file mode 100644
index 0000000000..43d735d1d7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table18.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table18</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table18'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The index of this cell in the row.
+The value of attribute cellIndex of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363
+*/
+function table18() {
+ var success;
+ if(checkInitialization(builder, "table18") != null) return;
+ var nodeList;
+ var testNode;
+ var vcindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vcindex = testNode.cellIndex;
+
+ assertEquals("cellIndexLink",1,vcindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table18</h2>
+<p>&lt;test name='table18' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table18&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The index of this cell in the row.
+The value of attribute cellIndex of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80748363</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cellIndex interface='HTMLTableCellElement' obj='testNode' var='vcindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcindex' expected='1' <a id="cellIndexLink">id='cellIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table19.html b/dom/tests/mochitest/dom-level2-html/test_table19.html
new file mode 100644
index 0000000000..70b1973baf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table19.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table19</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table19'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Abbreviation for header cells.
+The index of this cell in the row.
+The value of attribute abbr of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037
+*/
+function table19() {
+ var success;
+ if(checkInitialization(builder, "table19") != null) return;
+ var nodeList;
+ var testNode;
+ var vabbr;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vabbr = testNode.abbr;
+
+ assertEquals("abbrLink","hd2",vabbr);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table19</h2>
+<p>&lt;test name='table19' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table19&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Abbreviation for header cells.
+The index of this cell in the row.
+The value of attribute abbr of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74444037</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vabbr' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;abbr interface='HTMLTableCellElement' obj='testNode' var='vabbr'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vabbr' expected='"hd2"' <a id="abbrLink">id='abbrLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table20.html b/dom/tests/mochitest/dom-level2-html/test_table20.html
new file mode 100644
index 0000000000..0ee499ec4d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table20.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table20</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table20'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Names group of related headers.
+The value of attribute axis of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418
+*/
+function table20() {
+ var success;
+ if(checkInitialization(builder, "table20") != null) return;
+ var nodeList;
+ var testNode;
+ var vaxis;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vaxis = testNode.axis;
+
+ assertEquals("axisLink","center",vaxis);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table20</h2>
+<p>&lt;test name='table20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table20&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Names group of related headers.
+The value of attribute axis of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76554418</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vaxis' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;axis interface='HTMLTableCellElement' obj='testNode' var='vaxis'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vaxis' expected='"center"' <a id="axisLink">id='axisLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table21.html b/dom/tests/mochitest/dom-level2-html/test_table21.html
new file mode 100644
index 0000000000..47bc008009
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table21.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table21</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table21'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Horizontal alignment of data in cell.
+The value of attribute align of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879
+*/
+function table21() {
+ var success;
+ if(checkInitialization(builder, "table21") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table21</h2>
+<p>&lt;test name='table21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table21&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Horizontal alignment of data in cell.
+The value of attribute align of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98433879</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableCellElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table22.html b/dom/tests/mochitest/dom-level2-html/test_table22.html
new file mode 100644
index 0000000000..8b7a7885d5
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table22.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table22</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table22'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Cell background color.
+The value of attribute bgColor of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431
+*/
+function table22() {
+ var success;
+ if(checkInitialization(builder, "table22") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgcolorLink","#FF0000".toLowerCase(),vbgcolor.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table22</h2>
+<p>&lt;test name='table22' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table22&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Cell background color.
+The value of attribute bgColor of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88135431</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLTableCellElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#FF0000"' <a id="bgcolorLink">id='bgcolorLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table23.html b/dom/tests/mochitest/dom-level2-html/test_table23.html
new file mode 100644
index 0000000000..691659797f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table23.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table23</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table23'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Alignment character for cells in a column.
+The value of attribute char of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780
+*/
+function table23() {
+ var success;
+ if(checkInitialization(builder, "table23") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vch = testNode.ch;
+
+ assertEquals("chLink",":",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table23</h2>
+<p>&lt;test name='table23' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table23&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Alignment character for cells in a column.
+The value of attribute char of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30914780</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableCellElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='":"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table24.html b/dom/tests/mochitest/dom-level2-html/test_table24.html
new file mode 100644
index 0000000000..6397a803ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table24.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table24</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table24'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+offset of alignment character.
+The value of attribute chOff of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310
+*/
+function table24() {
+ var success;
+ if(checkInitialization(builder, "table24") != null) return;
+ var nodeList;
+ var testNode;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vchoff = testNode.chOff;
+
+ assertEquals("chOffLink","1",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table24</h2>
+<p>&lt;test name='table24' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table24&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+offset of alignment character.
+The value of attribute chOff of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20144310</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableCellElement' obj='testNode' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"1"' <a id="chOffLink">id='chOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table25.html b/dom/tests/mochitest/dom-level2-html/test_table25.html
new file mode 100644
index 0000000000..107f652213
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table25.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table25</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table25'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Number of columns spanned by cell.
+The value of attribute colspan of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244
+*/
+function table25() {
+ var success;
+ if(checkInitialization(builder, "table25") != null) return;
+ var nodeList;
+ var testNode;
+ var vcolspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vcolspan = testNode.colSpan;
+
+ assertEquals("colSpanLink",1,vcolspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table25</h2>
+<p>&lt;test name='table25' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table25&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Number of columns spanned by cell.
+The value of attribute colspan of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84645244</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcolspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;colSpan interface='HTMLTableCellElement' obj='testNode' var='vcolspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcolspan' expected='1' <a id="colSpanLink">id='colSpanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table26.html b/dom/tests/mochitest/dom-level2-html/test_table26.html
new file mode 100644
index 0000000000..aa9b94df7f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table26.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table26</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table26'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The value of attribute height of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212
+*/
+function table26() {
+ var success;
+ if(checkInitialization(builder, "table26") != null) return;
+ var nodeList;
+ var testNode;
+ var vheight;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vheight = testNode.height;
+
+ assertEquals("heightLink","50",vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table26</h2>
+<p>&lt;test name='table26' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table26&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The value of attribute height of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83679212</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheight' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height interface='HTMLTableCellElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='"50"' <a id="heightLink">id='heightLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table27.html b/dom/tests/mochitest/dom-level2-html/test_table27.html
new file mode 100644
index 0000000000..ccb05c251b
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table27.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table27</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table27'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Suppress word wrapping.
+The value of attribute nowrap of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045
+*/
+function table27() {
+ var success;
+ if(checkInitialization(builder, "table27") != null) return;
+ var nodeList;
+ var testNode;
+ var vnowrap;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vnowrap = testNode.noWrap;
+
+ assertTrue("nowrapLink",vnowrap);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table27</h2>
+<p>&lt;test name='table27' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table27&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Suppress word wrapping.
+The value of attribute nowrap of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62922045</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vnowrap' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;noWrap interface='HTMLTableCellElement' obj='testNode' var='vnowrap'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='vnowrap' <a id="nowrapLink">id='nowrapLink'</a>/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table28.html b/dom/tests/mochitest/dom-level2-html/test_table28.html
new file mode 100644
index 0000000000..719ffa42cc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table28.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table28</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table28'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Number of rows spanned by cell.
+The value of attribute rowspan of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625
+*/
+function table28() {
+ var success;
+ if(checkInitialization(builder, "table28") != null) return;
+ var nodeList;
+ var testNode;
+ var vrowspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vrowspan = testNode.rowSpan;
+
+ assertEquals("rowSpanLink",1,vrowspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table28</h2>
+<p>&lt;test name='table28' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table28&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Number of rows spanned by cell.
+The value of attribute rowspan of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-48237625</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrowspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowSpan interface='HTMLTableCellElement' obj='testNode' var='vrowspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrowspan' expected='1' <a id="rowSpanLink">id='rowSpanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table29.html b/dom/tests/mochitest/dom-level2-html/test_table29.html
new file mode 100644
index 0000000000..b3ba2a4cde
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table29.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table29</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table29'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Scope covered by header cells.
+The value of attribute scope of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952
+*/
+function table29() {
+ var success;
+ if(checkInitialization(builder, "table29") != null) return;
+ var nodeList;
+ var testNode;
+ var vscope;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vscope = testNode.scope;
+
+ assertEquals("scopeLink","col",vscope);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table29</h2>
+<p>&lt;test name='table29' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table29&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Scope covered by header cells.
+The value of attribute scope of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36139952</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vscope' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scope interface='HTMLTableCellElement' obj='testNode' var='vscope'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vscope' expected='"col"' <a id="scopeLink">id='scopeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table30.html b/dom/tests/mochitest/dom-level2-html/test_table30.html
new file mode 100644
index 0000000000..20dd16e84d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table30.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table30</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table30'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+List of id attribute values for header cells.
+The value of attribute headers of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817
+*/
+function table30() {
+ var success;
+ if(checkInitialization(builder, "table30") != null) return;
+ var nodeList;
+ var testNode;
+ var vheaders;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vheaders = testNode.headers;
+
+ assertEquals("headersLink","header-3",vheaders);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table30</h2>
+<p>&lt;test name='table30' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table30&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+List of id attribute values for header cells.
+The value of attribute headers of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89104817</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vheaders' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;headers interface='HTMLTableCellElement' obj='testNode' var='vheaders'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheaders' expected='"header-3"' <a id="headersLink">id='headersLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table31.html b/dom/tests/mochitest/dom-level2-html/test_table31.html
new file mode 100644
index 0000000000..4384ea0cfb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table31.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table31</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table31'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Vertical alignment of data in cell.
+The value of attribute valign of the tablecell element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221
+*/
+function table31() {
+ var success;
+ if(checkInitialization(builder, "table31") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table31</h2>
+<p>&lt;test name='table31' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table31&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Vertical alignment of data in cell.
+The value of attribute valign of the tablecell element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58284221</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableCellElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table32.html b/dom/tests/mochitest/dom-level2-html/test_table32.html
new file mode 100644
index 0000000000..9c3f26440d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table32.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table32</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table32'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecell");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+cell width.
+The value of attribute width of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795
+*/
+function table32() {
+ var success;
+ if(checkInitialization(builder, "table32") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecell");
+ nodeList = doc.getElementsByTagName("td");
+ assertSize("Asize",4,nodeList);
+testNode = nodeList.item(1);
+ vwidth = testNode.width;
+
+ assertEquals("vwidthLink","175",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table32</h2>
+<p>&lt;test name='table32' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table32&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+cell width.
+The value of attribute width of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27480795</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecell' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"td"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='4' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableCellElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"175"' <a id="vwidthLink">id='vwidthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecell.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table33.html b/dom/tests/mochitest/dom-level2-html/test_table33.html
new file mode 100644
index 0000000000..23ca0f415f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table33.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table33</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table33'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Specifies the table's position with respect to the rest of the document.
+The value of attribute align of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23180977
+*/
+function table33() {
+ var success;
+ if(checkInitialization(builder, "table33") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table33</h2>
+<p>&lt;test name='table33' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table33&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Specifies the table's position with respect to the rest of the document.
+The value of attribute align of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23180977">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-23180977</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table34.html b/dom/tests/mochitest/dom-level2-html/test_table34.html
new file mode 100644
index 0000000000..941683d8f6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table34.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table34</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table34'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The width of the border around the table.
+The value of attribute border of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50969400
+*/
+function table34() {
+ var success;
+ if(checkInitialization(builder, "table34") != null) return;
+ var nodeList;
+ var testNode;
+ var vborder;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vborder = testNode.border;
+
+ assertEquals("borderLink","4",vborder);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table34</h2>
+<p>&lt;test name='table34' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table34&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The width of the border around the table.
+The value of attribute border of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50969400">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50969400</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vborder' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;border interface='HTMLTableElement' obj='testNode' var='vborder'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vborder' expected='"4"' <a id="borderLink">id='borderLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table35.html b/dom/tests/mochitest/dom-level2-html/test_table35.html
new file mode 100644
index 0000000000..b62ed83751
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table35.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table35</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table35'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Cell background color.
+The value of attribute bgcolor of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83532985
+*/
+function table35() {
+ var success;
+ if(checkInitialization(builder, "table35") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgcolorLink","#ff0000",vbgcolor);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table35</h2>
+<p>&lt;test name='table35' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table35&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Cell background color.
+The value of attribute bgcolor of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83532985">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83532985</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLTableElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#ff0000"' <a id="bgcolorLink">id='bgcolorLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table36.html b/dom/tests/mochitest/dom-level2-html/test_table36.html
new file mode 100644
index 0000000000..fecd64ea7c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table36.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table36</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table36'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Specifies which external table borders to render.
+The value of attribute frame of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64808476
+*/
+function table36() {
+ var success;
+ if(checkInitialization(builder, "table36") != null) return;
+ var nodeList;
+ var testNode;
+ var vframe;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vframe = testNode.frame;
+
+ assertEquals("frameLink","border",vframe);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table36</h2>
+<p>&lt;test name='table36' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table36&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Specifies which external table borders to render.
+The value of attribute frame of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64808476">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-64808476</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vframe' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;frame interface='HTMLTableElement' obj='testNode' var='vframe'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vframe' expected='"border"' <a id="frameLink">id='frameLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table37.html b/dom/tests/mochitest/dom-level2-html/test_table37.html
new file mode 100644
index 0000000000..ac1370db8d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table37.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table37</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table37'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Specifies the horizontal and vertical space between cell content and cell borders. The value of attribute cellpadding of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59162158
+*/
+function table37() {
+ var success;
+ if(checkInitialization(builder, "table37") != null) return;
+ var nodeList;
+ var testNode;
+ var vcellpadding;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vcellpadding = testNode.cellPadding;
+
+ assertEquals("cellpaddingLink","2",vcellpadding);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table37</h2>
+<p>&lt;test name='table37' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table37&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Specifies the horizontal and vertical space between cell content and cell borders. The value of attribute cellpadding of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59162158">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59162158</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcellpadding' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cellPadding interface='HTMLTableElement' obj='testNode' var='vcellpadding'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcellpadding' expected='"2"' <a id="cellpaddingLink">id='cellpaddingLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table38.html b/dom/tests/mochitest/dom-level2-html/test_table38.html
new file mode 100644
index 0000000000..2808b6ffac
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table38.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table38</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table38'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Specifies the horizontal and vertical separation between cells.
+The value of attribute cellspacing of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68907883
+*/
+function table38() {
+ var success;
+ if(checkInitialization(builder, "table38") != null) return;
+ var nodeList;
+ var testNode;
+ var vcellspacing;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vcellspacing = testNode.cellSpacing;
+
+ assertEquals("cellspacingLink","2",vcellspacing);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table38</h2>
+<p>&lt;test name='table38' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table38&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Specifies the horizontal and vertical separation between cells.
+The value of attribute cellspacing of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68907883">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68907883</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcellspacing' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cellSpacing interface='HTMLTableElement' obj='testNode' var='vcellspacing'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcellspacing' expected='"2"' <a id="cellspacingLink">id='cellspacingLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table39.html b/dom/tests/mochitest/dom-level2-html/test_table39.html
new file mode 100644
index 0000000000..0e44add03c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table39.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table39</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table39'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Supplementary description about the purpose or structure of a table.
+The value of attribute summary of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-44998528
+*/
+function table39() {
+ var success;
+ if(checkInitialization(builder, "table39") != null) return;
+ var nodeList;
+ var testNode;
+ var vsummary;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vsummary = testNode.summary;
+
+ assertEquals("summaryLink","HTML Control Table",vsummary);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table39</h2>
+<p>&lt;test name='table39' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table39&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Supplementary description about the purpose or structure of a table.
+The value of attribute summary of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-44998528">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-44998528</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsummary' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;summary interface='HTMLTableElement' obj='testNode' var='vsummary'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsummary' expected='"HTML Control Table"' <a id="summaryLink">id='summaryLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table40.html b/dom/tests/mochitest/dom-level2-html/test_table40.html
new file mode 100644
index 0000000000..7bd7104fb8
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table40.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table40</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table40'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Specifies which internal table borders to render.
+The value of attribute rules of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26347553
+*/
+function table40() {
+ var success;
+ if(checkInitialization(builder, "table40") != null) return;
+ var nodeList;
+ var testNode;
+ var vrules;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vrules = testNode.rules;
+
+ assertEquals("rulesLink","all",vrules);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table40</h2>
+<p>&lt;test name='table40' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table40&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Specifies which internal table borders to render.
+The value of attribute rules of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26347553">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26347553</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrules' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rules interface='HTMLTableElement' obj='testNode' var='vrules'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrules' expected='"all"' <a id="rulesLink">id='rulesLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table41.html b/dom/tests/mochitest/dom-level2-html/test_table41.html
new file mode 100644
index 0000000000..4ef3a6cde6
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table41.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table41</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table41'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Specifies the desired table width.
+The value of attribute width of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77447361
+*/
+function table41() {
+ var success;
+ if(checkInitialization(builder, "table41") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("table");
+ assertSize("Asize",3,nodeList);
+testNode = nodeList.item(1);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","680",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table41</h2>
+<p>&lt;test name='table41' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table41&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Specifies the desired table width.
+The value of attribute width of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77447361">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77447361</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"680"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table42.html b/dom/tests/mochitest/dom-level2-html/test_table42.html
new file mode 100644
index 0000000000..c834b83b4c
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table42.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table42</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table42'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Horizontal alignment of data within cells of this row.
+The value of attribute align of the tablerow element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257
+*/
+function table42() {
+ var success;
+ if(checkInitialization(builder, "table42") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",8,nodeList);
+testNode = nodeList.item(1);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table42</h2>
+<p>&lt;test name='table42' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table42&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Horizontal alignment of data within cells of this row.
+The value of attribute align of the tablerow element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='8' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableRowElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table43.html b/dom/tests/mochitest/dom-level2-html/test_table43.html
new file mode 100644
index 0000000000..4c41700ab9
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table43.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table43</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table43'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Background color for rows.
+The value of attribute bgcolor of the tablerow element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18161327
+*/
+function table43() {
+ var success;
+ if(checkInitialization(builder, "table43") != null) return;
+ var nodeList;
+ var testNode;
+ var vbgcolor;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",8,nodeList);
+testNode = nodeList.item(1);
+ vbgcolor = testNode.bgColor;
+
+ assertEquals("bgcolorLink","#00FFFF".toLowerCase(),vbgcolor.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table43</h2>
+<p>&lt;test name='table43' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table43&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Background color for rows.
+The value of attribute bgcolor of the tablerow element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18161327">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18161327</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vbgcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='8' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bgColor interface='HTMLTableRowElement' obj='testNode' var='vbgcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vbgcolor' expected='"#00FFFF"' <a id="bgcolorLink">id='bgcolorLink'</a> ignoreCase='true'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table44.html b/dom/tests/mochitest/dom-level2-html/test_table44.html
new file mode 100644
index 0000000000..b4cc70d7ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table44.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table44</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table44'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "table");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Vertical alignment of data within cells of this row.
+The value of attribute valign of the tablerow element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90000058
+*/
+function table44() {
+ var success;
+ if(checkInitialization(builder, "table44") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "table");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",8,nodeList);
+testNode = nodeList.item(1);
+ vvalign = testNode.vAlign;
+
+ assertEquals("valignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table44</h2>
+<p>&lt;test name='table44' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table44&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Vertical alignment of data within cells of this row.
+The value of attribute valign of the tablerow element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90000058">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90000058</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='table' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='8' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableRowElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="valignLink">id='valignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/table.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table45.html b/dom/tests/mochitest/dom-level2-html/test_table45.html
new file mode 100644
index 0000000000..ef7b8352b3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table45.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table45</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table45'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Alignment character for cells in a column.
+The value of attribute ch of the tablerow element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502
+*/
+function table45() {
+ var success;
+ if(checkInitialization(builder, "table45") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ vch = testNode.ch;
+
+ assertEquals("vchLink","*",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table45</h2>
+<p>&lt;test name='table45' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table45&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Alignment character for cells in a column.
+The value of attribute ch of the tablerow element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableRowElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"*"' <a id="vchLink">id='vchLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table46.html b/dom/tests/mochitest/dom-level2-html/test_table46.html
new file mode 100644
index 0000000000..46b1f81d73
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table46.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table46</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table46'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Offset of alignment character.
+The value of attribute choff of the tablerow element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461
+*/
+function table46() {
+ var success;
+ if(checkInitialization(builder, "table46") != null) return;
+ var nodeList;
+ var testNode;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(1);
+ vchoff = testNode.chOff;
+
+ assertEquals("choffLink","1",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table46</h2>
+<p>&lt;test name='table46' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table46&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Offset of alignment character.
+The value of attribute choff of the tablerow element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='1'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableRowElement' obj='testNode' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"1"' <a id="choffLink">id='choffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table47.html b/dom/tests/mochitest/dom-level2-html/test_table47.html
new file mode 100644
index 0000000000..9c2ee518b7
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table47.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table47</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table47'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablerow");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+The index of this row, relative to the entire table.
+The value of attribute rowIndex of the table element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67347567
+*/
+function table47() {
+ var success;
+ if(checkInitialization(builder, "table47") != null) return;
+ var nodeList;
+ var testNode;
+ var vrindex;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablerow");
+ nodeList = doc.getElementsByTagName("tr");
+ assertSize("Asize",5,nodeList);
+testNode = nodeList.item(4);
+ vrindex = testNode.rowIndex;
+
+ assertEquals("rowIndexLink",2,vrindex);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table47</h2>
+<p>&lt;test name='table47' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table47&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+The index of this row, relative to the entire table.
+The value of attribute rowIndex of the table element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67347567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67347567</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vrindex' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablerow' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='4'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rowIndex interface='HTMLTableRowElement' obj='testNode' var='vrindex'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vrindex' expected='2' <a id="rowIndexLink">id='rowIndexLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablerow.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table48.html b/dom/tests/mochitest/dom-level2-html/test_table48.html
new file mode 100644
index 0000000000..1fadc4b913
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table48.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table48</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table48'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Horizontal alignment of cell data in column.
+The value of attribute align of the tablecol element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257
+*/
+function table48() {
+ var success;
+ if(checkInitialization(builder, "table48") != null) return;
+ var nodeList;
+ var testNode;
+ var valign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","center",valign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table48</h2>
+<p>&lt;test name='table48' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLTableColElement align&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Horizontal alignment of cell data in column.
+The value of attribute align of the tablecol element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-74098257</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='valign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;align interface='HTMLTableColElement' obj='testNode' var='valign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valign' expected='"center"' <a id="alignLink">id='alignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table49.html b/dom/tests/mochitest/dom-level2-html/test_table49.html
new file mode 100644
index 0000000000..3d0e51e1d0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table49.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table49</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table49'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Alignment character for cells in a column.
+The value of attribute ch of the tablecol element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502
+*/
+function table49() {
+ var success;
+ if(checkInitialization(builder, "table49") != null) return;
+ var nodeList;
+ var testNode;
+ var vch;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vch = testNode.ch;
+
+ assertEquals("chLink","*",vch);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table49</h2>
+<p>&lt;test name='table49' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table49&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Alignment character for cells in a column.
+The value of attribute ch of the tablecol element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16230502</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vch' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ch interface='HTMLTableColElement' obj='testNode' var='vch'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vch' expected='"*"' <a id="chLink">id='chLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table50.html b/dom/tests/mochitest/dom-level2-html/test_table50.html
new file mode 100644
index 0000000000..42a24f385d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table50.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table50</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table50'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Offset of alignment character.
+The value of attribute choff of the tablecol element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461
+*/
+function table50() {
+ var success;
+ if(checkInitialization(builder, "table50") != null) return;
+ var nodeList;
+ var testNode;
+ var vchoff;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vchoff = testNode.chOff;
+
+ assertEquals("chOffLink","20",vchoff);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table50</h2>
+<p>&lt;test name='table50' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table50&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Offset of alignment character.
+The value of attribute choff of the tablecol element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-68207461</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vchoff' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;chOff interface='HTMLTableColElement' obj='testNode' var='vchoff'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vchoff' expected='"20"' <a id="chOffLink">id='chOffLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table51.html b/dom/tests/mochitest/dom-level2-html/test_table51.html
new file mode 100644
index 0000000000..095ff6f191
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table51.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table51</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table51'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Indicates the number of columns in a group or affected by a grouping.
+The value of attribute span of the tablecol element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335
+*/
+function table51() {
+ var success;
+ if(checkInitialization(builder, "table51") != null) return;
+ var nodeList;
+ var testNode;
+ var vspan;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vspan = testNode.span;
+
+ assertEquals("spanLink",1,vspan);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table51</h2>
+<p>&lt;test name='table51' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table51&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Indicates the number of columns in a group or affected by a grouping.
+The value of attribute span of the tablecol element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96511335</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vspan' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span interface='HTMLTableColElement' obj='testNode' var='vspan'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vspan' expected='1' <a id="spanLink">id='spanLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table52.html b/dom/tests/mochitest/dom-level2-html/test_table52.html
new file mode 100644
index 0000000000..f8724c73bc
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table52.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table52</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table52'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Vertical alignment of cell data in column.
+The value of attribute valign of the tablecol element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710
+*/
+function table52() {
+ var success;
+ if(checkInitialization(builder, "table52") != null) return;
+ var nodeList;
+ var testNode;
+ var vvalign;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vvalign = testNode.vAlign;
+
+ assertEquals("vAlignLink","middle",vvalign);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table52</h2>
+<p>&lt;test name='table52' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table52&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Vertical alignment of cell data in column.
+The value of attribute valign of the tablecol element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83291710</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vvalign' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;vAlign interface='HTMLTableColElement' obj='testNode' var='vvalign'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vvalign' expected='"middle"' <a id="vAlignLink">id='vAlignLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_table53.html b/dom/tests/mochitest/dom-level2-html/test_table53.html
new file mode 100644
index 0000000000..5442287b17
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_table53.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/table53</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['table53'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "tablecol");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+Default column width.
+The value of attribute width of the tablecol element is read and checked against the expected value.
+
+* @author Netscape
+* @author Sivakiran Tummala
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799
+*/
+function table53() {
+ var success;
+ if(checkInitialization(builder, "table53") != null) return;
+ var nodeList;
+ var testNode;
+ var vwidth;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "tablecol");
+ nodeList = doc.getElementsByTagName("col");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","20",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/table53</h2>
+<p>&lt;test name='table53' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;table53&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+Default column width.
+The value of attribute width of the tablecol element is read and checked against the expected value.
+&lt;/description&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-15&lt;/date&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-25196799</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vwidth' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='tablecol' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"col"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width interface='HTMLTableColElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"20"' <a id="widthLink">id='widthLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/tablecol.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/common_readableStreams.js b/dom/tests/mochitest/fetch/common_readableStreams.js
new file mode 100644
index 0000000000..a739e1dbfa
--- /dev/null
+++ b/dom/tests/mochitest/fetch/common_readableStreams.js
@@ -0,0 +1,414 @@
+const SAME_COMPARTMENT = "same-compartment";
+const IFRAME_COMPARTMENT = "iframe-compartment";
+const BIG_BUFFER_SIZE = 1000000;
+const ITER_MAX = 10;
+
+function makeBuffer(size) {
+ let buffer = new Uint8Array(size);
+ buffer.fill(42);
+
+ let value = 0;
+ for (let i = 0; i < 1000000; i += 1000) {
+ buffer.set([++value % 255], i);
+ }
+
+ return buffer;
+}
+
+function apply_compartment(compartment, data) {
+ if (compartment == SAME_COMPARTMENT) {
+ return self[data.func](data.args, self);
+ }
+
+ if (compartment == IFRAME_COMPARTMENT) {
+ const iframe = document.querySelector("#iframe").contentWindow;
+ return iframe[data.func](data.args, self);
+ }
+
+ ok(false, "Invalid compartment value");
+}
+
+async function test_nativeStream(compartment) {
+ info("test_nativeStream");
+
+ let r = await fetch("/");
+
+ return apply_compartment(compartment, {
+ func: "test_nativeStream_continue",
+ args: r,
+ });
+}
+
+async function test_nativeStream_continue(r, that) {
+ that.ok(r.body instanceof that.ReadableStream, "We have a ReadableStream");
+
+ let a = r.clone();
+ that.ok(a instanceof that.Response, "We have a cloned Response");
+ that.ok(a.body instanceof that.ReadableStream, "We have a ReadableStream");
+
+ let b = a.clone();
+ that.ok(b instanceof that.Response, "We have a cloned Response");
+ that.ok(b.body instanceof that.ReadableStream, "We have a ReadableStream");
+
+ let blob = await r.blob();
+
+ that.ok(blob instanceof that.Blob, "We have a blob");
+ let d = await a.body.getReader().read();
+
+ that.ok(!d.done, "We have read something!");
+ blob = await b.blob();
+
+ that.ok(blob instanceof that.Blob, "We have a blob");
+}
+
+async function test_timeout(compartment) {
+ info("test_timeout");
+
+ let blob = new Blob([""]);
+ let r = await fetch(URL.createObjectURL(blob));
+
+ return apply_compartment(compartment, {
+ func: "test_timeout_continue",
+ args: r,
+ });
+}
+
+async function test_timeout_continue(r, that) {
+ await r.body.getReader().read();
+
+ await new Promise(resolve => setTimeout(resolve, 0));
+
+ try {
+ await r.blob();
+ that.ok(false, "We cannot have a blob here!");
+ } catch (exc) {
+ that.ok(true, "We cannot have a blob here!");
+ }
+}
+
+async function test_nonNativeStream(compartment) {
+ info("test_nonNativeStream");
+
+ let buffer = makeBuffer(BIG_BUFFER_SIZE);
+ info("Buffer size: " + buffer.byteLength);
+
+ let r = new Response(
+ new ReadableStream({
+ start: controller => {
+ controller.enqueue(buffer);
+ controller.close();
+ },
+ })
+ );
+
+ return apply_compartment(compartment, {
+ func: "test_nonNativeStream_continue",
+ args: { r, buffer },
+ });
+}
+
+async function test_nonNativeStream_continue(data, that) {
+ that.ok(
+ data.r.body instanceof that.ReadableStream,
+ "We have a ReadableStream"
+ );
+
+ let a = data.r.clone();
+ that.ok(a instanceof that.Response, "We have a cloned Response");
+ that.ok(a.body instanceof that.ReadableStream, "We have a ReadableStream");
+
+ let b = a.clone();
+ that.ok(b instanceof that.Response, "We have a cloned Response");
+ that.ok(b.body instanceof that.ReadableStream, "We have a ReadableStream");
+
+ let blob = await data.r.blob();
+
+ that.ok(blob instanceof that.Blob, "We have a blob");
+ let d = await a.body.getReader().read();
+
+ that.ok(!d.done, "We have read something!");
+ blob = await b.blob();
+
+ that.ok(blob instanceof that.Blob, "We have a blob");
+ that.is(blob.size, data.buffer.byteLength, "Blob size matches");
+}
+
+async function test_noUint8Array(compartment) {
+ info("test_noUint8Array");
+
+ let r = new Response(
+ new ReadableStream({
+ start: controller => {
+ controller.enqueue("hello world!");
+ controller.close();
+ },
+ })
+ );
+
+ return apply_compartment(compartment, {
+ func: "test_noUint8Array_continue",
+ args: r,
+ });
+}
+
+async function test_noUint8Array_continue(r, that) {
+ that.ok(r.body instanceof that.ReadableStream, "We have a ReadableStream");
+
+ try {
+ await r.blob();
+ that.ok(false, "We cannot have a blob here!");
+ } catch (ex) {
+ that.ok(true, "We cannot have a blob here!");
+ }
+}
+
+async function test_pendingStream(compartment) {
+ let r = new Response(
+ new ReadableStream({
+ start: controller => {
+ controller.enqueue(makeBuffer(BIG_BUFFER_SIZE));
+ // Let's keep this controler open.
+ self.ccc = controller;
+ },
+ })
+ );
+
+ return apply_compartment(compartment, {
+ func: "test_pendingStream_continue",
+ args: r,
+ });
+}
+
+async function test_pendingStream_continue(r, that) {
+ let d = await r.body.getReader().read();
+
+ that.ok(!d.done, "We have read something!");
+
+ if ("close" in that) {
+ that.close();
+ }
+}
+
+async function test_nativeStream_cache(compartment) {
+ info("test_nativeStream_cache");
+
+ let origBody = "123456789abcdef";
+ let url = "/nativeStream";
+
+ let cache = await caches.open("nativeStream");
+
+ info("Storing a body as a string");
+ await cache.put(url, new Response(origBody));
+
+ return apply_compartment(compartment, {
+ func: "test_nativeStream_cache_continue",
+ args: { caches, cache, url, origBody },
+ });
+}
+
+async function test_nativeStream_cache_continue(data, that) {
+ that.info("Retrieving the stored value");
+ let cacheResponse = await data.cache.match(data.url);
+
+ that.info("Converting the response to text");
+ let cacheBody = await cacheResponse.text();
+
+ that.is(data.origBody, cacheBody, "Bodies match");
+
+ await data.caches.delete("nativeStream");
+}
+
+async function test_nonNativeStream_cache(compartment) {
+ info("test_nonNativeStream_cache");
+
+ let url = "/nonNativeStream";
+
+ let cache = await caches.open("nonNativeStream");
+ let buffer = makeBuffer(BIG_BUFFER_SIZE);
+ info("Buffer size: " + buffer.byteLength);
+
+ info("Storing a body as a string");
+ let r = new Response(
+ new ReadableStream({
+ start: controller => {
+ controller.enqueue(buffer);
+ controller.close();
+ },
+ })
+ );
+
+ return apply_compartment(compartment, {
+ func: "test_nonNativeStream_cache_continue",
+ args: { caches, cache, buffer, r },
+ });
+}
+
+async function test_nonNativeStream_cache_continue(data, that) {
+ await data.cache.put(data.url, data.r);
+
+ that.info("Retrieving the stored value");
+ let cacheResponse = await data.cache.match(data.url);
+
+ that.info("Converting the response to text");
+ let cacheBody = await cacheResponse.arrayBuffer();
+
+ that.ok(cacheBody instanceof that.ArrayBuffer, "Body is an array buffer");
+ that.is(cacheBody.byteLength, BIG_BUFFER_SIZE, "Body length is correct");
+
+ let value = 0;
+ for (let i = 0; i < 1000000; i += 1000) {
+ that.is(
+ new Uint8Array(cacheBody)[i],
+ ++value % 255,
+ "byte in position " + i + " is correct"
+ );
+ }
+
+ await data.caches.delete("nonNativeStream");
+}
+
+async function test_codeExecution(compartment) {
+ info("test_codeExecution");
+
+ let r = new Response(
+ new ReadableStream({
+ start(c) {
+ controller = c;
+ },
+ pull() {
+ console.log("pull called");
+ },
+ })
+ );
+
+ return apply_compartment(compartment, {
+ func: "test_codeExecution_continue",
+ args: r,
+ });
+}
+
+// This is intended to just be a drop-in replacement for an old observer
+// notification.
+function addConsoleStorageListener(listener) {
+ const ConsoleAPIStorage = SpecialPowers.Cc[
+ "@mozilla.org/consoleAPI-storage;1"
+ ].getService(SpecialPowers.Ci.nsIConsoleAPIStorage);
+ listener.__handler = (message, id) => {
+ listener.observe(message, id);
+ };
+ ConsoleAPIStorage.addLogEventListener(
+ listener.__handler,
+ SpecialPowers.wrap(document).nodePrincipal
+ );
+}
+
+function removeConsoleStorageListener(listener) {
+ const ConsoleAPIStorage = SpecialPowers.Cc[
+ "@mozilla.org/consoleAPI-storage;1"
+ ].getService(SpecialPowers.Ci.nsIConsoleAPIStorage);
+ ConsoleAPIStorage.removeLogEventListener(listener.__handler);
+}
+
+async function test_codeExecution_continue(r, that) {
+ function consoleListener() {
+ addConsoleStorageListener(this);
+ }
+
+ var promise = new Promise(resolve => {
+ consoleListener.prototype = {
+ observe(aSubject) {
+ that.ok(true, "Something has been received");
+
+ var obj = aSubject.wrappedJSObject;
+ if (obj.arguments[0] && obj.arguments[0] === "pull called") {
+ that.ok(true, "Message received!");
+ removeConsoleStorageListener(this);
+ resolve();
+ }
+ },
+ };
+ });
+
+ var cl = new consoleListener();
+
+ r.body.getReader().read();
+ await promise;
+}
+
+async function test_global(compartment) {
+ info("test_global: " + compartment);
+
+ self.foo = 42;
+ self.iter = ITER_MAX;
+
+ let r = new Response(
+ new ReadableStream({
+ start(c) {
+ self.controller = c;
+ },
+ pull() {
+ if (!("iter" in self) || self.iter < 0 || self.iter > ITER_MAX) {
+ throw "Something bad is happening here!";
+ }
+
+ let buffer = new Uint8Array(1);
+ buffer.fill(self.foo);
+ self.controller.enqueue(buffer);
+
+ if (--self.iter == 0) {
+ controller.close();
+ }
+ },
+ })
+ );
+
+ return apply_compartment(compartment, {
+ func: "test_global_continue",
+ args: r,
+ });
+}
+
+async function test_global_continue(r, that) {
+ let a = await r.arrayBuffer();
+
+ that.is(
+ Object.getPrototypeOf(a),
+ that.ArrayBuffer.prototype,
+ "Body is an array buffer"
+ );
+ that.is(a.byteLength, ITER_MAX, "Body length is correct");
+
+ for (let i = 0; i < ITER_MAX; ++i) {
+ that.is(new Uint8Array(a)[i], 42, "Byte " + i + " is correct");
+ }
+}
+
+function workify(func) {
+ info("Workifying " + func);
+
+ return new Promise((resolve, reject) => {
+ let worker = new Worker("worker_readableStreams.js");
+ worker.postMessage(func);
+ worker.onmessage = function (e) {
+ if (e.data.type == "done") {
+ resolve();
+ return;
+ }
+
+ if (e.data.type == "error") {
+ reject(e.data.message);
+ return;
+ }
+
+ if (e.data.type == "test") {
+ ok(e.data.test, e.data.message);
+ return;
+ }
+
+ if (e.data.type == "info") {
+ info(e.data.message);
+ return;
+ }
+ };
+ });
+}
diff --git a/dom/tests/mochitest/fetch/common_temporaryFileBlob.js b/dom/tests/mochitest/fetch/common_temporaryFileBlob.js
new file mode 100644
index 0000000000..51aed67cf2
--- /dev/null
+++ b/dom/tests/mochitest/fetch/common_temporaryFileBlob.js
@@ -0,0 +1,146 @@
+var data = new Array(256).join("1234567890ABCDEF");
+
+function test_fetch_basic() {
+ info("Simple fetch test");
+
+ fetch("/tests/dom/xhr/tests/temporaryFileBlob.sjs", {
+ method: "POST",
+ body: data,
+ })
+ .then(response => {
+ return response.blob();
+ })
+ .then(blob => {
+ ok(blob instanceof Blob, "We have a blob!");
+ is(blob.size, data.length, "Data length matches");
+ if ("SpecialPowers" in self) {
+ is(
+ SpecialPowers.wrap(blob).blobImplType,
+ "StreamBlobImpl[TemporaryFileBlobImpl]",
+ "We have a blob stored into a stream file"
+ );
+ }
+
+ var fr = new FileReader();
+ fr.readAsText(blob);
+ fr.onload = function () {
+ is(fr.result, data, "Data content matches");
+ next();
+ };
+ });
+}
+
+function test_fetch_worker() {
+ generic_worker_test("fetch in workers", "fetch");
+}
+
+function test_xhr_basic() {
+ info("Simple XHR test");
+
+ let xhr = new XMLHttpRequest();
+ xhr.responseType = "blob";
+ xhr.open("POST", "/tests/dom/xhr/tests/temporaryFileBlob.sjs");
+ xhr.send(data);
+
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == 4) {
+ let blob = xhr.response;
+
+ ok(blob instanceof Blob, "We have a blob!");
+ is(blob.size, data.length, "Data length matches");
+ if ("SpecialPowers" in self) {
+ is(
+ SpecialPowers.wrap(blob).blobImplType,
+ "StreamBlobImpl[TemporaryFileBlobImpl]",
+ "We have a blob stored into a stream file"
+ );
+ }
+
+ var fr = new FileReader();
+ fr.readAsText(blob);
+ fr.onload = function () {
+ is(fr.result, data, "Data content matches");
+ next();
+ };
+ }
+ };
+}
+
+function test_xhr_worker() {
+ generic_worker_test("XHR in workers", "xhr");
+}
+
+function test_response_basic() {
+ info("Response");
+
+ let r = new Response(data);
+ r.blob().then(blob => {
+ ok(blob instanceof Blob, "We have a blob!");
+ is(blob.size, data.length, "Data length matches");
+ if ("SpecialPowers" in self) {
+ is(
+ SpecialPowers.wrap(blob).blobImplType,
+ "StreamBlobImpl[TemporaryFileBlobImpl]",
+ "We have a blob stored into a stream file"
+ );
+ }
+
+ var fr = new FileReader();
+ fr.readAsText(blob);
+ fr.onload = function () {
+ is(fr.result, data, "Data content matches");
+ next();
+ };
+ });
+}
+
+function test_response_worker() {
+ generic_worker_test("Response in workers", "response");
+}
+
+function test_request_basic() {
+ info("Request");
+
+ let r = new Request("https://example.com", { body: data, method: "POST" });
+ r.blob().then(blob => {
+ ok(blob instanceof Blob, "We have a blob!");
+ is(blob.size, data.length, "Data length matches");
+ if ("SpecialPowers" in self) {
+ is(
+ SpecialPowers.wrap(blob).blobImplType,
+ "StreamBlobImpl[TemporaryFileBlobImpl]",
+ "We have a blob stored into a stream file"
+ );
+ }
+
+ var fr = new FileReader();
+ fr.readAsText(blob);
+ fr.onload = function () {
+ is(fr.result, data, "Data content matches");
+ next();
+ };
+ });
+}
+
+function test_request_worker() {
+ generic_worker_test("Request in workers", "request");
+}
+
+function generic_worker_test(title, what) {
+ info(title);
+
+ var w = new Worker("worker_temporaryFileBlob.js");
+ w.onmessage = function (e) {
+ if (e.data.type == "info") {
+ info(e.data.msg);
+ } else if (e.data.type == "check") {
+ ok(e.data.what, e.data.msg);
+ } else if (e.data.type == "finish") {
+ next();
+ } else {
+ ok(false, "Something wrong happened");
+ }
+ };
+
+ w.postMessage(what);
+}
diff --git a/dom/tests/mochitest/fetch/empty.js b/dom/tests/mochitest/fetch/empty.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/fetch/empty.js
diff --git a/dom/tests/mochitest/fetch/empty.js^headers^ b/dom/tests/mochitest/fetch/empty.js^headers^
new file mode 100644
index 0000000000..d0b9633bb0
--- /dev/null
+++ b/dom/tests/mochitest/fetch/empty.js^headers^
@@ -0,0 +1 @@
+Service-Worker-Allowed: /
diff --git a/dom/tests/mochitest/fetch/fetch_test_framework.js b/dom/tests/mochitest/fetch/fetch_test_framework.js
new file mode 100644
index 0000000000..a985c43b64
--- /dev/null
+++ b/dom/tests/mochitest/fetch/fetch_test_framework.js
@@ -0,0 +1,165 @@
+function testScript(script) {
+ function makeWrapperUrl(wrapper) {
+ return wrapper + "?script=" + script;
+ }
+ let workerWrapperUrl = makeWrapperUrl("worker_wrapper.js");
+
+ // The framework runs the entire test in many different configurations.
+ // On slow platforms and builds this can make the tests likely to
+ // timeout while they are still running. Lengthen the timeout to
+ // accomodate this.
+ SimpleTest.requestLongerTimeout(4);
+
+ // reroute.html should have set this variable if a service worker is present!
+ if (!("isSWPresent" in window)) {
+ window.isSWPresent = false;
+ }
+
+ function setupPrefs() {
+ return new Promise(function (resolve, reject) {
+ SpecialPowers.pushPrefEnv(
+ {
+ set: [
+ ["dom.serviceWorkers.enabled", true],
+ ["dom.serviceWorkers.testing.enabled", true],
+ ["dom.serviceWorkers.idle_timeout", 60000],
+ ["dom.serviceWorkers.exemptFromPerDomainMax", true],
+ ],
+ },
+ resolve
+ );
+ });
+ }
+
+ function workerTest() {
+ return new Promise(function (resolve, reject) {
+ var worker = new Worker(workerWrapperUrl);
+ worker.onmessage = function (event) {
+ if (event.data.context != "Worker") {
+ return;
+ }
+ if (event.data.type == "finish") {
+ resolve();
+ } else if (event.data.type == "status") {
+ ok(event.data.status, event.data.context + ": " + event.data.msg);
+ }
+ };
+ worker.onerror = function (event) {
+ reject("Worker error: " + event.message);
+ };
+
+ worker.postMessage({ script });
+ });
+ }
+
+ function nestedWorkerTest() {
+ return new Promise(function (resolve, reject) {
+ var worker = new Worker(makeWrapperUrl("nested_worker_wrapper.js"));
+ worker.onmessage = function (event) {
+ if (event.data.context != "NestedWorker") {
+ return;
+ }
+ if (event.data.type == "finish") {
+ resolve();
+ } else if (event.data.type == "status") {
+ ok(event.data.status, event.data.context + ": " + event.data.msg);
+ }
+ };
+ worker.onerror = function (event) {
+ reject("Nested Worker error: " + event.message);
+ };
+
+ worker.postMessage({ script });
+ });
+ }
+
+ function serviceWorkerTest() {
+ var isB2G =
+ !navigator.userAgent.includes("Android") &&
+ /Mobile|Tablet/.test(navigator.userAgent);
+ if (isB2G) {
+ // TODO B2G doesn't support running service workers for now due to bug 1137683.
+ dump("Skipping running the test in SW until bug 1137683 gets fixed.\n");
+ return Promise.resolve();
+ }
+ return new Promise(function (resolve, reject) {
+ function setupSW(registration) {
+ var worker =
+ registration.installing ||
+ registration.waiting ||
+ registration.active;
+ var iframe;
+
+ window.addEventListener("message", function onMessage(event) {
+ if (event.data.context != "ServiceWorker") {
+ return;
+ }
+ if (event.data.type == "finish") {
+ window.removeEventListener("message", onMessage);
+ iframe.remove();
+ registration.unregister().then(resolve).catch(reject);
+ } else if (event.data.type == "status") {
+ ok(event.data.status, event.data.context + ": " + event.data.msg);
+ }
+ });
+
+ worker.onerror = reject;
+
+ iframe = document.createElement("iframe");
+ iframe.src = "message_receiver.html";
+ iframe.onload = function () {
+ worker.postMessage({ script });
+ };
+ document.body.appendChild(iframe);
+ }
+
+ navigator.serviceWorker
+ .register(workerWrapperUrl, { scope: "." })
+ .then(setupSW);
+ });
+ }
+
+ function windowTest() {
+ return new Promise(function (resolve, reject) {
+ var scriptEl = document.createElement("script");
+ scriptEl.setAttribute("src", script);
+ scriptEl.onload = function () {
+ runTest().then(resolve, reject);
+ };
+ document.body.appendChild(scriptEl);
+ });
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ // We have to run the window, worker and service worker tests sequentially
+ // since some tests set and compare cookies and running in parallel can lead
+ // to conflicting values.
+ setupPrefs()
+ .then(function () {
+ return windowTest();
+ })
+ .then(function () {
+ return workerTest();
+ })
+ .then(function () {
+ return nestedWorkerTest();
+ })
+ .then(function () {
+ return serviceWorkerTest();
+ })
+ .catch(function (e) {
+ ok(false, "Some test failed in " + script);
+ info(e);
+ info(e.message);
+ return Promise.resolve();
+ })
+ .then(function () {
+ try {
+ if (parent && parent.finishTest) {
+ parent.finishTest();
+ return;
+ }
+ } catch {}
+ SimpleTest.finish();
+ });
+}
diff --git a/dom/tests/mochitest/fetch/file_fetch_cached_redirect.html b/dom/tests/mochitest/fetch/file_fetch_cached_redirect.html
new file mode 100644
index 0000000000..64e3289892
--- /dev/null
+++ b/dom/tests/mochitest/fetch/file_fetch_cached_redirect.html
@@ -0,0 +1 @@
+<html><body>My contents don't matter. Only my header matters!</body></html>
diff --git a/dom/tests/mochitest/fetch/file_fetch_cached_redirect.html^headers^ b/dom/tests/mochitest/fetch/file_fetch_cached_redirect.html^headers^
new file mode 100644
index 0000000000..eee464d0eb
--- /dev/null
+++ b/dom/tests/mochitest/fetch/file_fetch_cached_redirect.html^headers^
@@ -0,0 +1,3 @@
+HTTP 302 Redirect
+Location: //example.org/target_does_not_matter.html
+Cache-Control: max-age=10
diff --git a/dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html b/dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html
new file mode 100644
index 0000000000..793575f45c
--- /dev/null
+++ b/dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<script>
+addEventListener('message', evt => {
+ let url = '/tests/dom/security/test/csp/file_redirects_resource.sjs?redir=other&res=xhr-resp';
+ fetch(url).then(response => {
+ parent.postMessage('RESOLVED', '*');
+ }).catch(error => {
+ parent.postMessage('REJECTED', '*');
+ });
+}, { once: true });
+</script>
+</html>
diff --git a/dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html^headers^ b/dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html^headers^
new file mode 100644
index 0000000000..4c43573eb7
--- /dev/null
+++ b/dom/tests/mochitest/fetch/file_fetch_csp_block_frame.html^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/html
+Content-Security-Policy: connect-src 'self'
diff --git a/dom/tests/mochitest/fetch/file_fetch_observer.html b/dom/tests/mochitest/fetch/file_fetch_observer.html
new file mode 100644
index 0000000000..480198fa6f
--- /dev/null
+++ b/dom/tests/mochitest/fetch/file_fetch_observer.html
@@ -0,0 +1,146 @@
+<script>
+function ok(a, msg) {
+ parent.postMessage({ type: "check", status: !!a, message: msg }, "*");
+}
+
+function is(a, b, msg) {
+ ok(a === b, msg);
+}
+
+function testObserver() {
+ ok("FetchObserver" in self, "We have a FetchObserver prototype");
+
+ fetch('http://mochi.test:8888/tests/dom/tests/mochitest/fetch/slow.sjs', { observe: o => {
+ ok(!!o, "We have an observer");
+ ok(o instanceof FetchObserver, "The correct object has been passed");
+ is(o.state, "requesting", "By default the state is requesting");
+ next();
+ }});
+}
+
+function testObserveAbort() {
+ var ac = new AbortController();
+
+ fetch('http://mochi.test:8888/tests/dom/tests/mochitest/fetch/slow.sjs', {
+ signal: ac.signal,
+ observe: o => {
+ o.onstatechange = () => {
+ ok(true, "StateChange event dispatched");
+ if (o.state == "aborted") {
+ ok(true, "Aborted!");
+ next();
+ }
+ }
+ ac.abort();
+ }
+ });
+}
+
+function testObserveComplete() {
+ var ac = new AbortController();
+
+ fetch('http://mochi.test:8888/tests/dom/tests/mochitest/fetch/slow.sjs', {
+ signal: ac.signal,
+ observe: o => {
+ o.onstatechange = () => {
+ ok(true, "StateChange event dispatched");
+ if (o.state == "complete") {
+ ok(true, "Operation completed");
+ next();
+ }
+ }
+ }
+ });
+}
+
+function testObserveErrored() {
+ var ac = new AbortController();
+
+ fetch('foo: bar', {
+ signal: ac.signal,
+ observe: o => {
+ o.onstatechange = () => {
+ ok(true, "StateChange event dispatched");
+ if (o.state == "errored") {
+ ok(true, "Operation completed");
+ next();
+ }
+ }
+ }
+ });
+}
+
+function testObserveResponding() {
+ var ac = new AbortController();
+
+ fetch('http://mochi.test:8888/tests/dom/tests/mochitest/fetch/slow.sjs', {
+ signal: ac.signal,
+ observe: o => {
+ o.onstatechange = () => {
+ if (o.state == "responding") {
+ ok(true, "We have responding events");
+ next();
+ }
+ }
+ }
+ });
+}
+
+function workify(worker) {
+ function methods() {
+ function ok(a, msg) {
+ postMessage( { type: 'check', state: !!a, message: msg });
+ };
+ function is(a, b, msg) {
+ postMessage( { type: 'check', state: a === b, message: msg });
+ };
+ function next() {
+ postMessage( { type: 'finish' });
+ };
+ }
+
+ var str = methods.toString();
+ var methodsContent = str.substring(0, str.length - 1).split('\n').splice(1).join('\n');
+
+ str = worker.toString();
+ var workerContent = str.substring(0, str.length - 1).split('\n').splice(1).join('\n');
+
+ var content = methodsContent + workerContent;
+ var url = URL.createObjectURL(new Blob([content], { type: "application/javascript" }));
+ var w = new Worker(url);
+ w.onmessage = e => {
+ if (e.data.type == 'check') {
+ ok(e.data.state, "WORKER: " + e.data.message);
+ } else if (e.data.type == 'finish') {
+ next();
+ } else {
+ ok(false, "Something went wrong");
+ }
+ }
+}
+
+var steps = [
+ testObserver,
+ testObserveAbort,
+ function() { workify(testObserveAbort); },
+ testObserveComplete,
+ function() { workify(testObserveComplete); },
+ testObserveErrored,
+ function() { workify(testObserveErrored); },
+ testObserveResponding,
+ function() { workify(testObserveResponding); },
+];
+
+function next() {
+ if (!steps.length) {
+ parent.postMessage({ type: "finish" }, "*");
+ return;
+ }
+
+ var step = steps.shift();
+ step();
+}
+
+next();
+
+</script>
diff --git a/dom/tests/mochitest/fetch/iframe_readableStreams.html b/dom/tests/mochitest/fetch/iframe_readableStreams.html
new file mode 100644
index 0000000000..11a3838789
--- /dev/null
+++ b/dom/tests/mochitest/fetch/iframe_readableStreams.html
@@ -0,0 +1,4 @@
+<script type="application/javascript" src="common_readableStreams.js"></script>
+<script>
+parent.runTests();
+</script>
diff --git a/dom/tests/mochitest/fetch/message_receiver.html b/dom/tests/mochitest/fetch/message_receiver.html
new file mode 100644
index 0000000000..82cb587c72
--- /dev/null
+++ b/dom/tests/mochitest/fetch/message_receiver.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<script>
+ navigator.serviceWorker.onmessage = function(e) {
+ window.parent.postMessage(e.data, "*");
+ };
+</script>
diff --git a/dom/tests/mochitest/fetch/mochitest.ini b/dom/tests/mochitest/fetch/mochitest.ini
new file mode 100644
index 0000000000..6a7005bd56
--- /dev/null
+++ b/dom/tests/mochitest/fetch/mochitest.ini
@@ -0,0 +1,92 @@
+[DEFAULT]
+tags = condprof
+support-files =
+ fetch_test_framework.js
+ file_fetch_cached_redirect.html
+ file_fetch_cached_redirect.html^headers^
+ file_fetch_csp_block_frame.html
+ file_fetch_csp_block_frame.html^headers^
+ test_fetch_basic.js
+ test_fetch_basic_http.js
+ test_fetch_cached_redirect.js
+ test_fetch_cors.js
+ file_fetch_observer.html
+ test_formdataparsing.js
+ test_headers_common.js
+ test_request.js
+ test_response.js
+ utils.js
+ nested_worker_wrapper.js
+ worker_wrapper.js
+ message_receiver.html
+ reroute.html
+ reroute.js
+ reroute.js^headers^
+ slow.sjs
+ sw_reroute.js
+ empty.js
+ empty.js^headers^
+ worker_temporaryFileBlob.js
+ common_temporaryFileBlob.js
+ common_readableStreams.js
+ worker_readableStreams.js
+ iframe_readableStreams.html
+ !/dom/xhr/tests/file_XHR_binary1.bin
+ !/dom/xhr/tests/file_XHR_binary1.bin^headers^
+ !/dom/xhr/tests/file_XHR_binary2.bin
+ !/dom/xhr/tests/file_XHR_pass1.xml
+ !/dom/xhr/tests/file_XHR_pass2.txt
+ !/dom/xhr/tests/file_XHR_pass3.txt
+ !/dom/xhr/tests/file_XHR_pass3.txt^headers^
+ !/dom/xhr/tests/responseIdentical.sjs
+ !/dom/xhr/tests/temporaryFileBlob.sjs
+ !/dom/html/test/form_submit_server.sjs
+ !/dom/security/test/cors/file_CrossSiteXHR_server.sjs
+ !/dom/security/test/csp/file_redirects_resource.sjs
+ !/dom/base/test/referrer_helper.js
+ !/dom/base/test/referrer_testserver.sjs
+[test_headers.html]
+[test_headers_sw_reroute.html]
+[test_headers_mainthread.html]
+[test_fetch_basic.html]
+[test_fetch_basic_sw_reroute.html]
+[test_fetch_basic_sw_empty_reroute.html]
+[test_fetch_basic_http.html]
+[test_fetch_basic_http_sw_reroute.html]
+[test_fetch_basic_http_sw_empty_reroute.html]
+[test_fetch_cached_redirect.html]
+[test_fetch_cors.html]
+skip-if =
+ http3
+[test_fetch_cors_sw_reroute.html]
+skip-if =
+ os == "android" # Bug 1623134
+ http3
+[test_fetch_cors_sw_empty_reroute.html]
+skip-if =
+ os == "android" # Bug 1623134
+ http3
+[test_fetch_csp_block.html]
+[test_fetch_observer.html]
+skip-if =
+ http3
+[test_fetch_user_control_rp.html]
+skip-if =
+ http3
+[test_formdataparsing.html]
+[test_formdataparsing_sw_reroute.html]
+[test_request.html]
+[test_request_context.html]
+[test_request_sw_reroute.html]
+[test_response.html]
+skip-if =
+ http3
+[test_response_sw_reroute.html]
+skip-if =
+ http3
+[test_temporaryFileBlob.html]
+[test_readableStreams.html]
+scheme=https
+skip-if =
+ http3
+[test_responseReadyForWasm.html]
diff --git a/dom/tests/mochitest/fetch/nested_worker_wrapper.js b/dom/tests/mochitest/fetch/nested_worker_wrapper.js
new file mode 100644
index 0000000000..1a14cf06d9
--- /dev/null
+++ b/dom/tests/mochitest/fetch/nested_worker_wrapper.js
@@ -0,0 +1,32 @@
+function getScriptUrl() {
+ return new URL(location.href).searchParams.get("script");
+}
+
+// Hold the nested worker alive until this parent worker closes.
+var worker;
+
+addEventListener("message", function nestedWorkerWrapperOnMessage(evt) {
+ removeEventListener("message", nestedWorkerWrapperOnMessage);
+
+ worker = new Worker("worker_wrapper.js?script=" + getScriptUrl());
+
+ worker.addEventListener("message", function (evt) {
+ self.postMessage({
+ context: "NestedWorker",
+ type: evt.data.type,
+ status: evt.data.status,
+ msg: evt.data.msg,
+ });
+ });
+
+ worker.addEventListener("error", function (evt) {
+ self.postMessage({
+ context: "NestedWorker",
+ type: "status",
+ status: false,
+ msg: "Nested worker error: " + evt.message,
+ });
+ });
+
+ worker.postMessage(evt.data);
+});
diff --git a/dom/tests/mochitest/fetch/reroute.html b/dom/tests/mochitest/fetch/reroute.html
new file mode 100644
index 0000000000..bb12212ea9
--- /dev/null
+++ b/dom/tests/mochitest/fetch/reroute.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script>
+["SimpleTest", "ok", "info", "is", "$"]
+ .forEach((v) => window[v] = window.parent[v]);
+</script>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script>
+// If we are using the empty service worker then requests won't actually
+// get intercepted and response URLs will reflect redirects. This means
+// all our checks should use the "no sw" logic. Otherwise we need to
+// note that interceptions are taking place so we can adjust our
+// response URL expectations.
+if (!navigator.serviceWorker.controller.scriptURL.endsWith('empty.js')) {
+ window.isSWPresent = true;
+}
+testScript(location.search.substring(1) + ".js");
+</script>
diff --git a/dom/tests/mochitest/fetch/reroute.js b/dom/tests/mochitest/fetch/reroute.js
new file mode 100644
index 0000000000..a4f309d780
--- /dev/null
+++ b/dom/tests/mochitest/fetch/reroute.js
@@ -0,0 +1,27 @@
+onfetch = function (e) {
+ if (e.request.url.includes("Referer")) {
+ // Silently rewrite the referrer so the referrer test passes since the
+ // document/worker isn't aware of this service worker.
+ var url = e.request.url.substring(0, e.request.url.indexOf("?"));
+ url += "?headers=" + JSON.stringify({ Referer: self.location.href });
+
+ e.respondWith(
+ e.request.text().then(function (text) {
+ var body = text === "" ? undefined : text;
+ var mode =
+ e.request.mode == "navigate" ? "same-origin" : e.request.mode;
+ return fetch(url, {
+ method: e.request.method,
+ headers: e.request.headers,
+ body,
+ mode,
+ credentials: e.request.credentials,
+ redirect: e.request.redirect,
+ cache: e.request.cache,
+ });
+ })
+ );
+ return;
+ }
+ e.respondWith(fetch(e.request));
+};
diff --git a/dom/tests/mochitest/fetch/reroute.js^headers^ b/dom/tests/mochitest/fetch/reroute.js^headers^
new file mode 100644
index 0000000000..d0b9633bb0
--- /dev/null
+++ b/dom/tests/mochitest/fetch/reroute.js^headers^
@@ -0,0 +1 @@
+Service-Worker-Allowed: /
diff --git a/dom/tests/mochitest/fetch/slow.sjs b/dom/tests/mochitest/fetch/slow.sjs
new file mode 100644
index 0000000000..27b9719b71
--- /dev/null
+++ b/dom/tests/mochitest/fetch/slow.sjs
@@ -0,0 +1,15 @@
+function handleRequest(request, response) {
+ response.processAsync();
+
+ timer = Components.classes["@mozilla.org/timer;1"].createInstance(
+ Components.interfaces.nsITimer
+ );
+ timer.init(
+ function () {
+ response.write("Here the content. But slowly.");
+ response.finish();
+ },
+ 1000,
+ Components.interfaces.nsITimer.TYPE_ONE_SHOT
+ );
+}
diff --git a/dom/tests/mochitest/fetch/sw_reroute.js b/dom/tests/mochitest/fetch/sw_reroute.js
new file mode 100644
index 0000000000..73f4aecae6
--- /dev/null
+++ b/dom/tests/mochitest/fetch/sw_reroute.js
@@ -0,0 +1,43 @@
+var gRegistration;
+var iframe;
+
+function testScript(script) {
+ var scope = "./reroute.html?" + script.replace(".js", "");
+ function setupSW(registration) {
+ gRegistration = registration;
+
+ iframe = document.createElement("iframe");
+ iframe.src = scope;
+ document.body.appendChild(iframe);
+ }
+
+ SpecialPowers.pushPrefEnv(
+ {
+ set: [
+ ["dom.serviceWorkers.enabled", true],
+ ["dom.serviceWorkers.testing.enabled", true],
+ ["dom.serviceWorkers.exemptFromPerDomainMax", true],
+ ["dom.serviceWorkers.idle_timeout", 60000],
+ ],
+ },
+ function () {
+ var scriptURL = location.href.includes("sw_empty_reroute.html")
+ ? "empty.js"
+ : "reroute.js";
+ navigator.serviceWorker
+ .register(scriptURL, { scope })
+ .then(swr => waitForState(swr.installing, "activated", swr))
+ .then(setupSW);
+ }
+ );
+}
+
+function finishTest() {
+ iframe.remove();
+ gRegistration.unregister().then(SimpleTest.finish, function (e) {
+ dump("unregistration failed: " + e + "\n");
+ SimpleTest.finish();
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic.html b/dom/tests/mochitest/fetch/test_fetch_basic.html
new file mode 100644
index 0000000000..7f3536c92e
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() function in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_basic.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic.js b/dom/tests/mochitest/fetch/test_fetch_basic.js
new file mode 100644
index 0000000000..27343d8662
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic.js
@@ -0,0 +1,179 @@
+function testAboutURL() {
+ var p1 = fetch("about:blank").then(
+ function (res) {
+ ok(false, "about:blank should fail");
+ },
+ function (e) {
+ ok(e instanceof TypeError, "about:blank should fail");
+ }
+ );
+
+ var p2 = fetch("about:config").then(
+ function (res) {
+ ok(false, "about:config should fail");
+ },
+ function (e) {
+ ok(e instanceof TypeError, "about:config should fail");
+ }
+ );
+
+ return Promise.all([p1, p2]);
+}
+
+function testDataURL() {
+ return Promise.all(
+ [
+ [
+ "data:text/plain;charset=UTF-8,Hello",
+ "text/plain;charset=UTF-8",
+ "Hello",
+ ],
+ [
+ "data:text/plain;charset=utf-8;base64,SGVsbG8=",
+ "text/plain;charset=utf-8",
+ "Hello",
+ ],
+ [
+ "data:text/xml,%3Cres%3Ehello%3C/res%3E%0A",
+ "text/xml",
+ "<res>hello</res>\n",
+ ],
+ ["data:text/plain,hello%20pass%0A", "text/plain", "hello pass\n"],
+ ["data:,foo", "text/plain;charset=US-ASCII", "foo"],
+ ["data:text/plain;base64,Zm9v", "text/plain", "foo"],
+ ["data:text/plain,foo#bar", "text/plain", "foo"],
+ ["data:text/plain,foo%23bar", "text/plain", "foo#bar"],
+ ].map(test => {
+ var uri = test[0],
+ contentType = test[1],
+ expectedBody = test[2];
+ return fetch(uri).then(res => {
+ ok(true, "Data URL fetch should resolve");
+ if (res.type == "error") {
+ ok(false, "Data URL fetch should not fail.");
+ return Promise.reject();
+ }
+ ok(res instanceof Response, "Fetch should resolve to a Response");
+ is(res.status, 200, "Data URL status should be 200");
+ is(res.statusText, "OK", "Data URL statusText should be OK");
+ ok(
+ res.headers.has("content-type"),
+ "Headers must have Content-Type header"
+ );
+ is(
+ res.headers.get("content-type"),
+ contentType,
+ "Content-Type header should match specified value"
+ );
+ return res
+ .text()
+ .then(body => is(body, expectedBody, "Data URL Body should match"));
+ });
+ })
+ );
+}
+
+function testSameOriginBlobURL() {
+ var blob = new Blob(["english ", "sentence"], { type: "text/plain" });
+ var url = URL.createObjectURL(blob);
+ return fetch(url).then(function (res) {
+ URL.revokeObjectURL(url);
+ ok(true, "Blob URL fetch should resolve");
+ if (res.type == "error") {
+ ok(false, "Blob URL fetch should not fail.");
+ return Promise.reject();
+ }
+ ok(res instanceof Response, "Fetch should resolve to a Response");
+ is(res.status, 200, "Blob fetch status should be 200");
+ is(res.statusText, "OK", "Blob fetch statusText should be OK");
+ ok(
+ res.headers.has("content-type"),
+ "Headers must have Content-Type header"
+ );
+ is(
+ res.headers.get("content-type"),
+ blob.type,
+ "Content-Type header should match specified value"
+ );
+ ok(
+ res.headers.has("content-length"),
+ "Headers must have Content-Length header"
+ );
+ is(
+ parseInt(res.headers.get("content-length")),
+ 16,
+ "Content-Length should match Blob's size"
+ );
+ return res.text().then(function (body) {
+ is(body, "english sentence", "Blob fetch body should match");
+ });
+ });
+}
+
+function testNonGetBlobURL() {
+ var blob = new Blob(["english ", "sentence"], { type: "text/plain" });
+ var url = URL.createObjectURL(blob);
+ return Promise.all(
+ ["HEAD", "POST", "PUT", "DELETE"].map(method => {
+ var req = new Request(url, { method });
+ return fetch(req)
+ .then(function (res) {
+ ok(false, "Blob URL with non-GET request should not succeed");
+ })
+ .catch(function (e) {
+ ok(
+ e instanceof TypeError,
+ "Blob URL with non-GET request should get a TypeError"
+ );
+ });
+ })
+ ).then(function () {
+ URL.revokeObjectURL(url);
+ });
+}
+
+function testMozErrors() {
+ // mozErrors shouldn't be available to content and be ignored.
+ return fetch("http://localhost:4/should/fail", { mozErrors: true })
+ .then(res => {
+ ok(false, "Request should not succeed");
+ })
+ .catch(err => {
+ ok(err instanceof TypeError);
+ });
+}
+
+function testRequestMozErrors() {
+ // mozErrors shouldn't be available to content and be ignored.
+ const r = new Request("http://localhost:4/should/fail", { mozErrors: true });
+ return fetch(r)
+ .then(res => {
+ ok(false, "Request should not succeed");
+ })
+ .catch(err => {
+ ok(err instanceof TypeError);
+ });
+}
+
+function testViewSourceURL() {
+ var p2 = fetch("view-source:/").then(
+ function (res) {
+ ok(false, "view-source: URL should fail");
+ },
+ function (e) {
+ ok(e instanceof TypeError, "view-source: URL should fail");
+ }
+ );
+}
+
+function runTest() {
+ return Promise.resolve()
+ .then(testAboutURL)
+ .then(testDataURL)
+ .then(testSameOriginBlobURL)
+ .then(testNonGetBlobURL)
+ .then(testMozErrors)
+ .then(testRequestMozErrors)
+ .then(testViewSourceURL);
+ // Put more promise based tests here.
+}
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic_http.html b/dom/tests/mochitest/fetch/test_fetch_basic_http.html
new file mode 100644
index 0000000000..f6916501d7
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() http fetching in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_basic_http.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic_http.js b/dom/tests/mochitest/fetch/test_fetch_basic_http.js
new file mode 100644
index 0000000000..781af2ecde
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http.js
@@ -0,0 +1,268 @@
+var path = "/tests/dom/xhr/tests/";
+
+var passFiles = [
+ ["file_XHR_pass1.xml", "GET", 200, "OK", "text/xml"],
+ ["file_XHR_pass2.txt", "GET", 200, "OK", "text/plain"],
+ ["file_XHR_pass3.txt", "GET", 200, "OK", "text/plain"],
+];
+
+function testURL() {
+ var promises = [];
+ passFiles.forEach(function (entry) {
+ var p = fetch(path + entry[0]).then(function (res) {
+ ok(
+ res.type !== "error",
+ "Response should not be an error for " + entry[0]
+ );
+ is(res.status, entry[2], "Status should match expected for " + entry[0]);
+ is(
+ res.statusText,
+ entry[3],
+ "Status text should match expected for " + entry[0]
+ );
+ if (entry[0] != "file_XHR_pass3.txt") {
+ ok(
+ res.url.endsWith(path + entry[0]),
+ "Response url should match request for simple fetch for " + entry[0]
+ );
+ } else {
+ ok(
+ res.url.endsWith(path + "file_XHR_pass2.txt"),
+ "Response url should match request for simple fetch for " + entry[0]
+ );
+ }
+ is(
+ res.headers.get("content-type"),
+ entry[4],
+ "Response should have content-type for " + entry[0]
+ );
+ });
+ promises.push(p);
+ });
+
+ return Promise.all(promises);
+}
+
+var failFiles = [["ftp://localhost" + path + "file_XHR_pass1.xml", "GET"]];
+
+function testURLFail() {
+ var promises = [];
+ failFiles.forEach(function (entry) {
+ var p = fetch(entry[0]).then(
+ function (res) {
+ ok(false, "Response should be an error for " + entry[0]);
+ },
+ function (e) {
+ ok(
+ e instanceof TypeError,
+ "Response should be an error for " + entry[0]
+ );
+ }
+ );
+ promises.push(p);
+ });
+
+ return Promise.all(promises);
+}
+
+function testRequestGET() {
+ var promises = [];
+ passFiles.forEach(function (entry) {
+ var req = new Request(path + entry[0], { method: entry[1] });
+ var p = fetch(req).then(function (res) {
+ ok(
+ res.type !== "error",
+ "Response should not be an error for " + entry[0]
+ );
+ is(res.status, entry[2], "Status should match expected for " + entry[0]);
+ is(
+ res.statusText,
+ entry[3],
+ "Status text should match expected for " + entry[0]
+ );
+ if (entry[0] != "file_XHR_pass3.txt") {
+ ok(
+ res.url.endsWith(path + entry[0]),
+ "Response url should match request for simple fetch for " + entry[0]
+ );
+ } else {
+ ok(
+ res.url.endsWith(path + "file_XHR_pass2.txt"),
+ "Response url should match request for simple fetch for " + entry[0]
+ );
+ }
+ is(
+ res.headers.get("content-type"),
+ entry[4],
+ "Response should have content-type for " + entry[0]
+ );
+ });
+ promises.push(p);
+ });
+
+ return Promise.all(promises);
+}
+
+function arraybuffer_equals_to(ab, s) {
+ is(ab.byteLength, s.length, "arraybuffer byteLength should match");
+
+ var u8v = new Uint8Array(ab);
+ is(
+ String.fromCharCode.apply(String, u8v),
+ s,
+ "arraybuffer bytes should match"
+ );
+}
+
+function testResponses() {
+ var fetches = [
+ fetch(path + "file_XHR_pass2.txt").then(res => {
+ is(res.status, 200, "status should match");
+ return res
+ .text()
+ .then(v => is(v, "hello pass\n", "response should match"));
+ }),
+
+ fetch(path + "file_XHR_binary1.bin").then(res => {
+ is(res.status, 200, "status should match");
+ return res
+ .arrayBuffer()
+ .then(v =>
+ arraybuffer_equals_to(
+ v,
+ "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb"
+ )
+ );
+ }),
+
+ new Promise((resolve, reject) => {
+ var jsonBody = JSON.stringify({ title: "aBook", author: "john" });
+ var req = new Request(path + "responseIdentical.sjs", {
+ method: "POST",
+ body: jsonBody,
+ });
+ var p = fetch(req).then(res => {
+ is(res.status, 200, "status should match");
+ return res.json().then(v => {
+ is(JSON.stringify(v), jsonBody, "json response should match");
+ });
+ });
+ resolve(p);
+ }),
+
+ new Promise((resolve, reject) => {
+ var req = new Request(path + "responseIdentical.sjs", {
+ method: "POST",
+ body: "{",
+ });
+ var p = fetch(req).then(res => {
+ is(res.status, 200, "wrong status");
+ return res.json().then(
+ v => ok(false, "expected json parse failure"),
+ e => ok(true, "expected json parse failure")
+ );
+ });
+ resolve(p);
+ }),
+ ];
+
+ return Promise.all(fetches);
+}
+
+function testBlob() {
+ return fetch(path + "/file_XHR_binary2.bin").then(r => {
+ is(r.status, 200, "status should match");
+ return r.blob().then(b => {
+ is(b.size, 65536, "blob should have size 65536");
+ return readAsArrayBuffer(b).then(function (ab) {
+ var u8 = new Uint8Array(ab);
+ for (var i = 0; i < 65536; i++) {
+ if (u8[i] !== (i & 255)) {
+ break;
+ }
+ }
+ is(i, 65536, "wrong value at offset " + i);
+ });
+ });
+ });
+}
+
+// This test is a copy of dom/html/test/formData_test.js testSend() modified to
+// use the fetch API. Please change this if you change that.
+function testFormDataSend() {
+ var file,
+ blob = new Blob(["hey"], { type: "text/plain" });
+
+ var fd = new FormData();
+ fd.append("string", "hey");
+ fd.append("empty", blob);
+ fd.append("explicit", blob, "explicit-file-name");
+ fd.append("explicit-empty", blob, "");
+ file = new File([blob], "testname", { type: "text/plain" });
+ fd.append("file-name", file);
+ file = new File([blob], "", { type: "text/plain" });
+ fd.append("empty-file-name", file);
+ file = new File([blob], "testname", { type: "text/plain" });
+ fd.append("file-name-overwrite", file, "overwrite");
+
+ var req = new Request("/tests/dom/html/test/form_submit_server.sjs", {
+ method: "POST",
+ body: fd,
+ });
+
+ return fetch(req).then(r => {
+ is(r.status, 200, "status should match");
+ return r.json().then(response => {
+ for (var entry of response) {
+ if (
+ entry.headers["Content-Disposition"] != 'form-data; name="string"'
+ ) {
+ is(entry.headers["Content-Type"], "text/plain");
+ }
+
+ is(entry.body, "hey");
+ }
+
+ is(
+ response[1].headers["Content-Disposition"],
+ 'form-data; name="empty"; filename="blob"'
+ );
+
+ is(
+ response[2].headers["Content-Disposition"],
+ 'form-data; name="explicit"; filename="explicit-file-name"'
+ );
+
+ is(
+ response[3].headers["Content-Disposition"],
+ 'form-data; name="explicit-empty"; filename=""'
+ );
+
+ is(
+ response[4].headers["Content-Disposition"],
+ 'form-data; name="file-name"; filename="testname"'
+ );
+
+ is(
+ response[5].headers["Content-Disposition"],
+ 'form-data; name="empty-file-name"; filename=""'
+ );
+
+ is(
+ response[6].headers["Content-Disposition"],
+ 'form-data; name="file-name-overwrite"; filename="overwrite"'
+ );
+ });
+ });
+}
+
+function runTest() {
+ return Promise.resolve()
+ .then(testURL)
+ .then(testURLFail)
+ .then(testRequestGET)
+ .then(testResponses)
+ .then(testBlob)
+ .then(testFormDataSend);
+ // Put more promise based tests here.
+}
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_empty_reroute.html b/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_empty_reroute.html
new file mode 100644
index 0000000000..5ea6a6227c
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_empty_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() http fetching in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_basic_http.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_reroute.html b/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_reroute.html
new file mode 100644
index 0000000000..5ea6a6227c
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() http fetching in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_basic_http.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic_sw_empty_reroute.html b/dom/tests/mochitest/fetch/test_fetch_basic_sw_empty_reroute.html
new file mode 100644
index 0000000000..c5cb02571a
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_sw_empty_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() function in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_basic.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_basic_sw_reroute.html b/dom/tests/mochitest/fetch/test_fetch_basic_sw_reroute.html
new file mode 100644
index 0000000000..c5cb02571a
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_sw_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() function in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_basic.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_cached_redirect.html b/dom/tests/mochitest/fetch/test_fetch_cached_redirect.html
new file mode 100644
index 0000000000..d172957bab
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cached_redirect.html
@@ -0,0 +1,22 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1374943 - Test fetch cached redirects</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_cached_redirect.js");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/test_fetch_cached_redirect.js b/dom/tests/mochitest/fetch/test_fetch_cached_redirect.js
new file mode 100644
index 0000000000..48d9b2231f
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cached_redirect.js
@@ -0,0 +1,17 @@
+async function testCachedRedirectErrorMode() {
+ // This is a file that returns a 302 to someplace else and will be cached.
+ const REDIRECTING_URL = "file_fetch_cached_redirect.html";
+
+ let firstResponse = await fetch(REDIRECTING_URL, { redirect: "manual" });
+ // okay, now it should be in the cahce.
+ try {
+ let secondResponse = await fetch(REDIRECTING_URL, { redirect: "error" });
+ } catch (ex) {}
+
+ ok(true, "didn't crash");
+}
+
+function runTest() {
+ return Promise.resolve().then(testCachedRedirectErrorMode);
+ // Put more promise based tests here.
+}
diff --git a/dom/tests/mochitest/fetch/test_fetch_cors.html b/dom/tests/mochitest/fetch/test_fetch_cors.html
new file mode 100644
index 0000000000..b079df8cba
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cors.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() CORS mode</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_cors.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_cors.js b/dom/tests/mochitest/fetch/test_fetch_cors.js
new file mode 100644
index 0000000000..05ce221435
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cors.js
@@ -0,0 +1,1883 @@
+var path = "/tests/dom/base/test/";
+
+function isOpaqueResponse(response) {
+ return (
+ response.type == "opaque" &&
+ response.status === 0 &&
+ response.statusText === ""
+ );
+}
+
+function testModeSameOrigin() {
+ // Fetch spec Section 4, step 4, "request's mode is same-origin".
+ var req = new Request("http://example.com", { mode: "same-origin" });
+ return fetch(req).then(
+ function (res) {
+ ok(
+ false,
+ "Attempting to fetch a resource from a different origin with mode same-origin should fail."
+ );
+ },
+ function (e) {
+ ok(
+ e instanceof TypeError,
+ "Attempting to fetch a resource from a different origin with mode same-origin should fail."
+ );
+ }
+ );
+}
+
+function testNoCorsCtor() {
+ // Request constructor Step 19.1
+ var simpleMethods = ["GET", "HEAD", "POST"];
+ for (var i = 0; i < simpleMethods.length; ++i) {
+ var r = new Request("http://example.com", {
+ method: simpleMethods[i],
+ mode: "no-cors",
+ });
+ ok(
+ true,
+ "no-cors Request with simple method " + simpleMethods[i] + " is allowed."
+ );
+ }
+
+ var otherMethods = ["DELETE", "OPTIONS", "PUT"];
+ for (var i = 0; i < otherMethods.length; ++i) {
+ try {
+ var r = new Request("http://example.com", {
+ method: otherMethods[i],
+ mode: "no-cors",
+ });
+ ok(
+ false,
+ "no-cors Request with non-simple method " +
+ otherMethods[i] +
+ " is not allowed."
+ );
+ } catch (e) {
+ ok(
+ true,
+ "no-cors Request with non-simple method " +
+ otherMethods[i] +
+ " is not allowed."
+ );
+ }
+ }
+
+ // Request constructor Step 19.2, check guarded headers.
+ var r = new Request(".", { mode: "no-cors" });
+ r.headers.append("Content-Type", "multipart/form-data");
+ is(
+ r.headers.get("content-type"),
+ "multipart/form-data",
+ "Appending simple header should succeed"
+ );
+ r.headers.append("custom", "value");
+ ok(!r.headers.has("custom"), "Appending custom header should fail");
+ r.headers.append("DNT", "value");
+ ok(!r.headers.has("DNT"), "Appending forbidden header should fail");
+}
+
+var corsServerPath =
+ "/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?";
+function testModeNoCors() {
+ // Fetch spec, section 4, step 4, response tainting should be set opaque, so
+ // that fetching leads to an opaque filtered response in step 8.
+ var r = new Request("http://example.com" + corsServerPath + "status=200", {
+ mode: "no-cors",
+ });
+ return fetch(r).then(
+ function (res) {
+ ok(
+ isOpaqueResponse(res),
+ "no-cors Request fetch should result in opaque response"
+ );
+ },
+ function (e) {
+ ok(false, "no-cors Request fetch should not error");
+ }
+ );
+}
+
+function testSameOriginCredentials() {
+ var cookieStr = "type=chocolatechip";
+ var tests = [
+ {
+ // Initialize by setting a cookie.
+ pass: 1,
+ setCookie: cookieStr,
+ withCred: "same-origin",
+ },
+ {
+ // Default mode is "same-origin".
+ pass: 1,
+ cookie: cookieStr,
+ },
+ {
+ pass: 1,
+ noCookie: 1,
+ withCred: "omit",
+ },
+ {
+ pass: 1,
+ cookie: cookieStr,
+ withCred: "same-origin",
+ },
+ {
+ pass: 1,
+ cookie: cookieStr,
+ withCred: "include",
+ },
+ ];
+
+ var finalPromiseResolve, finalPromiseReject;
+ var finalPromise = new Promise(function (res, rej) {
+ finalPromiseResolve = res;
+ finalPromiseReject = rej;
+ });
+
+ function makeRequest(test) {
+ req = {
+ // Add a default query param just to make formatting the actual params
+ // easier.
+ url: corsServerPath + "a=b",
+ method: test.method,
+ headers: test.headers,
+ withCred: test.withCred,
+ };
+
+ if (test.setCookie) {
+ req.url += "&setCookie=" + escape(test.setCookie);
+ }
+ if (test.cookie) {
+ req.url += "&cookie=" + escape(test.cookie);
+ }
+ if (test.noCookie) {
+ req.url += "&noCookie";
+ }
+
+ return new Request(req.url, {
+ method: req.method,
+ headers: req.headers,
+ credentials: req.withCred,
+ });
+ }
+
+ function testResponse(res, test) {
+ ok(test.pass, "Expected test to pass " + JSON.stringify(test));
+ is(res.status, 200, "wrong status in test for " + JSON.stringify(test));
+ is(res.statusText, "OK", "wrong status text for " + JSON.stringify(test));
+ return res.text().then(function (v) {
+ is(
+ v,
+ "<res>hello pass</res>\n",
+ "wrong text in test for " + JSON.stringify(test)
+ );
+ });
+ }
+
+ function runATest(tests, i) {
+ var test = tests[i];
+ var request = makeRequest(test);
+ console.log(request.url);
+ fetch(request).then(
+ function (res) {
+ testResponse(res, test).then(function () {
+ if (i < tests.length - 1) {
+ runATest(tests, i + 1);
+ } else {
+ finalPromiseResolve();
+ }
+ });
+ },
+ function (e) {
+ ok(!test.pass, "Expected test to fail " + JSON.stringify(test));
+ ok(e instanceof TypeError, "Test should fail " + JSON.stringify(test));
+ if (i < tests.length - 1) {
+ runATest(tests, i + 1);
+ } else {
+ finalPromiseResolve();
+ }
+ }
+ );
+ }
+
+ runATest(tests, 0);
+ return finalPromise;
+}
+
+function testModeCors() {
+ var tests = [
+ // Plain request
+ { pass: 1, method: "GET", noAllowPreflight: 1 },
+
+ // undefined username
+ { pass: 1, method: "GET", noAllowPreflight: 1, username: undefined },
+
+ // undefined username and password
+ {
+ pass: 1,
+ method: "GET",
+ noAllowPreflight: 1,
+ username: undefined,
+ password: undefined,
+ },
+
+ // nonempty username
+ { pass: 0, method: "GET", noAllowPreflight: 1, username: "user" },
+
+ // nonempty password
+ { pass: 0, method: "GET", noAllowPreflight: 1, password: "password" },
+
+ // Default allowed headers
+ {
+ pass: 1,
+ method: "GET",
+ headers: {
+ "Content-Type": "text/plain",
+ Accept: "foo/bar",
+ "Accept-Language": "sv-SE",
+ },
+ noAllowPreflight: 1,
+ },
+
+ {
+ pass: 0,
+ method: "GET",
+ headers: {
+ "Content-Type": "foo/bar",
+ Accept: "foo/bar",
+ "Accept-Language": "sv-SE",
+ },
+ noAllowPreflight: 1,
+ },
+
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "Content-Type": "foo/bar, text/plain" },
+ noAllowPreflight: 1,
+ },
+
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "Content-Type": "foo/bar, text/plain, garbage" },
+ noAllowPreflight: 1,
+ },
+
+ // Custom headers
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "X-My-Header",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: {
+ "x-my-header": "myValue",
+ "long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header":
+ "secondValue",
+ },
+ allowHeaders:
+ "x-my-header, long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header-long-header",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "x-my%-header": "myValue" },
+ allowHeaders: "x-my%-header",
+ },
+ { pass: 0, method: "GET", headers: { "x-my-header": "myValue" } },
+ { pass: 0, method: "GET", headers: { "x-my-header": "" } },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "y-my-header",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header y-my-header",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header, y-my-header z",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header, y-my-he(ader",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { myheader: "" },
+ allowMethods: "myheader",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "User-Agent": "myValue" },
+ allowHeaders: "User-Agent",
+ },
+ { pass: 0, method: "GET", headers: { "User-Agent": "myValue" } },
+
+ // Multiple custom headers
+ {
+ pass: 1,
+ method: "GET",
+ headers: {
+ "x-my-header": "myValue",
+ "second-header": "secondValue",
+ "third-header": "thirdValue",
+ },
+ allowHeaders: "x-my-header, second-header, third-header",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: {
+ "x-my-header": "myValue",
+ "second-header": "secondValue",
+ "third-header": "thirdValue",
+ },
+ allowHeaders: "x-my-header,second-header,third-header",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: {
+ "x-my-header": "myValue",
+ "second-header": "secondValue",
+ "third-header": "thirdValue",
+ },
+ allowHeaders: "x-my-header ,second-header ,third-header",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: {
+ "x-my-header": "myValue",
+ "second-header": "secondValue",
+ "third-header": "thirdValue",
+ },
+ allowHeaders: "x-my-header , second-header , third-header",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "x-my-header": "myValue", "second-header": "secondValue" },
+ allowHeaders: ", x-my-header, , ,, second-header, , ",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "x-my-header": "myValue", "second-header": "secondValue" },
+ allowHeaders: "x-my-header, second-header, unused-header",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "myValue", "y-my-header": "secondValue" },
+ allowHeaders: "x-my-header",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "", "y-my-header": "" },
+ allowHeaders: "x-my-header",
+ },
+
+ // HEAD requests
+ { pass: 1, method: "HEAD", noAllowPreflight: 1 },
+
+ // HEAD with safe headers
+ {
+ pass: 1,
+ method: "HEAD",
+ headers: {
+ "Content-Type": "text/plain",
+ Accept: "foo/bar",
+ "Accept-Language": "sv-SE",
+ },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 0,
+ method: "HEAD",
+ headers: {
+ "Content-Type": "foo/bar",
+ Accept: "foo/bar",
+ "Accept-Language": "sv-SE",
+ },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 0,
+ method: "HEAD",
+ headers: { "Content-Type": "foo/bar, text/plain" },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 0,
+ method: "HEAD",
+ headers: { "Content-Type": "foo/bar, text/plain, garbage" },
+ noAllowPreflight: 1,
+ },
+
+ // HEAD with custom headers
+ {
+ pass: 1,
+ method: "HEAD",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header",
+ },
+ { pass: 0, method: "HEAD", headers: { "x-my-header": "myValue" } },
+ {
+ pass: 0,
+ method: "HEAD",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "",
+ },
+ {
+ pass: 0,
+ method: "HEAD",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "y-my-header",
+ },
+ {
+ pass: 0,
+ method: "HEAD",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header y-my-header",
+ },
+
+ // POST tests
+ { pass: 1, method: "POST", body: "hi there", noAllowPreflight: 1 },
+ { pass: 1, method: "POST" },
+ { pass: 1, method: "POST", noAllowPreflight: 1 },
+
+ // POST with standard headers
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain" },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "multipart/form-data" },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "foo/bar" },
+ },
+ { pass: 0, method: "POST", headers: { "Content-Type": "foo/bar" } },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: {
+ "Content-Type": "text/plain",
+ Accept: "foo/bar",
+ "Accept-Language": "sv-SE",
+ },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "foo/bar, text/plain" },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "foo/bar, text/plain, garbage" },
+ noAllowPreflight: 1,
+ },
+
+ // POST with custom headers
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: {
+ Accept: "foo/bar",
+ "Accept-Language": "sv-SE",
+ "x-my-header": "myValue",
+ },
+ allowHeaders: "x-my-header",
+ },
+ {
+ pass: 1,
+ method: "POST",
+ headers: { "Content-Type": "text/plain", "x-my-header": "myValue" },
+ allowHeaders: "x-my-header",
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain", "x-my-header": "myValue" },
+ allowHeaders: "x-my-header",
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "foo/bar", "x-my-header": "myValue" },
+ allowHeaders: "x-my-header, content-type",
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "foo/bar" },
+ noAllowPreflight: 1,
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "foo/bar", "x-my-header": "myValue" },
+ allowHeaders: "x-my-header",
+ },
+ {
+ pass: 1,
+ method: "POST",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header",
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "x-my-header": "myValue" },
+ allowHeaders: "x-my-header, $_%",
+ },
+
+ // Other methods
+ { pass: 1, method: "DELETE", allowMethods: "DELETE" },
+ { pass: 0, method: "DELETE", allowHeaders: "DELETE" },
+ { pass: 0, method: "DELETE" },
+ { pass: 0, method: "DELETE", allowMethods: "" },
+ { pass: 1, method: "DELETE", allowMethods: "POST, PUT, DELETE" },
+ { pass: 1, method: "DELETE", allowMethods: "POST, DELETE, PUT" },
+ { pass: 1, method: "DELETE", allowMethods: "DELETE, POST, PUT" },
+ { pass: 1, method: "DELETE", allowMethods: "POST ,PUT ,DELETE" },
+ { pass: 1, method: "DELETE", allowMethods: "POST,PUT,DELETE" },
+ { pass: 1, method: "DELETE", allowMethods: "POST , PUT , DELETE" },
+ {
+ pass: 1,
+ method: "DELETE",
+ allowMethods: " ,, PUT ,, , , DELETE , ,",
+ },
+ { pass: 0, method: "DELETE", allowMethods: "PUT" },
+ { pass: 0, method: "DELETE", allowMethods: "DELETEZ" },
+ { pass: 0, method: "DELETE", allowMethods: "DELETE PUT" },
+ { pass: 0, method: "DELETE", allowMethods: "DELETE, PUT Z" },
+ { pass: 0, method: "DELETE", allowMethods: "DELETE, PU(T" },
+ { pass: 0, method: "DELETE", allowMethods: "PUT DELETE" },
+ { pass: 0, method: "DELETE", allowMethods: "PUT Z, DELETE" },
+ { pass: 0, method: "DELETE", allowMethods: "PU(T, DELETE" },
+ { pass: 0, method: "PUT", allowMethods: "put" },
+
+ // Status messages
+ {
+ pass: 1,
+ method: "GET",
+ noAllowPreflight: 1,
+ status: 404,
+ statusMessage: "nothin' here",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ noAllowPreflight: 1,
+ status: 401,
+ statusMessage: "no can do",
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "foo/bar" },
+ allowHeaders: "content-type",
+ status: 500,
+ statusMessage: "server boo",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ noAllowPreflight: 1,
+ status: 200,
+ statusMessage: "Yes!!",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ headers: { "x-my-header": "header value" },
+ allowHeaders: "x-my-header",
+ preflightStatus: 400,
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "x-my-header": "header value" },
+ allowHeaders: "x-my-header",
+ preflightStatus: 200,
+ },
+ {
+ pass: 1,
+ method: "GET",
+ headers: { "x-my-header": "header value" },
+ allowHeaders: "x-my-header",
+ preflightStatus: 204,
+ },
+
+ // exposed headers
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: { "x-my-header": "x header" },
+ exposeHeaders: "x-my-header",
+ expectedResponseHeaders: ["x-my-header"],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ origin: "http://invalid",
+ responseHeaders: { "x-my-header": "x header" },
+ exposeHeaders: "x-my-header",
+ expectedResponseHeaders: [],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: { "x-my-header": "x header" },
+ expectedResponseHeaders: [],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: { "x-my-header": "x header" },
+ exposeHeaders: "x-my-header y",
+ expectedResponseHeaders: [],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: { "x-my-header": "x header" },
+ exposeHeaders: "y x-my-header",
+ expectedResponseHeaders: [],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: { "x-my-header": "x header" },
+ exposeHeaders: "x-my-header, y-my-header z",
+ expectedResponseHeaders: [],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: { "x-my-header": "x header" },
+ exposeHeaders: "x-my-header, y-my-hea(er",
+ expectedResponseHeaders: [],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: { "x-my-header": "x header", "y-my-header": "y header" },
+ exposeHeaders: " , ,,y-my-header,z-my-header, ",
+ expectedResponseHeaders: ["y-my-header"],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ responseHeaders: {
+ "Cache-Control": "cacheControl header",
+ "Content-Language": "contentLanguage header",
+ Expires: "expires header",
+ "Last-Modified": "lastModified header",
+ Pragma: "pragma header",
+ Unexpected: "unexpected header",
+ },
+ expectedResponseHeaders: [
+ "Cache-Control",
+ "Content-Language",
+ "Content-Type",
+ "Expires",
+ "Last-Modified",
+ "Pragma",
+ ],
+ },
+ // Check that sending a body in the OPTIONS response works
+ {
+ pass: 1,
+ method: "DELETE",
+ allowMethods: "DELETE",
+ preflightBody: "I'm a preflight response body",
+ },
+ ];
+
+ var baseURL = "http://example.org" + corsServerPath;
+ var origin = "http://mochi.test:8888";
+ var fetches = [];
+ for (test of tests) {
+ var req = {
+ url: baseURL + "allowOrigin=" + escape(test.origin || origin),
+ method: test.method,
+ headers: test.headers,
+ uploadProgress: test.uploadProgress,
+ body: test.body,
+ responseHeaders: test.responseHeaders,
+ };
+
+ if (test.pass) {
+ req.url += "&origin=" + escape(origin) + "&requestMethod=" + test.method;
+ }
+
+ if ("username" in test) {
+ var u = new URL(req.url);
+ u.username = test.username || "";
+ req.url = u.href;
+ }
+
+ if ("password" in test) {
+ var u = new URL(req.url);
+ u.password = test.password || "";
+ req.url = u.href;
+ }
+
+ if (test.noAllowPreflight) {
+ req.url += "&noAllowPreflight";
+ }
+
+ if (test.pass && "headers" in test) {
+ function isUnsafeHeader(name) {
+ lName = name.toLowerCase();
+ return (
+ lName != "accept" &&
+ lName != "accept-language" &&
+ (lName != "content-type" ||
+ ![
+ "text/plain",
+ "multipart/form-data",
+ "application/x-www-form-urlencoded",
+ ].includes(test.headers[name].toLowerCase()))
+ );
+ }
+ req.url += "&headers=" + escape(JSON.stringify(test.headers));
+ reqHeaders = escape(
+ Object.keys(test.headers)
+ .filter(isUnsafeHeader)
+ .map(s => s.toLowerCase())
+ .sort()
+ .join(",")
+ );
+ req.url += reqHeaders ? "&requestHeaders=" + reqHeaders : "";
+ }
+ if ("allowHeaders" in test) {
+ req.url += "&allowHeaders=" + escape(test.allowHeaders);
+ }
+ if ("allowMethods" in test) {
+ req.url += "&allowMethods=" + escape(test.allowMethods);
+ }
+ if (test.body) {
+ req.url += "&body=" + escape(test.body);
+ }
+ if (test.status) {
+ req.url += "&status=" + test.status;
+ req.url += "&statusMessage=" + escape(test.statusMessage);
+ }
+ if (test.preflightStatus) {
+ req.url += "&preflightStatus=" + test.preflightStatus;
+ }
+ if (test.responseHeaders) {
+ req.url +=
+ "&responseHeaders=" + escape(JSON.stringify(test.responseHeaders));
+ }
+ if (test.exposeHeaders) {
+ req.url += "&exposeHeaders=" + escape(test.exposeHeaders);
+ }
+ if (test.preflightBody) {
+ req.url += "&preflightBody=" + escape(test.preflightBody);
+ }
+
+ fetches.push(
+ (function (test) {
+ return new Promise(function (resolve) {
+ resolve(
+ new Request(req.url, {
+ method: req.method,
+ mode: "cors",
+ headers: req.headers,
+ body: req.body,
+ })
+ );
+ })
+ .then(function (request) {
+ return fetch(request);
+ })
+ .then(function (res) {
+ ok(test.pass, "Expected test to pass for " + JSON.stringify(test));
+ if (test.status) {
+ is(
+ res.status,
+ test.status,
+ "wrong status in test for " + JSON.stringify(test)
+ );
+ is(
+ res.statusText,
+ test.statusMessage,
+ "wrong status text for " + JSON.stringify(test)
+ );
+ } else {
+ is(
+ res.status,
+ 200,
+ "wrong status in test for " + JSON.stringify(test)
+ );
+ is(
+ res.statusText,
+ "OK",
+ "wrong status text for " + JSON.stringify(test)
+ );
+ }
+ if (test.responseHeaders) {
+ for (header in test.responseHeaders) {
+ if (!test.expectedResponseHeaders.includes(header)) {
+ is(
+ res.headers.has(header),
+ false,
+ "|Headers.has()|wrong response header (" +
+ header +
+ ") in test for " +
+ JSON.stringify(test)
+ );
+ } else {
+ is(
+ res.headers.get(header),
+ test.responseHeaders[header],
+ "|Headers.get()|wrong response header (" +
+ header +
+ ") in test for " +
+ JSON.stringify(test)
+ );
+ }
+ }
+ }
+
+ return res.text();
+ })
+ .then(function (v) {
+ if (test.method !== "HEAD") {
+ is(
+ v,
+ "<res>hello pass</res>\n",
+ "wrong responseText in test for " + JSON.stringify(test)
+ );
+ } else {
+ is(
+ v,
+ "",
+ "wrong responseText in HEAD test for " + JSON.stringify(test)
+ );
+ }
+ })
+ .catch(function (e) {
+ ok(!test.pass, "Expected test failure for " + JSON.stringify(test));
+ ok(
+ e instanceof TypeError,
+ "Exception should be TypeError for " + JSON.stringify(test)
+ );
+ });
+ })(test)
+ );
+ }
+
+ return Promise.all(fetches);
+}
+
+function testCrossOriginCredentials() {
+ var origin = "http://mochi.test:8888";
+ var tests = [
+ { pass: 1, method: "GET", withCred: "include", allowCred: 1 },
+ { pass: 0, method: "GET", withCred: "include", allowCred: 0 },
+ { pass: 0, method: "GET", withCred: "include", allowCred: 1, origin: "*" },
+ { pass: 1, method: "GET", withCred: "omit", allowCred: 1, origin: "*" },
+ {
+ pass: 1,
+ method: "GET",
+ setCookie: "a=1",
+ withCred: "include",
+ allowCred: 1,
+ },
+ {
+ pass: 1,
+ method: "GET",
+ cookie: "a=1",
+ withCred: "include",
+ allowCred: 1,
+ },
+ { pass: 1, method: "GET", noCookie: 1, withCred: "omit", allowCred: 1 },
+ { pass: 0, method: "GET", noCookie: 1, withCred: "include", allowCred: 1 },
+ {
+ pass: 1,
+ method: "GET",
+ setCookie: "a=2",
+ withCred: "omit",
+ allowCred: 1,
+ },
+ {
+ pass: 1,
+ method: "GET",
+ cookie: "a=1",
+ withCred: "include",
+ allowCred: 1,
+ },
+ {
+ pass: 1,
+ method: "GET",
+ setCookie: "a=2",
+ withCred: "include",
+ allowCred: 1,
+ },
+ {
+ pass: 1,
+ method: "GET",
+ cookie: "a=2",
+ withCred: "include",
+ allowCred: 1,
+ },
+ {
+ // When credentials mode is same-origin, but mode is cors, no
+ // cookie should be sent cross origin.
+ pass: 0,
+ method: "GET",
+ cookie: "a=2",
+ withCred: "same-origin",
+ allowCred: 1,
+ },
+ {
+ // When credentials mode is same-origin, but mode is cors, no
+ // cookie should be sent cross origin. This test checks the same
+ // thing as above, but uses the noCookie check on the server
+ // instead, and expects a valid response.
+ pass: 1,
+ method: "GET",
+ noCookie: 1,
+ withCred: "same-origin",
+ },
+ {
+ // Initialize by setting a cookies for same- and cross- origins.
+ pass: 1,
+ hops: [
+ { server: origin, setCookie: escape("a=1") },
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowCred: 1,
+ setCookie: escape("a=2"),
+ },
+ ],
+ withCred: "include",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: origin, cookie: escape("a=1") },
+ { server: origin, cookie: escape("a=1") },
+ { server: "http://example.com", allowOrigin: origin, noCookie: 1 },
+ ],
+ withCred: "same-origin",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: origin, cookie: escape("a=1") },
+ { server: origin, cookie: escape("a=1") },
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowCred: 1,
+ cookie: escape("a=2"),
+ },
+ ],
+ withCred: "include",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: origin, cookie: escape("a=1") },
+ { server: origin, cookie: escape("a=1") },
+ { server: "http://example.com", allowOrigin: "*", noCookie: 1 },
+ ],
+ withCred: "same-origin",
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: origin, cookie: escape("a=1") },
+ { server: origin, cookie: escape("a=1") },
+ {
+ server: "http://example.com",
+ allowOrigin: "*",
+ allowCred: 1,
+ cookie: escape("a=2"),
+ },
+ ],
+ withCred: "include",
+ },
+ // fails because allow-credentials CORS header is not set by server
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: origin, cookie: escape("a=1") },
+ { server: origin, cookie: escape("a=1") },
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ cookie: escape("a=2"),
+ },
+ ],
+ withCred: "include",
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: origin, noCookie: 1 },
+ { server: origin, noCookie: 1 },
+ { server: "http://example.com", allowOrigin: origin, noCookie: 1 },
+ ],
+ withCred: "omit",
+ },
+ ];
+
+ var baseURL = "http://example.org" + corsServerPath;
+ var origin = "http://mochi.test:8888";
+
+ var finalPromiseResolve, finalPromiseReject;
+ var finalPromise = new Promise(function (res, rej) {
+ finalPromiseResolve = res;
+ finalPromiseReject = rej;
+ });
+
+ function makeRequest(test) {
+ var url;
+ if (test.hops) {
+ url =
+ test.hops[0].server +
+ corsServerPath +
+ "hop=1&hops=" +
+ escape(JSON.stringify(test.hops));
+ } else {
+ url = baseURL + "allowOrigin=" + escape(test.origin || origin);
+ }
+ req = {
+ url,
+ method: test.method,
+ headers: test.headers,
+ withCred: test.withCred,
+ };
+
+ if (test.allowCred) {
+ req.url += "&allowCred";
+ }
+
+ if (test.setCookie) {
+ req.url += "&setCookie=" + escape(test.setCookie);
+ }
+ if (test.cookie) {
+ req.url += "&cookie=" + escape(test.cookie);
+ }
+ if (test.noCookie) {
+ req.url += "&noCookie";
+ }
+
+ if ("allowHeaders" in test) {
+ req.url += "&allowHeaders=" + escape(test.allowHeaders);
+ }
+ if ("allowMethods" in test) {
+ req.url += "&allowMethods=" + escape(test.allowMethods);
+ }
+
+ return new Request(req.url, {
+ method: req.method,
+ headers: req.headers,
+ credentials: req.withCred,
+ });
+ }
+
+ function testResponse(res, test) {
+ ok(test.pass, "Expected test to pass for " + JSON.stringify(test));
+ is(res.status, 200, "wrong status in test for " + JSON.stringify(test));
+ is(res.statusText, "OK", "wrong status text for " + JSON.stringify(test));
+ return res.text().then(function (v) {
+ is(
+ v,
+ "<res>hello pass</res>\n",
+ "wrong text in test for " + JSON.stringify(test)
+ );
+ });
+ }
+
+ function runATest(tests, i) {
+ var test = tests[i];
+ var request = makeRequest(test);
+ fetch(request).then(
+ function (res) {
+ testResponse(res, test).then(function () {
+ if (i < tests.length - 1) {
+ runATest(tests, i + 1);
+ } else {
+ finalPromiseResolve();
+ }
+ });
+ },
+ function (e) {
+ ok(!test.pass, "Expected test failure for " + JSON.stringify(test));
+ ok(
+ e instanceof TypeError,
+ "Exception should be TypeError for " + JSON.stringify(test)
+ );
+ if (i < tests.length - 1) {
+ runATest(tests, i + 1);
+ } else {
+ finalPromiseResolve();
+ }
+ }
+ );
+ }
+
+ runATest(tests, 0);
+ return finalPromise;
+}
+
+function testModeNoCorsCredentials() {
+ var cookieStr = "type=chocolatechip";
+ var tests = [
+ {
+ // Initialize by setting a cookie.
+ pass: 1,
+ setCookie: cookieStr,
+ withCred: "include",
+ },
+ {
+ pass: 1,
+ noCookie: 1,
+ withCred: "omit",
+ },
+ {
+ pass: 1,
+ noCookie: 1,
+ withCred: "same-origin",
+ },
+ {
+ pass: 1,
+ cookie: cookieStr,
+ withCred: "include",
+ },
+ {
+ pass: 1,
+ cookie: cookieStr,
+ withCred: "omit",
+ status: 500,
+ },
+ {
+ pass: 1,
+ cookie: cookieStr,
+ withCred: "same-origin",
+ status: 500,
+ },
+ {
+ pass: 1,
+ noCookie: 1,
+ withCred: "include",
+ status: 500,
+ },
+ ];
+
+ var finalPromiseResolve, finalPromiseReject;
+ var finalPromise = new Promise(function (res, rej) {
+ finalPromiseResolve = res;
+ finalPromiseReject = rej;
+ });
+
+ function makeRequest(test) {
+ req = {
+ url: "http://example.org" + corsServerPath + "a+b",
+ withCred: test.withCred,
+ };
+
+ if (test.setCookie) {
+ req.url += "&setCookie=" + escape(test.setCookie);
+ }
+ if (test.cookie) {
+ req.url += "&cookie=" + escape(test.cookie);
+ }
+ if (test.noCookie) {
+ req.url += "&noCookie";
+ }
+
+ return new Request(req.url, {
+ method: "GET",
+ mode: "no-cors",
+ credentials: req.withCred,
+ });
+ }
+
+ function testResponse(res, test) {
+ is(res.type, "opaque", "wrong response type for " + JSON.stringify(test));
+
+ // Get unfiltered response
+ var chromeResponse = SpecialPowers.wrap(res);
+ var unfiltered = chromeResponse.cloneUnfiltered();
+
+ var status = test.status ? test.status : 200;
+ is(
+ unfiltered.status,
+ status,
+ "wrong status in test for " + JSON.stringify(test)
+ );
+
+ return unfiltered.text().then(function (v) {
+ if (test.status === 200) {
+ const expected =
+ SpecialPowers.getIntPref(
+ "browser.opaqueResponseBlocking.filterFetchResponse"
+ ) > 0
+ ? ""
+ : "<res>hello pass</res>\n";
+ is(v, expected, "wrong text in test for " + JSON.stringify(test));
+ }
+ });
+ }
+
+ function runATest(tests, i) {
+ if (typeof SpecialPowers !== "object") {
+ finalPromiseResolve();
+ return;
+ }
+
+ var test = tests[i];
+ var request = makeRequest(test);
+ fetch(request).then(
+ function (res) {
+ ok(test.pass, "Expected test to pass " + JSON.stringify(test));
+ testResponse(res, test).then(function () {
+ if (i < tests.length - 1) {
+ runATest(tests, i + 1);
+ } else {
+ finalPromiseResolve();
+ }
+ });
+ },
+ function (e) {
+ ok(!test.pass, "Expected test to fail " + JSON.stringify(test));
+ ok(e instanceof TypeError, "Test should fail " + JSON.stringify(test));
+ if (i < tests.length - 1) {
+ runATest(tests, i + 1);
+ } else {
+ finalPromiseResolve();
+ }
+ }
+ );
+ }
+
+ runATest(tests, 0);
+ return finalPromise;
+}
+
+function testCORSRedirects() {
+ var origin = "http://mochi.test:8888";
+
+ var tests = [
+ {
+ pass: 1,
+ method: "GET",
+ hops: [{ server: "http://example.com", allowOrigin: origin }],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://mochi.test:8888", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://mochi.test:8888", allowOrigin: "*" },
+ ],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://mochi.test:8888" },
+ ],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: "http://mochi.test:8888" },
+ { server: "http://mochi.test:8888" },
+ { server: "http://example.com", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://mochi.test:8888" },
+ { server: "http://mochi.test:8888" },
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://mochi.test:8888" },
+ ],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://test2.mochi.test:8888", allowOrigin: origin },
+ {
+ server: "http://sub2.xn--lt-uia.mochi.test:8888",
+ allowOrigin: origin,
+ },
+ { server: "http://sub1.test1.mochi.test:8888", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://test2.mochi.test:8888", allowOrigin: origin },
+ { server: "http://sub2.xn--lt-uia.mochi.test:8888", allowOrigin: "*" },
+ { server: "http://sub1.test1.mochi.test:8888", allowOrigin: "*" },
+ ],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://test2.mochi.test:8888", allowOrigin: "*" },
+ { server: "http://sub2.xn--lt-uia.mochi.test:8888", allowOrigin: "*" },
+ { server: "http://sub1.test1.mochi.test:8888", allowOrigin: "*" },
+ ],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://test2.mochi.test:8888", allowOrigin: origin },
+ { server: "http://sub2.xn--lt-uia.mochi.test:8888", allowOrigin: "x" },
+ { server: "http://sub1.test1.mochi.test:8888", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://test2.mochi.test:8888", allowOrigin: origin },
+ { server: "http://sub2.xn--lt-uia.mochi.test:8888", allowOrigin: "*" },
+ { server: "http://sub1.test1.mochi.test:8888", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 0,
+ method: "GET",
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://test2.mochi.test:8888", allowOrigin: origin },
+ { server: "http://sub2.xn--lt-uia.mochi.test:8888", allowOrigin: "*" },
+ { server: "http://sub1.test1.mochi.test:8888" },
+ ],
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain" },
+ hops: [
+ { server: "http://mochi.test:8888" },
+ { server: "http://example.com", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain", "my-header": "myValue" },
+ hops: [
+ { server: "http://mochi.test:8888" },
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowHeaders: "my-header",
+ },
+ ],
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain", "my-header": "myValue" },
+ hops: [
+ { server: "http://mochi.test:8888" },
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowHeaders: "my-header",
+ noAllowPreflight: 1,
+ },
+ ],
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain", "my-header": "myValue" },
+ hops: [
+ { server: "http://mochi.test:8888" },
+ {
+ server: "http://test1.example.com",
+ allowOrigin: origin,
+ allowHeaders: "my-header",
+ },
+ {
+ server: "http://test2.example.com",
+ allowOrigin: origin,
+ allowHeaders: "my-header",
+ },
+ ],
+ },
+ {
+ pass: 1,
+ method: "DELETE",
+ hops: [
+ { server: "http://mochi.test:8888" },
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowMethods: "DELETE",
+ },
+ ],
+ },
+ {
+ pass: 0,
+ method: "DELETE",
+ hops: [
+ { server: "http://mochi.test:8888" },
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowMethods: "DELETE",
+ noAllowPreflight: 1,
+ },
+ ],
+ },
+ {
+ pass: 0,
+ method: "DELETE",
+ hops: [
+ { server: "http://mochi.test:8888" },
+ {
+ server: "http://test1.example.com",
+ allowOrigin: origin,
+ allowMethods: "DELETE",
+ },
+ {
+ server: "http://test2.example.com",
+ allowOrigin: origin,
+ allowMethods: "DELETE",
+ },
+ ],
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain", "my-header": "myValue" },
+ hops: [
+ { server: "http://example.com", allowOrigin: origin },
+ { server: "http://sub1.test1.mochi.test:8888", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 0,
+ method: "DELETE",
+ hops: [
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowMethods: "DELETE",
+ },
+ {
+ server: "http://sub1.test1.mochi.test:8888",
+ allowOrigin: origin,
+ allowMethods: "DELETE",
+ },
+ ],
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain", "my-header": "myValue" },
+ hops: [
+ { server: "http://example.com" },
+ {
+ server: "http://sub1.test1.mochi.test:8888",
+ allowOrigin: origin,
+ allowHeaders: "my-header",
+ },
+ ],
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain" },
+ hops: [
+ { server: "http://mochi.test:8888" },
+ { server: "http://example.com", allowOrigin: origin },
+ ],
+ },
+ {
+ pass: 0,
+ method: "POST",
+ body: "hi there",
+ headers: { "Content-Type": "text/plain", "my-header": "myValue" },
+ hops: [
+ {
+ server: "http://example.com",
+ allowOrigin: origin,
+ allowHeaders: "my-header",
+ },
+ {
+ server: "http://mochi.test:8888",
+ allowOrigin: origin,
+ allowHeaders: "my-header",
+ },
+ ],
+ },
+ ];
+
+ var fetches = [];
+ for (test of tests) {
+ req = {
+ url:
+ test.hops[0].server +
+ corsServerPath +
+ "hop=1&hops=" +
+ escape(JSON.stringify(test.hops)),
+ method: test.method,
+ headers: test.headers,
+ body: test.body,
+ };
+
+ if (test.headers) {
+ req.url += "&headers=" + escape(JSON.stringify(test.headers));
+ }
+
+ if (test.pass) {
+ if (test.body) {
+ req.url += "&body=" + escape(test.body);
+ }
+ }
+
+ var request = new Request(req.url, {
+ method: req.method,
+ headers: req.headers,
+ body: req.body,
+ });
+ fetches.push(
+ (function (request, test) {
+ return fetch(request).then(
+ function (res) {
+ ok(test.pass, "Expected test to pass for " + JSON.stringify(test));
+ is(
+ res.status,
+ 200,
+ "wrong status in test for " + JSON.stringify(test)
+ );
+ is(
+ res.statusText,
+ "OK",
+ "wrong status text for " + JSON.stringify(test)
+ );
+ is(
+ res.type,
+ "cors",
+ "wrong response type for " + JSON.stringify(test)
+ );
+ var reqHost = new URL(req.url).host;
+ // If there is a service worker present, the redirections will be
+ // transparent, assuming that the original request is to the current
+ // site and would be intercepted.
+ if (isSWPresent) {
+ if (reqHost === location.host) {
+ is(
+ new URL(res.url).host,
+ reqHost,
+ "Response URL should be original URL with a SW present"
+ );
+ }
+ } else {
+ is(
+ new URL(res.url).host,
+ new URL(test.hops[test.hops.length - 1].server).host,
+ "Response URL should be redirected URL"
+ );
+ }
+ return res.text().then(function (v) {
+ is(
+ v,
+ "<res>hello pass</res>\n",
+ "wrong responseText in test for " + JSON.stringify(test)
+ );
+ });
+ },
+ function (e) {
+ ok(!test.pass, "Expected test failure for " + JSON.stringify(test));
+ ok(
+ e instanceof TypeError,
+ "Exception should be TypeError for " + JSON.stringify(test)
+ );
+ }
+ );
+ })(request, test)
+ );
+ }
+
+ return Promise.all(fetches);
+}
+
+function testNoCORSRedirects() {
+ var origin = "http://mochi.test:8888";
+
+ var tests = [
+ { pass: 1, method: "GET", hops: [{ server: "http://example.com" }] },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [{ server: origin }, { server: "http://example.com" }],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ // Must use a simple header due to no-cors header restrictions.
+ headers: { "accept-language": "en-us" },
+ hops: [{ server: origin }, { server: "http://example.com" }],
+ },
+ {
+ pass: 1,
+ method: "GET",
+ hops: [
+ { server: origin },
+ { server: "http://example.com" },
+ { server: origin },
+ ],
+ },
+ {
+ pass: 1,
+ method: "POST",
+ body: "upload body here",
+ hops: [{ server: origin }, { server: "http://example.com" }],
+ },
+ {
+ pass: 0,
+ method: "DELETE",
+ hops: [{ server: origin }, { server: "http://example.com" }],
+ },
+ ];
+
+ var fetches = [];
+ for (test of tests) {
+ req = {
+ url:
+ test.hops[0].server +
+ corsServerPath +
+ "hop=1&hops=" +
+ escape(JSON.stringify(test.hops)),
+ method: test.method,
+ headers: test.headers,
+ body: test.body,
+ };
+
+ if (test.headers) {
+ req.url += "&headers=" + escape(JSON.stringify(test.headers));
+ }
+
+ if (test.pass) {
+ if (test.body) {
+ req.url += "&body=" + escape(test.body);
+ }
+ }
+
+ fetches.push(
+ (function (req, test) {
+ return new Promise(function (resolve, reject) {
+ resolve(
+ new Request(req.url, {
+ mode: "no-cors",
+ method: req.method,
+ headers: req.headers,
+ body: req.body,
+ })
+ );
+ })
+ .then(function (request) {
+ return fetch(request);
+ })
+ .then(
+ function (res) {
+ ok(
+ test.pass,
+ "Expected test to pass for " + JSON.stringify(test)
+ );
+ // All requests are cross-origin no-cors, we should always have
+ // an opaque response here. All values on the opaque response
+ // should be hidden.
+ is(
+ res.type,
+ "opaque",
+ "wrong response type for " + JSON.stringify(test)
+ );
+ is(
+ res.status,
+ 0,
+ "wrong status in test for " + JSON.stringify(test)
+ );
+ is(
+ res.statusText,
+ "",
+ "wrong status text for " + JSON.stringify(test)
+ );
+ is(res.url, "", "wrong response url for " + JSON.stringify(test));
+ return res.text().then(function (v) {
+ is(
+ v,
+ "",
+ "wrong responseText in test for " + JSON.stringify(test)
+ );
+ });
+ },
+ function (e) {
+ ok(
+ !test.pass,
+ "Expected test failure for " + JSON.stringify(test)
+ );
+ ok(
+ e instanceof TypeError,
+ "Exception should be TypeError for " + JSON.stringify(test)
+ );
+ }
+ );
+ })(req, test)
+ );
+ }
+
+ return Promise.all(fetches);
+}
+
+function testReferrer() {
+ var referrer;
+ if (self && self.location) {
+ referrer = self.location.href;
+ } else {
+ referrer = document.documentURI;
+ }
+
+ var dict = {
+ Referer: referrer,
+ };
+ return fetch(
+ corsServerPath + "headers=" + encodeURIComponent(JSON.stringify(dict))
+ ).then(
+ function (res) {
+ is(res.status, 200, "expected correct referrer header to be sent");
+ dump(res.statusText);
+ },
+ function (e) {
+ ok(false, "expected correct referrer header to be sent");
+ }
+ );
+}
+
+function runTest() {
+ testNoCorsCtor();
+ let promise = Promise.resolve();
+ if (typeof SpecialPowers === "object") {
+ promise = SpecialPowers.pushPrefEnv({
+ // Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default"
+ set: [["network.cookie.sameSite.laxByDefault", false]],
+ });
+ }
+
+ return promise
+ .then(testModeSameOrigin)
+ .then(testModeNoCors)
+ .then(testModeCors)
+ .then(testSameOriginCredentials)
+ .then(testCrossOriginCredentials)
+ .then(testModeNoCorsCredentials)
+ .then(testCORSRedirects)
+ .then(testNoCORSRedirects)
+ .then(testReferrer);
+ // Put more promise based tests here.
+}
diff --git a/dom/tests/mochitest/fetch/test_fetch_cors_sw_empty_reroute.html b/dom/tests/mochitest/fetch/test_fetch_cors_sw_empty_reroute.html
new file mode 100644
index 0000000000..ab519de573
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cors_sw_empty_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() CORS mode</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_cors.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_cors_sw_reroute.html b/dom/tests/mochitest/fetch/test_fetch_cors_sw_reroute.html
new file mode 100644
index 0000000000..ab519de573
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cors_sw_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test fetch() CORS mode</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_cors.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_csp_block.html b/dom/tests/mochitest/fetch/test_fetch_csp_block.html
new file mode 100644
index 0000000000..0347c7319e
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_csp_block.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test fetch() rejects when CSP blocks</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+
+function withFrame(url) {
+ return new Promise(resolve => {
+ let frame = document.createElement('iframe');
+ frame.addEventListener('load', _ => {
+ resolve(frame);
+ }, { once: true });
+ frame.src = url;
+ document.body.appendChild(frame);
+ });
+}
+
+function asyncTest(frame) {
+ return new Promise((resolve, reject) => {
+ addEventListener('message', evt => {
+ if (evt.data === 'REJECTED') {
+ resolve();
+ } else {
+ reject();
+ }
+ }, { once: true });
+ frame.contentWindow.postMessage('GO', '*');
+ });
+}
+
+withFrame('file_fetch_csp_block_frame.html').then(frame => {
+ asyncTest(frame).then(_ => {
+ ok(true, 'fetch rejected correctly');
+ }).catch(e => {
+ ok(false, 'fetch resolved when it should have been CSP blocked');
+ }).then(_ => {
+ frame.remove();
+ SimpleTest.finish();
+ });
+});
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/test_fetch_observer.html b/dom/tests/mochitest/fetch/test_fetch_observer.html
new file mode 100644
index 0000000000..7d9c80f4c8
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_observer.html
@@ -0,0 +1,40 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test FetchObserver</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+
+SpecialPowers.pushPrefEnv({"set": [["dom.fetchObserver.enabled", true ]]}, () => {
+ let ifr = document.createElement('iframe');
+ ifr.src = "file_fetch_observer.html";
+ document.body.appendChild(ifr);
+
+ onmessage = function(e) {
+ if (e.data.type == "finish") {
+ SimpleTest.finish();
+ return;
+ }
+
+ if (e.data.type == "check") {
+ ok(e.data.status, e.data.message);
+ return;
+ }
+
+ ok(false, "Something when wrong.");
+ }
+});
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_fetch_user_control_rp.html b/dom/tests/mochitest/fetch/test_fetch_user_control_rp.html
new file mode 100644
index 0000000000..67ad489191
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_user_control_rp.html
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test fetch user control referrer policy Bug 1304623</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+ const SJS = "://example.com/tests/dom/base/test/referrer_testserver.sjs?";
+ const PARAMS = ["SCHEME_FROM", "SCHEME_TO", "CROSS_ORIGIN"];
+
+ const testCases = [
+ {ACTION: ["generate-fetch-user-control-policy-test"],
+ PREFS: [['network.http.referer.defaultPolicy', 0]],
+ TESTS: [
+ // 0. No referrer.
+ {NAME: 'default-policy-value-no-referrer-https-http',
+ DESC: 'default-policy-value-no-referrer-https-http',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'http',
+ RESULT: 'none'},
+ {NAME: 'default-policy-value-no-referrer-https-https',
+ DESC: 'default-policy-value-no-referrer-https-https',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'https',
+ RESULT: 'none'}],
+ },
+ {ACTION: ["generate-fetch-user-control-policy-test"],
+ PREFS: [['network.http.referer.defaultPolicy', 1]],
+ TESTS: [
+ // 1. Same origin.
+ {NAME: 'default-policy-value-same-origin-https-http',
+ DESC: 'default-policy-value-same-origin-https-http',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'http',
+ RESULT: 'none'},
+ {NAME: 'default-policy-value-same-origin-http-https',
+ DESC: 'default-policy-value-same-origin-http-https',
+ SCHEME_FROM: 'http',
+ SCHEME_TO: 'https',
+ RESULT: 'none'},
+ {NAME: 'default-policy-value-same-origin-https-https',
+ DESC: 'default-policy-value-same-origin-https-https',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'https',
+ RESULT: 'full'}],
+ },
+ {ACTION: ["generate-fetch-user-control-policy-test"],
+ PREFS: [['network.http.referer.defaultPolicy', 2]],
+ TESTS: [
+ // 2. strict-origin-when-cross-origin.
+ {NAME: 'default-policy-value-strict-origin-when-cross-origin-https-http',
+ DESC: 'default-policy-value-strict-origin-when-cross-origin-https-http',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'http',
+ RESULT: 'none'},
+ {NAME: 'default-policy-value-strict-origin-when-cross-origin-http-https',
+ DESC: 'default-policy-value-strict-origin-when-cross-origin-http-https',
+ SCHEME_FROM: 'http',
+ SCHEME_TO: 'https',
+ RESULT: 'origin'},
+ {NAME: 'default-policy-value-strict-origin-when-cross-origin-https-https-same-origin',
+ DESC: 'default-policy-value-strict-origin-when-cross-origin-https-https-same-origin',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'https',
+ RESULT: 'full'},
+ {NAME: 'default-policy-value-strict-origin-when-cross-origin-https-https-cross-origin',
+ DESC: 'default-policy-value-strict-origin-when-cross-origin-https-https-cross-origin',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'https',
+ CROSS_ORIGIN: 'true',
+ RESULT: 'origin'}],
+ },
+ {ACTION: ["generate-fetch-user-control-policy-test"],
+ PREFS: [['network.http.referer.defaultPolicy', 3]],
+ TESTS: [
+ // 3. Default no-referrer-when-downgrade.
+ {NAME: 'default-policy-value-no-referrer-when-downgrade-https-http',
+ DESC: 'default-policy-value-no-referrer-when-downgrade-https-http',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'http',
+ RESULT: 'none'},
+ {NAME: 'default-policy-value-no-referrer-when-downgrade-http-https',
+ DESC: 'default-policy-value-no-referrer-when-downgrade-http-https',
+ SCHEME_FROM: 'http',
+ SCHEME_TO: 'https',
+ RESULT: 'full'},
+ {NAME: 'default-policy-value-no-referrer-when-downgrade-https-https',
+ DESC: 'default-policy-value-no-referrer-when-downgrade-https-https',
+ SCHEME_FROM: 'https',
+ SCHEME_TO: 'https',
+ RESULT: 'full'}],
+ },
+ ];
+
+ </script>
+ <script type="application/javascript" src="/tests/dom/base/test/referrer_helper.js"></script>
+
+</head>
+<body onload="tests.next();">
+ <iframe id="testframe"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/test_formdataparsing.html b/dom/tests/mochitest/fetch/test_formdataparsing.html
new file mode 100644
index 0000000000..d82f9425ad
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_formdataparsing.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1109751 - Test FormData parsing</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_formdataparsing.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_formdataparsing.js b/dom/tests/mochitest/fetch/test_formdataparsing.js
new file mode 100644
index 0000000000..5792ddfe01
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_formdataparsing.js
@@ -0,0 +1,368 @@
+var boundary = "1234567891011121314151617";
+
+// fn(body) should create a Body subclass with content body treated as
+// FormData and return it.
+function testFormDataParsing(fn) {
+ function makeTest(shouldPass, input, testFn) {
+ var obj = fn(input);
+ return obj.formData().then(
+ function (fd) {
+ ok(shouldPass, "Expected test to be valid FormData for " + input);
+ if (testFn) {
+ return testFn(fd);
+ }
+ },
+ function (e) {
+ if (shouldPass) {
+ ok(false, "Expected test to pass for " + input);
+ } else {
+ ok(e.name == "TypeError", "Error should be a TypeError.");
+ }
+ }
+ );
+ }
+
+ // [shouldPass?, input, testFn]
+ var tests = [
+ [
+ true,
+
+ boundary +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+
+ function (fd) {
+ is(fd.get("greeting"), '"hello"');
+ },
+ ],
+ [
+ false,
+
+ // Invalid disposition.
+ boundary +
+ '\r\nContent-Disposition: form-datafoobar; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ true,
+
+ "--" +
+ boundary +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+
+ function (fd) {
+ is(fd.get("greeting"), '"hello"');
+ },
+ ],
+ [false, boundary + "\r\n\r\n" + boundary + "-"],
+ [
+ false,
+ // No valid ending.
+ boundary + "\r\n\r\n" + boundary,
+ ],
+ [
+ false,
+
+ // One '-' prefix is not allowed. 2 or none.
+ "-" +
+ boundary +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ "invalid" +
+ boundary +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ "suffix" +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ "suffix" +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ // Partial boundary
+ boundary.substr(3) +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ // Missing '\n' at beginning.
+ '\rContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ // No form-data.
+ '\r\nContent-Disposition: mixed; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ // No headers.
+ '\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ // No content-disposition.
+ '\r\nContent-Dispositypo: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ // No name.
+ '\r\nContent-Disposition: form-data;\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ // Missing empty line between headers and body.
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ // Empty entry followed by valid entry.
+ boundary +
+ "\r\n\r\n" +
+ boundary +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+
+ boundary +
+ // Header followed by empty line, but empty body not followed by
+ // newline.
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ true,
+
+ boundary +
+ // Empty body followed by newline.
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n\r\n' +
+ boundary +
+ "-",
+
+ function (fd) {
+ is(fd.get("greeting"), "", "Empty value is allowed.");
+ },
+ ],
+ [
+ false,
+ boundary +
+ // Value is boundary itself.
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n' +
+ boundary +
+ "\r\n" +
+ boundary +
+ "-",
+ ],
+ [
+ false,
+ boundary +
+ // Variant of above with no valid ending boundary.
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n' +
+ boundary,
+ ],
+ [
+ true,
+ boundary +
+ // Unquoted filename with empty body.
+ '\r\nContent-Disposition: form-data; name="file"; filename=file1.txt\r\n\r\n\r\n' +
+ boundary +
+ "-",
+
+ function (fd) {
+ var f = fd.get("file");
+ ok(
+ f instanceof File,
+ "Entry with filename attribute should be read as File."
+ );
+ is(f.name, "file1.txt", "Filename should match.");
+ is(f.type, "text/plain", "Default content-type should be text/plain.");
+ return readAsText(f).then(function (text) {
+ is(text, "", "File should be empty.");
+ });
+ },
+ ],
+ [
+ true,
+ boundary +
+ // Quoted filename with empty body.
+ '\r\nContent-Disposition: form-data; name="file"; filename="file1.txt"\r\n\r\n\r\n' +
+ boundary +
+ "-",
+
+ function (fd) {
+ var f = fd.get("file");
+ ok(
+ f instanceof File,
+ "Entry with filename attribute should be read as File."
+ );
+ is(f.name, "file1.txt", "Filename should match.");
+ is(f.type, "text/plain", "Default content-type should be text/plain.");
+ return readAsText(f).then(function (text) {
+ is(text, "", "File should be empty.");
+ });
+ },
+ ],
+ [
+ false,
+ boundary +
+ // Invalid filename
+ '\r\nContent-Disposition: form-data; name="file"; filename="[\n@;xt"\r\n\r\n\r\n' +
+ boundary +
+ "-",
+ ],
+ [
+ true,
+ boundary +
+ '\r\nContent-Disposition: form-data; name="file"; filename="[@;xt"\r\n\r\n\r\n' +
+ boundary +
+ "-",
+
+ function (fd) {
+ var f = fd.get("file");
+ ok(
+ f instanceof File,
+ "Entry with filename attribute should be read as File."
+ );
+ is(f.name, "[@", "Filename should match.");
+ },
+ ],
+ [
+ true,
+ boundary +
+ '\r\nContent-Disposition: form-data; name="file"; filename="file with spaces"\r\n\r\n\r\n' +
+ boundary +
+ "-",
+
+ function (fd) {
+ var f = fd.get("file");
+ ok(
+ f instanceof File,
+ "Entry with filename attribute should be read as File."
+ );
+ is(f.name, "file with spaces", "Filename should match.");
+ },
+ ],
+ [
+ true,
+ boundary +
+ "\r\n" +
+ 'Content-Disposition: form-data; name="file"; filename="xml.txt"\r\n' +
+ "content-type : application/xml\r\n" +
+ "\r\n" +
+ "<body>foobar\r\n\r\n</body>\r\n" +
+ boundary +
+ "-",
+
+ function (fd) {
+ var f = fd.get("file");
+ ok(
+ f instanceof File,
+ "Entry with filename attribute should be read as File."
+ );
+ is(f.name, "xml.txt", "Filename should match.");
+ is(
+ f.type,
+ "application/xml",
+ "content-type should be application/xml."
+ );
+ return readAsText(f).then(function (text) {
+ is(
+ text,
+ "<body>foobar\r\n\r\n</body>",
+ "File should have correct text."
+ );
+ });
+ },
+ ],
+ ];
+
+ var promises = [];
+ for (var i = 0; i < tests.length; ++i) {
+ var test = tests[i];
+ promises.push(makeTest(test[0], test[1], test[2]));
+ }
+
+ return Promise.all(promises);
+}
+
+function makeRequest(body) {
+ var req = new Request("", {
+ method: "post",
+ body,
+ headers: {
+ "Content-Type": "multipart/form-data; boundary=" + boundary,
+ },
+ });
+ return req;
+}
+
+function makeResponse(body) {
+ var res = new Response(body, {
+ headers: {
+ "Content-Type": "multipart/form-data; boundary=" + boundary,
+ },
+ });
+ return res;
+}
+
+function runTest() {
+ return Promise.all([
+ testFormDataParsing(makeRequest),
+ testFormDataParsing(makeResponse),
+ ]);
+}
diff --git a/dom/tests/mochitest/fetch/test_formdataparsing_sw_reroute.html b/dom/tests/mochitest/fetch/test_formdataparsing_sw_reroute.html
new file mode 100644
index 0000000000..0e25c404a9
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_formdataparsing_sw_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1109751 - Test FormData parsing</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_formdataparsing.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_headers.html b/dom/tests/mochitest/fetch/test_headers.html
new file mode 100644
index 0000000000..b9cad02c2f
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_headers.html
@@ -0,0 +1,17 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test Fetch Headers - Basic</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_headers_common.js");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/test_headers_common.js b/dom/tests/mochitest/fetch/test_headers_common.js
new file mode 100644
index 0000000000..3b2604f88f
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_headers_common.js
@@ -0,0 +1,327 @@
+//
+// Utility functions
+//
+
+function shouldThrow(func, expected, msg) {
+ var err;
+ try {
+ func();
+ } catch (e) {
+ err = e;
+ } finally {
+ ok(err instanceof expected, msg);
+ }
+}
+
+function recursiveArrayCompare(actual, expected) {
+ is(
+ Array.isArray(actual),
+ Array.isArray(expected),
+ "Both should either be arrays, or not"
+ );
+ if (Array.isArray(actual) && Array.isArray(expected)) {
+ var diff = actual.length !== expected.length;
+
+ for (var i = 0, n = actual.length; !diff && i < n; ++i) {
+ diff = recursiveArrayCompare(actual[i], expected[i]);
+ }
+
+ return diff;
+ } else {
+ return actual !== expected;
+ }
+}
+
+function arrayEquals(actual, expected, msg) {
+ if (actual === expected) {
+ return;
+ }
+
+ var diff = recursiveArrayCompare(actual, expected);
+
+ ok(!diff, msg);
+ if (diff) {
+ is(actual, expected, msg);
+ }
+}
+
+function checkHas(headers, name, msg) {
+ function doCheckHas(n) {
+ return headers.has(n);
+ }
+ return _checkHas(doCheckHas, headers, name, msg);
+}
+
+function checkNotHas(headers, name, msg) {
+ function doCheckNotHas(n) {
+ return !headers.has(n);
+ }
+ return _checkHas(doCheckNotHas, headers, name, msg);
+}
+
+function _checkHas(func, headers, name, msg) {
+ ok(func(name), msg);
+ ok(func(name.toLowerCase()), msg);
+ ok(func(name.toUpperCase()), msg);
+}
+
+function checkGet(headers, name, expected, msg) {
+ is(headers.get(name), expected, msg);
+ is(headers.get(name.toLowerCase()), expected, msg);
+ is(headers.get(name.toUpperCase()), expected, msg);
+}
+
+//
+// Test Cases
+//
+
+function TestCoreBehavior(headers, name) {
+ var start = headers.get(name);
+
+ headers.append(name, "bar");
+
+ checkHas(headers, name, "Has the header");
+ var expected = start ? start.concat(", bar") : "bar";
+ checkGet(headers, name, expected, "Retrieve all headers for name");
+
+ headers.append(name, "baz");
+ checkHas(headers, name, "Has the header");
+ expected = start ? start.concat(", bar, baz") : "bar, baz";
+ checkGet(headers, name, expected, "Retrieve all headers for name");
+
+ headers.set(name, "snafu");
+ checkHas(headers, name, "Has the header after set");
+ checkGet(headers, name, "snafu", "Retrieve all headers after set");
+
+ const value_bam = "boom";
+ let testHTTPWhitespace = ["\t", "\n", "\r", " "];
+ while (testHTTPWhitespace.length) {
+ headers.delete(name);
+
+ let char = testHTTPWhitespace.shift();
+ headers.set(name, char);
+ checkGet(
+ headers,
+ name,
+ "",
+ "Header value " +
+ char +
+ " should be normalized before checking and throwing"
+ );
+ headers.delete(name);
+
+ let valueFront = char + value_bam;
+ headers.set(name, valueFront);
+ checkGet(
+ headers,
+ name,
+ value_bam,
+ "Header value " +
+ valueFront +
+ " should be normalized before checking and throwing"
+ );
+
+ headers.delete(name);
+
+ let valueBack = value_bam + char;
+ headers.set(name, valueBack);
+ checkGet(
+ headers,
+ name,
+ value_bam,
+ "Header value " +
+ valueBack +
+ " should be normalized before checking and throwing"
+ );
+ }
+
+ headers.delete(name.toUpperCase());
+ checkNotHas(headers, name, "Does not have the header after delete");
+ checkGet(headers, name, null, "Retrieve all headers after delete");
+
+ // should be ok to delete non-existent name
+ headers.delete(name);
+
+ shouldThrow(
+ function () {
+ headers.append("foo,", "bam");
+ },
+ TypeError,
+ "Append invalid header name should throw TypeError."
+ );
+
+ shouldThrow(
+ function () {
+ headers.append(name, "ba\nm");
+ },
+ TypeError,
+ "Append invalid header value should throw TypeError."
+ );
+
+ shouldThrow(
+ function () {
+ headers.append(name, "ba\rm");
+ },
+ TypeError,
+ "Append invalid header value should throw TypeError."
+ );
+
+ ok(!headers.guard, "guard should be undefined in content");
+}
+
+function TestEmptyHeaders() {
+ is(typeof Headers, "function", "Headers global constructor exists.");
+ var headers = new Headers();
+ ok(headers, "Constructed empty Headers object");
+ TestCoreBehavior(headers, "foo");
+}
+
+function TestFilledHeaders() {
+ var source = new Headers();
+ var filled = new Headers(source);
+ ok(filled, "Fill header from empty header");
+ TestCoreBehavior(filled, "foo");
+
+ source = new Headers();
+ source.append("abc", "123");
+ source.append("def", "456");
+ source.append("def", "789");
+
+ filled = new Headers(source);
+ checkGet(
+ filled,
+ "abc",
+ source.get("abc"),
+ "Single value header list matches"
+ );
+ checkGet(
+ filled,
+ "def",
+ source.get("def"),
+ "Multiple value header list matches"
+ );
+ TestCoreBehavior(filled, "def");
+
+ filled = new Headers({
+ zxy: "987",
+ xwv: "654",
+ uts: "321",
+ });
+ checkGet(filled, "zxy", "987", "Has first object filled key");
+ checkGet(filled, "xwv", "654", "Has second object filled key");
+ checkGet(filled, "uts", "321", "Has third object filled key");
+ TestCoreBehavior(filled, "xwv");
+
+ filled = new Headers([
+ ["zxy", "987"],
+ ["xwv", "654"],
+ ["xwv", "abc"],
+ ["uts", "321"],
+ ]);
+ checkGet(filled, "zxy", "987", "Has first sequence filled key");
+ checkGet(filled, "xwv", "654, abc", "Has second sequence filled key");
+ checkGet(filled, "uts", "321", "Has third sequence filled key");
+ TestCoreBehavior(filled, "xwv");
+
+ shouldThrow(
+ function () {
+ filled = new Headers([
+ ["zxy", "987", "654"],
+ ["uts", "321"],
+ ]);
+ },
+ TypeError,
+ "Fill with non-tuple sequence should throw TypeError."
+ );
+
+ shouldThrow(
+ function () {
+ filled = new Headers([["zxy"], ["uts", "321"]]);
+ },
+ TypeError,
+ "Fill with non-tuple sequence should throw TypeError."
+ );
+}
+
+function iterate(iter) {
+ var result = [];
+ for (var val = iter.next(); !val.done; ) {
+ result.push(val.value);
+ val = iter.next();
+ }
+ return result;
+}
+
+function iterateForOf(iter) {
+ var result = [];
+ for (var value of iter) {
+ result.push(value);
+ }
+ return result;
+}
+
+function byteInflate(str) {
+ var encoder = new TextEncoder();
+ var encoded = encoder.encode(str);
+ var result = "";
+ for (var i = 0; i < encoded.length; ++i) {
+ result += String.fromCharCode(encoded[i]);
+ }
+ return result;
+}
+
+function TestHeadersIterator() {
+ var ehsanInflated = byteInflate("احسان");
+ var headers = new Headers();
+ headers.set("foo0", "bar0");
+ headers.append("foo", "bar");
+ headers.append("foo", ehsanInflated);
+ headers.append("Foo2", "bar2");
+ headers.set("Foo2", "baz2");
+ headers.set("foo3", "bar3");
+ headers.delete("foo0");
+ headers.delete("foo3");
+
+ var key_iter = headers.keys();
+ var value_iter = headers.values();
+ var entries_iter = headers.entries();
+
+ arrayEquals(iterate(key_iter), ["foo", "foo2"], "Correct key iterator");
+ arrayEquals(
+ iterate(value_iter),
+ ["bar, " + ehsanInflated, "baz2"],
+ "Correct value iterator"
+ );
+ arrayEquals(
+ iterate(entries_iter),
+ [
+ ["foo", "bar, " + ehsanInflated],
+ ["foo2", "baz2"],
+ ],
+ "Correct entries iterator"
+ );
+
+ arrayEquals(
+ iterateForOf(headers),
+ [
+ ["foo", "bar, " + ehsanInflated],
+ ["foo2", "baz2"],
+ ],
+ "Correct entries iterator"
+ );
+ arrayEquals(
+ iterateForOf(new Headers(headers)),
+ [
+ ["foo", "bar, " + ehsanInflated],
+ ["foo2", "baz2"],
+ ],
+ "Correct entries iterator"
+ );
+}
+
+function runTest() {
+ TestEmptyHeaders();
+ TestFilledHeaders();
+ TestHeadersIterator();
+ return Promise.resolve();
+}
diff --git a/dom/tests/mochitest/fetch/test_headers_mainthread.html b/dom/tests/mochitest/fetch/test_headers_mainthread.html
new file mode 100644
index 0000000000..de78b364e3
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_headers_mainthread.html
@@ -0,0 +1,155 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test Fetch Headers - Basic</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="test_headers_common.js"> </script>
+<script type="text/javascript">
+// Main thread specific tests because they need SpecialPowers. Expects
+// test_headers_common.js to already be loaded.
+
+function TestRequestHeaders() {
+ is(typeof Headers, "function", "Headers global constructor exists.");
+ var headers = new Headers();
+ ok(headers, "Constructed empty Headers object");
+ SpecialPowers.wrap(headers).guard = "request";
+ TestCoreBehavior(headers, "foo");
+ var forbidden = [
+ "Accept-Charset",
+ "Accept-Encoding",
+ "Access-Control-Request-Headers",
+ "Access-Control-Request-Method",
+ "Connection",
+ "Content-Length",
+ "Cookie",
+ "Cookie2",
+ "Date",
+ "DNT",
+ "Expect",
+ "Host",
+ "Keep-Alive",
+ "Origin",
+ "Referer",
+ "TE",
+ "Trailer",
+ "Transfer-Encoding",
+ "Upgrade",
+ "Via",
+ "Proxy-Authorization",
+ "Proxy-blarg",
+ "Proxy-",
+ "Sec-foo",
+ "Sec-"
+ ];
+
+ for (var i = 0, n = forbidden.length; i < n; ++i) {
+ var name = forbidden[i];
+ headers.append(name, "hmm");
+ checkNotHas(headers, name, "Should not be able to append " + name + " to request headers");
+ headers.set(name, "hmm");
+ checkNotHas(headers, name, "Should not be able to set " + name + " on request headers");
+ }
+}
+
+function TestRequestNoCorsHeaders() {
+ is(typeof Headers, "function", "Headers global constructor exists.");
+ var headers = new Headers();
+ ok(headers, "Constructed empty Headers object");
+ SpecialPowers.wrap(headers).guard = "request-no-cors";
+
+ headers.append("foo", "bar");
+ checkNotHas(headers, "foo", "Should not be able to append arbitrary headers to request-no-cors headers.");
+ headers.set("foo", "bar");
+ checkNotHas(headers, "foo", "Should not be able to set arbitrary headers on request-no-cors headers.");
+
+ var simpleNames = [
+ "Accept",
+ "Accept-Language",
+ "Content-Language"
+ ];
+
+ var simpleContentTypes = [
+ "application/x-www-form-urlencoded",
+ "multipart/form-data",
+ "text/plain",
+ "application/x-www-form-urlencoded; charset=utf-8",
+ "multipart/form-data; charset=utf-8",
+ "text/plain; charset=utf-8"
+ ];
+
+ for (var i = 0, n = simpleNames.length; i < n; ++i) {
+ var name = simpleNames[i];
+ headers.append(name, "hmm");
+ checkHas(headers, name, "Should be able to append " + name + " to request-no-cors headers");
+ headers.set(name, "hmm");
+ checkHas(headers, name, "Should be able to set " + name + " on request-no-cors headers");
+ }
+
+ for (var i = 0, n = simpleContentTypes.length; i < n; ++i) {
+ var value = simpleContentTypes[i];
+ headers.append("Content-Type", value);
+ checkHas(headers, "Content-Type", "Should be able to append " + value + " Content-Type to request-no-cors headers");
+ headers.delete("Content-Type");
+ headers.set("Content-Type", value);
+ checkHas(headers, "Content-Type", "Should be able to set " + value + " Content-Type on request-no-cors headers");
+ }
+}
+
+function TestResponseHeaders() {
+ is(typeof Headers, "function", "Headers global constructor exists.");
+ var headers = new Headers();
+ ok(headers, "Constructed empty Headers object");
+ SpecialPowers.wrap(headers).guard = "response";
+ TestCoreBehavior(headers, "foo");
+ var forbidden = [
+ "Set-Cookie",
+ "Set-Cookie2"
+ ];
+
+ for (var i = 0, n = forbidden.length; i < n; ++i) {
+ var name = forbidden[i];
+ headers.append(name, "hmm");
+ checkNotHas(headers, name, "Should not be able to append " + name + " to response headers");
+ headers.set(name, "hmm");
+ checkNotHas(headers, name, "Should not be able to set " + name + " on response headers");
+ }
+}
+
+function TestImmutableHeaders() {
+ is(typeof Headers, "function", "Headers global constructor exists.");
+ var headers = new Headers();
+ ok(headers, "Constructed empty Headers object");
+ TestCoreBehavior(headers, "foo");
+ headers.append("foo", "atleastone");
+
+ SpecialPowers.wrap(headers).guard = "immutable";
+
+ shouldThrow(function() {
+ headers.append("foo", "wat");
+ }, TypeError, "Should not be able to append to immutable headers");
+
+ shouldThrow(function() {
+ headers.set("foo", "wat");
+ }, TypeError, "Should not be able to set immutable headers");
+
+ shouldThrow(function() {
+ headers.delete("foo");
+ }, TypeError, "Should not be able to delete immutable headers");
+
+ checkHas(headers, "foo", "Should be able to check immutable headers");
+ ok(headers.get("foo"), "Should be able to get immutable headers");
+}
+
+TestRequestHeaders();
+TestRequestNoCorsHeaders();
+TestResponseHeaders();
+TestImmutableHeaders();
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_headers_sw_reroute.html b/dom/tests/mochitest/fetch/test_headers_sw_reroute.html
new file mode 100644
index 0000000000..eb8d1109bd
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_headers_sw_reroute.html
@@ -0,0 +1,17 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test Fetch Headers - Basic</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_headers_common.js");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/test_readableStreams.html b/dom/tests/mochitest/fetch/test_readableStreams.html
new file mode 100644
index 0000000000..1731aa8bae
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_readableStreams.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for ReadableStreams and Fetch</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="common_readableStreams.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <script type="application/javascript">
+
+async function tests() {
+ await SpecialPowers.pushPrefEnv({
+ "set": [["dom.caches.enabled", true],
+ ["dom.caches.testing.enabled", true],
+ ["dom.quotaManager.testing", true]]
+ });
+
+ await test_nativeStream(SAME_COMPARTMENT);
+ await test_nativeStream(IFRAME_COMPARTMENT);
+ await workify('test_nativeStream');
+
+ await test_timeout(SAME_COMPARTMENT);
+ await test_timeout(IFRAME_COMPARTMENT);
+ await workify('test_timeout');
+
+ await test_nonNativeStream(SAME_COMPARTMENT);
+ await test_nonNativeStream(IFRAME_COMPARTMENT);
+ await workify('test_nonNativeStream');
+
+ await test_pendingStream(SAME_COMPARTMENT);
+ await test_pendingStream(IFRAME_COMPARTMENT);
+ await workify('test_pendingStream');
+
+ await test_noUint8Array(SAME_COMPARTMENT);
+ await test_noUint8Array(IFRAME_COMPARTMENT);
+ await workify('test_noUint8Array');
+
+ // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
+ // Acquire storage access permission here so that the cache works in xorigin
+ // tests. Otherwise, the iframe containing this page is isolated from
+ // first-party storage access, which isolates the caches object.
+ if (isXOrigin) {
+ SpecialPowers.wrap(document).notifyUserGestureActivation();
+ await SpecialPowers.addPermission(
+ "storageAccessAPI",
+ true,
+ window.location.href
+ );
+ await SpecialPowers.wrap(document).requestStorageAccess();
+ }
+
+ await test_nativeStream_cache(SAME_COMPARTMENT);
+ await test_nativeStream_cache(IFRAME_COMPARTMENT);
+ await workify('test_nativeStream_cache');
+
+ await test_nonNativeStream_cache(SAME_COMPARTMENT);
+ await test_nonNativeStream_cache(IFRAME_COMPARTMENT);
+ await workify('test_nonNativeStream_cache');
+
+ await test_codeExecution(SAME_COMPARTMENT);
+ await test_codeExecution(IFRAME_COMPARTMENT);
+
+ await test_global(SAME_COMPARTMENT);
+ await test_global(IFRAME_COMPARTMENT);
+ await workify('test_global');
+}
+
+async function runTests() {
+ try {
+ await tests();
+ } catch (exc) {
+ ok(false, exc.toString());
+ } finally {
+ SimpleTest.finish();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+// The iframe starts the tests by calling parent.next() when it loads.
+ </script>
+ <iframe src="iframe_readableStreams.html" id="iframe"></iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_request.html b/dom/tests/mochitest/fetch/test_request.html
new file mode 100644
index 0000000000..3a35665eb5
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_request.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test Request object in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_request.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_request.js b/dom/tests/mochitest/fetch/test_request.js
new file mode 100644
index 0000000000..7abd833869
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_request.js
@@ -0,0 +1,744 @@
+function testDefaultCtor() {
+ var req = new Request("");
+ is(req.method, "GET", "Default Request method is GET");
+ ok(
+ req.headers instanceof Headers,
+ "Request should have non-null Headers object"
+ );
+ is(
+ req.url,
+ self.location.href,
+ "URL should be resolved with entry settings object's API base URL"
+ );
+ is(req.destination, "", "Default destination is the empty string.");
+ is(
+ req.referrer,
+ "about:client",
+ "Default referrer is `client` which serializes to about:client."
+ );
+ is(req.mode, "cors", "Request mode for string input is cors");
+ is(
+ req.credentials,
+ "same-origin",
+ "Default Request credentials is same-origin"
+ );
+ is(req.cache, "default", "Default Request cache is default");
+
+ var req = new Request(req);
+ is(req.method, "GET", "Default Request method is GET");
+ ok(
+ req.headers instanceof Headers,
+ "Request should have non-null Headers object"
+ );
+ is(
+ req.url,
+ self.location.href,
+ "URL should be resolved with entry settings object's API base URL"
+ );
+ is(req.destination, "", "Default destination is the empty string.");
+ is(
+ req.referrer,
+ "about:client",
+ "Default referrer is `client` which serializes to about:client."
+ );
+ is(req.mode, "cors", "Request mode string input is cors");
+ is(
+ req.credentials,
+ "same-origin",
+ "Default Request credentials is same-origin"
+ );
+ is(req.cache, "default", "Default Request cache is default");
+}
+
+function testClone() {
+ var orig = new Request("./cloned_request.txt", {
+ method: "POST",
+ headers: { "Sample-Header": "5" },
+ body: "Sample body",
+ mode: "same-origin",
+ credentials: "same-origin",
+ cache: "no-store",
+ });
+ var clone = orig.clone();
+ ok(clone.method === "POST", "Request method is POST");
+ ok(
+ clone.headers instanceof Headers,
+ "Request should have non-null Headers object"
+ );
+
+ is(
+ clone.headers.get("sample-header"),
+ "5",
+ "Request sample-header should be 5."
+ );
+ orig.headers.set("sample-header", 6);
+ is(
+ clone.headers.get("sample-header"),
+ "5",
+ "Cloned Request sample-header should continue to be 5."
+ );
+
+ ok(
+ clone.url === new URL("./cloned_request.txt", self.location.href).href,
+ "URL should be resolved with entry settings object's API base URL"
+ );
+ ok(
+ clone.referrer === "about:client",
+ "Default referrer is `client` which serializes to about:client."
+ );
+ ok(clone.mode === "same-origin", "Request mode is same-origin");
+ ok(clone.credentials === "same-origin", "Default credentials is same-origin");
+ ok(clone.cache === "no-store", "Default cache is no-store");
+
+ ok(!orig.bodyUsed, "Original body is not consumed.");
+ ok(!clone.bodyUsed, "Clone body is not consumed.");
+
+ var origBody = null;
+ var clone2 = null;
+ return orig
+ .text()
+ .then(function (body) {
+ origBody = body;
+ is(origBody, "Sample body", "Original body string matches");
+ ok(orig.bodyUsed, "Original body is consumed.");
+ ok(!clone.bodyUsed, "Clone body is not consumed.");
+
+ try {
+ orig.clone();
+ ok(false, "Cannot clone Request whose body is already consumed");
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "clone() of consumed body should throw TypeError"
+ );
+ }
+
+ clone2 = clone.clone();
+ return clone.text();
+ })
+ .then(function (body) {
+ is(body, origBody, "Clone body matches original body.");
+ ok(clone.bodyUsed, "Clone body is consumed.");
+
+ try {
+ clone.clone();
+ ok(false, "Cannot clone Request whose body is already consumed");
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "clone() of consumed body should throw TypeError"
+ );
+ }
+
+ return clone2.text();
+ })
+ .then(function (body) {
+ is(body, origBody, "Clone body matches original body.");
+ ok(clone2.bodyUsed, "Clone body is consumed.");
+
+ try {
+ clone2.clone();
+ ok(false, "Cannot clone Request whose body is already consumed");
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "clone() of consumed body should throw TypeError"
+ );
+ }
+ });
+}
+
+function testUsedRequest() {
+ // Passing a used request should fail.
+ var req = new Request("", { method: "post", body: "This is foo" });
+ var p1 = req.text().then(function (v) {
+ try {
+ var req2 = new Request(req);
+ ok(false, "Used Request cannot be passed to new Request");
+ } catch (e) {
+ ok(true, "Used Request cannot be passed to new Request");
+ }
+ });
+
+ // Passing a request should set the request as used.
+ var reqA = new Request("", { method: "post", body: "This is foo" });
+ var reqB = new Request(reqA);
+ is(
+ reqA.bodyUsed,
+ true,
+ "Passing a Request to another Request should set the former as used"
+ );
+ return p1;
+}
+
+function testSimpleUrlParse() {
+ // Just checks that the URL parser is actually being used.
+ var req = new Request("/file.html");
+ is(
+ req.url,
+ new URL("/file.html", self.location.href).href,
+ "URL parser should be used to resolve Request URL"
+ );
+}
+
+// Bug 1109574 - Passing a Request with null body should keep bodyUsed unset.
+function testBug1109574() {
+ var r1 = new Request("");
+ is(r1.bodyUsed, false, "Initial value of bodyUsed should be false");
+ var r2 = new Request(r1);
+ is(r1.bodyUsed, false, "Request with null body should not have bodyUsed set");
+ // This should succeed.
+ var r3 = new Request(r1);
+}
+
+// Bug 1184550 - Request constructor should always throw if used flag is set,
+// even if body is null
+function testBug1184550() {
+ var req = new Request("", { method: "post", body: "Test" });
+ fetch(req);
+ ok(req.bodyUsed, "Request body should be used immediately after fetch()");
+ return fetch(req)
+ .then(function (resp) {
+ ok(false, "Second fetch with same request should fail.");
+ })
+ .catch(function (err) {
+ is(err.name, "TypeError", "Second fetch with same request should fail.");
+ });
+}
+
+function testHeaderGuard() {
+ var headers = {
+ Cookie: "Custom cookie",
+ "Non-Simple-Header": "value",
+ };
+ var r1 = new Request("", { headers });
+ ok(
+ !r1.headers.has("Cookie"),
+ "Default Request header should have guard request and prevent setting forbidden header."
+ );
+ ok(
+ r1.headers.has("Non-Simple-Header"),
+ "Default Request header should have guard request and allow setting non-simple header."
+ );
+
+ var r2 = new Request("", { mode: "no-cors", headers });
+ ok(
+ !r2.headers.has("Cookie"),
+ "no-cors Request header should have guard request-no-cors and prevent setting non-simple header."
+ );
+ ok(
+ !r2.headers.has("Non-Simple-Header"),
+ "no-cors Request header should have guard request-no-cors and prevent setting non-simple header."
+ );
+}
+
+function testMode() {
+ try {
+ var req = new Request("http://example.com", { mode: "navigate" });
+ ok(
+ false,
+ "Creating a Request with navigate RequestMode should throw a TypeError"
+ );
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "Creating a Request with navigate RequestMode should throw a TypeError"
+ );
+ }
+}
+
+function testMethod() {
+ // These get normalized.
+ var allowed = ["delete", "get", "head", "options", "post", "put"];
+ for (var i = 0; i < allowed.length; ++i) {
+ try {
+ var r = new Request("", { method: allowed[i] });
+ ok(true, "Method " + allowed[i] + " should be allowed");
+ is(
+ r.method,
+ allowed[i].toUpperCase(),
+ "Standard HTTP method " + allowed[i] + " should be normalized"
+ );
+ } catch (e) {
+ ok(false, "Method " + allowed[i] + " should be allowed");
+ }
+ }
+
+ var allowed = ["pAtCh", "foo"];
+ for (var i = 0; i < allowed.length; ++i) {
+ try {
+ var r = new Request("", { method: allowed[i] });
+ ok(true, "Method " + allowed[i] + " should be allowed");
+ is(
+ r.method,
+ allowed[i],
+ "Non-standard but valid HTTP method " +
+ allowed[i] +
+ " should not be normalized"
+ );
+ } catch (e) {
+ ok(false, "Method " + allowed[i] + " should be allowed");
+ }
+ }
+
+ var forbidden = ["connect", "trace", "track", "<invalid token??"];
+ for (var i = 0; i < forbidden.length; ++i) {
+ try {
+ var r = new Request("", { method: forbidden[i] });
+ ok(false, "Method " + forbidden[i] + " should be forbidden");
+ } catch (e) {
+ ok(true, "Method " + forbidden[i] + " should be forbidden");
+ }
+ }
+
+ var allowedNoCors = ["get", "head", "post"];
+ for (var i = 0; i < allowedNoCors.length; ++i) {
+ try {
+ var r = new Request("", { method: allowedNoCors[i], mode: "no-cors" });
+ ok(
+ true,
+ "Method " + allowedNoCors[i] + " should be allowed in no-cors mode"
+ );
+ } catch (e) {
+ ok(
+ false,
+ "Method " + allowedNoCors[i] + " should be allowed in no-cors mode"
+ );
+ }
+ }
+
+ var forbiddenNoCors = ["aardvark", "delete", "options", "put"];
+ for (var i = 0; i < forbiddenNoCors.length; ++i) {
+ try {
+ var r = new Request("", { method: forbiddenNoCors[i], mode: "no-cors" });
+ ok(
+ false,
+ "Method " + forbiddenNoCors[i] + " should be forbidden in no-cors mode"
+ );
+ } catch (e) {
+ ok(
+ true,
+ "Method " + forbiddenNoCors[i] + " should be forbidden in no-cors mode"
+ );
+ }
+ }
+
+ // HEAD/GET requests cannot have a body.
+ try {
+ var r = new Request("", { method: "get", body: "hello" });
+ ok(false, "HEAD/GET request cannot have a body");
+ } catch (e) {
+ is(e.name, "TypeError", "HEAD/GET request cannot have a body");
+ }
+
+ try {
+ var r = new Request("", { method: "head", body: "hello" });
+ ok(false, "HEAD/GET request cannot have a body");
+ } catch (e) {
+ is(e.name, "TypeError", "HEAD/GET request cannot have a body");
+ }
+ // Non HEAD/GET should not throw.
+ var r = new Request("", { method: "patch", body: "hello" });
+}
+function testUrlFragment() {
+ var req = new Request("./request#withfragment");
+ is(
+ req.url,
+ new URL("./request#withfragment", self.location.href).href,
+ "request.url should be serialized without exclude fragment flag set"
+ );
+}
+function testUrlMalformed() {
+ try {
+ var req = new Request("http:// example.com");
+ ok(
+ false,
+ "Creating a Request with a malformed URL should throw a TypeError"
+ );
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "Creating a Request with a malformed URL should throw a TypeError"
+ );
+ }
+}
+
+function testUrlCredentials() {
+ try {
+ var req = new Request("http://user@example.com");
+ ok(false, "URLs with credentials should be rejected");
+ } catch (e) {
+ is(e.name, "TypeError", "URLs with credentials should be rejected");
+ }
+
+ try {
+ var req = new Request("http://user:password@example.com");
+ ok(false, "URLs with credentials should be rejected");
+ } catch (e) {
+ is(e.name, "TypeError", "URLs with credentials should be rejected");
+ }
+}
+
+function testBodyUsed() {
+ var req = new Request("./bodyused", { method: "post", body: "Sample body" });
+ is(req.bodyUsed, false, "bodyUsed is initially false.");
+ return req
+ .text()
+ .then(v => {
+ is(v, "Sample body", "Body should match");
+ is(req.bodyUsed, true, "After reading body, bodyUsed should be true.");
+ })
+ .then(v => {
+ return req.blob().then(
+ v => {
+ ok(false, "Attempting to read body again should fail.");
+ },
+ e => {
+ ok(true, "Attempting to read body again should fail.");
+ }
+ );
+ });
+}
+
+var text = "κόσμε";
+function testBodyCreation() {
+ var req1 = new Request("", { method: "post", body: text });
+ var p1 = req1.text().then(function (v) {
+ ok(typeof v === "string", "Should resolve to string");
+ is(text, v, "Extracted string should match");
+ });
+
+ var req2 = new Request("", {
+ method: "post",
+ body: new Uint8Array([72, 101, 108, 108, 111]),
+ });
+ var p2 = req2.text().then(function (v) {
+ is("Hello", v, "Extracted string should match");
+ });
+
+ var req2b = new Request("", {
+ method: "post",
+ body: new Uint8Array([72, 101, 108, 108, 111]).buffer,
+ });
+ var p2b = req2b.text().then(function (v) {
+ is("Hello", v, "Extracted string should match");
+ });
+
+ var reqblob = new Request("", { method: "post", body: new Blob([text]) });
+ var pblob = reqblob.text().then(function (v) {
+ is(v, text, "Extracted string should match");
+ });
+
+ // FormData has its own function since it has blobs and files.
+
+ var params = new URLSearchParams();
+ params.append("item", "Geckos");
+ params.append("feature", "stickyfeet");
+ params.append("quantity", "700");
+ var req3 = new Request("", { method: "post", body: params });
+ var p3 = req3.text().then(function (v) {
+ var extracted = new URLSearchParams(v);
+ is(extracted.get("item"), "Geckos", "Param should match");
+ is(extracted.get("feature"), "stickyfeet", "Param should match");
+ is(extracted.get("quantity"), "700", "Param should match");
+ });
+
+ return Promise.all([p1, p2, p2b, pblob, p3]);
+}
+
+function testFormDataBodyCreation() {
+ var f1 = new FormData();
+ f1.append("key", "value");
+ f1.append("foo", "bar");
+
+ var r1 = new Request("", { method: "post", body: f1 });
+ // Since f1 is serialized immediately, later additions should not show up.
+ f1.append("more", "stuff");
+ var p1 = r1.formData().then(function (fd) {
+ ok(fd instanceof FormData, "Valid FormData extracted.");
+ ok(fd.has("key"), "key should exist.");
+ ok(fd.has("foo"), "foo should exist.");
+ ok(!fd.has("more"), "more should not exist.");
+ });
+
+ f1.append("blob", new Blob([text]));
+ var r2 = new Request("", { method: "post", body: f1 });
+ f1.delete("key");
+ var p2 = r2.formData().then(function (fd) {
+ ok(fd instanceof FormData, "Valid FormData extracted.");
+ ok(fd.has("more"), "more should exist.");
+
+ var b = fd.get("blob");
+ is(b.name, "blob", "blob entry should be a Blob.");
+ ok(b instanceof Blob, "blob entry should be a Blob.");
+
+ return readAsText(b).then(function (output) {
+ is(output, text, "Blob contents should match.");
+ });
+ });
+
+ return Promise.all([p1, p2]);
+}
+
+function testBodyExtraction() {
+ var text = "κόσμε";
+ var newReq = function () {
+ return new Request("", { method: "post", body: text });
+ };
+ return newReq()
+ .text()
+ .then(function (v) {
+ ok(typeof v === "string", "Should resolve to string");
+ is(text, v, "Extracted string should match");
+ })
+ .then(function () {
+ return newReq()
+ .blob()
+ .then(function (v) {
+ ok(v instanceof Blob, "Should resolve to Blob");
+ return readAsText(v).then(function (result) {
+ is(result, text, "Decoded Blob should match original");
+ });
+ });
+ })
+ .then(function () {
+ return newReq()
+ .json()
+ .then(
+ function (v) {
+ ok(false, "Invalid json should reject");
+ },
+ function (e) {
+ ok(true, "Invalid json should reject");
+ }
+ );
+ })
+ .then(function () {
+ return newReq()
+ .arrayBuffer()
+ .then(function (v) {
+ ok(v instanceof ArrayBuffer, "Should resolve to ArrayBuffer");
+ var dec = new TextDecoder();
+ is(
+ dec.decode(new Uint8Array(v)),
+ text,
+ "UTF-8 decoded ArrayBuffer should match original"
+ );
+ });
+ })
+ .then(function () {
+ return newReq()
+ .formData()
+ .then(
+ function (v) {
+ ok(false, "invalid FormData read should fail.");
+ },
+ function (e) {
+ ok(e.name == "TypeError", "invalid FormData read should fail.");
+ }
+ );
+ });
+}
+
+function testFormDataBodyExtraction() {
+ // URLSearchParams translates to application/x-www-form-urlencoded.
+ var params = new URLSearchParams();
+ params.append("item", "Geckos");
+ params.append("feature", "stickyfeet");
+ params.append("quantity", "700");
+ params.append("quantity", "800");
+
+ var req = new Request("", { method: "POST", body: params });
+ var p1 = req.formData().then(function (fd) {
+ ok(fd.has("item"), "Has entry 'item'.");
+ ok(fd.has("feature"), "Has entry 'feature'.");
+ var entries = fd.getAll("quantity");
+ is(entries.length, 2, "Entries with same name are correctly handled.");
+ is(entries[0], "700", "Entries with same name are correctly handled.");
+ is(entries[1], "800", "Entries with same name are correctly handled.");
+ });
+
+ var f1 = new FormData();
+ f1.append("key", "value");
+ f1.append("foo", "bar");
+ f1.append("blob", new Blob([text]));
+ var r2 = new Request("", { method: "post", body: f1 });
+ var p2 = r2.formData().then(function (fd) {
+ ok(fd.has("key"), "Has entry 'key'.");
+ ok(fd.has("foo"), "Has entry 'foo'.");
+ ok(fd.has("blob"), "Has entry 'blob'.");
+ var entries = fd.getAll("blob");
+ is(entries.length, 1, "getAll returns all items.");
+ is(entries[0].name, "blob", "Filename should be blob.");
+ ok(entries[0] instanceof Blob, "getAll returns blobs.");
+ });
+
+ var ws = "\r\n\r\n\r\n\r\n";
+ f1.set(
+ "key",
+ new File([ws], "file name has spaces.txt", { type: "new/lines" })
+ );
+ var r3 = new Request("", { method: "post", body: f1 });
+ var p3 = r3.formData().then(function (fd) {
+ ok(fd.has("foo"), "Has entry 'foo'.");
+ ok(fd.has("blob"), "Has entry 'blob'.");
+ var entries = fd.getAll("blob");
+ is(entries.length, 1, "getAll returns all items.");
+ is(entries[0].name, "blob", "Filename should be blob.");
+ ok(entries[0] instanceof Blob, "getAll returns blobs.");
+
+ ok(fd.has("key"), "Has entry 'key'.");
+ var f = fd.get("key");
+ ok(f instanceof File, "entry should be a File.");
+ is(f.name, "file name has spaces.txt", "File name should match.");
+ is(f.type, "new/lines", "File type should match.");
+ is(f.size, ws.length, "File size should match.");
+ return readAsText(f).then(function (text) {
+ is(text, ws, "File contents should match.");
+ });
+ });
+
+ // Override header and ensure parse fails.
+ var boundary = "1234567891011121314151617";
+ var body =
+ boundary +
+ '\r\nContent-Disposition: form-data; name="greeting"\r\n\r\n"hello"\r\n' +
+ boundary +
+ "-";
+
+ var r4 = new Request("", {
+ method: "post",
+ body,
+ headers: {
+ "Content-Type": "multipart/form-datafoobar; boundary=" + boundary,
+ },
+ });
+ var p4 = r4.formData().then(
+ function () {
+ ok(false, "Invalid mimetype should fail.");
+ },
+ function () {
+ ok(true, "Invalid mimetype should fail.");
+ }
+ );
+
+ var r5 = new Request("", {
+ method: "POST",
+ body: params,
+ headers: {
+ "Content-Type": "application/x-www-form-urlencodedfoobar",
+ },
+ });
+ var p5 = r5.formData().then(
+ function () {
+ ok(false, "Invalid mimetype should fail.");
+ },
+ function () {
+ ok(true, "Invalid mimetype should fail.");
+ }
+ );
+ return Promise.all([p1, p2, p3, p4]);
+}
+
+// mode cannot be set to "CORS-with-forced-preflight" from javascript.
+function testModeCorsPreflightEnumValue() {
+ try {
+ var r = new Request(".", { mode: "cors-with-forced-preflight" });
+ ok(
+ false,
+ "Creating Request with mode cors-with-forced-preflight should fail."
+ );
+ } catch (e) {
+ ok(
+ true,
+ "Creating Request with mode cors-with-forced-preflight should fail."
+ );
+ // Also ensure that the error message matches error messages for truly
+ // invalid strings.
+ var invalidMode = "not-in-requestmode-enum";
+ var invalidExc;
+ try {
+ var r = new Request(".", { mode: invalidMode });
+ } catch (e) {
+ invalidExc = e;
+ }
+ var expectedMessage = invalidExc.message.replace(
+ invalidMode,
+ "cors-with-forced-preflight"
+ );
+ is(
+ e.message,
+ expectedMessage,
+ "mode cors-with-forced-preflight should throw same error as invalid RequestMode strings."
+ );
+ }
+}
+
+// HEAD/GET Requests are not allowed to have a body even when copying another
+// Request.
+function testBug1154268() {
+ var r1 = new Request("/index.html", { method: "POST", body: "Hi there" });
+ ["HEAD", "GET"].forEach(function (method) {
+ try {
+ var r2 = new Request(r1, { method });
+ ok(
+ false,
+ method + " Request copied from POST Request with body should fail."
+ );
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ method + " Request copied from POST Request with body should fail."
+ );
+ }
+ });
+}
+
+function testRequestConsumedByFailedConstructor() {
+ var r1 = new Request("http://example.com", {
+ method: "POST",
+ body: "hello world",
+ });
+ try {
+ var r2 = new Request(r1, { method: "GET" });
+ ok(false, "GET Request copied from POST Request with body should fail.");
+ } catch (e) {
+ ok(true, "GET Request copied from POST Request with body should fail.");
+ }
+ ok(
+ !r1.bodyUsed,
+ "Initial request should not be consumed by failed Request constructor"
+ );
+}
+
+function runTest() {
+ testDefaultCtor();
+ testSimpleUrlParse();
+ testUrlFragment();
+ testUrlCredentials();
+ testUrlMalformed();
+ testMode();
+ testMethod();
+ testBug1109574();
+ testBug1184550();
+ testHeaderGuard();
+ testModeCorsPreflightEnumValue();
+ testBug1154268();
+ testRequestConsumedByFailedConstructor();
+
+ return Promise.resolve()
+ .then(testBodyCreation)
+ .then(testBodyUsed)
+ .then(testBodyExtraction)
+ .then(testFormDataBodyCreation)
+ .then(testFormDataBodyExtraction)
+ .then(testUsedRequest)
+ .then(testClone());
+ // Put more promise based tests here.
+}
diff --git a/dom/tests/mochitest/fetch/test_request_context.html b/dom/tests/mochitest/fetch/test_request_context.html
new file mode 100644
index 0000000000..db8b8bdc6e
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_request_context.html
@@ -0,0 +1,19 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Make sure that Request.context is not exposed by default</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script>
+var req = new Request("");
+ok(!("context" in req), "Request.context should not be exposed by default");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_request_sw_reroute.html b/dom/tests/mochitest/fetch/test_request_sw_reroute.html
new file mode 100644
index 0000000000..0250148f1b
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_request_sw_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test Request object in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_request.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_response.html b/dom/tests/mochitest/fetch/test_response.html
new file mode 100644
index 0000000000..af75f957fc
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_response.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test Response object in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_response.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_response.js b/dom/tests/mochitest/fetch/test_response.js
new file mode 100644
index 0000000000..40a124bfc0
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_response.js
@@ -0,0 +1,346 @@
+function testDefaultCtor() {
+ var res = new Response();
+ is(res.type, "default", "Default Response type is default");
+ ok(
+ res.headers instanceof Headers,
+ "Response should have non-null Headers object"
+ );
+ is(res.url, "", "URL should be empty string");
+ is(res.status, 200, "Default status is 200");
+ is(res.statusText, "", "Default statusText is an empty string");
+}
+
+function testClone() {
+ var orig = new Response("This is a body", {
+ status: 404,
+ statusText: "Not Found",
+ headers: { "Content-Length": 5 },
+ });
+ var clone = orig.clone();
+ is(clone.status, 404, "Response status is 404");
+ is(clone.statusText, "Not Found", "Response statusText is POST");
+ ok(
+ clone.headers instanceof Headers,
+ "Response should have non-null Headers object"
+ );
+
+ is(
+ clone.headers.get("content-length"),
+ "5",
+ "Response content-length should be 5."
+ );
+ orig.headers.set("content-length", 6);
+ is(
+ clone.headers.get("content-length"),
+ "5",
+ "Response content-length should be 5."
+ );
+
+ ok(!orig.bodyUsed, "Original body is not consumed.");
+ ok(!clone.bodyUsed, "Clone body is not consumed.");
+
+ var origBody = null;
+ var clone2 = null;
+ return orig
+ .text()
+ .then(function (body) {
+ origBody = body;
+ is(origBody, "This is a body", "Original body string matches");
+ ok(orig.bodyUsed, "Original body is consumed.");
+ ok(!clone.bodyUsed, "Clone body is not consumed.");
+
+ try {
+ orig.clone();
+ ok(false, "Cannot clone Response whose body is already consumed");
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "clone() of consumed body should throw TypeError"
+ );
+ }
+
+ clone2 = clone.clone();
+ return clone.text();
+ })
+ .then(function (body) {
+ is(body, origBody, "Clone body matches original body.");
+ ok(clone.bodyUsed, "Clone body is consumed.");
+
+ try {
+ clone.clone();
+ ok(false, "Cannot clone Response whose body is already consumed");
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "clone() of consumed body should throw TypeError"
+ );
+ }
+
+ return clone2.text();
+ })
+ .then(function (body) {
+ is(body, origBody, "Clone body matches original body.");
+ ok(clone2.bodyUsed, "Clone body is consumed.");
+
+ try {
+ clone2.clone();
+ ok(false, "Cannot clone Response whose body is already consumed");
+ } catch (e) {
+ is(
+ e.name,
+ "TypeError",
+ "clone() of consumed body should throw TypeError"
+ );
+ }
+ });
+}
+
+function testCloneUnfiltered() {
+ var url =
+ "http://example.com/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?status=200";
+ return fetch(url, { mode: "no-cors" }).then(function (response) {
+ // By default the chrome-only function should not be available.
+ is(response.type, "opaque", "response should be opaque");
+ is(
+ response.cloneUnfiltered,
+ undefined,
+ "response.cloneUnfiltered should be undefined"
+ );
+
+ // When the test is run in a worker context we can't actually try to use
+ // the chrome-only function. SpecialPowers is not defined.
+ if (typeof SpecialPowers !== "object") {
+ return;
+ }
+
+ // With a chrome code, however, should be able to get an unfiltered response.
+ var chromeResponse = SpecialPowers.wrap(response);
+ is(
+ typeof chromeResponse.cloneUnfiltered,
+ "function",
+ "chromeResponse.cloneFiltered should be a function"
+ );
+ var unfiltered = chromeResponse.cloneUnfiltered();
+ is(unfiltered.type, "default", "unfiltered response should be default");
+ is(unfiltered.status, 200, "unfiltered response should have 200 status");
+ });
+}
+
+function testError() {
+ var res = Response.error();
+ is(res.status, 0, "Error response status should be 0");
+ try {
+ res.headers.set("someheader", "not allowed");
+ ok(false, "Error response should have immutable headers");
+ } catch (e) {
+ ok(true, "Error response should have immutable headers");
+ }
+}
+
+function testRedirect() {
+ var res = Response.redirect("./redirect.response");
+ is(res.status, 302, "Default redirect has status code 302");
+ is(res.statusText, "", "Default redirect has status text empty");
+ var h = res.headers.get("location");
+ ok(
+ h === new URL("./redirect.response", self.location.href).href,
+ "Location header should be correct absolute URL"
+ );
+ try {
+ res.headers.set("someheader", "not allowed");
+ ok(false, "Redirects should have immutable headers");
+ } catch (e) {
+ ok(true, "Redirects should have immutable headers");
+ }
+
+ var successStatus = [301, 302, 303, 307, 308];
+ for (var i = 0; i < successStatus.length; ++i) {
+ var res = Response.redirect("./redirect.response", successStatus[i]);
+ is(res.status, successStatus[i], "Status code should match");
+ }
+
+ var failStatus = [300, 0, 304, 305, 306, 309, 500];
+ for (var i = 0; i < failStatus.length; ++i) {
+ try {
+ var res = Response.redirect(".", failStatus[i]);
+ ok(false, "Invalid status code should fail " + failStatus[i]);
+ } catch (e) {
+ is(
+ e.name,
+ "RangeError",
+ "Invalid status code should fail " + failStatus[i]
+ );
+ }
+ }
+}
+
+function testOk() {
+ var r1 = new Response("", { status: 200 });
+ ok(r1.ok, "Response with status 200 should have ok true");
+
+ var r2 = new Response(undefined, { status: 204 });
+ ok(r2.ok, "Response with status 204 should have ok true");
+
+ var r3 = new Response("", { status: 299 });
+ ok(r3.ok, "Response with status 299 should have ok true");
+
+ var r4 = new Response("", { status: 302 });
+ ok(!r4.ok, "Response with status 302 should have ok false");
+}
+
+function testBodyUsed() {
+ var res = new Response("Sample body");
+ ok(!res.bodyUsed, "bodyUsed is initially false.");
+ return res
+ .text()
+ .then(v => {
+ is(v, "Sample body", "Body should match");
+ ok(res.bodyUsed, "After reading body, bodyUsed should be true.");
+ })
+ .then(() => {
+ return res.blob().then(
+ v => {
+ ok(false, "Attempting to read body again should fail.");
+ },
+ e => {
+ ok(true, "Attempting to read body again should fail.");
+ }
+ );
+ });
+}
+
+function testBodyCreation() {
+ var text = "κόσμε";
+ var res1 = new Response(text);
+ var p1 = res1.text().then(function (v) {
+ ok(typeof v === "string", "Should resolve to string");
+ is(text, v, "Extracted string should match");
+ });
+
+ var res2 = new Response(new Uint8Array([72, 101, 108, 108, 111]));
+ var p2 = res2.text().then(function (v) {
+ is("Hello", v, "Extracted string should match");
+ });
+
+ var res2b = new Response(new Uint8Array([72, 101, 108, 108, 111]).buffer);
+ var p2b = res2b.text().then(function (v) {
+ is("Hello", v, "Extracted string should match");
+ });
+
+ var resblob = new Response(new Blob([text]));
+ var pblob = resblob.text().then(function (v) {
+ is(v, text, "Extracted string should match");
+ });
+
+ var params = new URLSearchParams();
+ params.append("item", "Geckos");
+ params.append("feature", "stickyfeet");
+ params.append("quantity", "700");
+ var res3 = new Response(params);
+ var p3 = res3.text().then(function (v) {
+ var extracted = new URLSearchParams(v);
+ is(extracted.get("item"), "Geckos", "Param should match");
+ is(extracted.get("feature"), "stickyfeet", "Param should match");
+ is(extracted.get("quantity"), "700", "Param should match");
+ });
+
+ return Promise.all([p1, p2, p2b, pblob, p3]);
+}
+
+function testBodyExtraction() {
+ var text = "κόσμε";
+ var newRes = function () {
+ return new Response(text);
+ };
+ return newRes()
+ .text()
+ .then(function (v) {
+ ok(typeof v === "string", "Should resolve to string");
+ is(text, v, "Extracted string should match");
+ })
+ .then(function () {
+ return newRes()
+ .blob()
+ .then(function (v) {
+ ok(v instanceof Blob, "Should resolve to Blob");
+ return readAsText(v).then(function (result) {
+ is(result, text, "Decoded Blob should match original");
+ });
+ });
+ })
+ .then(function () {
+ return newRes()
+ .json()
+ .then(
+ function (v) {
+ ok(false, "Invalid json should reject");
+ },
+ function (e) {
+ ok(true, "Invalid json should reject");
+ }
+ );
+ })
+ .then(function () {
+ return newRes()
+ .arrayBuffer()
+ .then(function (v) {
+ ok(v instanceof ArrayBuffer, "Should resolve to ArrayBuffer");
+ var dec = new TextDecoder();
+ is(
+ dec.decode(new Uint8Array(v)),
+ text,
+ "UTF-8 decoded ArrayBuffer should match original"
+ );
+ });
+ });
+}
+
+function testNullBodyStatus() {
+ [204, 205, 304].forEach(function (status) {
+ try {
+ var res = new Response(new Blob(), { status });
+ ok(
+ false,
+ "Response body provided but status code does not permit a body"
+ );
+ } catch (e) {
+ ok(true, "Response body provided but status code does not permit a body");
+ }
+ });
+
+ [204, 205, 304].forEach(function (status) {
+ try {
+ var res = new Response(undefined, { status });
+ ok(true, "Response body provided but status code does not permit a body");
+ } catch (e) {
+ ok(
+ false,
+ "Response body provided but status code does not permit a body"
+ );
+ }
+ });
+}
+
+function runTest() {
+ testDefaultCtor();
+ testError();
+ testRedirect();
+ testOk();
+ testNullBodyStatus();
+
+ return (
+ Promise.resolve()
+ .then(testBodyCreation)
+ .then(testBodyUsed)
+ .then(testBodyExtraction)
+ .then(testClone)
+ .then(testCloneUnfiltered)
+ // Put more promise based tests here.
+ .catch(function (e) {
+ dump("### ### " + e + "\n");
+ ok(false, "got unexpected error!");
+ })
+ );
+}
diff --git a/dom/tests/mochitest/fetch/test_responseReadyForWasm.html b/dom/tests/mochitest/fetch/test_responseReadyForWasm.html
new file mode 100644
index 0000000000..7f312a9fb3
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_responseReadyForWasm.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Response ready to be used by wasm</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <script type="application/javascript">
+
+const isCachingEnabled = SpecialPowers.getBoolPref("javascript.options.wasm_caching");
+
+async function runTests() {
+ let response = await fetch("/tests/dom/promise/tests/test_webassembly_compile_sample.wasm");
+ ok(!!response, "Fetch a wasm module produces a Response object");
+ is(response.headers.get("content-type"), "application/wasm", "Correct content-type");
+ if (!isCachingEnabled) {
+ ok(!SpecialPowers.wrap(response).hasCacheInfoChannel, "nsICacheInfoChannel not available");
+ SimpleTest.finish();
+ return;
+ }
+
+ ok(SpecialPowers.wrap(response).hasCacheInfoChannel, "nsICacheInfoChannel available");
+
+ let clonedResponse = response.clone();
+ ok(!!clonedResponse, "Cloned response");
+ is(clonedResponse.headers.get("content-type"), "application/wasm", "Correct content-type");
+ ok(SpecialPowers.wrap(clonedResponse).hasCacheInfoChannel, "nsICacheInfoChannel available");
+
+ response = await fetch(location.href);
+ ok(!!response, "Fetch another resource");
+ ok(response.headers.get("content-type") != "application/wasm", "Correct content-type");
+ ok(!SpecialPowers.wrap(response).hasCacheInfoChannel, "nsICacheInfoChannel available");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+runTests();
+
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/test_response_sw_reroute.html b/dom/tests/mochitest/fetch/test_response_sw_reroute.html
new file mode 100644
index 0000000000..b7d52c9849
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_response_sw_reroute.html
@@ -0,0 +1,23 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1039846 - Test Response object in worker</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="utils.js"> </script>
+<script type="text/javascript" src="sw_reroute.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_response.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/test_temporaryFileBlob.html b/dom/tests/mochitest/fetch/test_temporaryFileBlob.html
new file mode 100644
index 0000000000..8c645e8416
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_temporaryFileBlob.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1312410</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="common_temporaryFileBlob.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <script type="application/javascript">
+
+var tests = [
+ // from common_temporaryFileBlob.js:
+ test_fetch_basic,
+ test_fetch_worker,
+ test_xhr_basic,
+ test_xhr_worker,
+ test_response_basic,
+ test_response_worker,
+ test_request_basic,
+ test_request_worker,
+];
+
+function next() {
+ if (!tests.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ var test = tests.shift();
+ test();
+}
+
+SpecialPowers.pushPrefEnv({ "set" : [[ "dom.blob.memoryToTemporaryFile", 1 ]] },
+ next);
+SimpleTest.waitForExplicitFinish();
+
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/fetch/test_webassembly_streaming.html b/dom/tests/mochitest/fetch/test_webassembly_streaming.html
new file mode 100644
index 0000000000..48311ca503
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_webassembly_streaming.html
@@ -0,0 +1,22 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test WebAssembly.compileStreaming() and instantiateStreaming()</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script type="text/javascript" src="fetch_test_framework.js"> </script>
+<script class="testbody" type="text/javascript">
+testScript("test_fetch_basic.js");
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/fetch/utils.js b/dom/tests/mochitest/fetch/utils.js
new file mode 100644
index 0000000000..8b93c1e90b
--- /dev/null
+++ b/dom/tests/mochitest/fetch/utils.js
@@ -0,0 +1,51 @@
+// Utilities
+// =========
+
+// Helper that uses FileReader or FileReaderSync based on context and returns
+// a Promise that resolves with the text or rejects with error.
+function readAsText(blob) {
+ if (typeof FileReader !== "undefined") {
+ return new Promise(function (resolve, reject) {
+ var fs = new FileReader();
+ fs.onload = function () {
+ resolve(fs.result);
+ };
+ fs.onerror = reject;
+ fs.readAsText(blob);
+ });
+ } else {
+ var fs = new FileReaderSync();
+ return Promise.resolve(fs.readAsText(blob));
+ }
+}
+
+function readAsArrayBuffer(blob) {
+ if (typeof FileReader !== "undefined") {
+ return new Promise(function (resolve, reject) {
+ var fs = new FileReader();
+ fs.onload = function () {
+ resolve(fs.result);
+ };
+ fs.onerror = reject;
+ fs.readAsArrayBuffer(blob);
+ });
+ } else {
+ var fs = new FileReaderSync();
+ return Promise.resolve(fs.readAsArrayBuffer(blob));
+ }
+}
+
+function waitForState(worker, state, context) {
+ return new Promise(resolve => {
+ if (worker.state === state) {
+ resolve(context);
+ return;
+ }
+ worker.addEventListener("statechange", function onStateChange() {
+ if (worker.state === state) {
+ worker.removeEventListener("statechange", onStateChange);
+ resolve(context);
+ }
+ });
+ });
+}
diff --git a/dom/tests/mochitest/fetch/worker_readableStreams.js b/dom/tests/mochitest/fetch/worker_readableStreams.js
new file mode 100644
index 0000000000..905c73b7fa
--- /dev/null
+++ b/dom/tests/mochitest/fetch/worker_readableStreams.js
@@ -0,0 +1,26 @@
+importScripts("common_readableStreams.js");
+
+function info(message) {
+ postMessage({ type: "info", message });
+}
+
+function ok(a, message) {
+ postMessage({ type: "test", test: !!a, message });
+}
+
+function is(a, b, message) {
+ ok(a === b, message);
+}
+
+onmessage = function (e) {
+ self[e.data](SAME_COMPARTMENT).then(
+ ok => {
+ postMessage({ type: "done" });
+ },
+ exc => {
+ dump(exc);
+ dump(exc.stack);
+ postMessage({ type: "error", message: exc.toString() });
+ }
+ );
+};
diff --git a/dom/tests/mochitest/fetch/worker_temporaryFileBlob.js b/dom/tests/mochitest/fetch/worker_temporaryFileBlob.js
new file mode 100644
index 0000000000..e36c32a788
--- /dev/null
+++ b/dom/tests/mochitest/fetch/worker_temporaryFileBlob.js
@@ -0,0 +1,31 @@
+importScripts("common_temporaryFileBlob.js");
+
+function info(msg) {
+ postMessage({ type: "info", msg });
+}
+
+function ok(a, msg) {
+ postMessage({ type: "check", what: !!a, msg });
+}
+
+function is(a, b, msg) {
+ ok(a === b, msg);
+}
+
+function next() {
+ postMessage({ type: "finish" });
+}
+
+onmessage = function (e) {
+ if (e.data == "xhr") {
+ test_xhr_basic();
+ } else if (e.data == "fetch") {
+ test_fetch_basic();
+ } else if (e.data == "response") {
+ test_response_basic();
+ } else if (e.data == "request") {
+ test_request_basic();
+ } else {
+ ok(false, "Unknown message");
+ }
+};
diff --git a/dom/tests/mochitest/fetch/worker_wrapper.js b/dom/tests/mochitest/fetch/worker_wrapper.js
new file mode 100644
index 0000000000..72d00db0e1
--- /dev/null
+++ b/dom/tests/mochitest/fetch/worker_wrapper.js
@@ -0,0 +1,85 @@
+importScripts("utils.js");
+
+function getScriptUrl() {
+ return new URL(location.href).searchParams.get("script");
+}
+
+importScripts(getScriptUrl());
+
+var client;
+var context;
+
+function ok(a, msg) {
+ client.postMessage({
+ type: "status",
+ status: !!a,
+ msg: a + ": " + msg,
+ context,
+ });
+}
+
+function is(a, b, msg) {
+ client.postMessage({
+ type: "status",
+ status: a === b,
+ msg: a + " === " + b + ": " + msg,
+ context,
+ });
+}
+
+addEventListener("message", function workerWrapperOnMessage(e) {
+ removeEventListener("message", workerWrapperOnMessage);
+ var data = e.data;
+
+ function runTestAndReportToClient(event) {
+ var done = function (res) {
+ client.postMessage({ type: "finish", context });
+ return res;
+ };
+
+ try {
+ // runTest() is provided by the test.
+ var result = runTest().then(done, done);
+ if ("waitUntil" in event) {
+ event.waitUntil(result);
+ }
+ } catch (e) {
+ client.postMessage({
+ type: "status",
+ status: false,
+ msg: "worker failed to run " + data.script + "; error: " + e.message,
+ context,
+ });
+ done();
+ }
+ }
+
+ if ("ServiceWorker" in self) {
+ // Fetch requests from a service worker are not intercepted.
+ self.isSWPresent = false;
+
+ e.waitUntil(
+ self.clients
+ .matchAll({ includeUncontrolled: true })
+ .then(function (clients) {
+ for (var i = 0; i < clients.length; ++i) {
+ if (clients[i].url.indexOf("message_receiver.html") > -1) {
+ client = clients[i];
+ break;
+ }
+ }
+ if (!client) {
+ dump(
+ "We couldn't find the message_receiver window, the test will fail\n"
+ );
+ }
+ context = "ServiceWorker";
+ runTestAndReportToClient(e);
+ })
+ );
+ } else {
+ client = self;
+ context = "Worker";
+ runTestAndReportToClient(e);
+ }
+});
diff --git a/dom/tests/mochitest/fs/chrome.ini b/dom/tests/mochitest/fs/chrome.ini
new file mode 100644
index 0000000000..6e0fd9f922
--- /dev/null
+++ b/dom/tests/mochitest/fs/chrome.ini
@@ -0,0 +1,5 @@
+[DEFAULT]
+support-files =
+ page_blank.html
+
+[test_privateWin.html]
diff --git a/dom/tests/mochitest/fs/page_blank.html b/dom/tests/mochitest/fs/page_blank.html
new file mode 100644
index 0000000000..3a4797d5ac
--- /dev/null
+++ b/dom/tests/mochitest/fs/page_blank.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+This is a test
+</body>
+</html>
diff --git a/dom/tests/mochitest/fs/test_privateWin.html b/dom/tests/mochitest/fs/test_privateWin.html
new file mode 100644
index 0000000000..a222e74db4
--- /dev/null
+++ b/dom/tests/mochitest/fs/test_privateWin.html
@@ -0,0 +1,56 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>OPFS private window test</title>
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+
+<script type="text/javascript">
+
+const contentPage = "http://mochi.test:8888/chrome/dom/fs/test/mochitest/page_blank.html";
+
+function testOnPrivateWindow(aCallback) {
+ let mainWindow = window.browsingContext.topChromeWindow;
+ let win = mainWindow.OpenBrowserWindow({private: true});
+ win.addEventListener("load", function() {
+ win.addEventListener("DOMContentLoaded", function onInnerLoad() {
+ if (win.content.location.href == "about:privatebrowsing") {
+ win.gBrowser.loadURI(Services.io.newURI(contentPage), {
+ triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
+ });
+ return;
+ }
+ win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
+ SimpleTest.executeSoon(function() { aCallback(win); });
+ }, true);
+ }, {capture: true, once: true});
+}
+
+function doTest() {
+ testOnPrivateWindow(async function(privateWin) {
+ try {
+ let root = await privateWin.navigator.storage.getDirectory();
+ ok(false, "Didn't block storage.getDirectory() in private browsing");
+ } catch(e) {
+ ok(true, "blocked storage.getDirectory() in private browsing");
+ is(e.name, "SecurityError", "Threw right type error");
+ }
+ privateWin.close();
+ SimpleTest.finish();
+ });
+}
+
+function startTest() {
+ SpecialPowers.pushPrefEnv({'set': [["dom.fs.enabled", true]]}, doTest);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/gamepad_frame.html b/dom/tests/mochitest/gamepad/gamepad_frame.html
new file mode 100644
index 0000000000..dae1e92b1b
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/gamepad_frame.html
@@ -0,0 +1,22 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>frame</title>
+ <script type="text/javascript">
+ var connectedEvents = 0;
+ var buttonPresses = 0;
+ var idlConnected = 0;
+ window.addEventListener("gamepadconnected", function() {
+ connectedEvents++;
+ });
+ window.addEventListener("gamepadbuttondown", function() {
+ buttonPresses++;
+ });
+ window.ongamepadconnected = () => ++idlConnected;
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/gamepad_frame_state.html b/dom/tests/mochitest/gamepad/gamepad_frame_state.html
new file mode 100644
index 0000000000..a53b91b2cb
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/gamepad_frame_state.html
@@ -0,0 +1,16 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>frame</title>
+ <script type="text/javascript">
+ var gamepad;
+ window.addEventListener("gamepadconnected", function(e) {
+ gamepad = e.gamepad;
+ });
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/mochitest.ini b/dom/tests/mochitest/gamepad/mochitest.ini
new file mode 100644
index 0000000000..63aecbc623
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/mochitest.ini
@@ -0,0 +1,23 @@
+[DEFAULT]
+scheme = https
+support-files =
+ gamepad_frame.html
+ gamepad_frame_state.html
+ mock_gamepad.js
+
+[test_check_timestamp.html]
+support-files = test_check_timestamp_iframe.html
+[test_gamepad.html]
+support-files = test_gamepad_iframe.html
+[test_gamepad_connect_events.html]
+support-files = test_gamepad_connect_events_iframe.html
+[test_gamepad_extensions.html]
+support-files = test_gamepad_extensions_iframe.html
+[test_gamepad_frame_state_sync.html]
+support-files = test_gamepad_frame_state_sync_iframe.html
+[test_gamepad_hidden_frame.html]
+support-files = test_gamepad_hidden_frame_iframe.html
+[test_gamepad_multitouch_crossorigin.html]
+support-files = test_gamepad_multitouch_crossorigin_iframe.html
+[test_navigator_gamepads.html]
+support-files = test_navigator_gamepads_iframe.html
diff --git a/dom/tests/mochitest/gamepad/mock_gamepad.js b/dom/tests/mochitest/gamepad/mock_gamepad.js
new file mode 100644
index 0000000000..778035ef10
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/mock_gamepad.js
@@ -0,0 +1,19 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+var GamepadService;
+
+async function setGamepadPreferenceAndCreateIframe(iframeSrc) {
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.gamepad.test.enabled", true]],
+ });
+
+ let iframe = document.createElement("iframe");
+ iframe.src = iframeSrc;
+ document.body.appendChild(iframe);
+}
+
+function runGamepadTest(callback) {
+ GamepadService = navigator.requestGamepadServiceTest();
+ callback();
+}
diff --git a/dom/tests/mochitest/gamepad/test_check_timestamp.html b/dom/tests/mochitest/gamepad/test_check_timestamp.html
new file mode 100644
index 0000000000..04fc8dc9d8
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_check_timestamp.html
@@ -0,0 +1,20 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test Gamepad.timestamp</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+setGamepadPreferenceAndCreateIframe("test_check_timestamp_iframe.html");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_check_timestamp_iframe.html b/dom/tests/mochitest/gamepad/test_check_timestamp_iframe.html
new file mode 100644
index 0000000000..ca99c26746
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_check_timestamp_iframe.html
@@ -0,0 +1,71 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test Gamepad.timestamp</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+
+let ok = window.parent.ok;
+let is = window.parent.is;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+window.addEventListener("gamepadbuttondown", buttonpresshandler);
+
+var index;
+var timea=0;
+var firstPress = true;
+var testOver = false;
+
+runGamepadTest(checkTimestamp);
+
+async function checkTimestamp(){
+ const index = await GamepadService.addGamepad("test gamepad 1",
+ GamepadService.standardMapping,
+ GamepadService.noHand,
+ 4,
+ 2,
+ 0,
+ 0,
+ 0);
+
+ // Press a button to make the gamepad visible
+ // to the page.
+ await GamepadService.newButtonEvent(index, 0, true, true);
+ await GamepadService.newButtonEvent(index, 0, true, true);
+ ok(true, "test");
+}
+
+function cleanup(){
+ SpecialPowers.executeSoon(async function() {
+ await GamepadService.removeGamepad(index);
+ SimpleTest.finish();
+ });
+}
+
+async function buttonpresshandler(e) {
+ if (testOver) {
+ return;
+ }
+ if (timea == 0){
+ timea = e.gamepad.timestamp;
+ } else {
+ ok(timea <= e.gamepad.timestamp, "Timestamp less than last timestamp");
+ }
+ await GamepadService.newButtonEvent(index, 0, false, false);
+ if (!firstPress) {
+ testOver = true;
+ SpecialPowers.executeSoon(cleanup);
+ } else {
+ firstPress = false;
+ }
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad.html b/dom/tests/mochitest/gamepad/test_gamepad.html
new file mode 100644
index 0000000000..4e7c9a32bc
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad.html
@@ -0,0 +1,20 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+setGamepadPreferenceAndCreateIframe("test_gamepad_iframe.html");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_connect_events.html b/dom/tests/mochitest/gamepad/test_gamepad_connect_events.html
new file mode 100644
index 0000000000..f505ceb9d9
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_connect_events.html
@@ -0,0 +1,22 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!-- bug 893785 - Test that sending a gamepadconnected event to a new window
+ doesn't result in a gamepadconnected event being sent to existing
+ windows that have already received it. -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test hidden frames</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+setGamepadPreferenceAndCreateIframe("test_gamepad_connect_events_iframe.html");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_connect_events_iframe.html b/dom/tests/mochitest/gamepad/test_gamepad_connect_events_iframe.html
new file mode 100644
index 0000000000..278e6796c0
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_connect_events_iframe.html
@@ -0,0 +1,83 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!-- bug 893785 - Test that sending a gamepadconnected event to a new window
+ doesn't result in a gamepadconnected event being sent to existing
+ windows that have already received it. -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test hidden frames</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+let ok = window.parent.ok;
+let is = window.parent.is;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+var gamepad_index;
+
+async function pressButton() {
+ await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
+ await GamepadService.newButtonEvent(gamepad_index, 0, false, false);
+}
+
+ // Add a gamepad
+async function startTests() {
+ window.addEventListener("gamepadbuttondown", function() {
+ // Wait to ensure that all frames received the button press as well.
+ SpecialPowers.executeSoon(tests[testNum++]);
+ });
+
+ gamepad_index = await GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ GamepadService.noHand,
+ 4, // buttons
+ 2,
+ 0,
+ 0,
+ 0)
+
+ await gamepad_connected();
+}
+
+var f1, f2;
+async function gamepad_connected() {
+ f1 = document.getElementById('f1');
+ await pressButton();
+}
+
+var testNum = 0;
+var tests = [
+ test1,
+ test2,
+];
+
+function test1() {
+ is(f1.contentWindow.connectedEvents, 1, "right number of connection events in frame 1");
+
+ // Now add another frame.
+ f2 = document.createElement("iframe");
+ f2.addEventListener("load", async () => {
+ // When the frame is loaded, press a button again.
+ await pressButton();
+ });
+ f2.src = "gamepad_frame.html";
+ document.body.appendChild(f2);
+}
+
+async function test2() {
+ is(f1.contentWindow.connectedEvents, 1, "right number of connection events in frame 1");
+ is(f2.contentWindow.connectedEvents, 1, "right number of connection events in frame 2");
+ is(f1.contentWindow.idlConnected, 1, "right number of IDL connection events in frame 1");
+ is(f2.contentWindow.idlConnected, 1, "right number of IDL connection events in frame 2");
+ await GamepadService.removeGamepad(gamepad_index);
+ SimpleTest.finish();
+}
+
+</script>
+<iframe id="f1" src="gamepad_frame.html" onload="runGamepadTest(startTests)"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_extensions.html b/dom/tests/mochitest/gamepad/test_gamepad_extensions.html
new file mode 100644
index 0000000000..364ad540fe
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_extensions.html
@@ -0,0 +1,19 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+setGamepadPreferenceAndCreateIframe("test_gamepad_extensions_iframe.html");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_extensions_iframe.html b/dom/tests/mochitest/gamepad/test_gamepad_extensions_iframe.html
new file mode 100644
index 0000000000..6db4b85bb6
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_extensions_iframe.html
@@ -0,0 +1,179 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+let ok = window.parent.ok;
+let is = window.parent.is;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+var tests = [
+ poseadd,
+ posecheck,
+ touchadd,
+ touchcheck,
+ haptictest // Keep haptictest at the last because it will test removing gamepad from the service.
+];
+var gamepad_index = 0;
+var testNum = 0;
+var poseOrient = new Float32Array([-0.203, -0.235, 0.740, -0.596]);
+var posePos = new Float32Array([-0.0233, -0.707, -0.763]);
+var poseAngVel = new Float32Array([-0.0008, 0.00147, 0.001]);
+var poseAngAcc = new Float32Array([-0.494, 0.476, -0.241]);
+var poseLinVel = new Float32Array([0.003,0.024,-0.068]);
+var poseLinAcc = new Float32Array([-1.211,21.427,-2.348]);
+var touchData = [{touchId: 0, surfaceId: 0, pos: new Float32Array([-0.5, 0.5]), surf: new Float32Array([100, 100])},
+ {touchId: 1, surfaceId: 0, pos: new Float32Array([-0.1, 1.0]), surf: new Float32Array([100, 100])}];
+
+window.addEventListener("gamepadconnected", connecthandler);
+window.addEventListener("gamepadbuttondown", function() {
+ // Wait to ensure that all frames received the button press as well.
+ SpecialPowers.executeSoon(async ()=> {
+ await tests[testNum++]()
+ });
+});
+
+async function pressButton() {
+ await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
+ await GamepadService.newButtonEvent(gamepad_index, 0, false, false);
+}
+
+async function startTest() {
+ await SpecialPowers.pushPrefEnv({ "set": [
+ ["dom.gamepad.extensions.enabled", true],
+ ["dom.gamepad.extensions.lightindicator", true],
+ ["dom.gamepad.extensions.multitouch", true]] });
+ // Add a gamepad
+ gamepad_index = await GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ GamepadService.leftHand,
+ 4,
+ 2,
+ 1,
+ 1,
+ 2);
+
+ // Simulate button events on the gamepad we added
+ await pressButton();
+
+}
+
+function connecthandler(e) {
+ ok(e.gamepad.timestamp <= performance.now(),
+ "gamepad.timestamp should less than or equal to performance.now()");
+ is(e.gamepad.index, 0, "correct gamepad index");
+ is(e.gamepad.id, "test gamepad", "correct gamepad name");
+ is(e.gamepad.mapping, "standard", "standard mapping");
+ is(e.gamepad.hand, "left", "left hand");
+ is(e.gamepad.buttons.length, 4, "correct number of buttons");
+ is(e.gamepad.axes.length, 2, "correct number of axes");
+ is(e.gamepad.hapticActuators.length, 1, "correct number of haptics");
+ is(e.gamepad.lightIndicators.length, 1, "correct number of light indicators");
+ is(e.gamepad.touchEvents.length, 2, "correct number of touches");
+}
+
+function checkValueInFloat32Array(array1, array2) {
+ if (array1.length != array2.length) {
+ return false;
+ }
+ var index = 0;
+ while (index < array2.length) {
+ if (array1[index] != array2[index]) {
+ return false;
+ }
+ ++index;
+ }
+ return true;
+}
+
+async function poseadd() {
+ await GamepadService.newPoseMove(gamepad_index, poseOrient,
+ posePos, poseAngVel, poseAngAcc,
+ poseLinVel, poseLinAcc);
+ await pressButton();
+}
+
+async function posecheck() {
+ var gamepads = navigator.getGamepads();
+ var pose = gamepads[0].pose;
+ is(gamepads[0].pose.hasOrientation, true,
+ "correct gamepadPose hasOrientation");
+ is(gamepads[0].pose.hasPosition, true,
+ "correct gamepadPose hasPosition");
+ is(checkValueInFloat32Array(pose.orientation, poseOrient), true,
+ "correct gamepadPose orientation");
+ is(checkValueInFloat32Array(pose.position, posePos), true,
+ "correct gamepadPose position");
+ is(checkValueInFloat32Array(pose.angularVelocity, poseAngVel), true,
+ "correct gamepadPose angularVelocity");
+ is(checkValueInFloat32Array(pose.angularAcceleration, poseAngAcc), true,
+ "correct gamepadPose angularAcceleration");
+ is(checkValueInFloat32Array(pose.linearVelocity, poseLinVel), true,
+ "correct gamepadPose linearVelocity");
+ is(checkValueInFloat32Array(pose.linearAcceleration, poseLinAcc), true,
+ "correct gamepadPose linearAcceleration");
+ await pressButton();
+}
+
+function setFrameVisible(f, visible) {
+ SpecialPowers.wrap(f.contentWindow).browsingContext.isActive = visible;
+}
+
+function haptictest() {
+ var gamepads = navigator.getGamepads();
+ var hapticActuators = gamepads[0].hapticActuators[0];
+ hapticActuators.pulse(1, 100).then(async function(result) {
+ is(result, true, "gamepad hapticActuators test success.");
+ await GamepadService.removeGamepad(gamepad_index);
+ SimpleTest.finish();
+ });
+ // When page is background, we should stop our haptics and still
+ // can get the promise.
+ var f1 = document.getElementById('f1');
+ setFrameVisible(f1, false);
+}
+
+async function touchadd() {
+ for(var count = 0; count < touchData.length; count++) {
+ const touch = touchData[count];
+ await GamepadService.newTouch(gamepad_index, count, touch.touchId,
+ touch.surfaceId, touch.pos,
+ touch.surf);
+ }
+ await pressButton();
+}
+
+async function touchcheck() {
+ var gamepads = navigator.getGamepads();
+ var touches = gamepads[0].touchEvents;
+
+ is(touches.length, 2, " number of touches");
+
+ var count = 0;
+ touches.forEach(function(touch) {
+ is(touch.touchId, touchData[count].touchId,
+ "correct GamepadTouch touchId");
+ is(touch.surfaceId, touchData[count].surfaceId,
+ "correct GamepadTouch surfaceId");
+ is(checkValueInFloat32Array(touch.position, touchData[count].pos), true,
+ "correct touch position");
+ is(checkValueInFloat32Array(touch.surfaceDimensions, touchData[count].surf), true,
+ "correct touch surfaceDimensions");
+
+ ++count;
+ });
+
+ await pressButton();
+}
+
+</script>
+<iframe id="f1" src="gamepad_frame_state.html" onload="runGamepadTest(startTest)"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html b/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html
new file mode 100644
index 0000000000..927a4e54bb
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html
@@ -0,0 +1,19 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test hidden frames</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+setGamepadPreferenceAndCreateIframe("test_gamepad_frame_state_sync_iframe.html");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync_iframe.html b/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync_iframe.html
new file mode 100644
index 0000000000..d64197dce0
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync_iframe.html
@@ -0,0 +1,113 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test hidden frames</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+let ok = window.parent.ok;
+let is = window.parent.is;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+ // Add a gamepad
+var index;
+
+function setFrameVisible(f, visible) {
+ SpecialPowers.wrap(f.contentWindow).browsingContext.isActive = visible;
+}
+
+var frames_loaded = 0;
+async function startTest() {
+ frames_loaded++;
+ if (frames_loaded != 2) return;
+ index = await GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ GamepadService.noHand,
+ 4, // buttons
+ 2,
+ 0,
+ 0,
+ 0);
+ await gamepad_loaded();
+}
+var f1, f2;
+async function gamepad_loaded() {
+ f1 = document.getElementById('f1');
+ f2 = document.getElementById('f2');
+ let w1 = f1.contentWindow;
+ let w2 = f2.contentWindow;
+ w1.addEventListener("gamepadbuttonup", () => {
+ ok(!f1.contentWindow.gamepad.buttons[0].pressed,
+ "frame 1 no button pressed");
+ ok(!f1.contentWindow.gamepad.buttons[0].touched,
+ "frame 1 no button touched");
+ });
+ w2.addEventListener("gamepadbuttonup", () => {
+ ok(!f2.contentWindow.gamepad.buttons[0].pressed,
+ "frame 2 no button pressed");
+ ok(!f2.contentWindow.gamepad.buttons[0].touched,
+ "frame 2 no button touched");
+ setFrameVisible(f2, false);
+ SpecialPowers.executeSoon(async function() {
+ await GamepadService.newButtonEvent(index, 0, true, true);
+ });
+ })
+ // Now press the button, but don't release it.
+ await GamepadService.newButtonEvent(index, 0, true, true);
+}
+
+window.addEventListener("gamepadbuttondown", function() {
+ // Wait to ensure that all frames received the button press as well.
+ SpecialPowers.executeSoon(tests[testNum++]);
+});
+
+var testNum = 0;
+var tests = [
+ check_button_pressed,
+ check_second_frame_no_button_press,
+];
+
+async function check_button_pressed() {
+ // At this point the both frames should see the button as pressed.
+ ok(f1.contentWindow.gamepad.buttons[0].pressed, "frame 1 sees button pressed");
+ ok(f1.contentWindow.gamepad.buttons[0].touched, "frame 1 sees button touched");
+ ok(f2.contentWindow.gamepad.buttons[0].pressed, "frame 2 sees button pressed");
+ ok(f2.contentWindow.gamepad.buttons[0].touched, "frame 2 sees button touched");
+
+ // Now release the button, then hide the second frame.
+ await GamepadService.newButtonEvent(index, 0, false, false);
+}
+
+async function check_second_frame_no_button_press () {
+ /*
+ * At this point the first frame should see the button as pressed,
+ * but the second frame should not, since it's hidden.
+ */
+ ok(f1.contentWindow.gamepad.buttons[0].pressed, "frame 1 sees button pressed");
+ ok(f1.contentWindow.gamepad.buttons[0].touched, "frame 1 sees button touched");
+ ok(!f2.contentWindow.gamepad.buttons[0].pressed, "frame 2 should not see button pressed");
+ ok(!f2.contentWindow.gamepad.buttons[0].touched, "frame 2 should not see button touched");
+
+ // Now unhide the second frame.
+ setFrameVisible(f2, true);
+ SpecialPowers.executeSoon(async function() {
+ // Now that the frame is visible again, it should see the button
+ // that was pressed.
+ ok(f2.contentWindow.gamepad.buttons[0].pressed, "frame 2 sees button pressed");
+ ok(f2.contentWindow.gamepad.buttons[0].touched, "frame 2 sees button touched");
+ // cleanup
+ await GamepadService.removeGamepad(index);
+ SimpleTest.finish();
+ });
+}
+
+</script>
+<iframe id="f1" src="gamepad_frame_state.html" onload="runGamepadTest(startTest)"></iframe>
+<iframe id="f2" src="gamepad_frame_state.html" onload="runGamepadTest(startTest)"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html b/dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html
new file mode 100644
index 0000000000..985f001ca4
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html
@@ -0,0 +1,19 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test hidden frames</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+setGamepadPreferenceAndCreateIframe("test_gamepad_hidden_frame_iframe.html");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_hidden_frame_iframe.html b/dom/tests/mochitest/gamepad/test_gamepad_hidden_frame_iframe.html
new file mode 100644
index 0000000000..60ad2edd01
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_hidden_frame_iframe.html
@@ -0,0 +1,81 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test hidden frames</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+let ok = window.parent.ok;
+let is = window.parent.is;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+window.addEventListener("gamepadbuttondown", function() {
+ // Wait to ensure that all frames received the button press as well.
+ SpecialPowers.executeSoon(tests[testNum++]);
+});
+
+async function pressButton() {
+ await GamepadService.newButtonEvent(index, 0, true, true);
+ await GamepadService.newButtonEvent(index, 0, false, false);
+}
+
+function setFrameVisible(f, visible) {
+ SpecialPowers.wrap(f.contentWindow).browsingContext.isActive = visible;
+}
+
+var frames_loaded = 0;
+async function startTest() {
+ frames_loaded++;
+ if (frames_loaded != 2) return;
+ index = await GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ GamepadService.noHand,
+ 4, // buttons
+ 2,
+ 0,
+ 0,
+ 0);
+
+ await gamepad_loaded();
+}
+var f1, f2;
+async function gamepad_loaded() {
+ f1 = document.getElementById('f1');
+ f2 = document.getElementById('f2');
+ await pressButton();
+}
+
+
+
+var testNum = 0;
+var tests = [
+ test1,
+ test2,
+];
+
+function test1() {
+ is(f1.contentWindow.buttonPresses, 1, "right number of button presses in frame 1");
+ is(f2.contentWindow.buttonPresses, 1, "right number of button presses in frame 2");
+
+ // Now hide the second frame and send another button press.
+ setFrameVisible(f2, false);
+ SpecialPowers.executeSoon( async () => { await pressButton(); });
+}
+
+async function test2() {
+ is(f1.contentWindow.buttonPresses, 2, "right number of button presses in frame 1");
+ is(f2.contentWindow.buttonPresses, 1, "right number of button presses in frame 2");
+ await GamepadService.removeGamepad(index);
+ SimpleTest.finish();
+}
+
+</script>
+<iframe id="f1" src="gamepad_frame.html" onload="runGamepadTest(startTest)"></iframe>
+<iframe id="f2" src="gamepad_frame.html" onload="runGamepadTest(startTest)"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_iframe.html b/dom/tests/mochitest/gamepad/test_gamepad_iframe.html
new file mode 100644
index 0000000000..f7e29c1761
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_iframe.html
@@ -0,0 +1,81 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+let ok = window.parent.ok;
+let is = window.parent.is;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+// This should be held for the entire time the testing API is being used to
+// ensure monitoring has been started and that a single GamepadPlatformService
+// instance is used for the entire test
+var GamepadsKungFuDeathGrip = navigator.getGamepads();
+
+// Due to gamepad being a polling API instead of event driven, test ordering
+// ends up being a little weird in order to deal with e10s. Calls to
+// GamepadService are async across processes, so we'll need to make sure
+// we account for timing before checking values.
+window.addEventListener("gamepadconnected", connecthandler);
+var index;
+var testNum = 0;
+
+window.addEventListener("gamepadbuttondown", () => {
+ SpecialPowers.executeSoon(buttontest1);
+});
+
+window.addEventListener("gamepadbuttonup", () => {
+ SpecialPowers.executeSoon(buttontest2);
+});
+
+runGamepadTest(startTest);
+
+async function startTest() {
+ // Add a gamepad
+ index = await GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ GamepadService.noHand,
+ 4,
+ 2,
+ 0,
+ 0,
+ 0);
+ await GamepadService.newButtonEvent(index, 0, true, true);
+}
+
+function connecthandler(e) {
+ ok(e.gamepad.timestamp <= performance.now(),
+ "gamepad.timestamp should less than or equal to performance.now()");
+ is(e.gamepad.index, 0, "correct gamepad index");
+ is(e.gamepad.id, "test gamepad", "correct gamepad name");
+ is(e.gamepad.mapping, "standard", "standard mapping");
+ is(e.gamepad.buttons.length, 4, "correct number of buttons");
+ is(e.gamepad.axes.length, 2, "correct number of axes");
+}
+
+async function buttontest1() {
+ var gamepads = navigator.getGamepads();
+ is(gamepads[0].buttons[0].pressed, true, "gamepad button should register as pressed");
+ is(gamepads[0].buttons[0].touched, true, "gamepad button should register as touched");
+ await GamepadService.newButtonValueEvent(index, 1, true, true, 0.5);
+}
+
+async function buttontest2() {
+ var gamepads = navigator.getGamepads();
+ is(gamepads[0].buttons[1].pressed, true, "gamepad button should register as pressed");
+ is(gamepads[0].buttons[1].touched, true, "gamepad button should register as touched");
+ is(gamepads[0].buttons[1].value, 0.5, "gamepad button value should be 0.5");
+ await GamepadService.removeGamepad(index);
+ SimpleTest.finish();
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin.html b/dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin.html
new file mode 100644
index 0000000000..244b2f18dc
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin.html
@@ -0,0 +1,20 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+ <!DOCTYPE HTML>
+ <html>
+ <head>
+ <title>Test hidden frames</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <script type="text/javascript" src="mock_gamepad.js"></script>
+ <script class="testbody" type="text/javascript">
+ // This test loads in an iframe, to ensure that the navigator instance is
+ // loaded with the correct value of the preference.
+ SimpleTest.waitForExplicitFinish();
+ setGamepadPreferenceAndCreateIframe("test_gamepad_multitouch_crossorigin_iframe.html");
+ </script>
+ </body>
+ </html>
+ \ No newline at end of file
diff --git a/dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin_iframe.html b/dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin_iframe.html
new file mode 100644
index 0000000000..de551fac06
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_multitouch_crossorigin_iframe.html
@@ -0,0 +1,256 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+let ok = window.parent.ok;
+let is = window.parent.is;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+let tests = [
+ touchAdd,
+ touchcheck1,
+ touchAdd,
+ touchcheck2,
+ touchAdd,
+ touchcheck3
+];
+
+let gamepad_index;
+let testNum = 0;
+let touchData1 = [{touchId: 0, surfaceId: 0, pos: new Float32Array([-0.5, 0.5]), surf: new Float32Array([100, 100])},
+ {touchId: 1, surfaceId: 0, pos: new Float32Array([-0.1, 1.0]), surf: new Float32Array([100, 100])}];
+let touchData2 = [{touchId: 2, surfaceId: 0, pos: new Float32Array([-0.2, 0.3]), surf: new Float32Array([120, 200])},
+ {touchId: 3, surfaceId: 0, pos: new Float32Array([-0.4, 0.7]), surf: new Float32Array([120, 200])}];
+let touchData3 = [{touchId: 4, surfaceId: 0, pos: new Float32Array([-0.5, 0.6]), surf: new Float32Array([150, 100])},
+ {touchId: 5, surfaceId: 0, pos: new Float32Array([-0.3, 0.8]), surf: new Float32Array([150, 100])}];
+
+let data = [
+ touchData1,
+ touchData2,
+ touchData3
+];
+let dataNum = 0;
+
+window.addEventListener("gamepadconnected", connecthandler);
+window.addEventListener("gamepadbuttondown", function() {
+ // Wait to ensure that all frames received the button press as well.
+ ok(true, "gamepadbuttondown");
+ SpecialPowers.executeSoon(tests[testNum++]);
+});
+
+async function pressButton() {
+ await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
+ await GamepadService.newButtonEvent(gamepad_index, 0, false, false);
+}
+
+let frames_loaded = 0;
+async function startTest() {
+ frames_loaded++;
+ let promise = SpecialPowers.pushPrefEnv({ "set": [
+ ["dom.gamepad.extensions.enabled", true],
+ ["dom.gamepad.extensions.lightindicator", true],
+ ["dom.gamepad.extensions.multitouch", true]] });
+ if (frames_loaded == 2) {
+ await promise;
+ // Add a gamepad
+ gamepad_index = await GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ GamepadService.leftHand,
+ 4,
+ 2,
+ 1,
+ 1,
+ 2)
+ await gamepad_loaded();
+ }
+}
+
+let f1, f2;
+async function gamepad_loaded() {
+ f1 = document.getElementById('f1');
+ f2 = document.getElementById('f2');
+ await GamepadService.newButtonEvent(gamepad_index, 0, true, true);
+}
+
+function connecthandler(e) {
+ ok(e.gamepad.timestamp <= performance.now(),
+ "gamepad.timestamp should less than or equal to performance.now()");
+ is(e.gamepad.index, 0, "correct gamepad index");
+ is(e.gamepad.id, "test gamepad", "correct gamepad name");
+ is(e.gamepad.mapping, "standard", "standard mapping");
+ is(e.gamepad.hand, "left", "left hand");
+ is(e.gamepad.buttons.length, 4, "correct number of buttons");
+ is(e.gamepad.axes.length, 2, "correct number of axes");
+ is(e.gamepad.hapticActuators.length, 1, "correct number of haptics");
+ is(e.gamepad.lightIndicators.length, 1, "correct number of light indicators");
+ is(e.gamepad.touchEvents.length, 2, "correct number of touches");
+}
+
+function checkValueInFloat32Array(array1, array2) {
+ if (array1.length != array2.length) {
+ return false;
+ }
+ let index = 0;
+ while (index < array2.length) {
+ if (array1[index] != array2[index]) {
+ return false;
+ }
+ ++index;
+ }
+ return true;
+}
+
+function setFrameVisible(f, visible) {
+ SpecialPowers.wrap(f.contentWindow).browsingContext.isActive = visible;
+}
+
+async function touchAdd() {
+ for(let count = 0; count < data[dataNum].length; count++) {
+ const touch = data[dataNum][count];
+ await GamepadService.newTouch(gamepad_index, count, touch.touchId,
+ touch.surfaceId, touch.pos,
+ touch.surf);
+ }
+ ++dataNum;
+ await pressButton();
+}
+
+async function touchcheck1() {
+ let touches = f1.contentWindow.gamepad.touchEvents;
+ is(touches.length, touchData1.length, "f1 number of touches");
+
+ let count = 0;
+ touches.forEach(function(touch) {
+ is(touch.touchId, data[0][count].touchId,
+ "correct GamepadTouch touchId");
+ is(touch.surfaceId, data[0][count].surfaceId,
+ "correct GamepadTouch surfaceId");
+ is(checkValueInFloat32Array(touch.position, data[0][count].pos), true,
+ "correct touch position");
+ is(checkValueInFloat32Array(touch.surfaceDimensions, data[0][count].surf), true,
+ "correct touch surfaceDimensions");
+
+ ++count;
+ });
+
+ touches = f2.contentWindow.gamepad.touchEvents;
+ is(touches.length, data[0].length,"f2 number of touches");
+
+ count = 0;
+ touches.forEach(function(touch) {
+ is(touch.touchId, data[0][count].touchId,
+ "correct GamepadTouch touchId");
+ is(touch.surfaceId, data[0][count].surfaceId,
+ "correct GamepadTouch surfaceId");
+ is(checkValueInFloat32Array(touch.position, data[0][count].pos), true,
+ "correct touch position");
+ is(checkValueInFloat32Array(touch.surfaceDimensions, data[0][count].surf), true,
+ "correct touch surfaceDimensions");
+
+ ++count;
+ });
+
+ // Making f2 to be at the background.
+ setFrameVisible(f2, false);
+ pressButton();
+}
+
+async function touchcheck2() {
+ let touches = f1.contentWindow.gamepad.touchEvents;
+ is(touches.length, data[1].length, "f1 number of touches");
+
+ let count = 0;
+ touches.forEach(function(touch) {
+ is(touch.touchId, data[1][count].touchId,
+ "correct GamepadTouch touchId");
+ is(touch.surfaceId, data[1][count].surfaceId,
+ "correct GamepadTouch surfaceId");
+ is(checkValueInFloat32Array(touch.position, data[1][count].pos), true,
+ "correct touch position");
+ is(checkValueInFloat32Array(touch.surfaceDimensions, data[1][count].surf), true,
+ "correct touch surfaceDimensions");
+
+ ++count;
+ });
+
+ touches = f2.contentWindow.gamepad.touchEvents;
+ is(touches.length, touchData1.length,"f2 number of touches");
+
+ // When f2 is at the background, it will use the previous status.
+ count = 0;
+ touches.forEach(function(touch) {
+ is(touch.touchId, data[0][count].touchId,
+ "correct GamepadTouch touchId");
+ is(touch.surfaceId, data[0][count].surfaceId,
+ "correct GamepadTouch surfaceId");
+ is(checkValueInFloat32Array(touch.position, data[0][count].pos), true,
+ "correct touch position");
+ is(checkValueInFloat32Array(touch.surfaceDimensions, data[0][count].surf), true,
+ "correct touch surfaceDimensions");
+
+ ++count;
+ });
+
+ setFrameVisible(f2, true);
+ pressButton();
+}
+
+async function touchcheck3() {
+ let touches = f1.contentWindow.gamepad.touchEvents;
+ is(touches.length, touchData3.length, "f1 number of touches");
+
+ let count = 0;
+ touches.forEach(function(touch) {
+ is(touch.touchId, data[2][count].touchId,
+ "correct GamepadTouch touchId");
+ is(touch.surfaceId, data[2][count].surfaceId,
+ "correct GamepadTouch surfaceId");
+ is(checkValueInFloat32Array(touch.position, data[2][count].pos), true,
+ "correct touch position");
+ is(checkValueInFloat32Array(touch.surfaceDimensions, data[2][count].surf), true,
+ "correct touch surfaceDimensions");
+
+ ++count;
+ });
+
+ touches = f2.contentWindow.gamepad.touchEvents;
+ is(touches.length, touchData3.length,"f2 number of touches");
+
+ count = 0;
+ touches.forEach(function(touch) {
+ // f2 was at the background so doesn't add touch events from data[1].
+ is(touch.touchId, data[2][count].touchId - data[1].length,
+ "correct GamepadTouch touchId");
+ is(touch.surfaceId, data[2][count].surfaceId,
+ "correct GamepadTouch surfaceId");
+ is(checkValueInFloat32Array(touch.position, data[2][count].pos), true,
+ "correct touch position");
+ is(checkValueInFloat32Array(touch.surfaceDimensions, data[2][count].surf), true,
+ "correct touch surfaceDimensions");
+
+ ++count;
+ });
+
+ SpecialPowers.executeSoon(cleanup);
+}
+
+function cleanup(){
+ SpecialPowers.executeSoon(async function() {
+ await GamepadService.removeGamepad(gamepad_index);
+ SimpleTest.finish();
+ });
+}
+
+</script>
+<iframe id="f1" src="gamepad_frame_state.html" onload="runGamepadTest(startTest)"></iframe>
+<iframe id="f2" src="gamepad_frame_state.html" onload="runGamepadTest(startTest)"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_navigator_gamepads.html b/dom/tests/mochitest/gamepad/test_navigator_gamepads.html
new file mode 100644
index 0000000000..06dc214a45
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_navigator_gamepads.html
@@ -0,0 +1,19 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+setGamepadPreferenceAndCreateIframe("test_navigator_gamepads_iframe.html");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/gamepad/test_navigator_gamepads_iframe.html b/dom/tests/mochitest/gamepad/test_navigator_gamepads_iframe.html
new file mode 100644
index 0000000000..9c98bac2d3
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_navigator_gamepads_iframe.html
@@ -0,0 +1,123 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript" src="mock_gamepad.js"></script>
+<script class="testbody" type="text/javascript">
+let ok = window.parent.ok;
+let is = window.parent.is;
+let isnot = window.parent.isnot;
+let SimpleTest = window.parent.SimpleTest;
+let SpecialPowers = window.parent.SpecialPowers;
+
+var content_index1 = 0;
+var internal_index2;
+var content_index2 = 1;
+
+var testNum = 0;
+var tests = [
+ check_first_gamepad,
+ check_second_gamepad,
+ check_gamepad_hole,
+ check_no_gamepads,
+];
+
+function run_next_test(event) {
+ SpecialPowers.executeSoon(async function() {
+ await tests[testNum++](event);
+ });
+}
+
+function buttonhandler(e) {
+ run_next_test(e);
+}
+
+function disconnecthandler(e) {
+ run_next_test(e);
+}
+window.addEventListener("gamepadbuttondown", buttonhandler);
+window.addEventListener("gamepaddisconnected", disconnecthandler);
+
+runGamepadTest(startTest)
+
+async function startTest() {
+ // gamepads should be empty first
+ is(navigator.getGamepads().length, 0, "should be zero gamepads exposed");
+ // Add a gamepad
+ internal_index1 = await GamepadService.addGamepad("test gamepad 1", // id
+ GamepadService.standardMapping,
+ GamepadService.noHand,
+ 4, // buttons
+ 2,
+ 0,
+ 0,
+ 0);
+
+ // Press a button to make the gamepad visible to the page.
+ await GamepadService.newButtonEvent(internal_index1, 0, true, true);
+}
+
+async function check_first_gamepad(e) {
+ ok(true, "Checking first gamepad");
+ // First gamepad gets added.
+ is(e.gamepad.id, "test gamepad 1", "correct gamepad name");
+ var gamepads = navigator.getGamepads();
+ is(gamepads.length, 1, "should have one gamepad exposed");
+ is(gamepads[e.gamepad.index], e.gamepad, "right gamepad exposed at index");
+ is(gamepads[content_index1], e.gamepad, "gamepad counter working correctly");
+ // Add a second gamepad, should automatically show up.
+ internal_index2 = await GamepadService.addGamepad("test gamepad 2", // id
+ GamepadService.standardMapping,
+ GamepadService.noHand,
+ 4, // buttons
+ 2,
+ 0,
+ 0,
+ 0);
+
+ await GamepadService.newButtonEvent(internal_index2, 0, true, true);
+
+ ok(true, "Done checking first gamepad");
+}
+
+async function check_second_gamepad(e) {
+ ok(true, "Checking second gamepad");
+ // Second gamepad gets added.
+ is(e.gamepad.index, 1, "gamepad index should be 1")
+ is(e.gamepad.id, "test gamepad 2", "correct gamepad name");
+ var gamepads = navigator.getGamepads();
+ is(gamepads.length, 2, "should have two gamepads exposed");
+ is(gamepads[e.gamepad.index], e.gamepad, "right gamepad exposed at index");
+ is(gamepads[content_index2], e.gamepad, "gamepad counter working correctly");
+ // Now remove the first one.
+ await GamepadService.removeGamepad(internal_index1);
+ ok(true, "Done checking second gamepad");
+}
+
+async function check_gamepad_hole(e) {
+ ok(true, "Checking gamepad hole");
+ // First gamepad gets removed.
+ var gamepads = navigator.getGamepads();
+ is(gamepads.length, 2, "gamepads should have two entries");
+ is(gamepads[content_index1], null, "should be a hole in the gamepad list");
+ isnot(gamepads[content_index2], null, "second gamepad should exist");
+ // Now remove the second one.
+ await GamepadService.removeGamepad(internal_index2);
+ ok(true, "Done checking gamepad hole");
+}
+
+function check_no_gamepads(e) {
+ ok(true, "Checking no gamepads");
+ // Second gamepad gets removed.
+ var gamepads = navigator.getGamepads();
+ is(gamepads.length, 0, "gamepads should be empty");
+ SimpleTest.finish();
+}
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/497633.html b/dom/tests/mochitest/general/497633.html
new file mode 100644
index 0000000000..da011f54c8
--- /dev/null
+++ b/dom/tests/mochitest/general/497633.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+</head>
+<body>
+<script>
+var t = 0;
+function doe() {
+setTimeout(function() {
+ if (t == 1) {
+ window.close();
+ window.opener.done();
+ }
+ else {
+ window.frames[0].location.reload();
+ t++;
+ }
+}, 300);
+}
+</script>
+
+<iframe srcdoc="<html xmlns='http://www.w3.org/1999/xhtml'>
+ <iframe/>
+ <frameset onblur='window.frameElement.parentNode.removeChild(window.frameElement)' id='frame'/>
+
+ <script>
+function doe(i){
+ document.getElementById('frame').focus();
+ document.getElementsByTagName('*')[1].focus();
+}
+top.opener.SimpleTest.waitForFocus(function () setTimeout(doe, 100), top);
+ </script>
+ </html>" onload="doe()" id="content"></iframe>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/general/chrome.ini b/dom/tests/mochitest/general/chrome.ini
new file mode 100644
index 0000000000..9910eb7a9b
--- /dev/null
+++ b/dom/tests/mochitest/general/chrome.ini
@@ -0,0 +1,12 @@
+[DEFAULT]
+skip-if = os == 'android'
+
+[test_innerScreen.xhtml]
+[test_offsets.xhtml]
+support-files = test_offsets.css test_offsets.js
+skip-if = (os == "mac" && debug) #leaks Bug 1571583
+[test_spacetopagedown.html]
+[test_nodeAdoption_chrome_boundary.xhtml]
+[test_focusrings.xhtml]
+support-files = file_focusrings.html
+skip-if = toolkit == 'android' #TIMED_OUT
diff --git a/dom/tests/mochitest/general/cssA.css b/dom/tests/mochitest/general/cssA.css
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/cssA.css
diff --git a/dom/tests/mochitest/general/cssB.css b/dom/tests/mochitest/general/cssB.css
new file mode 100644
index 0000000000..8d44ebd00f
--- /dev/null
+++ b/dom/tests/mochitest/general/cssB.css
@@ -0,0 +1,2 @@
+@import 'cssC.css';
+@import url('http://example.org/tests/dom/tests/mochitest/general/cssC.css');
diff --git a/dom/tests/mochitest/general/cssC.css b/dom/tests/mochitest/general/cssC.css
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/cssC.css
diff --git a/dom/tests/mochitest/general/embed_navigate.html b/dom/tests/mochitest/general/embed_navigate.html
new file mode 100644
index 0000000000..93641f026a
--- /dev/null
+++ b/dom/tests/mochitest/general/embed_navigate.html
@@ -0,0 +1 @@
+<script>location="https://test2.example.org/tests/dom/tests/mochitest/general/postback.html"</script>
diff --git a/dom/tests/mochitest/general/emptyCssFile2.css b/dom/tests/mochitest/general/emptyCssFile2.css
new file mode 100644
index 0000000000..64f97ae687
--- /dev/null
+++ b/dom/tests/mochitest/general/emptyCssFile2.css
@@ -0,0 +1 @@
+@import url('http://example.org/tests/dom/tests/mochitest/general/cross.css'); \ No newline at end of file
diff --git a/dom/tests/mochitest/general/fail.png b/dom/tests/mochitest/general/fail.png
new file mode 100644
index 0000000000..db812bd7d5
--- /dev/null
+++ b/dom/tests/mochitest/general/fail.png
Binary files differ
diff --git a/dom/tests/mochitest/general/file_bug628069.html b/dom/tests/mochitest/general/file_bug628069.html
new file mode 100644
index 0000000000..9fd28888c9
--- /dev/null
+++ b/dom/tests/mochitest/general/file_bug628069.html
@@ -0,0 +1,16 @@
+<html>
+<body onhashchange='hashchange(event)' onload='load()'>
+
+<script>
+function hashchange(e) {
+ (opener || parent).childHashchange(e);
+}
+
+function load() {
+ (opener || parent).childLoad();
+}
+</script>
+
+Just a shell of a page.
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/file_clonewrapper.html b/dom/tests/mochitest/general/file_clonewrapper.html
new file mode 100644
index 0000000000..18e0505d86
--- /dev/null
+++ b/dom/tests/mochitest/general/file_clonewrapper.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html>
+<head>
+<script type="application/javascript">
+
+ function waitForMessage() {
+ return new Promise(function(resolve) {
+ window.addEventListener('message', function(evt) {
+ resolve(evt.data);
+ }, {once: true});
+ });
+ }
+
+ // Set up the objects for cloning.
+ function setup() {
+ window.testObject = { myNumber: 42,
+ myString: "hello",
+ myImageData: new ImageData(10, 10) };
+ }
+
+ // Called by the chrome parent window.
+ function tryToClone(obj, shouldSucceed, message) {
+ var success = false;
+ try { window.postMessage(obj, '*'); success = true; }
+ catch (e) { message = message + ' (threw: ' + e.message + ')'; }
+ is(success, shouldSucceed, message);
+ return (success && shouldSucceed) ? waitForMessage() : Promise.resolve();
+ }
+
+</script>
+</head>
+<body onload="setup()">
+<input id="fileinput" type="file"></input>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/file_domWindowUtils_scrollbarSize.html b/dom/tests/mochitest/general/file_domWindowUtils_scrollbarSize.html
new file mode 100644
index 0000000000..1959fc4f68
--- /dev/null
+++ b/dom/tests/mochitest/general/file_domWindowUtils_scrollbarSize.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<html>
+<body style='width: 100000px; overflow: hidden;'></body>
+ <div id="float" style="float: left; overflow: scroll;">
+ <div style="width: 200px;"></div>
+ </div>
+</html>
diff --git a/dom/tests/mochitest/general/file_focusrings.html b/dom/tests/mochitest/general/file_focusrings.html
new file mode 100644
index 0000000000..74f3a563ed
--- /dev/null
+++ b/dom/tests/mochitest/general/file_focusrings.html
@@ -0,0 +1,5 @@
+<html><style>
+* { outline: none; -moz-appearance: none; min-width:10px; min-height:10px; }
+#elem:focus { outline: 2px solid red; }
+#elem:-moz-focusring { outline: 1px solid blue; }
+</style><div id='container'></html>
diff --git a/dom/tests/mochitest/general/file_frameElementWrapping.html b/dom/tests/mochitest/general/file_frameElementWrapping.html
new file mode 100644
index 0000000000..44237f7e04
--- /dev/null
+++ b/dom/tests/mochitest/general/file_frameElementWrapping.html
@@ -0,0 +1,32 @@
+<html>
+ <script>
+ function check(elt, expectAccess, prop) {
+ var access = false;
+ try {
+ elt[prop];
+ access = true;
+ }
+ catch (e) {}
+ return access === expectAccess;
+ }
+
+ function sendMessage(success, sameOrigin, prop) {
+ var result = success ? 'PASS' : 'FAIL';
+ var message;
+ if (sameOrigin)
+ message = 'Can access |' + prop + '| if same origin';
+ else
+ message = 'Cannot access |' + prop + '| if not same origin';
+ parent.postMessage(result + ',' + message, '*');
+ }
+
+ var sameOrigin = location.host !== 'example.org';
+ var pass = check(frameElement, sameOrigin, 'src');
+ if (!pass) {
+ sendMessage(false, sameOrigin, 'src');
+ } else {
+ pass = check(parent.location, sameOrigin, 'href');
+ sendMessage(pass, sameOrigin, 'href');
+ }
+ </script>
+</html>
diff --git a/dom/tests/mochitest/general/file_moving_nodeList.html b/dom/tests/mochitest/general/file_moving_nodeList.html
new file mode 100644
index 0000000000..2456c6e689
--- /dev/null
+++ b/dom/tests/mochitest/general/file_moving_nodeList.html
@@ -0,0 +1,31 @@
+<html>
+ <head>
+ <script>
+ document.childNodes.expando = "foo";
+
+ function getNodeList() {
+ return document.childNodes;
+ }
+ function getOptions() {
+ return document.createElement("select").options;
+ }
+
+ function tryToUseNodeList(nodeList, ok) {
+ function expectException(op, reason) {
+ try {
+ var result = op();
+ ok(false, "should have thrown an exception, got: " + result);
+ } catch (e) {
+ ok(/Permission denied/.test(e.toString()), reason);
+ }
+ }
+
+ expectException(function() { nodeList.length = 2; }, "should not be able to set attributes");
+ expectException(function() { nodeList.item(0); }, "should not have access to any functions");
+ expectException(function() { nodeList.foo = "foo"; }, "should not be able to add expandos");
+ }
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/file_moving_xhr.html b/dom/tests/mochitest/general/file_moving_xhr.html
new file mode 100644
index 0000000000..ee09c2bd10
--- /dev/null
+++ b/dom/tests/mochitest/general/file_moving_xhr.html
@@ -0,0 +1,28 @@
+<html>
+ <head>
+ <script>
+ function createXHR() {
+ var xhr = new XMLHttpRequest();
+ xhr.expando = "foo";
+ return xhr;
+ }
+
+ function tryToUseXHR(xhr, ok) {
+ function expectException(op, reason) {
+ try {
+ var result = op();
+ ok(false, "should have thrown an exception, got: " + result);
+ } catch (e) {
+ ok(/Permission denied/.test(e.toString()), reason);
+ }
+ }
+
+ expectException(function() { xhr.open(); }, "should not have access to any functions");
+ expectException(function() { xhr.foo = "foo"; }, "should not be able to add expandos");
+ expectException(function() { xhr.withCredentials = true; }, "should not be able to set attributes");
+ }
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/file_resource_timing_nocors.html b/dom/tests/mochitest/general/file_resource_timing_nocors.html
new file mode 100644
index 0000000000..631251c2b1
--- /dev/null
+++ b/dom/tests/mochitest/general/file_resource_timing_nocors.html
@@ -0,0 +1,191 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css?resource-timing-nocors"/>
+
+ <!--
+ This document has the origin http://mochi.test:8888.
+
+ The resource timing of any all sub-resources should be reported, except for
+ any sub-resources of any cross-origin resources that are loaded.
+
+ Note that the resource timing of the original cross-origin resource should
+ itself be reported. The goal here is to not reveal which sub-resources are
+ loaded by any cross-origin resources (the fact that any given cross-origin
+ resource itself is loaded is known to the original origin).
+
+ In the comments below, the following annotations apply:
+
+ [r] - this resource should be reported by performance.getEntries()
+ [!] - this resource should be excluded from performance.getEntries()
+ -->
+
+
+ <!-- 1. [r] http://mochi.test:8888 , generateCss.sjs?A
+ [r] http://mochi.test:8888 , generateCss.sjs?B
+ -->
+ <link rel="stylesheet" type="text/css" href="generateCss.sjs?A"/>
+
+
+ <!-- 2. [r] http://example.com , generateCss.sjs?C
+ [!] http://example.com , generateCss.sjs?D
+ -->
+ <link rel="stylesheet" type="text/css" href="http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?C"/>
+
+
+ <!-- 3. [r] http://example.com , generateCss.sjs?E
+ [!] http://mochi.test:8888 , generateCss.sjs?F
+ -->
+ <link rel="stylesheet" type="text/css" href="http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?E"/>
+
+
+ <!-- 4. [r] http://mochi.test:8888 , generateCss.sjs?G
+ [r] http://mochi.test:8888 , generateCss.sjs?H
+ [r] http://example.com , generateCss.sjs?I
+ [!] http://example.com , generateCss.sjs?J
+ [r] http://example.org , generateCss.sjs?K
+ [!] http://example.org , generateCss.sjs?L
+ [!] http://example.org , generateCss.sjs?M
+ -->
+ <link rel="stylesheet" type="text/css" href="generateCss.sjs?G"/>
+
+
+ <!-- 5. background-image: -moz-image-rect()
+ [r] http://example.net , generateCss.sjs?N
+ [!] http://example.net , blue.png
+ -->
+ <link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?N"/>
+
+
+ <!-- 6. background-image: url()
+ [r] http://example.net , generateCss.sjs?O
+ [!] http://example.net , red.png
+ -->
+ <link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?O"/>
+
+
+ <!-- 7. @font-face
+ [r] http://example.net , generateCss.sjs?P
+ [!] http://example.net , Ahem.tff
+ -->
+ <link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?P"/>
+
+
+ <!-- 8. cursor: url()
+ [r] http://example.net , generateCss.sjs?Q
+ [!] http://example.net , over.png
+ -->
+ <link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?Q"/>
+
+
+ <!-- 9. mask: url(res.svg#mask)
+ TODO: I don't think this is working properly. Must fix.
+ [r] http://example.net , generateCss.sjs?R
+ [!] http://example.net , file_use_counter_svg_fill_pattern_data.svg
+ -->
+ <link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?R"/>
+
+
+ <!-- TODO: add test that we _do_ include subresources if the cross-origin sheet was fetched via CORS -->
+
+
+ <script type="application/javascript">
+
+function ok(cond, message) {
+ window.opener.ok(cond, message)
+}
+
+function is(received, expected, message) {
+ window.opener.is(received, expected, message);
+}
+
+function isnot(received, notExpected, message) {
+ window.opener.isnot(received, notExpected, message);
+}
+
+var allResources = {
+ "http://mochi.test:8888/tests/SimpleTest/test.css?resource-timing-nocors" : "link",
+
+ // 1
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?A" : "link",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?B" : "css",
+
+ // 2
+ "http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?C" : "link",
+
+ // 3
+ "http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?E" : "link",
+
+ // 4
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?G" : "link",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?H" : "css",
+ "http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?I" : "css",
+ "http://example.org/tests/dom/tests/mochitest/general/generateCss.sjs?K" : "css",
+
+ // 5
+ "http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?N" : "link",
+
+ // 6
+ "http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?O" : "link",
+
+ // 7
+ "http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?P" : "link",
+
+ // 8
+ "http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?Q" : "link",
+
+ // 9
+ "http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?R" : "link",
+};
+
+window.onload = function() {
+ let entries = performance.getEntriesByType('resource');
+ for (let entry of entries) {
+ //dump(entry.name + " || "+ entry.initiatorType+ "\n");
+ if (!(entry.name in allResources)) {
+ if (entry.name.substr(-4) == ".ttf") {
+ // TODO: fix hiding of font files
+ continue;
+ }
+ ok(false, "Did not expect timing for resource: " + entry.name);
+ continue;
+ }
+ let resType = allResources[entry.name];
+ is(entry.initiatorType, resType,
+ "Expected matching initiatorType for: " + entry.name);
+ delete allResources[entry.name];
+ }
+
+ for (let res in allResources) {
+ ok(false, "Expect timing for resource: " + res);
+ }
+
+ window.opener.finishTests();
+}
+
+</script>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1180145"
+ title="Resource timing NO-CORS CSS">
+ Bug #1180145 - Resource Timing NO-CORS CSS
+ </a>
+ <p id="display"></p>
+ <div id="content">
+ </div>
+
+ <div class="c1"> BLUE </div>
+ <div class="c2"> RED </div>
+ <div class="c3"> Font </div>
+ <div class="c4"> CURSOR </div>
+ <div class="c5"> <img id="image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="> </div>
+ <div class="c6"> </div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/frameSelectEvents.html b/dom/tests/mochitest/general/frameSelectEvents.html
new file mode 100644
index 0000000000..21995c86ef
--- /dev/null
+++ b/dom/tests/mochitest/general/frameSelectEvents.html
@@ -0,0 +1,929 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Testing Selection Events</title>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+
+ <body>
+ <div id="normal">
+ <span id="inner">A bunch of text in a span inside of a div which should be selected</span>
+ </div>
+
+ <div id="ce">
+ This is a random block of text
+ </div>
+
+ <input type="text" id="input" value="XXXXXXXXXXXXXXXXXXX" width="200"> <br>
+
+ <textarea id="textarea" width="200">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</textarea>
+
+ <script>
+ // Call the testing methods from the parent window
+ var is = parent.is;
+ var ok = parent.ok;
+
+ // spin() spins the event loop for two cycles, giving time for
+ // selectionchange events to be fired, and handled by our listeners.
+ function spin() {
+ return new Promise(function(a) {
+ parent.SimpleTest.executeSoon(function() {
+ parent.SimpleTest.executeSoon(a)
+ });
+ });
+ }
+
+ /**
+ * @param {Node} node
+ */
+ function isProperSelectionChangeTarget(node) {
+ return node === document || node === input || node === textarea;
+ }
+
+ // The main test
+ parent.add_task(async function() {
+ await spin();
+
+ var selectstart = 0;
+ var selectionchange = 0;
+ var inputSelectionchange = 0;
+ var textareaSelectionchange = 0;
+
+ var cancel = false;
+ var selectstartTarget = null;
+
+ async function UpdateSelectEventsOnTextControlsPref({ selectstart, selectionchange }) {
+ await SpecialPowers.pushPrefEnv({
+ 'set': [
+ ['dom.select_events.textcontrols.selectstart.enabled', !!selectstart],
+ ['dom.select_events.textcontrols.selectionchange.enabled', !!selectionchange],
+ ]
+ });
+ }
+ await UpdateSelectEventsOnTextControlsPref({
+ selectstart: false,
+ selectionchange: false,
+ });
+
+ document.addEventListener('selectstart', function(aEvent) {
+ console.log("originaltarget", aEvent.originalTarget, "new", selectstartTarget);
+ is(aEvent.originalTarget, selectstartTarget,
+ "The original target of selectstart");
+ selectstartTarget = null;
+
+ console.log(selectstart);
+ selectstart++;
+
+ if (cancel) {
+ aEvent.preventDefault();
+ }
+ });
+ document.addEventListener('selectionchange', function(aEvent) {
+ ok(isProperSelectionChangeTarget(aEvent.target),
+ "The target of selectionchange should be one of document, input, or textarea");
+ console.log(selectionchange);
+ selectionchange++;
+ });
+
+ function elt(aId) { return document.getElementById(aId); }
+ function reset() {
+ selectstart = 0;
+ selectionchange = 0;
+ inputSelectionchange = 0;
+ textareaSelectionchange = 0;
+ cancel = false;
+ }
+
+ elt("input").addEventListener('selectionchange', function(aEvent) {
+ is (aEvent.originalTarget, elt("input"),
+ "The original target of selectionchange should be the input");
+ console.log(inputSelectionchange);
+ inputSelectionchange++;
+ });
+ elt("textarea").addEventListener('selectionchange', function(aEvent) {
+ is (aEvent.originalTarget, elt("textarea"),
+ "The original target of selectionchange should be the textarea");
+ console.log(textareaSelectionchange);
+ textareaSelectionchange++;
+ });
+
+ function checkEventCounts(
+ aTestDescription,
+ aSituationDescription,
+ aExpectedEventCounts
+ ) {
+ let {
+ selectstartOnDocument = 0,
+ selectionchangeOnDocument = 0,
+ selectionchangeOnInput = 0,
+ selectionchangeOnTextarea = 0,
+ } = aExpectedEventCounts;
+
+ is(
+ selectstart,
+ selectstartOnDocument,
+ `${
+ aTestDescription
+ }: "selectstart" event on the document node should be fired ${
+ selectstartOnDocument
+ } times ${aSituationDescription}`
+ );
+ is(
+ selectionchange,
+ selectionchangeOnDocument,
+ `${
+ aTestDescription
+ }: "selectionchange" event on the document node should be fired ${
+ selectionchangeOnDocument
+ } times ${aSituationDescription}`
+ );
+ is(
+ inputSelectionchange,
+ selectionchangeOnInput,
+ `${
+ aTestDescription
+ }: "selectionchange" event on the <input> should be fired ${
+ selectionchangeOnInput
+ } times ${aSituationDescription}`
+ );
+ is(
+ textareaSelectionchange,
+ selectionchangeOnTextarea,
+ `${
+ aTestDescription
+ }: "selectionchange" event on the <textarea> should be fired ${
+ selectionchangeOnTextarea
+ } times ${aSituationDescription}`
+ );
+ }
+
+ async function testWithSynthesizingMouse(
+ aDescription,
+ aElement,
+ aOffset,
+ aType,
+ aExpectedEventCounts
+ ) {
+ const eventObject = aType == "click" ? {} : { type: aType };
+ if (aOffset.y === undefined || aOffset.y === null) {
+ aOffset.y = 10;
+ }
+ synthesizeMouse(aElement, aOffset.x, aOffset.y, eventObject);
+ await spin();
+
+ checkEventCounts(
+ aDescription,
+ `after synthesizing ${aType} at ${aOffset.x}, ${aOffset.y}`,
+ aExpectedEventCounts
+ );
+ reset();
+ }
+
+ async function testWithSynthesizingKey(
+ aDescription,
+ aKey,
+ aEventObject,
+ aExpectedEventCounts
+ ) {
+ synthesizeKey(aKey, aEventObject);
+ await spin();
+
+ checkEventCounts(
+ aDescription,
+ `after synthesizing a key press of "${aKey}"`,
+ aExpectedEventCounts
+ );
+ reset();
+ }
+
+ async function testWithSettingContentEditableAttribute(
+ aDescription,
+ aElement,
+ aContentEditableValue,
+ aExpectedEventCounts
+ ) {
+ aElement.setAttribute("contenteditable",
+ aContentEditableValue ? "true" : "false");
+ await spin();
+
+ checkEventCounts(
+ aDescription,
+ `after setting contenteditable attribute to ${
+ aElement.getAttribute("contenteditable")
+ }`,
+ aExpectedEventCounts
+ );
+ reset();
+ }
+
+ var selection = document.getSelection();
+ function isCollapsed() {
+ is(selection.isCollapsed, true, "Selection is collapsed");
+ }
+ function isNotCollapsed() {
+ is(selection.isCollapsed, false, "Selection is not collapsed");
+ }
+
+ // Make sure setting the element to contentEditable doesn't cause any selectionchange events
+ await testWithSettingContentEditableAttribute(
+ "Setting contenteditable attribute to true of <div> should not change selection",
+ elt("ce"),
+ true,
+ {}
+ );
+
+ // Make sure setting the element to not be contentEditable doesn't cause any selectionchange events
+ await testWithSettingContentEditableAttribute(
+ 'Setting contenteditable attribute to false of <div contenteditable="true"> should not change selection',
+ elt("ce"),
+ false,
+ {}
+ );
+
+ // Now make the div contentEditable and proceed with the test
+ await testWithSettingContentEditableAttribute(
+ 'Setting contenteditable attribute to true of <div contenteditable="false"> should not change selection',
+ elt("ce"),
+ true,
+ {}
+ );
+
+ // Focus the contenteditable text
+ await testWithSynthesizingMouse(
+ 'Clicking in <div contenteditable="true"> should change selection',
+ elt("ce"),
+ { x: 100 },
+ "click",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ // Move the selection to the right, this should only fire selectstart once
+ selectstartTarget = elt("ce").firstChild;
+ await testWithSynthesizingKey(
+ 'Synthesizing Shift-ArrowRight to select a character in the text node of <div contenteditable="true"> should start to select again and change selection',
+ "KEY_ArrowRight",
+ { shiftKey: true },
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+ await testWithSynthesizingKey(
+ 'Synthesizing Shift-ArrowRight again to select 2 characters in the text node of <div contenteditable="true"> should change selection',
+ "KEY_ArrowRight",
+ { shiftKey: true },
+ { selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+
+ // Move it back so that the selection is empty again
+ await testWithSynthesizingKey(
+ 'Synthesizing Shift-ArrowLeft to shrink selection in the text node of <div contenteditable="true"> should change selection',
+ "KEY_ArrowLeft",
+ { shiftKey: true },
+ { selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+ await testWithSynthesizingKey(
+ 'Synthesizing Shift-ArrowLeft again to collapse selection in the text node of <div contenteditable="true"> should change selection',
+ "KEY_ArrowLeft",
+ { shiftKey: true },
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ // Going from empty to non-empty should fire selectstart again
+ selectstartTarget = elt("ce").firstChild;
+ await testWithSynthesizingKey(
+ 'Synthesizing Shift-ArrowLeft again to select a character on the other side in the text node of <div contenteditable="true"> should start to select and change selection',
+ "KEY_ArrowLeft",
+ { shiftKey: true },
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+
+ async function testWithSynthesizingMouseDrag(
+ aDescription,
+ aElement,
+ aSelectstartTarget
+ ) {
+ // Select a region
+ await testWithSynthesizingMouse(
+ `Pressing left mouse button ${
+ aDescription
+ } should not start to select but should change selection`,
+ aElement,
+ { x: 50 },
+ "mousedown",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ selectstartTarget = aSelectstartTarget;
+ await testWithSynthesizingMouse(
+ `Dragging mouse to right to extend selection ${
+ aDescription
+ } should start to select and change selection`,
+ aElement,
+ { x: 100 },
+ "mousemove",
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+
+ // Moving it more shouldn't trigger a start (move back to empty)
+ await testWithSynthesizingMouse(
+ `Dragging mouse to left to shrink selection ${
+ aDescription
+ } should change selection`,
+ aElement,
+ { x: 75 },
+ "mousemove",
+ { selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+ await testWithSynthesizingMouse(
+ `Dragging mouse to left to collapse selection ${
+ aDescription
+ } should change selection`,
+ aElement,
+ { x: 50 },
+ "mousemove",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ // Wiggling the mouse a little such that it doesn't select any
+ // characters shouldn't trigger a selection
+ await testWithSynthesizingMouse(
+ `Dragging mouse to bottom a bit ${
+ aDescription
+ } should not cause selection change`,
+ aElement,
+ { x: 50, y: 11 },
+ "mousemove",
+ {}
+ );
+ isCollapsed();
+
+ // Moving the mouse again from an empty selection should trigger a
+ // selectstart
+ selectstartTarget = aSelectstartTarget;
+ await testWithSynthesizingMouse(
+ `Dragging mouse to left to extend selection ${
+ aDescription
+ } should start to select and change selection`,
+ aElement,
+ { x: 25 },
+ "mousemove",
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+
+ // Releasing the mouse shouldn't do anything
+ await testWithSynthesizingMouse(
+ `Releasing left mouse button to stop dragging ${
+ aDescription
+ } should not change selection`,
+ aElement,
+ { x: 25 },
+ "mouseup",
+ {}
+ );
+ isNotCollapsed();
+
+ // And neither should moving your mouse around when the mouse
+ // button isn't pressed
+ await testWithSynthesizingMouse(
+ `Just moving mouse to right ${
+ aDescription
+ } should not start to select nor change selection`,
+ aElement,
+ { x: 50 },
+ "mousemove",
+ {}
+ );
+ isNotCollapsed();
+
+ // Clicking in an random location should move the selection, but not perform a
+ // selectstart
+ await testWithSynthesizingMouse(
+ `Clicking to collapse selection ${
+ aDescription
+ } should cause only selection change`,
+ aElement,
+ { x: 50 },
+ "click",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ // Clicking there again should do nothing
+ await testWithSynthesizingMouse(
+ `Clicking same position again ${
+ aDescription
+ } should not change selection`,
+ aElement,
+ { x: 50 },
+ "click",
+ {}
+ );
+ isCollapsed();
+
+ // Selecting a region, and canceling the selectstart should mean that the
+ // selection remains collapsed
+ await testWithSynthesizingMouse(
+ `Pressing left mouse button on different character to move caret ${
+ aDescription
+ } should cause only selection change`,
+ aElement,
+ { x: 75 },
+ "mousedown",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+ cancel = true;
+ selectstartTarget = aSelectstartTarget;
+ await testWithSynthesizingMouse(
+ `Moving mouse to right to extend selection but selectstart event will be prevented default ${
+ aDescription
+ } should start to select and change selection`,
+ aElement,
+ { x: 100 },
+ "mousemove",
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+ await testWithSynthesizingMouse(
+ `Releasing the left mouse button after dragging but selectstart was prevented the default ${
+ aDescription
+ } should not change selection`,
+ aElement,
+ { x: 100 },
+ "mouseup",
+ {}
+ );
+ isCollapsed();
+ }
+
+ // Should work both on normal
+ await testWithSynthesizingMouseDrag(
+ "on the text node in the non-editable <div>",
+ elt("inner"),
+ elt("inner").firstChild
+ );
+ // and contenteditable fields
+ await testWithSynthesizingMouseDrag(
+ 'on the text node in the editable <div contenteditable="true">',
+ elt("ce"),
+ elt("ce").firstChild
+ );
+ // and fields with elements in them
+ await testWithSynthesizingMouseDrag(
+ "on the text node in the non-editable <div>'s child",
+ elt("normal"),
+ elt("inner").firstChild
+ );
+
+ await testWithSynthesizingMouse(
+ "Clicking in the text node in the `<div>` should change selection",
+ elt("inner"),
+ { x: 50 },
+ "click",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ reset();
+ // Select all should fire both selectstart and change
+ selectstartTarget = document.body;
+ await testWithSynthesizingKey(
+ "Select All when no editor has focus should start to select and select all content",
+ "a", { accelKey: true },
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+
+ // Clear the selection
+ await testWithSynthesizingMouse(
+ "Clicking in the non-editable <div> should clear selection",
+ elt("inner"),
+ { x: 50 },
+ "click",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ // Even if we already have a selection
+ await testWithSynthesizingMouse(
+ "Pressing the left mouse button in non-editable <div> should change selection",
+ elt("inner"),
+ { x: 75 },
+ "mousedown",
+ { selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+ selectstartTarget = elt("inner").firstChild;
+ await testWithSynthesizingMouse(
+ "Dragging mouse to right to extend selection should start and change selection",
+ elt("inner"),
+ { x: 100 },
+ "mousemove",
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+ await testWithSynthesizingMouse(
+ "Releasing the left mouse button should not change selection",
+ elt("inner"),
+ { x: 100 },
+ "mouseup",
+ {}
+ );
+ isNotCollapsed();
+
+ selectstartTarget = document.body;
+ await testWithSynthesizingKey(
+ "Select All when no editor has focus should start to select and select all content (again)",
+ "a",
+ { accelKey: true },
+ { selectstartOnDocument: 1, selectionchangeOnDocument: 1 }
+ );
+ isNotCollapsed();
+
+ // Clear the selection
+ await testWithSynthesizingMouse(
+ "Clicking in the non-editable <div> should clear selection (again)",
+ elt("inner"),
+ { x: 50 },
+ "click",
+ {selectionchangeOnDocument: 1 }
+ );
+ isCollapsed();
+
+ // Make sure that a synthesized selection change doesn't fire selectstart
+ getSelection().removeAllRanges();
+ await spin();
+ is(
+ selectstart,
+ 0,
+ "Selection.removeAllRanges() should not cause selectstart event"
+ );
+ is(
+ selectionchange,
+ 1,
+ "Selection.removeAllRanges() should cause selectionchange event"
+ );
+ reset();
+ isCollapsed();
+
+ await (async function test_Selection_selectNode() {
+ const range = document.createRange();
+ range.selectNode(elt("inner"));
+ getSelection().addRange(range);
+ await spin();
+ is(
+ selectstart,
+ 0,
+ "Selection.addRange() should not cause selectstart event"
+ );
+ is(
+ selectionchange,
+ 1,
+ "Selection.addRange() should cause selectionchange event"
+ );
+ reset();
+ isNotCollapsed();
+ })();
+
+ // Change the range, without replacing
+ await (async function test_Selection_getRangeAt_selectNode() {
+ getSelection().getRangeAt(0).selectNode(elt("ce"));
+ await spin();
+ is(
+ selectstart,
+ 0,
+ "Selection.getRangeAt(0).selectNode() should not cause selectstart event"
+ );
+ is(
+ selectionchange,
+ 1,
+ "Selection.getRangeAt(0).selectNode() should cause selectionchange event"
+ );
+ reset();
+ isNotCollapsed();
+ })();
+
+ // Remove the range
+ getSelection().removeAllRanges();
+ await spin();
+ is(
+ selectstart,
+ 0,
+ "Selection.removeAllRanges() should not cause selectstart event (again)"
+ );
+ is(
+ selectionchange,
+ 1,
+ "Selection.removeAllRanges() should cause selectionchange event (again)"
+ );
+ reset();
+ isCollapsed();
+
+ for (const textControl of [elt("input"), elt("textarea")]) {
+ await UpdateSelectEventsOnTextControlsPref({
+ selectstart: false,
+ selectionchange: false,
+ });
+
+ // Without the dom.select_events.textcontrols.enabled pref,
+ // pressing the mouse shouldn't do anything.
+ await testWithSynthesizingMouse(
+ `Pressing the left mouse button in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should change selection of the document`,
+ textControl,
+ { x: 50 },
+ "mousedown",
+ {
+ // XXX Bug 1721287: For some reason we fire 2 selectchange events
+ // on the body when switching from the <input> to the <textarea>.
+ selectionchangeOnDocument:
+ document.activeElement != textControl &&
+ (document.activeElement.tagName.toLocaleLowerCase() == "input" ||
+ document.activeElement.tagName.toLocaleLowerCase() == "textarea")
+ ? 2
+ : 1,
+ }
+ );
+
+ // Releasing the mouse shouldn't do anything
+ await testWithSynthesizingMouse(
+ `Releasing the left mouse button in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should not change any selection`,
+ textControl,
+ { x: 50 },
+ "mouseup",
+ {}
+ );
+
+ for (const selectstart of [1, 0]) {
+ await UpdateSelectEventsOnTextControlsPref({
+ selectstart,
+ selectionchange: true,
+ });
+
+ const selectstartEventSetting = `selectstart in text controls is ${
+ selectstart ? "enabled" : "disabled"
+ }`;
+
+ const isInput = textControl.tagName.toLocaleLowerCase() == "input";
+
+ await testWithSynthesizingMouse(
+ `Pressing the left mouse button in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should change selection (${selectstartEventSetting})`,
+ textControl,
+ { x: 40 },
+ "mousedown",
+ {
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+
+ selectstartTarget = textControl;
+ await testWithSynthesizingMouse(
+ `Dragging mouse to right to extend selection in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should start to select and change selection (${
+ selectstartEventSetting
+ })`,
+ textControl,
+ { x: 100 },
+ "mousemove",
+ {
+ selectstartOnDocument: selectstart,
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+
+ // Moving it more shouldn't trigger a start (move back to empty)
+ await testWithSynthesizingMouse(
+ `Dragging mouse to left to shrink selection in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should change selection (${selectstartEventSetting})`,
+ textControl,
+ { x: 75 },
+ "mousemove",
+ {
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+ await testWithSynthesizingMouse(
+ `Dragging mouse to left to collapse selection in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should change selection (${selectstartEventSetting})`,
+ textControl,
+ { x: 40 },
+ "mousemove",
+ {
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+
+ // Wiggling the mouse a little such that it doesn't select any
+ // characters shouldn't trigger a selection
+ await testWithSynthesizingMouse(
+ `Pressing the left mouse button at caret in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should not change selection (${selectstartEventSetting})`,
+ textControl,
+ {
+ x: 40,
+ y: 11,
+ },
+ "mousemove",
+ {}
+ );
+
+ // Moving the mouse again from an empty selection should trigger a
+ // selectstart
+ selectstartTarget = textControl;
+ await testWithSynthesizingMouse(
+ `Dragging mouse to left to extend selection in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should start to select and change selection (${
+ selectstartEventSetting
+ })`,
+ textControl,
+ { x: 25 },
+ "mousemove",
+ {
+ selectstartOnDocument: selectstart,
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+
+ // Releasing the mouse shouldn't do anything
+ await testWithSynthesizingMouse(
+ `Releasing the left mouse button in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should not change selection (${selectstartEventSetting})`,
+ textControl,
+ { x: 25 },
+ "mouseup",
+ {}
+ );
+
+ // And neither should moving your mouse around when the mouse
+ // button isn't pressed
+ await testWithSynthesizingMouse(
+ `Just moving mouse to right in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should not start to select nor change selection (${
+ selectstartEventSetting
+ })`,
+ textControl,
+ { x: 50 },
+ "mousemove",
+ {}
+ );
+
+ // Clicking in an random location should move the selection, but
+ // not perform a selectstart
+ await testWithSynthesizingMouse(
+ `Clicking in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should change selection, but should not start selection (${
+ selectstartEventSetting
+ })`,
+ textControl,
+ { x: 50 },
+ "click",
+ {
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+
+ // Clicking there again should do nothing
+ await testWithSynthesizingMouse(
+ `Clicking at caret in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should not change selection (${selectstartEventSetting})`,
+ textControl,
+ { x: 50 },
+ "click",
+ {}
+ );
+
+ // Selecting a region, and canceling the selectstart should mean that the
+ // selection remains collapsed
+ await testWithSynthesizingMouse(
+ `Pressing the left mouse button at different character in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should change selection (${selectstartEventSetting})`,
+ textControl,
+ { x: 75 },
+ "mousedown",
+ {
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+ cancel = true;
+ selectstartTarget = textControl;
+ await testWithSynthesizingMouse(
+ `Dragging mouse to right to extend selection in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> but the default of selectstart is prevented should cause selectstart and selectionchange events (${
+ selectstartEventSetting
+ })`,
+ textControl,
+ { x: 100 },
+ "mousemove",
+ {
+ selectstartOnDocument: selectstart,
+ selectionchangeOnDocument: 1,
+ selectionchangeOnInput: isInput ? 1 : 0,
+ selectionchangeOnTextarea: isInput ? 0 : 1,
+ }
+ );
+ await testWithSynthesizingMouse(
+ `Releasing the left mouse button in <${
+ textControl.tagName.toLocaleLowerCase()
+ }> should not cause changing selection (${selectstartEventSetting})`,
+ textControl,
+ { x: 100 },
+ "mouseup",
+ {}
+ );
+ }
+ }
+
+ // Marking the input and textarea as display: none and then as visible again
+ // shouldn't trigger any changes, although the nodes will be re-framed
+ for (const textControl of [elt("input"), elt("textarea")]) {
+ await (async function test_set_display_of_text_control_to_none() {
+ textControl.setAttribute("style", "display: none;");
+ await spin();
+ checkEventCounts(
+ `Setting display of <${
+ textControl.tagName.toLocaleLowerCase()
+ }> to none`,
+ "",
+ {}
+ );
+ reset();
+ })();
+
+ await (async function test_remove_display_none_of_text_control() {
+ textControl.setAttribute("style", "");
+ await spin();
+ checkEventCounts(
+ `Removing display:none of <${
+ textControl.tagName.toLocaleLowerCase()
+ }>`,
+ "",
+ {}
+ );
+ reset();
+ })();
+ }
+
+ // When selection is at the end of contentEditable's content,
+ // clearing the content should trigger selection events.
+ await (async function test_removing_contenteditable() {
+ const savedContent = elt("ce").innerHTML;
+ document.getSelection().setBaseAndExtent(elt("ce"), 1, elt("ce"), 1);
+ await spin();
+ reset();
+
+ elt("ce").firstChild.remove();
+ await spin();
+ checkEventCounts(
+ 'Removing <div contenteditable="true"> from the DOM tree',
+ "",
+ { selectionchangeOnDocument: 1 }
+ );
+
+ elt("ce").innerHTML = savedContent;
+ await spin();
+ reset();
+ })();
+ });
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/frameStorageAllowed.html b/dom/tests/mochitest/general/frameStorageAllowed.html
new file mode 100644
index 0000000000..bb96392398
--- /dev/null
+++ b/dom/tests/mochitest/general/frameStorageAllowed.html
@@ -0,0 +1,22 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for storage allowed test</title>
+
+<script type="text/javascript" src="https://example.com/tests/dom/tests/mochitest/general/storagePermissionsUtils.js"></script>
+<script type="text/javascript">
+
+ task(async function() {
+ // We should be able to access storage
+ await storageAllowed();
+
+ // We should be able to run a web worker which can access storage
+ await runWorker("workerStorageAllowed.js");
+ });
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/frameStorageChrome.html b/dom/tests/mochitest/general/frameStorageChrome.html
new file mode 100644
index 0000000000..51f4fa85e6
--- /dev/null
+++ b/dom/tests/mochitest/general/frameStorageChrome.html
@@ -0,0 +1,20 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for storage allowed test</title>
+
+<script type="text/javascript" src="https://example.com/tests/dom/tests/mochitest/general/storagePermissionsUtils.js"></script>
+<script type="text/javascript">
+
+ task(async function() {
+ // We just check if we can access storage as chrome using special powers!
+ var params = new URLSearchParams(location.search.substr(1));
+ await chromePower(params.get('allowed') == 'yes', params.get('blockSessionStorage') == 'yes');
+ });
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/frameStorageNullprincipal.sjs b/dom/tests/mochitest/general/frameStorageNullprincipal.sjs
new file mode 100644
index 0000000000..7dfdc32d1e
--- /dev/null
+++ b/dom/tests/mochitest/general/frameStorageNullprincipal.sjs
@@ -0,0 +1,40 @@
+// This is a sjs file which reads in frameStoragePrevented.html, and writes it out as a data: URI, which this page redirects to.
+// This produces a URI with the null principal, which should be unable to access storage.
+// We append the #nullprincipal hash to the end of the data: URI to tell the script that it shouldn't try to spawn a webworker,
+// as it won't be allowed to, as it has a null principal.
+
+function handleRequest(request, response) {
+ // Get the nsIFile for frameStoragePrevented.html
+ var file;
+ getObjectState("SERVER_ROOT", function (serverRoot) {
+ file = serverRoot.getFile(
+ "/tests/dom/tests/mochitest/general/frameStoragePrevented.html"
+ );
+ });
+
+ // Set up the file streams to read in the file as UTF-8
+ let fstream = Components.classes[
+ "@mozilla.org/network/file-input-stream;1"
+ ].createInstance(Components.interfaces.nsIFileInputStream);
+ fstream.init(file, -1, 0, 0);
+ let cstream = Components.classes[
+ "@mozilla.org/intl/converter-input-stream;1"
+ ].createInstance(Components.interfaces.nsIConverterInputStream);
+ cstream.init(fstream, "UTF-8", 0, 0);
+
+ // Read in the file, and concatenate it onto the data string
+ let data = "";
+ let str = {};
+ let read = 0;
+ do {
+ read = cstream.readString(0xffffffff, str);
+ data += str.value;
+ } while (read != 0);
+
+ // Write out the file as a data: URI, and redirect to it
+ response.setStatusLine("1.1", 302, "Found");
+ response.setHeader(
+ "Location",
+ "data:text/html," + encodeURIComponent(data) + "#nullprincipal"
+ );
+}
diff --git a/dom/tests/mochitest/general/frameStoragePrevented.html b/dom/tests/mochitest/general/frameStoragePrevented.html
new file mode 100644
index 0000000000..693beff5a4
--- /dev/null
+++ b/dom/tests/mochitest/general/frameStoragePrevented.html
@@ -0,0 +1,47 @@
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for storage prevented test</title>
+
+<script type="text/javascript" src="https://example.com/tests/dom/tests/mochitest/general/storagePermissionsUtils.js"></script>
+<script type="text/javascript">
+
+ task(async function() {
+ // We shouldn't be able to access storage
+ await storagePrevented();
+
+ // This hash of the URI is set to #nullprincipal by the test if the current page has a null principal,
+ // and thus attempting to create a dedicated worker will throw
+ if (location.hash == "#nullprincipal") {
+ function createWorker() {
+ return new Promise((resolve, reject) => {
+ var w;
+ try {
+ w = new Worker("workerStoragePrevented.js");
+ } catch (e) {
+ ok(true, "Running workers was prevented");
+ resolve();
+ }
+
+ w.onerror = function() {
+ ok(true, "Running workers was prevented");
+ resolve();
+ }
+ });
+ }
+
+ await createWorker();
+ return;
+ }
+
+ // Try to run a worker, which shouldn't be able to access storage
+ await runWorker("workerStoragePrevented.js");
+ });
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/generateCss.sjs b/dom/tests/mochitest/general/generateCss.sjs
new file mode 100644
index 0000000000..d6b4348aa3
--- /dev/null
+++ b/dom/tests/mochitest/general/generateCss.sjs
@@ -0,0 +1,42 @@
+function handleRequest(request, response) {
+ response.setHeader("Content-Type", "text/css", false);
+ response.write(gResponses[request.queryString]);
+}
+
+let gResponses = {
+ // 1
+ A: "@import 'generateCss.sjs?B';",
+ B: "",
+
+ // 2
+ C: "@import 'generateCss.sjs?D';",
+ D: "",
+
+ // 3
+ E: "@import 'generateCss.sjs?F';",
+ F: "",
+
+ // 4
+ G: "@import 'generateCss.sjs?H'; @import 'http://example.org/tests/dom/tests/mochitest/general/generateCss.sjs?K';",
+ H: "@import 'http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?I';",
+ I: "@import 'generateCss.sjs?J",
+ J: "",
+ K: "@import 'generateCss.sjs?L';",
+ L: "@import 'generateCss.sjs?M",
+ M: "",
+
+ // 5
+ N: ".c1 { background-image: -moz-image-rect(url('/image/test/mochitest/blue.png'), 0, 0, 200, 200);}",
+
+ // 6
+ O: ".c2 { background-image: url('/image/test/mochitest/red.png');}",
+
+ // 7
+ P: "@font-face { font-family: Ahem; src: url('/tests/dom/base/test/Ahem.ttf'); } .c3 { font-family: Ahem; font-size: 20px; }",
+
+ // 8
+ Q: ".c4 { cursor: url('/image/test/mochitest/over.png') 2 2, auto; } ",
+
+ // 9
+ R: "#image { mask: url('/tests/dom/base/test/file_use_counter_svg_fill_pattern_data.svg'); }",
+};
diff --git a/dom/tests/mochitest/general/historyframes.html b/dom/tests/mochitest/general/historyframes.html
new file mode 100644
index 0000000000..f0f7e934ae
--- /dev/null
+++ b/dom/tests/mochitest/general/historyframes.html
@@ -0,0 +1,179 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=602256
+-->
+<head>
+ <title>Test for Bug 602256</title>
+</head>
+<body onload="SimpleTest.executeSoon(run_test)">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=602256">Mozilla Bug 602256</a>
+<div id="content">
+ <iframe id="iframe" src="start_historyframe.html"></iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 602256 **/
+
+var testWin = window.opener ? window.opener : window.parent;
+
+var SimpleTest = testWin.SimpleTest;
+function is() { testWin.is.apply(testWin, arguments); }
+
+var gFrame = null;
+
+var gState = null;
+
+window.addEventListener("popstate", function(aEvent) {
+ gState = aEvent.state;
+});
+
+function waitForLoad() {
+ function listener() {
+ gFrame.removeEventListener("load", listener);
+ SimpleTest.executeSoon(continue_test);
+ }
+
+ gFrame.addEventListener("load", listener);
+}
+
+function loadContent(aURL) {
+ waitForLoad();
+
+ gFrame.src = aURL;
+}
+
+function getURL() {
+ return gFrame.contentDocument.documentURI;
+}
+
+function getContent() {
+ return gFrame.contentDocument.getElementById("text").textContent;
+}
+
+var BASE_URI = "http://mochi.test:8888/tests/dom/tests/mochitest/general/";
+var START = BASE_URI + "start_historyframe.html";
+var URL1 = BASE_URI + "url1_historyframe.html";
+var URL2 = BASE_URI + "url2_historyframe.html";
+
+function run_test() {
+ window.history.pushState("START", window.location);
+
+ gFrame = document.getElementById("iframe");
+
+ continue_test();
+}
+
+function* test_body()
+{
+ yield* test_basic_inner_navigation();
+ yield* test_state_navigation();
+}
+
+var gTestContinuation = null;
+
+function continue_test() {
+ if (!gTestContinuation) {
+ gTestContinuation = test_body();
+ }
+ var ret = gTestContinuation.next();
+ if (ret.done) {
+ testWin.done();
+ }
+}
+
+var gTestContinuation = null;
+function continueAsync() {
+ setTimeout(function() { gTestContinuation.next(); })
+}
+
+function continueOnPopState() {
+ // Use continueAsync to avoid recursion within sync popstate listener.
+ window.addEventListener("popstate", continueAsync, { once: true });
+}
+
+function* test_basic_inner_navigation() {
+ // Navigate the inner frame a few times
+ yield loadContent(URL1);
+ is(getURL(), URL1, "URL should be correct");
+ is(getContent(), "Test1", "Page should be correct");
+
+ yield loadContent(URL2);
+
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ // Test that history is working
+ window.history.back();
+ yield waitForLoad();
+ is(getURL(), URL1, "URL should be correct");
+ is(getContent(), "Test1", "Page should be correct");
+
+ window.history.forward();
+ yield waitForLoad();
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+}
+
+function* test_state_navigation() {
+ window.history.pushState("STATE1", window.location);
+
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.pushState("STATE2", window.location);
+
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.back();
+ continueOnPopState();
+ yield;
+
+ is(gState, "STATE1", "State should be correct");
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.forward();
+ continueOnPopState();
+ yield;
+
+ is(gState, "STATE2", "State should be correct");
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.back();
+ continueOnPopState();
+ yield;
+ window.history.back();
+ continueOnPopState();
+ yield;
+
+ is(gState, "START", "State should be correct");
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.back();
+ continueAsync();
+ yield;
+ is(gState, "START", "State should be correct");
+ yield waitForLoad();
+
+ is(getURL(), URL1, "URL should be correct");
+ is(getContent(), "Test1", "Page should be correct");
+
+ window.history.back();
+ continueAsync();
+ yield;
+ is(gState, "START", "State should be correct after going back twice");
+ yield waitForLoad();
+
+ is(gState, "START", "State should be correct");
+ is(getURL(), START, "URL should be correct");
+ is(getContent(), "Start", "Page should be correct");
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/image_100.png b/dom/tests/mochitest/general/image_100.png
new file mode 100644
index 0000000000..df421453c2
--- /dev/null
+++ b/dom/tests/mochitest/general/image_100.png
Binary files differ
diff --git a/dom/tests/mochitest/general/image_200.png b/dom/tests/mochitest/general/image_200.png
new file mode 100644
index 0000000000..6f76d44387
--- /dev/null
+++ b/dom/tests/mochitest/general/image_200.png
Binary files differ
diff --git a/dom/tests/mochitest/general/image_50.png b/dom/tests/mochitest/general/image_50.png
new file mode 100644
index 0000000000..144a2f0b93
--- /dev/null
+++ b/dom/tests/mochitest/general/image_50.png
Binary files differ
diff --git a/dom/tests/mochitest/general/importsSameAndCrossOrigin.css b/dom/tests/mochitest/general/importsSameAndCrossOrigin.css
new file mode 100644
index 0000000000..69e239c063
--- /dev/null
+++ b/dom/tests/mochitest/general/importsSameAndCrossOrigin.css
@@ -0,0 +1,3 @@
+@import 'emptyCssFile2.css';
+@import url('http://example.org/tests/dom/tests/mochitest/general/emptyCssFile2.css');
+
diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini
new file mode 100644
index 0000000000..1fe4ccbaec
--- /dev/null
+++ b/dom/tests/mochitest/general/mochitest.ini
@@ -0,0 +1,182 @@
+[DEFAULT]
+prefs =
+ dom.svg.pathSeg.enabled=false
+support-files =
+ 497633.html
+ fail.png
+ file_bug628069.html
+ file_clonewrapper.html
+ file_domWindowUtils_scrollbarSize.html
+ file_frameElementWrapping.html
+ file_moving_nodeList.html
+ file_moving_xhr.html
+ file_resource_timing_nocors.html
+ generateCss.sjs
+ historyframes.html
+ start_historyframe.html
+ url1_historyframe.html
+ url2_historyframe.html
+ image_50.png
+ image_100.png
+ image_200.png
+ pass.apng
+ performance_timeline_main_test.html
+ resource_timing_iframe.html
+ resource_timing_main_test.html
+ resource_timing_cross_origin.html
+ res0.resource
+ res1.resource
+ res1.resource^headers^
+ res2.resource
+ res2.resource^headers^
+ res3.resource
+ res3.resource^headers^
+ res4.resource
+ res4.resource^headers^
+ res5.resource
+ res5.resource^headers^
+ res6.resource
+ res6.resource^headers^
+ res7.resource
+ res7.resource^headers^
+ res8.resource
+ res8.resource^headers^
+ resource_timing.js
+ navigation_timing.html
+ test_interfaces.js
+ frameStorageAllowed.html
+ frameStoragePrevented.html
+ frameStorageChrome.html
+ frameStorageNullprincipal.sjs
+ workerStorageAllowed.js
+ workerStoragePrevented.js
+ storagePermissionsUtils.js
+ window_storagePermissions.html
+ frameSelectEvents.html
+ !/image/test/mochitest/big.png
+ !/image/test/mochitest/blue.png
+ !/image/test/mochitest/clear.png
+ !/image/test/mochitest/damon.jpg
+ !/image/test/mochitest/over.png
+ !/image/test/mochitest/red.png
+ !/dom/base/test/Ahem.ttf
+ !/dom/base/test/file_empty.html
+ !/dom/base/test/file_use_counter_svg_fill_pattern_data.svg
+ resource_timing_location_navigate.html
+ resource_timing_meta_refresh.html
+ resource_timing_redirect.html
+ resource_timing_redirect.html^headers^
+ embed_navigate.html
+ postback.html
+
+[test_497898.html]
+[test_bug504220.html]
+[test_bug628069_1.html]
+[test_bug628069_2.html]
+[test_bug631440.html]
+[test_bug653364.html]
+[test_bug861217.html]
+[test_bug1161721.html]
+[test_bug1170911.html]
+[test_bug1208217.html]
+[test_bug1313753.html]
+[test_bug1434273.html]
+[test_clientRects.html]
+[test_clipboard_disallowed.html]
+[test_clipboard_events.html]
+support-files = window_clipboard_events.html
+skip-if = headless # bug 1403542
+[test_consoleAPI.html]
+[test_contentViewer_overrideDPPX.html]
+[test_CCW_optimization.html]
+[test_devicePixelRatio_with_zoom.html]
+[test_DOMMatrix.html]
+[test_domWindowUtils.html]
+[test_domWindowUtils_scrollbarSize.html]
+skip-if =
+ http3
+[test_domWindowUtils_scrollXY.html]
+[test_donottrack.html]
+[test_focus_scrollchildframe.html]
+[test_focus_legend_noparent.html]
+[test_for_of.html]
+[test_framedhistoryframes.html]
+skip-if =
+ http3
+[test_frameElementWrapping.html]
+skip-if =
+ http3
+[test_img_mutations.html]
+[test_interfaces.html]
+skip-if =
+ http3
+[test_interfaces_secureContext.html]
+scheme = https
+[test_media_queries_with_zoom.html]
+[test_navigation_timing.html]
+[test_network_events.html]
+skip-if = true
+# Disable this test until bug 795711 is fixed.
+[test_offsets.html]
+support-files = test_offsets.js
+[test_outerHTML.html]
+[test_outerHTML.xhtml]
+[test_paste_selection.html]
+[test_performance_now.html]
+[test_performance_timeline.html]
+skip-if =
+ verify
+ http3
+[test_performance_nav_timing_before_onload.html]
+[test_picture_apng.html]
+[test_picture_mutations.html]
+[test_pointerPreserves3D.html]
+[test_pointerPreserves3DClip.html]
+[test_pointerPreserves3DPerspective.html]
+[test_resource_timing.html]
+skip-if =
+ verify
+ http3
+[test_resource_timing_cross_origin.html]
+skip-if =
+ http3
+[test_resource_timing_frameset.html]
+skip-if =
+ http3
+[test_selectevents.html]
+skip-if = toolkit == 'android' # bug 1627523
+[test_showModalDialog_removed.html]
+[test_storagePermissionsAccept.html]
+skip-if =
+ http3
+[test_storagePermissionsLimitForeign.html]
+skip-if =
+ http3
+[test_storagePermissionsReject.html]
+skip-if =
+ http3
+[test_storagePermissionsRejectForeign.html]
+skip-if =
+ http3
+[test_stylesheetPI.html]
+[test_toggling_performance_navigation_timing.html]
+skip-if =
+ os == 'win' && bits == 64 && !debug # Bug 1730152
+ os == 'mac' && bits == 64 && !debug # Bug 1730152
+[test_vibrator.html]
+fail-if = xorigin
+skip-if =
+ http3
+[test_WebKitCSSMatrix.html]
+[test_windowedhistoryframes.html]
+skip-if =
+ http3
+[test_windowProperties.html]
+[test_resource_timing_nocors.html]
+skip-if =
+ http3
+[test_resizeby.html]
+skip-if = (toolkit == 'android') || (devedition && os == 'win' && bits == 32) || (os == 'linux' && bits == 64) # Window sizes cannot be controled on android; Windows: bug 1540554; Bug 1604152
+[test_resource_timing_cross_origin_navigate.html]
+skip-if =
+ http3
diff --git a/dom/tests/mochitest/general/navigation_timing.html b/dom/tests/mochitest/general/navigation_timing.html
new file mode 100644
index 0000000000..72ce60fb73
--- /dev/null
+++ b/dom/tests/mochitest/general/navigation_timing.html
@@ -0,0 +1,100 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+var timingParams = [
+ "navigationStart",
+ "unloadEventStart",
+ "unloadEventEnd",
+ "redirectStart",
+ "redirectEnd",
+ "fetchStart",
+ "domainLookupStart",
+ "domainLookupEnd",
+ "connectStart",
+ "connectEnd",
+ "requestStart",
+ "responseStart",
+ "responseEnd",
+ "domLoading",
+ "domInteractive",
+ "domContentLoadedEventStart",
+ "domContentLoadedEventEnd",
+ "domComplete",
+ "loadEventStart",
+ "loadEventEnd"
+ ];
+
+function is(received, expected, message) {
+ window.opener.is(received, expected, message);
+}
+
+function isnot(received, notExpected, message) {
+ window.opener.isnot(received, notExpected, message);
+}
+
+window.onload = function() {
+ if (location.href.includes("_blank")) {
+ test_blank();
+ return;
+ }
+
+ if (location.href.includes("_self")) {
+ test_self();
+ return;
+ }
+}
+
+function checkTimingValues(expectedValues) {
+ for (var name of timingParams) {
+ if (name in expectedValues) {
+ is(window.performance.timing[name], expectedValues[name], name+" should be "+expectedValues[name]);
+ } else {
+ isnot(window.performance.timing[name], 0, name+" should not be 0");
+ }
+ }
+}
+
+function test_blank() {
+ // We set a timeout to make sure this is run after onload is called
+ setTimeout(function(){
+ // When loading the page in _blank, unloadEvent and redirect timestamps should be 0
+ var expectedValues = { "unloadEventStart": 0, "unloadEventEnd": 0, "redirectStart": 0, "redirectEnd": 0 };
+ checkTimingValues(expectedValues);
+
+ // change location in order to test a _self load
+ window.location.href = "navigation_timing.html?x=1#_self";
+ }, 0);
+}
+
+function test_self() {
+ // We set a timeout to make sure this is run after onload is called
+ setTimeout(function(){
+ // When simply loading in _self, redirect timestamps should be 0 (unloadEventStart/End != 0)
+ var expectedValues = { "redirectStart": 0, "redirectEnd": 0 };
+ checkTimingValues(expectedValues);
+
+ window.opener.finishTests();
+ }, 0);
+}
+
+</script>
+
+</script>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1099092"
+ title="Navigation timing">
+ Bug #1099092 - Navigation Timing has incorrect values when page is load via link with target=_blank attribute
+ </a>
+ <p id="display"></p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/pass.apng b/dom/tests/mochitest/general/pass.apng
new file mode 100644
index 0000000000..6e78a9eef4
--- /dev/null
+++ b/dom/tests/mochitest/general/pass.apng
Binary files differ
diff --git a/dom/tests/mochitest/general/performance_timeline_main_test.html b/dom/tests/mochitest/general/performance_timeline_main_test.html
new file mode 100644
index 0000000000..f8094998eb
--- /dev/null
+++ b/dom/tests/mochitest/general/performance_timeline_main_test.html
@@ -0,0 +1,106 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css?performance-timeline-main-test"/>
+ <script type="application/javascript">
+
+function ok(cond, message) {
+ window.opener.ok(cond, message)
+}
+
+function is(received, expected, message) {
+ window.opener.is(received, expected, message);
+}
+
+function isnot(received, notExpected, message) {
+ window.opener.isnot(received, notExpected, message);
+}
+
+var receivedBufferFullEvents = 0;
+window.performance.onresourcetimingbufferfull = () => {
+ receivedBufferFullEvents++;
+}
+
+window.onload = () => {
+ // Here, we should have 4 entries (1 css, 3 png) since the image was loaded.
+ var nEntries = window.performance.getEntries().length;
+ ok(nEntries >= 4, "Performance.getEntries() returned wrong number of entries.");
+
+ window.performance.setResourceTimingBufferSize(5);
+ window.performance.mark("test-start");
+ window.performance.mark("test-end");
+
+ // The URI should be the address of a resource will be loaded later to be used on getEntriesByName.
+ window.performance.measure("http://mochi.test:8888/tests/dom/tests/mochitest/general/test-data2.json",
+ "test-start", "test-end");
+
+ is(window.performance.getEntries().length, nEntries + 3, "User Timing APIs should never be affected by setResourceTimingBufferSize.");
+ is(window.performance.getEntriesByType("resource").length, 4, "The number of PerformanceResourceTiming should be 4.");
+ is(window.performance.getEntriesByType("mark").length, 2, "The number of PerformanceMark entries should be 2.");
+ is(window.performance.getEntriesByType("measure").length, 1, "The number of PerformanceMeasure entries should be 1.");
+
+ is(receivedBufferFullEvents, 0, "onresourcetimingbufferfull should never be called.");
+
+ makeXhr("test-data2.json", firstCheck);
+}
+
+function makeXhr(aUrl, aCallback) {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.onload = aCallback;
+ xmlhttp.open("get", aUrl, true);
+ xmlhttp.send();
+}
+
+function firstCheck() {
+ SpecialPowers.executeSoon(() => {
+ is(window.performance.getEntriesByType("resource").length, 5,
+ "The number of PerformanceResourceTiming should be 5.");
+ is(receivedBufferFullEvents, 0,
+ "onresourcetimingbufferfull should not have been called yet.");
+ makeXhr("test-data2.json", secondCheck);
+ }, window);
+}
+
+function secondCheck() {
+ SpecialPowers.executeSoon(() => {
+ is(window.performance.getEntriesByType("resource").length, 5, "The number of PerformanceResourceTiming should be 5.");
+ is(receivedBufferFullEvents, 1, "onresourcetimingbufferfull should have been called since the last call.");
+ checkOrder(window.performance.getEntries(), "All PerformanceEntry");
+ checkOrder(window.performance.getEntriesByType("resource"), "PerformanceResourceTiming");
+ checkOrder(window.performance.getEntriesByType("mark"), "PerformanceMark");
+ checkOrder(window.performance.getEntriesByType("measure"), "PerformanceMeasure");
+
+ is(window.performance.getEntriesByName("http://mochi.test:8888/tests/dom/tests/mochitest/general/test-data2.json").length, 2, "Both PerformanceMeasure and XMLHttpRequest resource should be included.");
+ checkOrder(window.performance.getEntriesByName("http://mochi.test:8888/tests/dom/tests/mochitest/general/test-data2.json"), "Entry with performance.getEntrieByName()");
+ window.opener.finishTests();
+ }, window);
+}
+
+function checkOrder(entries, name) {
+ for (var i = 0; i < entries.length - 1; i++) {
+ ok(entries[i].startTime <= entries[i + 1].startTime, name + " should be sorted by startTime.");
+ }
+}
+
+</script>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1158731"
+ title="Buffer for Performance APIs (Resource Timing, User Timing) should be separeted">
+ Bug #1158731 - Buffer for Performance APIs (Resource Timing, User Timing) should be separeted
+ </a>
+ <p id="display"></p>
+ <div id="content">
+ <img src="http://mochi.test:8888/tests/image/test/mochitest/over.png">
+ <object data="http://mochi.test:8888/tests/image/test/mochitest/clear.png" type="image/png"></object>
+ <embed src="http://mochi.test:8888/tests/image/test/mochitest/green.png" type="image/png"/>
+ </div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/postback.html b/dom/tests/mochitest/general/postback.html
new file mode 100644
index 0000000000..c45cf5ad34
--- /dev/null
+++ b/dom/tests/mochitest/general/postback.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title></title>
+</head>
+<body>
+<script type="text/javascript">
+ window.addEventListener("load", () => {
+ window.parent.postMessage("loaded", "*");
+ });
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/res0.resource b/dom/tests/mochitest/general/res0.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res0.resource
diff --git a/dom/tests/mochitest/general/res1.resource b/dom/tests/mochitest/general/res1.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res1.resource
diff --git a/dom/tests/mochitest/general/res1.resource^headers^ b/dom/tests/mochitest/general/res1.resource^headers^
new file mode 100644
index 0000000000..2e5d8ea17a
--- /dev/null
+++ b/dom/tests/mochitest/general/res1.resource^headers^
@@ -0,0 +1,2 @@
+HTTP 200
+Timing-Allow-Origin: *
diff --git a/dom/tests/mochitest/general/res2.resource b/dom/tests/mochitest/general/res2.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res2.resource
diff --git a/dom/tests/mochitest/general/res2.resource^headers^ b/dom/tests/mochitest/general/res2.resource^headers^
new file mode 100644
index 0000000000..f19c20d3ec
--- /dev/null
+++ b/dom/tests/mochitest/general/res2.resource^headers^
@@ -0,0 +1,2 @@
+HTTP 302 Moved
+Location: http://test2.example.com/tests/image/test/mochitest/red.png
diff --git a/dom/tests/mochitest/general/res3.resource b/dom/tests/mochitest/general/res3.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res3.resource
diff --git a/dom/tests/mochitest/general/res3.resource^headers^ b/dom/tests/mochitest/general/res3.resource^headers^
new file mode 100644
index 0000000000..391a442227
--- /dev/null
+++ b/dom/tests/mochitest/general/res3.resource^headers^
@@ -0,0 +1,2 @@
+HTTP 200
+Timing-Allow-Origin: http://mochi.test:8888
diff --git a/dom/tests/mochitest/general/res4.resource b/dom/tests/mochitest/general/res4.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res4.resource
diff --git a/dom/tests/mochitest/general/res4.resource^headers^ b/dom/tests/mochitest/general/res4.resource^headers^
new file mode 100644
index 0000000000..fbf4a9de7f
--- /dev/null
+++ b/dom/tests/mochitest/general/res4.resource^headers^
@@ -0,0 +1,3 @@
+HTTP 302 Moved
+Timing-Allow-Origin: *
+Location: http://mochi.test:8888/tests/dom/tests/mochitest/general/res1.resource
diff --git a/dom/tests/mochitest/general/res5.resource b/dom/tests/mochitest/general/res5.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res5.resource
diff --git a/dom/tests/mochitest/general/res5.resource^headers^ b/dom/tests/mochitest/general/res5.resource^headers^
new file mode 100644
index 0000000000..1be24a555c
--- /dev/null
+++ b/dom/tests/mochitest/general/res5.resource^headers^
@@ -0,0 +1,2 @@
+HTTP 200
+Timing-Allow-Origin: http://mochi.test:8889
diff --git a/dom/tests/mochitest/general/res6.resource b/dom/tests/mochitest/general/res6.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res6.resource
diff --git a/dom/tests/mochitest/general/res6.resource^headers^ b/dom/tests/mochitest/general/res6.resource^headers^
new file mode 100644
index 0000000000..4a570ae678
--- /dev/null
+++ b/dom/tests/mochitest/general/res6.resource^headers^
@@ -0,0 +1,2 @@
+HTTP 200
+Timing-Allow-Origin:
diff --git a/dom/tests/mochitest/general/res7.resource b/dom/tests/mochitest/general/res7.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res7.resource
diff --git a/dom/tests/mochitest/general/res7.resource^headers^ b/dom/tests/mochitest/general/res7.resource^headers^
new file mode 100644
index 0000000000..d9bbf9462b
--- /dev/null
+++ b/dom/tests/mochitest/general/res7.resource^headers^
@@ -0,0 +1,2 @@
+HTTP 200
+Timing-Allow-Origin: http://mochi.test:8888 http://test1.com
diff --git a/dom/tests/mochitest/general/res8.resource b/dom/tests/mochitest/general/res8.resource
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/res8.resource
diff --git a/dom/tests/mochitest/general/res8.resource^headers^ b/dom/tests/mochitest/general/res8.resource^headers^
new file mode 100644
index 0000000000..21f490fd32
--- /dev/null
+++ b/dom/tests/mochitest/general/res8.resource^headers^
@@ -0,0 +1,2 @@
+HTTP 302 Moved
+Location: http://test1.example.com/tests/dom/tests/mochitest/general/res4.resource
diff --git a/dom/tests/mochitest/general/resource_timing.js b/dom/tests/mochitest/general/resource_timing.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing.js
diff --git a/dom/tests/mochitest/general/resource_timing_cross_origin.html b/dom/tests/mochitest/general/resource_timing_cross_origin.html
new file mode 100644
index 0000000000..d608cdce9a
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_cross_origin.html
@@ -0,0 +1,191 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+function ok(cond, message) {
+ window.opener.ok(cond, message)
+}
+
+function is(received, expected, message) {
+ window.opener.is(received, expected, message);
+}
+
+function isnot(received, notExpected, message) {
+ window.opener.isnot(received, notExpected, message);
+}
+
+var bufferFullCounter = 0;
+const expectedBufferFullEvents = 0;
+
+const properties = ["startTime", "redirectStart", "redirectEnd", "fetchStart",
+ "domainLookupStart", "domainLookupEnd", "connectStart",
+ "connectEnd", "requestStart", "responseStart", "responseEnd"];
+
+window.onload = function() {
+ ok(!!window.performance, "Performance object should exist");
+ ok(!!window.performance.getEntries, "Performance.getEntries() should exist");
+ ok(!!window.performance.getEntriesByName, "Performance.getEntriesByName() should exist");
+ ok(!!window.performance.getEntriesByType, "Performance.getEntriesByType() should exist");
+
+ window.performance.onresourcetimingbufferfull = function() {
+ bufferFullCounter += 1;
+ }
+
+ makeXhr("http://mochi.test:8888/tests/dom/tests/mochitest/general/test-data.json", firstCheck);
+};
+
+function firstCheck() {
+ var entries = window.performance.getEntriesByName("http://mochi.test:8888/tests/dom/tests/mochitest/general/test-data.json");
+ ok(!!entries[0], "same origin test-data.json is missing from entries");
+ checkSameOrigin(entries[0]);
+
+ var entries = window.performance.getEntriesByName("http://mochi.test:8888/tests/dom/tests/mochitest/general/res0.resource");
+ ok(!!entries[0], "same origin res0.resource is missing from entries");
+ checkSameOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res0.resource");
+ ok(!!entries[0], "cross origin res0.resource is missing from entries");
+ checkCrossOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res1.resource");
+ ok(!!entries[0], "res1.resource is missing from entries");
+ checkSameOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res2.resource");
+ ok(!!entries[0], "redirected res2.resource is missing from entries");
+ checkRedirectedCrossOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res3.resource");
+ ok(!!entries[0], "cross origin res3.resource is missing from entries");
+ checkSameOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res4.resource");
+ ok(!!entries[0], "redirected res4.resource is missing from entries");
+ checkRedirectedSameOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res5.resource");
+ ok(!!entries[0], "cross origin res5.resource is missing from entries");
+ checkCrossOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res6.resource");
+ ok(!!entries[0], "cross origin res6.resource is missing from entries");
+ checkCrossOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res7.resource");
+ ok(!!entries[0], "cross origin res7.resource is missing from entries");
+ checkCrossOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://test1.example.com/tests/dom/tests/mochitest/general/res8.resource");
+ ok(!!entries[0], "redirected res8.resource is missing from entries");
+ checkRedirectCrossOriginResourceSameOrigin(entries[0]);
+
+ entries = window.performance.getEntriesByName("http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing.js");
+ ok(!!entries[0], "same origin resource_timing.js is missing from entries");
+ checkSameOrigin(entries[0]);
+
+ is(bufferFullCounter, expectedBufferFullEvents, "Buffer full was called");
+ finishTests();
+}
+
+function checkEntry(entry, checks) {
+ // If the entry is undefined, we return early so we don't get a JS error
+ if (entry == undefined)
+ return;
+
+ for (var j = 1; j < properties.length; ++j) {
+ var prop = properties[j];
+ if (checks[prop] != undefined) {
+ is(entry[prop], checks[prop], "Wrong value for prop " + prop + " for resource " + entry.name);
+ } else {
+ isnot(entry[prop], 0, "Wrong value for prop " + prop + " for resource " + entry.name);
+ }
+ }
+}
+
+// No redirects have occured so RedirectStart/End are 0
+function checkSameOrigin(entry) {
+ const checks = { "redirectStart": 0, "redirectEnd": 0 };
+ checkEntry(entry, checks);
+}
+
+// This is a cross-origin resource that doesn't pass the check
+// All of these attributes are 0. No redirects
+function checkCrossOrigin(entry) {
+ const checks = { "redirectStart": 0, "redirectEnd": 0,
+ "domainLookupStart": 0, "domainLookupEnd": 0,
+ "connectStart": 0, "connectEnd": 0,
+ "requestStart": 0, "responseStart": 0 };
+ checkEntry(entry, checks);
+}
+
+// A cross-origin redirect has occured. RedirectStart/End and the rest of the
+// attributes are 0.
+function checkRedirectedCrossOrigin(entry) {
+ const checks = { "redirectStart": 0, "redirectEnd": 0,
+ "domainLookupStart": 0, "domainLookupEnd": 0,
+ "connectStart": 0, "connectEnd": 0,
+ "requestStart": 0, "responseStart": 0 };
+ checkEntry(entry, checks);
+}
+
+// The redirect is to the same origin as the initial document,
+// so no entries are 0.
+function checkRedirectedSameOrigin(entry) {
+ const checks = { };
+ checkEntry(entry, checks);
+}
+
+// The final entry passes the timing-allow-check,
+// but one of the redirects does not. redirectStart/End and the rest of the
+// attributes are 0 because all redirects need to pass TAO check.
+function checkRedirectCrossOriginResourceSameOrigin(entry) {
+ const checks = { "redirectStart": 0, "redirectEnd": 0,
+ "domainLookupStart": 0, "domainLookupEnd": 0,
+ "connectStart": 0, "connectEnd": 0,
+ "requestStart": 0, "responseStart": 0 };
+ checkEntry(entry, checks);
+}
+
+function makeXhr(aUrl, aCallback) {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.onload = aCallback;
+ xmlhttp.open("get", aUrl, true);
+ xmlhttp.send();
+}
+
+function finishTests() {
+ window.opener.finishTests();
+}
+
+</script>
+
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=822480"
+ title="Add resource timing API.">
+ Bug #822480 - Add in the Resource Timing API
+ </a>
+ <p id="display"></p>
+ <div id="content">
+ <object data="http://mochi.test:8888/tests/dom/tests/mochitest/general/res0.resource"></object> <!-- same origin, no header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res0.resource"></object> <!-- cross origin, no header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res1.resource"></object> <!-- cross origin, Timing-Allow-Origin: * header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res2.resource"></object> <!-- cross origin redirect to test2.example.com, no header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res3.resource"></object> <!-- cross origin, Timing-Allow-Origin: http://mochi.test:8888 header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res4.resource"></object> <!-- cross origin redirect to mochi.test:8888/.../res1.resource, Timing-Allow-Origin: * -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res5.resource"></object> <!-- cross origin, Timing-Allow-Origin: http://mochi.test:8889 -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res6.resource"></object> <!-- cross origin, Timing-Allow-Origin: "" (empty string) -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res7.resource"></object> <!-- cross origin, Timing-Allow-Origin: http://mochi.test:8888 http://test1.com header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res8.resource"></object> <!-- double cross origin redirect -->
+ <script type="text/javascript" src="http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing.js"></script> <!-- same origin script -->
+ </div>
+</body>
+
+</html>
diff --git a/dom/tests/mochitest/general/resource_timing_iframe.html b/dom/tests/mochitest/general/resource_timing_iframe.html
new file mode 100644
index 0000000000..2d50427d92
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_iframe.html
@@ -0,0 +1,50 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!--
+ This file is a sub-test file for the Resource Timing and Performance Timeline
+ APIs.
+ These tests are focused on the iframe corner case.
+ The first step is to check that the image from this document was added as
+ an entry to this window.performance object.
+ The second step is to check that this iframe was not added as an entry to its
+ own window.performance object.
+ As a final step, we do a double checking: no ifrmes were added as entries
+ to this window.performance object.
+-->
+
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 822480 - Add in the Resource Timing API</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<script>
+function doTest() {
+ window.parent.ok(!!window.performance.getEntriesByName(
+ "http://mochi.test:8888/tests/image/test/mochitest/damon.jpg").length,
+ "http://mochi.test:8888/tests/image/test/mochitest/damon.jpg should be a valid entry name");
+ let entries = window.performance.getEntriesByName(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing_iframe.html");
+ window.parent.is(entries.length, 1, "This iframe should have only 1 entry with its URL");
+ window.parent.is(entries[0].type, "navigate", "This iframe should have its navigation entry");
+
+ // Check that there are no iframes added as entries
+ var resources = window.performance.getEntriesByType("resource");
+ for (var i = 0 ; i < resources.length; i++) {
+ var entry = resources[i];
+ if (entry.initiatorType === "iframe") {
+ ok(false, "unexpected iframe " + entry.name);
+ }
+ }
+
+ window.parent.iframeTestsCompleted();
+}
+</script>
+<body onLoad="doTest()">
+ <img src="http://mochi.test:8888/tests/image/test/mochitest/damon.jpg"/>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/resource_timing_location_navigate.html b/dom/tests/mochitest/general/resource_timing_location_navigate.html
new file mode 100644
index 0000000000..94d0d0512e
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_location_navigate.html
@@ -0,0 +1,3 @@
+<script type="text/javascript">
+ document.location = "https://test1.example.org/tests/dom/tests/mochitest/general/postback.html"
+</script>
diff --git a/dom/tests/mochitest/general/resource_timing_main_test.html b/dom/tests/mochitest/general/resource_timing_main_test.html
new file mode 100644
index 0000000000..88b44f76dd
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_main_test.html
@@ -0,0 +1,290 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!--
+ This file contains test for the Resource Timing and Performance Timeline APIs.
+ The test starts by checking that all the entries were added to the performance
+ object.
+ The next step is to check that the "performance" object and its "getEntries()"
+ methods are available. We check all the 3 methods: getEntries,
+ getEntriesByName() and getEntriesByType().
+
+ As a next step, we check that the entries contain the correct information
+ ("checkEntries()" method).
+ The test checks that the entries contain all the required members, that the
+ timings are sorted properly and that the entries were returned in
+ chronological order with respect to startTime. In "checkEntries()", it is also
+ checked if the order of the entries is the expected order (the expected order
+ is hard-coded here).
+ The last test from the "checkEntries()" method will verify the iframe case:
+ the iframe must be added as an entry to this window's performance object,
+ while the image from the iframe should not be added here.
+
+ Next tests will check the Performance API extensions introduced by the
+ resource timing: window.performance.setResourceTimingBufferSize(1) and
+ window.performance.clearResourceTimings();
+
+ The last tests will verify that the xhr resources are also added as entries
+ to our performance object.
+
+ Meanwhile, the iframe from the page will get loaded
+ (resource_timing_iframe.html).
+ The iframe contains a second script that will do some tests, as well, plus
+ an image - its own resource.
+ The script from the iframe will check that the iframe itself was not added
+ as an entry (to itself). Also, it will check that its image was added as
+ entry to the iframe's performance object.
+ The last check is a double check: check that no subdocuments were added as
+ entries for this iframe's performance object.
+ The parent's (this window) "ok_wrapper()" method will be called once the tests
+ are completed.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css?resource-timing-main-test"/>
+ <script type="application/javascript">
+
+var mainWindowTestsDone = false;
+var iframeTestsDone = false;
+
+function ok(cond, message) {
+ window.opener.ok(cond, message)
+}
+
+function is(received, expected, message) {
+ window.opener.is(received, expected, message);
+}
+
+function isnot(received, notExpected, message) {
+ window.opener.isnot(received, notExpected, message);
+}
+
+var bufferFullCounter = 0;
+const expectedBufferFullEvents = 1;
+
+var allResources = {
+ "http://mochi.test:8888/tests/SimpleTest/test.css?resource-timing-main-test": "link",
+ "http://mochi.test:8888/tests/image/test/mochitest/blue.png" : "img",
+ "http://mochi.test:8888/tests/image/test/mochitest/red.png" : "object",
+ "http://mochi.test:8888/tests/image/test/mochitest/big.png" : "embed",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing_iframe.html" : "iframe"};
+
+window.onload = function() {
+ ok(!!window.performance, "Performance object should exist");
+ ok(!!window.performance.getEntries, "Performance.getEntries() should exist");
+ ok(!!window.performance.getEntriesByName, "Performance.getEntriesByName() should exist");
+ ok(!!window.performance.getEntriesByType, "Performance.getEntriesByType() should exist");
+
+ window.performance.onresourcetimingbufferfull = function() {
+ bufferFullCounter += 1;
+ }
+
+ is(window.performance.getEntriesByType("resource").length, Object.keys(allResources).length, "Performance.getEntriesByType() returned wrong number of entries.");
+
+ checkStringify(window.performance.getEntriesByType("resource")[0]);
+
+ ok(!!window.performance.getEntriesByType("resource").length,
+ "Performance.getEntriesByType() should return some results");
+ ok(!!window.performance.getEntriesByName("http://mochi.test:8888/tests/image/test/mochitest/blue.png").length,
+ "Performance.getEntriesByName() should return some results");
+
+ // Checks that two calls for "getEntriesByType()" return a different array with the same
+ // entries.
+ isnot(window.performance.getEntriesByType("resource"), window.performance.getEntriesByType("resource"),
+ "getEntriesByType() should return a different array object every time.");
+ ok(function (array1, array2) {
+ if (array1.length != array2.length) {
+ return false;
+ }
+ for (var i = 0 ; i < array1.length ; i++) {
+ if (array1[i] !== array2[i]) {
+ return false;
+ }
+ }
+ return true;
+ }(window.performance.getEntriesByType("resource"), window.performance.getEntriesByType("resource")),
+ "The arrays should have the same entries.");
+
+ checkEntries(window.performance.getEntriesByType("resource"));
+
+ window.performance.setResourceTimingBufferSize(1);
+ is(window.performance.getEntriesByType("resource").length, Object.keys(allResources).length, "No entries should be " +
+ "removed when setResourceTimingBufferSize is called.");
+
+ window.performance.setResourceTimingBufferSize(4);
+ is(window.performance.getEntriesByType("resource").length, Object.keys(allResources).length, "No entries should be " +
+ "removed when setResourceTimingBufferSize is called.");
+
+ window.performance.setResourceTimingBufferSize(1);
+ window.performance.clearResourceTimings();
+ is(window.performance.getEntriesByType("resource").length, 0, "All the entries should " +
+ "be removed when when clearResourceTimings is being called.");
+
+ makeXhr("test-data.json", firstCheck);
+}
+
+function checkStringify(entry) {
+ var object = JSON.parse(JSON.stringify(entry));
+ var keys = ["initiatorType","redirectStart","redirectEnd","fetchStart",
+ "domainLookupStart","domainLookupEnd","connectStart","connectEnd",
+ "secureConnectionStart","requestStart","responseStart","responseEnd",
+ "name","entryType","startTime","duration"];
+ for (var i in keys) {
+ ok(keys[i] in object, "The serialization should contain key: "+keys[i]);
+ }
+}
+
+function checkEntries(anEntryList) {
+ // Check that all the entries have all the properties.
+ for (var i = 0 ; i < anEntryList.length ; i++) {
+ var entry = anEntryList[i];
+
+ ok(!!entry, "PerformanceEntry should not be null");
+ ok(!!entry.name, "PerformanceEntry.name should be valid.");
+ ok(entry.startTime > 0, "PerformanceEntry.startTime should be grater than 0");
+
+ // The entries list should be in chronological order with respect to startTime
+ if (i > 0) {
+ ok(anEntryList[i - 1].startTime <= anEntryList[i].startTime,
+ "Entries list should be in chronological order with respect to startTime.");
+ }
+
+ // Check that each entry has all the properties and that the timings were
+ // returned in the expected order.
+ if ("initiatorType" in entry) {
+ ok("redirectStart" in entry, "PerformanceEntry.redirectStart should be part of PerformanceEntry");
+ ok("redirectEnd" in entry, "PerformanceEntry.redirectEnd should be part of PerformanceEntry");
+ ok("fetchStart" in entry, "PerformanceEntry.fetchStart should be part of PerformanceEntry");
+ ok("domainLookupStart" in entry, "PerformanceEntry.domainLookupStart should be part of PerformanceEntry");
+ ok("domainLookupEnd" in entry, "PerformanceEntry.domainLookupEnd should be part of PerformanceEntry");
+ ok("connectStart" in entry, "PerformanceEntry.connectStart should be part of PerformanceEntry");
+ ok("connectEnd" in entry, "PerformanceEntry.connectEnd should be part of PerformanceEntry");
+ ok("secureConnectionStart" in entry, "PerformanceEntry.secureConnectionStart should be part of PerformanceEntry");
+ ok("requestStart" in entry, "PerformanceEntry.requestStart should be part of PerformanceEntry");
+ ok("responseStart" in entry, "PerformanceEntry.responseStart should be part of PerformanceEntry");
+ ok("responseEnd" in entry, "PerformanceEntry.responseEnd should be part of PerformanceEntry");
+
+ // Check that timings are in proper order
+ sequence = ['startTime', 'redirectStart', 'redirectEnd', 'fetchStart',
+ 'domainLookupStart', 'domainLookupEnd', 'connectStart',
+ 'connectEnd', 'requestStart', 'responseStart', 'responseEnd'];
+ for (var j = 1; j < sequence.length; ++j) {
+ var prop = sequence[j];
+ var prevProp = sequence[j-1];
+ if (prop == 'redirectStart' && entry[prop] == 0)
+ continue;
+ if (prop == 'redirectEnd' && entry[prop] == 0)
+ continue;
+ ok(entry[prevProp] <= entry[prop],
+ ['Expected ', prevProp, ' to happen before ', prop,
+ ', got ', prevProp, ' = ', entry[prevProp],
+ ', ', prop, ' = ', entry[prop]].join(''));
+ }
+ }
+ }
+
+ // Check that the entries have the expected initiator type. We can't check
+ // the order (the order might depend on the platform the tests are running).
+ for (resourceName in allResources) {
+ // Check that we have a resource with the specific name.
+ namedEntries = window.performance.getEntriesByName(resourceName);
+ ok (!!namedEntries && (namedEntries.length == 1),
+ "An entry with the name '" + resourceName + "' should be available");
+
+ if (!namedEntries.length) {
+ continue;
+ }
+
+ // Double check for the entry name.
+ is (namedEntries[0].name, resourceName, "The resource name is invalid");
+
+ // Check the initiator type.
+ is (namedEntries[0].initiatorType, allResources[resourceName],
+ "The initiator type for " + resourceName + " is invalid");
+ }
+
+ // Check that the iframe's image was NOT added as an entry to this window's performance entry.
+ ok(!window.performance.getEntriesByName("http://mochi.test:8888/tests/image/test/mochitest/damon.jpg").length,
+ "http://mochi.test:8888/tests/image/test/mochitest/damon.jpg should be a valid entry name");
+}
+
+function firstCheck() {
+ is(window.performance.getEntriesByType("resource").length, 1, "The first xhr entry was not added.");
+ is(window.performance.getEntriesByType("resource")[0].initiatorType, "xmlhttprequest",
+ "The initiatorType is incorrect for this entry");
+ makeXhr("test-data2.json", secondCheck);
+}
+
+function secondCheck() {
+ // Since the buffer max size was set to '1', 'peformance.getEntriesByType()' should
+ // return only '1' entry (first xhr results).
+ is(window.performance.getEntriesByType("resource").length, 1, "The second xhr entry should not be " +
+ "returned since the buffer size was set to 1.");
+ isnot(window.performance.getEntriesByType("resource")[0].name, "http://mochi.test:8888/tests/dom/tests/mochitest/general/test-data2.json",
+ "We returned the second xhr instead of the first one");
+ finishTest();
+}
+
+function finishTest() {
+ // Check if all the tests are completed.
+ SpecialPowers.executeSoon(function () {
+ if (iframeTestsDone) {
+ is(bufferFullCounter, expectedBufferFullEvents, "onresourcetimingbufferfull called a wrong number of times");
+ window.opener.finishTests();
+ } else {
+ mainWindowTestsDone = true;
+ }
+ }, window);
+}
+
+function makeXhr(aUrl, aCallback) {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.onload = aCallback;
+ xmlhttp.open("get", aUrl, true);
+ xmlhttp.send();
+}
+
+function checkArraysHaveSameElementsInSameOrder(array1, array2) {
+ if (array1.length != array2.length) {
+ return false;
+ }
+ for (var i = 0 ; i < array1.length ; i++) {
+ if (array1[i] !== array2[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+function iframeTestsCompleted() {
+ if (mainWindowTestsDone) {
+ is(bufferFullCounter, expectedBufferFullEvents, "onresourcetimingbufferfull called a wrong number of times");
+ window.opener.finishTests();
+ }
+ else {
+ iframeTestsDone = true;
+ }
+}
+
+</script>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=822480"
+ title="Add resource timing API.">
+ Bug #822480 - Add in the Resource Timing API
+ </a>
+ <p id="display"></p>
+ <div id="content">
+ <img src="http://mochi.test:8888/tests/image/test/mochitest/blue.png">
+ <object data="http://mochi.test:8888/tests/image/test/mochitest/red.png" type="image/png"></object>
+ <embed src="http://mochi.test:8888/tests/image/test/mochitest/big.png" type="image/png"/>
+ <iframe sandbox="allow-same-origin allow-scripts" id="if_2" src="resource_timing_iframe.html" height="10" width="10"></iframe>
+ </div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/resource_timing_meta_refresh.html b/dom/tests/mochitest/general/resource_timing_meta_refresh.html
new file mode 100644
index 0000000000..dbbcd65413
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_meta_refresh.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="refresh" content="0; url=https://sub1.test1.example.org/tests/dom/tests/mochitest/general/postback.html">
+</head>
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/resource_timing_nocors.html b/dom/tests/mochitest/general/resource_timing_nocors.html
new file mode 100644
index 0000000000..39b34950fc
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_nocors.html
@@ -0,0 +1,88 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css"/>
+ <link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/dom/tests/mochitest/general/linkA.css"/>
+ <link rel="stylesheet" type="text/css" href="http://example.com/tests/dom/tests/mochitest/general/linkB.css"/>
+ <link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/linkC.css"/>
+
+<!--
+
+ Resources fetched by a cross-origin stylesheet loaded with a no-cors mode should not be reported.
+ Resources marked with a ^ should be reported in performance.getEntries()
+
+ (mochi.test:8888 | linkA.css)^ -> (mochi.test:8888 | cssA.css)^
+ -> (mochi.test:8888 | cssB.css)^ -> (mochi.test:8888 | cssC.css)^
+ -> (example.org | cssC.css)^
+ (example.com | linkB.css)^ -> (example.com | cssA.css)
+ -> (mochi.test:8888 | cssA.css)
+ -> (test2.examp.org | cssB.css) -> (test2.examp.org | cssC.css)
+ -> (example.org | cssC.css)
+ -> (example.net | cssC.css)
+
+ (example.net | linkC.css)^ -> (example.net | cssA.css)
+ [WITH Allow-* HEADERS]
+
+-->
+
+
+ <script type="application/javascript">
+
+function ok(cond, message) {
+ window.opener.ok(cond, message)
+}
+
+function is(received, expected, message) {
+ window.opener.is(received, expected, message);
+}
+
+function isnot(received, notExpected, message) {
+ window.opener.isnot(received, notExpected, message);
+}
+
+var allResources = {
+ "http://mochi.test:8888/tests/SimpleTest/test.css" : "link",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/linkA.css" : "link",
+ "http://example.com/tests/dom/tests/mochitest/general/linkB.css" : "link",
+ "http://example.net/tests/dom/tests/mochitest/general/linkC.css" : "link",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/cssA.css" : "css",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/cssB.css" : "css",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/cssC.css" : "css",
+ "http://example.org/tests/dom/tests/mochitest/general/cssC.css" : "css",
+};
+
+window.onload = function() {
+ let entries = performance.getEntries();
+ for (let entry of entries) {
+ let type = allResources[entry.name];
+ if (!type) {
+ ok(false, "Did not expect to find resource: "+entry.name);
+ continue;
+ }
+
+ is(entry.initiatorType, type, "Expected initiatorType does not match");
+ }
+
+ is(entries.length, Object.keys(allResources).length, "Found wrong number of resources");
+
+ window.opener.finishTests();
+}
+
+</script>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1180145"
+ title="Resource timing NO-CORS CSS">
+ Bug #1180145 - Resource Timing NO-CORS CSS
+ </a>
+ <p id="display"></p>
+ <div id="content">
+ </div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/resource_timing_redirect.html b/dom/tests/mochitest/general/resource_timing_redirect.html
new file mode 100644
index 0000000000..5417098d72
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_redirect.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title></title>
+</head>
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/resource_timing_redirect.html^headers^ b/dom/tests/mochitest/general/resource_timing_redirect.html^headers^
new file mode 100644
index 0000000000..aed575c918
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_redirect.html^headers^
@@ -0,0 +1,2 @@
+HTTP 302 Found
+Location: https://example.org/tests/dom/tests/mochitest/general/postback.html
diff --git a/dom/tests/mochitest/general/start_historyframe.html b/dom/tests/mochitest/general/start_historyframe.html
new file mode 100644
index 0000000000..a791af4e64
--- /dev/null
+++ b/dom/tests/mochitest/general/start_historyframe.html
@@ -0,0 +1 @@
+<p id='text'>Start</p>
diff --git a/dom/tests/mochitest/general/storagePermissionsUtils.js b/dom/tests/mochitest/general/storagePermissionsUtils.js
new file mode 100644
index 0000000000..d4a7190c82
--- /dev/null
+++ b/dom/tests/mochitest/general/storagePermissionsUtils.js
@@ -0,0 +1,282 @@
+const BEHAVIOR_ACCEPT = 0;
+const BEHAVIOR_REJECT_FOREIGN = 1;
+const BEHAVIOR_REJECT = 2;
+const BEHAVIOR_LIMIT_FOREIGN = 3;
+
+const kPrefName = "network.cookie.cookieBehavior";
+
+// Check if we are in frame, and declare ok and finishTest appropriately
+const inFrame = ("" + location).match(/frame/);
+if (inFrame) {
+ ok = function (a, message) {
+ if (!a) {
+ parent.postMessage("FAILURE: " + message, "http://mochi.test:8888");
+ } else {
+ parent.postMessage(message, "http://mochi.test:8888");
+ }
+ };
+
+ finishTest = function () {
+ parent.postMessage("done", "http://mochi.test:8888");
+ };
+} else {
+ finishTest = function () {
+ SimpleTest.finish();
+ };
+}
+
+function setCookieBehavior(behavior) {
+ return SpecialPowers.pushPrefEnv({ set: [[kPrefName, behavior]] });
+}
+
+function runIFrame(url) {
+ return new Promise((resolve, reject) => {
+ function onMessage(e) {
+ if (e.data == "done") {
+ resolve();
+ window.removeEventListener("message", onMessage);
+ return;
+ }
+
+ ok(!e.data.match(/^FAILURE/), e.data + " (IFRAME = " + url + ")");
+ }
+ window.addEventListener("message", onMessage);
+
+ document.querySelector("iframe").src = url;
+ });
+}
+
+function runWorker(url) {
+ return new Promise((resolve, reject) => {
+ var worker = new Worker(url);
+ worker.addEventListener("message", function (e) {
+ if (e.data == "done") {
+ resolve();
+ return;
+ }
+
+ ok(!e.data.match(/^FAILURE/), e.data + " (WORKER = " + url + ")");
+ });
+ });
+}
+
+function chromePower(allowed, blockSessionStorage) {
+ // localStorage is affected by storage policy.
+ try {
+ SpecialPowers.wrap(window).localStorage.getItem("X");
+ ok(allowed, "getting localStorage from chrome didn't throw");
+ } catch (e) {
+ ok(!allowed, "getting localStorage from chrome threw");
+ }
+
+ // sessionStorage is not. See bug 1183968.
+ try {
+ SpecialPowers.wrap(window).sessionStorage.getItem("X");
+ ok(!blockSessionStorage, "getting sessionStorage from chrome didn't throw");
+ } catch (e) {
+ ok(blockSessionStorage, "getting sessionStorage from chrome threw");
+ }
+
+ // indexedDB is affected by storage policy.
+ try {
+ SpecialPowers.wrap(window).indexedDB;
+ ok(allowed, "getting indexedDB from chrome didn't throw");
+ } catch (e) {
+ ok(!allowed, "getting indexedDB from chrome threw");
+ }
+
+ // Same with caches, along with the additional https-only requirement.
+ try {
+ var shouldResolve = allowed && location.protocol == "https:";
+ var promise = SpecialPowers.wrap(window).caches.keys();
+ ok(true, "getting caches from chrome should never throw");
+ return new Promise((resolve, reject) => {
+ promise.then(
+ function () {
+ ok(shouldResolve, "The promise was resolved for chrome");
+ resolve();
+ },
+ function (e) {
+ ok(!shouldResolve, "The promise was rejected for chrome: " + e);
+ resolve();
+ }
+ );
+ });
+ } catch (e) {
+ ok(false, "getting caches from chrome threw");
+ }
+}
+
+function storageAllowed() {
+ try {
+ localStorage.getItem("X");
+ ok(true, "getting localStorage didn't throw");
+ } catch (e) {
+ ok(false, "getting localStorage should not throw");
+ }
+
+ try {
+ sessionStorage.getItem("X");
+ ok(true, "getting sessionStorage didn't throw");
+ } catch (e) {
+ ok(false, "getting sessionStorage should not throw");
+ }
+
+ try {
+ indexedDB;
+ ok(true, "getting indexedDB didn't throw");
+ } catch (e) {
+ ok(false, "getting indexedDB should not throw");
+ }
+
+ try {
+ var promise = caches.keys();
+ ok(true, "getting caches didn't throw");
+
+ return new Promise((resolve, reject) => {
+ promise.then(
+ function () {
+ ok(location.protocol == "https:", "The promise was not rejected");
+ resolve();
+ },
+ function () {
+ ok(
+ location.protocol !== "https:",
+ "The promise should not have been rejected"
+ );
+ resolve();
+ }
+ );
+ });
+ } catch (e) {
+ ok(location.protocol !== "https:", "getting caches should not have thrown");
+ return Promise.resolve();
+ }
+}
+
+function storagePrevented() {
+ try {
+ localStorage.getItem("X");
+ ok(false, "getting localStorage should have thrown");
+ } catch (e) {
+ ok(true, "getting localStorage threw");
+ }
+
+ if (location.hash == "#thirdparty") {
+ // No matter what the user's preferences are, we don't block
+ // sessionStorage in 3rd-party iframes. We do block them everywhere
+ // else however.
+ try {
+ sessionStorage.getItem("X");
+ ok(true, "getting sessionStorage didn't throw");
+ } catch (e) {
+ ok(false, "getting sessionStorage should not have thrown");
+ }
+ } else {
+ try {
+ sessionStorage.getItem("X");
+ ok(false, "getting sessionStorage should have thrown");
+ } catch (e) {
+ ok(true, "getting sessionStorage threw");
+ }
+ }
+
+ try {
+ indexedDB;
+ ok(false, "getting indexedDB should have thrown");
+ } catch (e) {
+ ok(true, "getting indexedDB threw");
+ }
+
+ try {
+ var promise = caches.keys();
+ ok(true, "getting caches didn't throw");
+
+ return new Promise((resolve, reject) => {
+ promise.then(
+ function () {
+ ok(false, "The promise should have rejected");
+ resolve();
+ },
+ function () {
+ ok(true, "The promise was rejected");
+ resolve();
+ }
+ );
+ });
+ } catch (e) {
+ ok(location.protocol !== "https:", "getting caches should not have thrown");
+
+ return Promise.resolve();
+ }
+}
+
+function task(fn) {
+ if (!inFrame) {
+ SimpleTest.waitForExplicitFinish();
+ }
+
+ var gen = fn();
+
+ function next_step(val, e) {
+ var it;
+ try {
+ if (typeof e !== "undefined") {
+ it = gen.throw(e);
+ } else {
+ it = gen.next(val);
+ }
+ } catch (e) {
+ ok(false, "An error was thrown while stepping: " + e);
+ ok(false, "Stack: " + e.stack);
+ finishTest();
+ }
+
+ if (it.done) {
+ finishTest();
+ return;
+ }
+ it.value.then(next_step, e => next_step(null, e));
+ }
+
+ if (!gen.then) {
+ next_step();
+ } else {
+ gen.then(finishTest, e => {
+ ok(false, "An error was thrown while stepping: " + e);
+ ok(false, "Stack: " + e.stack);
+ finishTest();
+ });
+ }
+}
+
+// The test will run on a separate window in order to apply the new cookie jar settings.
+async function runTestInWindow(test) {
+ let w = window.open("window_storagePermissions.html");
+ await new Promise(resolve => {
+ w.onload = e => {
+ resolve();
+ };
+ });
+
+ await new Promise(resolve => {
+ onmessage = e => {
+ if (e.data.type == "finish") {
+ w.close();
+ resolve();
+ return;
+ }
+
+ if (e.data.type == "check") {
+ ok(e.data.test, e.data.msg);
+ return;
+ }
+
+ ok(false, "Unknown message");
+ };
+
+ w.postMessage(test.toString(), "*");
+ });
+}
+
+var thirdparty = "https://example.com/tests/dom/tests/mochitest/general/";
diff --git a/dom/tests/mochitest/general/test-data.json b/dom/tests/mochitest/general/test-data.json
new file mode 100644
index 0000000000..797ab7a9dc
--- /dev/null
+++ b/dom/tests/mochitest/general/test-data.json
@@ -0,0 +1 @@
+{ "id": "test JSON data", "myArray": ["foo", "bar", "baz", "biff"] }
diff --git a/dom/tests/mochitest/general/test-data2.json b/dom/tests/mochitest/general/test-data2.json
new file mode 100644
index 0000000000..797ab7a9dc
--- /dev/null
+++ b/dom/tests/mochitest/general/test-data2.json
@@ -0,0 +1 @@
+{ "id": "test JSON data", "myArray": ["foo", "bar", "baz", "biff"] }
diff --git a/dom/tests/mochitest/general/test_497898.html b/dom/tests/mochitest/general/test_497898.html
new file mode 100644
index 0000000000..c26c67af86
--- /dev/null
+++ b/dom/tests/mochitest/general/test_497898.html
@@ -0,0 +1,41 @@
+<html>
+<head>
+<title>Crash [@ nsFocusManager::SendFocusOrBlurEvent] after switching focus to a different window in this case</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script>
+SimpleTest.waitForExplicitFinish();
+
+function done()
+{
+ is("passed", "passed", "test passed without crashing");
+ SimpleTest.finish();
+}
+
+function switchFocus()
+{
+ setTimeout(() => window.open('497633.html', '_new', 'width=300,height=300'), 0);
+}
+</script>
+</head>
+<body>
+ <iframe srcdoc="<html><meta charset='utf-8'>
+ <head>
+ <script>
+ function run() {
+ setTimeout(() => document.getElementById('a').focus(), 0);
+ }
+ </script>
+ </head>
+ <body onload='run()'>
+ <button id='a' onfocus='parent.switchFocus()' onblur='window.frameElement.parentNode.removeChild(window.frameElement)'>Switching focus to a different program should not crash Mozilla</button>
+ </body>
+ </html>">
+ </iframe>
+
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/general/test_CCW_optimization.html b/dom/tests/mochitest/general/test_CCW_optimization.html
new file mode 100644
index 0000000000..ca3a2e096c
--- /dev/null
+++ b/dom/tests/mochitest/general/test_CCW_optimization.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1319087
+-->
+<head>
+ <title>Test for Bug 1319087</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1319087">Mozilla Bug 1319087</a>
+<p id="display"></p>
+<div id="content">
+ <iframe></iframe>
+ <iframe></iframe>
+</div>
+<pre id="test">
+<script type="text/javascript">
+
+function WrapperToOwnCompartment() {
+ var iframe = new frames[0].Object();
+ var obj = iframe.obj = new Object();
+ obj.x = 123;
+
+ for (var i = 0; i < 50; i++) {
+ is(iframe.obj, obj);
+ is(iframe.obj.x, 123);
+ }
+}
+
+function WrapperToYetAnotherCompartment() {
+ var iframe = new frames[0].Object();
+ // Obj points to an object in a third compartment.
+ var obj = iframe.obj = new frames[1].Object();
+ obj.x = 42;
+
+ for (var i = 0; i < 50; i++) {
+ is(iframe.obj, obj);
+ is(iframe.obj.x, 42);
+ }
+}
+
+WrapperToOwnCompartment();
+WrapperToYetAnotherCompartment();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_DOMMatrix.html b/dom/tests/mochitest/general/test_DOMMatrix.html
new file mode 100644
index 0000000000..81bf68d71c
--- /dev/null
+++ b/dom/tests/mochitest/general/test_DOMMatrix.html
@@ -0,0 +1,717 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test DOMMatrix behavior</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<script>
+function createMatrix(a, b, c, d, e, f)
+{
+ var m = new DOMMatrix();
+ m.a = a;
+ m.b = b;
+ m.c = c;
+ m.d = d;
+ m.e = e;
+ m.f = f;
+ return m;
+}
+
+function create3DMatrix(a, b, c, d, e, f)
+{
+ var m = new DOMMatrix();
+ m.a = a;
+ m.b = b;
+ m.c = c;
+ m.d = d;
+ m.e = e;
+ m.f = f;
+ m.m13 = 0;
+ return m;
+}
+
+function cmpMatrix(a, b, msg)
+{
+ if (Array.isArray(a))
+ a = new DOMMatrix(a);
+ if (Array.isArray(b))
+ b = new DOMMatrix(b);
+
+ ok(CompareDOMMatrix(a, b),
+ msg + " - got " + formatMatrix(a)
+ + ", expected " + formatMatrix(b));
+}
+
+function roughCmpMatrix(a, b, msg)
+{
+ if (Array.isArray(a))
+ a = new DOMMatrix(a);
+ if (Array.isArray(b))
+ b = new DOMMatrix(b);
+
+ ok(RoughCompareDOMMatrix(a, b),
+ msg + " - got " + formatMatrix(a)
+ + ", expected " + formatMatrix(b));
+}
+
+function formatMatrix(m)
+{
+ m = new DOMMatrix(m);
+
+ if (m.is2D)
+ return "(" + [m.a, m.b, m.c, m.d, m.e, m.f].join(', ') + ")";
+ else
+ return "(" + [m.m11, m.m12, m.m13, m.m14,
+ m.m21, m.m22, m.m23, m.m24,
+ m.m31, m.m32, m.m33, m.m34,
+ m.m41, m.m42, m.m43, m.m44,].join(', ') + ")";
+}
+
+function CompareMatrix(dm, m)
+{
+ var ma = m.toFloat32Array();
+ for (var x = 0; x < ma.length; x++) {
+ if (Math.abs(ma[x] - dm.m[x]) > 0.000001)
+ return false;
+ }
+
+ return true;
+}
+
+function CompareDOMMatrix(dm1, dm2)
+{
+ var m1 = dm1.toFloat32Array();
+ var m2 = dm2.toFloat32Array();
+
+ if (m1.length != m2.length)
+ return false;
+
+ for (var x = 0; x < m1.length; x++) {
+ if (Math.abs(m1[x] - m2[x]) > 0.000001)
+ return false;
+ }
+
+ return true;
+}
+
+function RoughCompareDOMMatrix(dm1, dm2)
+{
+ var m1 = dm1.toFloat32Array();
+ var m2 = dm2.toFloat32Array();
+
+ if (m1.length != m2.length)
+ return false;
+
+ const tolerance = 1 / 65535;
+ for (var x = 0; x < m1.length; x++) {
+ if (Math.abs(m1[x] - m2[x]) > tolerance)
+ return false;
+ }
+
+ return true;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function main()
+{
+ var tests = [
+ testCreateMatrix,
+ testMultiply,
+ testInverse,
+ testTranslate,
+ testScale,
+ testScaleNonUniform,
+ testRotate,
+ testRotateFromVector,
+ testFlipX,
+ testFlipY,
+ testSkewX,
+ testSkewY,
+ testMultiplyInPlace,
+ testInverseInPlace,
+ testTranslateInPlace,
+ testScaleInPlace,
+ testRotateInPlace,
+ testRotateFromVectorInPlace,
+ testSkewXInPlace,
+ testSkewYInPlace,
+ testCreateMatrix3D,
+ testMultiply3D,
+ testInverse3D,
+ testTranslate3D,
+ testScale3D,
+ test3D,
+ testParsing,
+ testStringify
+ ];
+ for (var i = 0; i < tests.length; i++) {
+ try{
+ tests[i]();
+ } catch (e) {
+ ok(false, "uncaught exception in test " + i + ": " + e.name);
+ }
+ }
+ SimpleTest.finish();
+}
+
+function testCreateMatrix()
+{
+ var m = new DOMMatrix();
+
+ // Should be initialised to identity
+ cmpMatrix(m, [1, 0, 0, 1, 0, 0],
+ "DOMMatrix should produce identity matrix");
+
+ m = new DOMMatrix([1,2,3,4,5,6]);
+ cmpMatrix(m, [1,2,3,4,5,6],
+ "DOMMatrix should produce the same matrix");
+ ok(m.is2D, "Failed to mark matrix as 2D.");
+
+ m = new DOMMatrix([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]);
+ cmpMatrix(m, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],
+ "DOMMatrix should produce the same matrix");
+ ok(!m.is2D, "Failed to mark matrix as 3D.");
+
+ var n = new DOMMatrix(m.toFloat32Array());
+ cmpMatrix(n, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],
+ "DOMMatrix should produce the same matrix with float32array constructor");
+ ok(!n.is2D, "Failed to mark matrix as 3D.");
+
+ var n = new DOMMatrix(m.toFloat64Array());
+ cmpMatrix(n, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],
+ "DOMMatrix should produce the same matrix with float64array constructor");
+ ok(!n.is2D, "Failed to mark matrix as 3D.");
+
+ var exn = null;
+ try {
+ m = new DOMMatrix([0]);
+ } catch (e) {
+ exn = e;
+ }
+ ok(exn, "did throw exception with bad DOMMatrix constructor with 1 parameter");
+
+ exn = null;
+ try {
+ m = new DOMMatrix([1,2,3,4,5,6,7,8,9]);
+ } catch (e) {
+ exn = e;
+ }
+ ok(exn, "did throw exception with bad DOMMatrix constructor with 9 parameters");
+
+ exn = null;
+ try {
+ m = new DOMMatrix([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]);
+ } catch (e) {
+ exn = e;
+ }
+ ok(exn, "did throw exception with bad DOMMatrix constructor with 17 parameters");
+}
+
+// DOMMatrix multiply(in DOMMatrix secondMatrix);
+function testMultiply()
+{
+ var m1 = createMatrix(1, 0, 0, 1, 50, 90);
+ var m2 = createMatrix(Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 0, 0);
+ var m3 = createMatrix(1, 0, 0, 1, 130, 160);
+ var result = m1.multiply(m2).multiply(m3);
+ roughCmpMatrix(result, [Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 255.060974, 111.213203],
+ "Unexpected result after multiplying matrices");
+
+ // Check orig matrices are unchanged
+ cmpMatrix(m1, [1, 0, 0, 1, 50, 90], "Matrix changed after multiplication");
+ roughCmpMatrix(m2, [Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 0, 0],
+ "Matrix changed after multiplication");
+ cmpMatrix(m3, [1, 0, 0, 1, 130, 160], "Matrix changed after multiplication");
+}
+
+// DOMMatrix inverse() raises(SVGException);
+function testInverse()
+{
+ // Test inversion
+ var m = createMatrix(2, 0, 0, 4, 110, -50);
+ roughCmpMatrix(m.inverse(), [0.5, 0, 0, 0.25, -55, 12.5],
+ "Unexpected result after inverting matrix");
+
+ // Test non-invertable
+ m = createMatrix(0, 0, 1, 0, 0, 0);
+ m = m.inverse();
+ ok(isNaN(m.a), "Failed to invalidate inverted singular matrix, got " + m.a);
+ ok(!m.is2D, "Failed to mark invalidated inverted singular matrix as 3D.");
+}
+
+// DOMMatrix translate(in float x, in float y);
+function testTranslate()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.translate(100, -50), [2, 0, 0, 1, 320, 50],
+ "Unexpected result after translate");
+}
+
+// DOMMatrix scale(in float scaleFactor);
+function testScale()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.scale(0.5), [1, 0, 0, 0.5, 120, 100],
+ "Unexpected result after scale");
+}
+
+// DOMMatrix scaleNonUniform(in float scaleFactorX, in float scaleFactorY);
+function testScaleNonUniform()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.scaleNonUniform(0.5, -3), [1, 0, 0, -3, 120, 100],
+ "Unexpected result after scaleNonUniform");
+}
+
+// DOMMatrix rotate(in float angle);
+function testRotate()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.rotate(45),
+ [2*Math.cos(Math.PI/4), Math.sin(Math.PI/4),
+ 2*-Math.sin(Math.PI/4), Math.cos(Math.PI/4),
+ 120, 100],
+ "Unexpected result after rotate");
+}
+
+// DOMMatrix rotateFromVector(in float x, in float y) raises(SVGException);
+function testRotateFromVector()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ // Make a 150 degree angle
+ var result = m.rotateFromVector(-2, 1.1547);
+ roughCmpMatrix(result,
+ [2*Math.cos(5*Math.PI/6), Math.sin(5*Math.PI/6),
+ 2*-Math.sin(5*Math.PI/6), Math.cos(5*Math.PI/6),
+ 120, 100],
+ "Unexpected result after rotateFromVector");
+
+ // Test bad input (1)
+ var exn = null;
+ try {
+ m.rotateFromVector(1, 0);
+ } catch (e) {
+ exn = e;
+ }
+ is(exn, null, "did not throw exception with zero coord for rotateFromVector");
+
+ // Test bad input (2)
+ exn = null;
+ try {
+ m.rotateFromVector(0, 1);
+ } catch (e) {
+ exn = e;
+ }
+ is(exn, null, "did not throw exception with zero coord for rotateFromVector");
+}
+
+// DOMMatrix flipX();
+function testFlipX()
+{
+ var m = createMatrix(1, 2, 3, 4, 5, 6);
+ cmpMatrix(m.flipX(), [-1, -2, 3, 4, 5, 6], "Unexpected result after flipX");
+}
+
+// DOMMatrix flipY();
+function testFlipY()
+{
+ var m = createMatrix(1, 2, 3, 4, 5, 6);
+ cmpMatrix(m.flipY(), [1, 2, -3, -4, 5, 6], "Unexpected result after flipY");
+}
+
+// DOMMatrix skewX(in float angle);
+function testSkewX()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.skewX(30), [2, 0, 2*Math.tan(Math.PI/6), 1, 120, 100],
+ "Unexpected result after skewX");
+}
+
+// DOMMatrix skewY(in float angle);
+function testSkewY()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.skewY(30), [2, Math.tan(Math.PI/6), 0, 1, 120, 100],
+ "Unexpected result after skewY");
+}
+
+// DOMMatrix multiply(in DOMMatrix secondMatrix);
+function testMultiplyInPlace()
+{
+ var m1 = createMatrix(1, 0, 0, 1, 50, 90);
+ var m2 = createMatrix(Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 0, 0);
+ var m3 = createMatrix(1, 0, 0, 1, 130, 160);
+ m1.multiplySelf(m2).multiplySelf(m3);
+ roughCmpMatrix(m1, [Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 255.060974, 111.213203],
+ "Unexpected result after multiplying matrices");
+
+ // Check orig matrices are unchanged
+ roughCmpMatrix(m2, [Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 0, 0],
+ "Matrix changed after multiplication");
+ cmpMatrix(m3, [1, 0, 0, 1, 130, 160], "Matrix changed after multiplication");
+}
+
+// DOMMatrix inverse() raises(SVGException);
+function testInverseInPlace()
+{
+ // Test inversion
+ var m = createMatrix(2, 0, 0, 4, 110, -50);
+ m.invertSelf();
+ roughCmpMatrix(m, [0.5, 0, 0, 0.25, -55, 12.5],
+ "Unexpected result after inverting matrix");
+
+ // Test non-invertable
+ m = createMatrix(0, 0, 1, 0, 0, 0);
+ m.invertSelf();
+ ok(isNaN(m.a), "Failed to invalidate inverted singular matrix, got " + m.a);
+ ok(!m.is2D, "Failed to mark invalidated inverted singular matrix as 3D.");
+}
+
+// DOMMatrix translate(in float x, in float y);
+function testTranslateInPlace()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ m.translateSelf(100, -50)
+ roughCmpMatrix(m, [2, 0, 0, 1, 320, 50],
+ "Unexpected result after translate");
+}
+
+// DOMMatrix scale(in float scaleFactor);
+function testScaleInPlace()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ m.scaleSelf(0.5);
+ roughCmpMatrix(m, [1, 0, 0, 0.5, 120, 100],
+ "Unexpected result after scale");
+}
+
+// DOMMatrix rotate(in float angle);
+function testRotateInPlace()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ m.rotateSelf(45);
+ roughCmpMatrix(m,
+ [2*Math.cos(Math.PI/4), Math.sin(Math.PI/4),
+ 2*-Math.sin(Math.PI/4), Math.cos(Math.PI/4),
+ 120, 100],
+ "Unexpected result after rotate");
+}
+
+// DOMMatrix rotateFromVector(in float x, in float y) raises(SVGException);
+function testRotateFromVectorInPlace()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ // Make a 150 degree angle
+ m.rotateFromVectorSelf(-2, 1.1547);
+ roughCmpMatrix(m,
+ [2*Math.cos(5*Math.PI/6), Math.sin(5*Math.PI/6),
+ 2*-Math.sin(5*Math.PI/6), Math.cos(5*Math.PI/6),
+ 120, 100],
+ "Unexpected result after rotateFromVector");
+
+ // Test bad input (1)
+ try {
+ m.rotateFromVectorSelf(1, 0);
+ ok(true, "did not throw exception with zero coord for rotateFromVector");
+ } catch (e) {
+ ok(false,
+ "Got unexpected exception " + e + ", expected NotSupportedError");
+ }
+
+ // Test bad input (2)
+ try {
+ m.rotateFromVectorSelf(0, 1);
+ ok(true, "did not throw exception with zero coord for rotateFromVector");
+ } catch (e) { }
+}
+
+// DOMMatrix skewX(in float angle);
+function testSkewXInPlace()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ m.skewXSelf(30);
+ roughCmpMatrix(m, [2, 0, 2*Math.tan(Math.PI/6), 1, 120, 100],
+ "Unexpected result after skewX");
+}
+
+// DOMMatrix skewY(in float angle);
+function testSkewYInPlace()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ m.skewYSelf(30);
+ roughCmpMatrix(m, [2, Math.tan(Math.PI/6), 0, 1, 120, 100],
+ "Unexpected result after skewY");
+}
+
+function testCreateMatrix3D()
+{
+ var m = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
+
+ // Should be initialised to identity
+ cmpMatrix(m, [1, 0, 0, 1, 0, 0],
+ "DOMMatrix should produce identity matrix");
+ is(m.is2D, false, "should produce 3d matrix");
+
+ m = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]);
+
+ // Should be initialised to identity
+ cmpMatrix(m, [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+ "DOMMatrix should produce identity matrix");
+ is(m.is2D, false, "should produce 3d matrix");
+}
+
+// DOMMatrix multiply(in DOMMatrix secondMatrix);
+function testMultiply3D()
+{
+ var m1 = createMatrix(1, 0, 0, 1, 50, 90);
+ var m2 = create3DMatrix(Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 0, 0);
+ var m3 = create3DMatrix(1, 0, 0, 1, 130, 160);
+ var result = m1.multiply(m2).multiply(m3);
+ ok(m1.is2D == true, "should produce 3d matrix");
+ roughCmpMatrix(result, [Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 255.060974, 111.213203],
+ "Unexpected result after multiplying matrices");
+
+ // Check orig matrices are unchanged
+ cmpMatrix(m1, [1, 0, 0, 1, 50, 90], "Matrix changed after multiplication");
+ roughCmpMatrix(m2, [Math.SQRT1_2, -Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, 0, 0],
+ "Matrix changed after multiplication");
+ cmpMatrix(m3, [1, 0, 0, 1, 130, 160], "Matrix changed after multiplication");
+}
+
+// DOMMatrix inverse() raises(SVGException);
+function testInverse3D()
+{
+ // Test inversion
+ var m = create3DMatrix(2, 0, 0, 4, 110, -50);
+ roughCmpMatrix(m.inverse(), [0.5, 0, 0, 0.25, -55, 12.5],
+ "Unexpected result after inverting matrix");
+
+ // Test non-invertable
+ m = createMatrix(0, 0, 1, 0, 0, 0);
+ m = m.inverse();
+ ok(isNaN(m.a), "Failed to invalidate inverted singular matrix, got " + m.a);
+ ok(!m.is2D, "Failed to mark invalidated inverted singular matrix as 3D.");
+}
+
+// DOMMatrix translate(in float x, in float y);
+function testTranslate3D()
+{
+ var m = create3DMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.translate(100, -50), [2, 0, 0, 1, 320, 50],
+ "Unexpected result after translate");
+}
+
+// DOMMatrix scale(in float scaleFactor);
+function testScale3D()
+{
+ var m = create3DMatrix(2, 0, 0, 1, 120, 100);
+ roughCmpMatrix(m.scale(0.5), [1, 0, 0, 0.5, 120, 100],
+ "Unexpected result after scale");
+}
+
+function Matrix3D() {
+ this.m = new Float32Array([
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1
+ ]);
+}
+
+Matrix3D.prototype = {
+ translate(x, y, z, result) {
+ result = result || new Matrix3D();
+ var m = result.m;
+
+ m[0] = 1;
+ m[1] = 0;
+ m[2] = 0;
+ m[3] = x;
+
+ m[4] = 0;
+ m[5] = 1;
+ m[6] = 0;
+ m[7] = y;
+
+ m[8] = 0;
+ m[9] = 0;
+ m[10] = 1;
+ m[11] = z;
+
+ m[12] = 0;
+ m[13] = 0;
+ m[14] = 0;
+ m[15] = 1;
+
+ return result;
+ },
+ inverse(matrix, result) {
+ result = result || new Matrix3D();
+ var m = matrix.m, r = result.m;
+
+ r[0] = m[5]*m[10]*m[15] - m[5]*m[14]*m[11] - m[6]*m[9]*m[15] + m[6]*m[13]*m[11] + m[7]*m[9]*m[14] - m[7]*m[13]*m[10];
+ r[1] = -m[1]*m[10]*m[15] + m[1]*m[14]*m[11] + m[2]*m[9]*m[15] - m[2]*m[13]*m[11] - m[3]*m[9]*m[14] + m[3]*m[13]*m[10];
+ r[2] = m[1]*m[6]*m[15] - m[1]*m[14]*m[7] - m[2]*m[5]*m[15] + m[2]*m[13]*m[7] + m[3]*m[5]*m[14] - m[3]*m[13]*m[6];
+ r[3] = -m[1]*m[6]*m[11] + m[1]*m[10]*m[7] + m[2]*m[5]*m[11] - m[2]*m[9]*m[7] - m[3]*m[5]*m[10] + m[3]*m[9]*m[6];
+
+ r[4] = -m[4]*m[10]*m[15] + m[4]*m[14]*m[11] + m[6]*m[8]*m[15] - m[6]*m[12]*m[11] - m[7]*m[8]*m[14] + m[7]*m[12]*m[10];
+ r[5] = m[0]*m[10]*m[15] - m[0]*m[14]*m[11] - m[2]*m[8]*m[15] + m[2]*m[12]*m[11] + m[3]*m[8]*m[14] - m[3]*m[12]*m[10];
+ r[6] = -m[0]*m[6]*m[15] + m[0]*m[14]*m[7] + m[2]*m[4]*m[15] - m[2]*m[12]*m[7] - m[3]*m[4]*m[14] + m[3]*m[12]*m[6];
+ r[7] = m[0]*m[6]*m[11] - m[0]*m[10]*m[7] - m[2]*m[4]*m[11] + m[2]*m[8]*m[7] + m[3]*m[4]*m[10] - m[3]*m[8]*m[6];
+
+ r[8] = m[4]*m[9]*m[15] - m[4]*m[13]*m[11] - m[5]*m[8]*m[15] + m[5]*m[12]*m[11] + m[7]*m[8]*m[13] - m[7]*m[12]*m[9];
+ r[9] = -m[0]*m[9]*m[15] + m[0]*m[13]*m[11] + m[1]*m[8]*m[15] - m[1]*m[12]*m[11] - m[3]*m[8]*m[13] + m[3]*m[12]*m[9];
+ r[10] = m[0]*m[5]*m[15] - m[0]*m[13]*m[7] - m[1]*m[4]*m[15] + m[1]*m[12]*m[7] + m[3]*m[4]*m[13] - m[3]*m[12]*m[5];
+ r[11] = -m[0]*m[5]*m[11] + m[0]*m[9]*m[7] + m[1]*m[4]*m[11] - m[1]*m[8]*m[7] - m[3]*m[4]*m[9] + m[3]*m[8]*m[5];
+
+ r[12] = -m[4]*m[9]*m[14] + m[4]*m[13]*m[10] + m[5]*m[8]*m[14] - m[5]*m[12]*m[10] - m[6]*m[8]*m[13] + m[6]*m[12]*m[9];
+ r[13] = m[0]*m[9]*m[14] - m[0]*m[13]*m[10] - m[1]*m[8]*m[14] + m[1]*m[12]*m[10] + m[2]*m[8]*m[13] - m[2]*m[12]*m[9];
+ r[14] = -m[0]*m[5]*m[14] + m[0]*m[13]*m[6] + m[1]*m[4]*m[14] - m[1]*m[12]*m[6] - m[2]*m[4]*m[13] + m[2]*m[12]*m[5];
+ r[15] = m[0]*m[5]*m[10] - m[0]*m[9]*m[6] - m[1]*m[4]*m[10] + m[1]*m[8]*m[6] + m[2]*m[4]*m[9] - m[2]*m[8]*m[5];
+
+ var det = m[0]*r[0] + m[1]*r[4] + m[2]*r[8] + m[3]*r[12];
+ for (var i = 0; i < 16; i++) r[i] /= det;
+ return result;
+ },
+ multiply(left, result) {
+ result = result || new Matrix3D();
+ var a = this.m, b = left.m, r = result.m;
+
+ r[0] = a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12];
+ r[1] = a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13];
+ r[2] = a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14];
+ r[3] = a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15];
+
+ r[4] = a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12];
+ r[5] = a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13];
+ r[6] = a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14];
+ r[7] = a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15];
+
+ r[8] = a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12];
+ r[9] = a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13];
+ r[10] = a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14];
+ r[11] = a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15];
+
+ r[12] = a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12];
+ r[13] = a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13];
+ r[14] = a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14];
+ r[15] = a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15];
+
+ return result;
+ },
+ scale(x, y, z, result) {
+ result = result || new Matrix3D();
+ var m = result.m;
+
+ m[0] = x;
+ m[1] = 0;
+ m[2] = 0;
+ m[3] = 0;
+
+ m[4] = 0;
+ m[5] = y;
+ m[6] = 0;
+ m[7] = 0;
+
+ m[8] = 0;
+ m[9] = 0;
+ m[10] = z;
+ m[11] = 0;
+
+ m[12] = 0;
+ m[13] = 0;
+ m[14] = 0;
+ m[15] = 1;
+
+ return result;
+ },
+ rotate(a, x, y, z, result) {
+ result = result || new Matrix3D();
+ var m = result.m;
+
+ var d = Math.sqrt(x*x + y*y + z*z);
+ a *= Math.PI / 180; x /= d; y /= d; z /= d;
+ var c = Math.cos(a), s = Math.sin(a), t = 1 - c;
+
+ m[0] = x * x * t + c;
+ m[1] = x * y * t - z * s;
+ m[2] = x * z * t + y * s;
+ m[3] = 0;
+
+ m[4] = y * x * t + z * s;
+ m[5] = y * y * t + c;
+ m[6] = y * z * t - x * s;
+ m[7] = 0;
+
+ m[8] = z * x * t - y * s;
+ m[9] = z * y * t + x * s;
+ m[10] = z * z * t + c;
+ m[11] = 0;
+
+ m[12] = 0;
+ m[13] = 0;
+ m[14] = 0;
+ m[15] = 1;
+
+ return result;
+ },
+ swap(result) {
+ result = result || new Matrix3D();
+ for (var x = 0; x < 16; x++)
+ result.m[x] = this.m[Math.floor(x/4) + (x%4)*4];
+
+ return result;
+ }
+};
+
+
+function test3D()
+{
+ var m = new DOMMatrix()
+ var m2 = new Matrix3D();
+
+ m.translateSelf(2,3,4).scaleSelf(1.2, 2.3, 3.4, 0, 0, 0);
+ m2 = m2.multiply(m2.translate(2,3,4)).multiply(m2.scale(1.2, 2.3, 3.4)).swap();
+
+ ok(CompareMatrix(m2, m), "translate + scale in 3d didn't match, expected: " + formatMatrix(m2.m) + ", got: " + formatMatrix(m));
+
+ m.invertSelf();
+ m2 = new Matrix3D();
+ m2 = m2.multiply(m2.translate(2,3,4)).multiply(m2.scale(1.2, 2.3, 3.4));
+ m2 = m2.inverse(m2).swap();
+ ok(CompareMatrix(m2, m), "translate + scale in inverted 3d didn't match, expected: " + formatMatrix(m2.m) + ", got: " + formatMatrix(m));
+}
+
+function testParsing()
+{
+ var m = new DOMMatrix("translate(10px, 20px) scale(.5, 2) rotate(45deg)");
+ var m2 = new DOMMatrix();
+ m2.translateSelf(10, 20).scaleSelf(.5,2).rotateSelf(45);
+ ok(CompareDOMMatrix(m2, m), "string parsing didn't match");
+
+ m = new DOMMatrix();
+ m.setMatrixValue("translate(10px, 20px) scale(.5, 2) rotate(45deg)");
+ ok(CompareDOMMatrix(m2, m), "string parsing didn't match");
+}
+
+
+function testStringify() {
+ var m = new DOMMatrix();
+ var s = "" + m;
+ ok(s == "matrix" + formatMatrix(m), "stringifier 1 produced wrong result: " + s);
+ m.a = 100;
+ s = "" + m;
+ ok(s == "matrix" + formatMatrix(m), "stringifier 2 produced wrong result: " + s);
+ m.m43 = 200;
+ s = "" + m;
+ ok(s == "matrix3d" + formatMatrix(m), "stringifier 3 produced wrong result:" + s);
+}
+
+window.addEventListener("load", main);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_WebKitCSSMatrix.html b/dom/tests/mochitest/general/test_WebKitCSSMatrix.html
new file mode 100644
index 0000000000..690a7d2c63
--- /dev/null
+++ b/dom/tests/mochitest/general/test_WebKitCSSMatrix.html
@@ -0,0 +1,339 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for WebKitCSSMatrix</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+function RoughCompareMatrix(dm1, dm2)
+{
+ var m1 = dm1.toFloat32Array();
+ var m2 = dm2.toFloat32Array();
+
+ if (m1.length != m2.length) {
+ return false;
+ }
+
+ const tolerance = 1 / 65535;
+ for (var x = 0; x < m1.length; x++) {
+ if (Math.abs(m1[x] - m2[x]) > tolerance) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+function CompareMatrix(dm1, dm2)
+{
+ var m1 = dm1.toFloat32Array();
+ var m2 = dm2.toFloat32Array();
+
+ if (m1.length != m2.length) {
+ return false;
+ }
+
+ for (var x = 0; x < m1.length; x++) {
+ if (m1[x] != m2[x] && !(Number.isNaN(m1[x]) && Number.isNaN(m2[x]))) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+test(function() {
+ var m = new WebKitCSSMatrix();
+
+ assert_equals(m.m11, 1, "m11 should be 1");
+ assert_equals(m.m22, 1, "m22 should be 1");
+ assert_equals(m.m33, 1, "m33 should be 1");
+ assert_equals(m.m44, 1, "m44 should be 1");
+ assert_equals(m.m12, 0, "m12 should be 0");
+ assert_equals(m.m13, 0, "m13 should be 0");
+ assert_equals(m.m14, 0, "m14 should be 0");
+ assert_equals(m.m21, 0, "m21 should be 0");
+ assert_equals(m.m23, 0, "m23 should be 0");
+ assert_equals(m.m24, 0, "m24 should be 0");
+ assert_equals(m.m31, 0, "m31 should be 0");
+ assert_equals(m.m32, 0, "m32 should be 0");
+ assert_equals(m.m34, 0, "m34 should be 0");
+ assert_equals(m.m41, 0, "m41 should be 0");
+ assert_equals(m.m42, 0, "m42 should be 0");
+ assert_equals(m.m43, 0, "m43 should be 0");
+}, "Test constructor with no arguments.");
+
+test(function() {
+ var m = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ assert_equals(m.m11, 1, "m11 should be 1");
+ assert_equals(m.m12, 2, "m12 should be 2");
+ assert_equals(m.m21, 3, "m21 should be 3");
+ assert_equals(m.m22, 4, "m22 should be 4");
+ assert_equals(m.m41, 5, "m41 should be 5");
+ assert_equals(m.m42, 6, "m42 should be 6");
+}, "Test constructor with transform list.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new WebKitCSSMatrix(m1);
+
+ assert_true(RoughCompareMatrix(m1, m2), "Matrix should be equal.");
+}, "Test constructor with other matrix.");
+
+test(function() {
+ var m = new WebKitCSSMatrix();
+ var mr = m.setMatrixValue("matrix(1,2,3,4,5,6)");
+
+ assert_equals(m.m11, 1, "m11 should be 1");
+ assert_equals(m.m12, 2, "m12 should be 2");
+ assert_equals(m.m21, 3, "m21 should be 3");
+ assert_equals(m.m22, 4, "m22 should be 4");
+ assert_equals(m.m41, 5, "m41 should be 5");
+ assert_equals(m.m42, 6, "m42 should be 6");
+
+ assert_equals(m, mr, "Return value of setMatrixValue should be the same matrix.");
+}, "Test setMatrixValue.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(6,5,4,3,2,1)");
+ var m4 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.multiply(m3);
+ var m2r = m2.multiply(m3);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "multiply should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m4), "Multiply should not mutate original matrix.");
+}, "Test multiply.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.inverse();
+ var m2r = m2.inverse();
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "inverse should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "inverse should not mutate original matrix.");
+}, "Test inverse.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.translate(2, 3, 4);
+ var m2r = m2.translate(2, 3, 4);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "translate should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "translate should not mutate original matrix.");
+}, "Test translate.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.scale(2);
+ var m2r = m2.scale(2, 2, 1);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "scale should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "scale should not mutate original matrix.");
+}, "Test scale with 1 argument.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.scale(2, 3);
+ var m2r = m2.scale(2, 3, 1);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "scale should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "scale should not mutate original matrix.");
+}, "Test scale with 2 arguments.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.scale(2, 3, 4);
+ var m2r = m2.scale(2, 3, 4);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "scale should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "scale should not mutate original matrix.");
+}, "Test scale with 3 arguments.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.scale(undefined, 3, 4);
+ var m2r = m2.scale(1, 3, 4);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "scale should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "scale should not mutate original matrix.");
+}, "Test scale with undefined scaleX argument.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.scale(2, undefined, 4);
+ var m2r = m2.scale(2, 2, 4);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "scale should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "scale should not mutate original matrix.");
+}, "Test scale with undefined scaleY argument.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.scale(2, 3, undefined);
+ var m2r = m2.scale(2, 3, 1);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "scale should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "scale should not mutate original matrix.");
+}, "Test scale with undefined scaleZ argument.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.rotate(2);
+ var m2r = m2.rotateAxisAngle(0, 0, 1, 2); // Rotate around unit vector on z-axis.
+
+ assert_true(RoughCompareMatrix(m1r, m2r));
+ assert_true(CompareMatrix(m1, m3), "rotate should not mutate original matrix.");
+}, "Test rotate with 1 argument.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.rotate(2, 3);
+ var m2r = m2.rotateAxisAngle(0, 1, 0, 3); // Rotate around unit vector on x-axis.
+ m2r = m2r.rotateAxisAngle(1, 0, 0, 2); // Rotate around unit vector on y-axis.
+
+ assert_true(RoughCompareMatrix(m1r, m2r));
+ assert_true(CompareMatrix(m1, m3), "rotate should not mutate original matrix.");
+}, "Test rotate with 2 arguments.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.rotate(2, 3, 4);
+ var m2r = m2.rotateAxisAngle(0, 0, 1, 4); // Rotate around unit vector on z-axis.
+ m2r = m2r.rotateAxisAngle(0, 1, 0, 3); // Rotate around unit vector on y-axis.
+ m2r = m2r.rotateAxisAngle(1, 0, 0, 2); // Rotate around unit vector on x-axis.
+
+ assert_true(RoughCompareMatrix(m1r, m2r));
+ assert_true(CompareMatrix(m1, m3), "rotate should not mutate original matrix.");
+}, "Test rotate with 3 arguments.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.rotate(2, undefined, undefined);
+ var m2r = m2.rotateAxisAngle(0, 0, 1, 2); // Rotate around unit vector on z-axis.
+
+ assert_true(RoughCompareMatrix(m1r, m2r));
+ assert_true(CompareMatrix(m1, m3), "rotate should not mutate original matrix.");
+}, "Test rotate with rotY and rotZ as undefined.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.rotate(undefined, 3, 4);
+ var m2r = m2.rotateAxisAngle(0, 0, 1, 4); // Rotate around unit vector on z-axis.
+ m2r = m2r.rotateAxisAngle(0, 1, 0, 3); // Rotate around unit vector on y-axis.
+
+ assert_true(RoughCompareMatrix(m1r, m2r));
+ assert_true(CompareMatrix(m1, m3), "rotate should not mutate original matrix.");
+}, "Test rotate with rotX as undefined.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.rotateAxisAngle(2, 3, 4, 5);
+ var m2r = m2.rotateAxisAngle(2, 3, 4, 5);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "rotateAxisAngle should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "rotateAxisAngle should not mutate original matrix.");
+}, "Test rotateAxisAngle.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.skewX(2);
+ var m2r = m2.skewX(2);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "skewX should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "skewX should not mutate original matrix.");
+}, "Test skewX.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+ var m2 = new DOMMatrix("matrix(1,2,3,4,5,6)");
+ var m3 = new WebKitCSSMatrix("matrix(1,2,3,4,5,6)");
+
+ var m1r = m1.skewY(2);
+ var m2r = m2.skewY(2);
+
+ assert_true(RoughCompareMatrix(m1r, m2r), "skewY should return the same result as DOMMatrixReadOnly.");
+ assert_true(CompareMatrix(m1, m3), "skewY should not mutate original matrix.");
+}, "Test skewY.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("matrix(1,0,0,0,0,0)");
+ m1 = m1.inverse();
+
+ var m2 = new DOMMatrix(new Array(16).fill(NaN));
+ assert_true(CompareMatrix(m1, m2), "Inverting a non-invertible matrix should set all attributes to NaN.")
+}, "Test that inverting an invertible matrix throws.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix("translate(10px, 10px)");
+ var m2 = new DOMMatrix();
+ m2.translateSelf(10, 10);
+ assert_true(RoughCompareMatrix(m1, m2), "translate in constructor should result in translated matrix");
+
+ assert_throws("SyntaxError", function() { new WebKitCSSMatrix("translate(10em, 10em)"); }, "Transform function may not contain relative units.")
+ assert_throws("SyntaxError", function() { new WebKitCSSMatrix("translate(10%, 10%)"); }, "Transform function may not contain percentage.")
+}, "Test constructor with translate");
+
+test(function() {
+ assert_throws("SyntaxError", function() { new WebKitCSSMatrix("initial"); }, "initial is not a valid constructor argument.")
+ assert_throws("SyntaxError", function() { new WebKitCSSMatrix("inherit"); }, "inherit is not a valid constructor arugment.")
+}, "Test invalid constructor arguments.");
+
+test(function() {
+ var m1 = new WebKitCSSMatrix();
+ m1 = m1.rotateAxisAngle(0, 0, 1, 45);
+
+ var m2 = new WebKitCSSMatrix();
+ m2 = m2.rotateAxisAngle(0, 0, 3, 45);
+
+ assert_true(RoughCompareMatrix(m1, m2), "rotateAxisAngle should normalize vector to unit vector.");
+}, "Test normalization of vector for rotateAxisAngle");
+</script>
diff --git a/dom/tests/mochitest/general/test_bug1161721.html b/dom/tests/mochitest/general/test_bug1161721.html
new file mode 100644
index 0000000000..ab609bf046
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1161721.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1161721
+-->
+<head>
+ <title>Test for Bug 1161721</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1161721">Mozilla Bug 1161721</a>
+<p id="display"></p>
+
+<div id="content">
+</div>
+
+<pre id="test">
+ <script type="application/javascript">
+ ok(!document.queryCommandSupported("paste"), "Paste isn't supported in non-privilged JavaScript");
+ ok(document.queryCommandSupported("copy"), "Copy is supported in non-privilged JavaScript");
+ ok(document.queryCommandSupported("cut"), "Cut is supported in non-privilged JavaScript");
+
+ ok(SpecialPowers.wrap(document).queryCommandSupported("paste"), "Paste is supported in privilged JavaScript");
+ ok(SpecialPowers.wrap(document).queryCommandSupported("copy"), "Copy is supported in privilged JavaScript");
+ ok(SpecialPowers.wrap(document).queryCommandSupported("cut"), "Cut is supported in privilged JavaScript");
+ </script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug1170911.html b/dom/tests/mochitest/general/test_bug1170911.html
new file mode 100644
index 0000000000..af0e71576f
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1170911.html
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1012662
+-->
+<head>
+ <title>Test for Bug 1170911</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1170911">Mozilla Bug 1170911</a>
+<p id="display"></p>
+
+<div id="content">
+ <textarea>textarea text</textarea>
+</div>
+
+<pre id="test">
+<script>
+const TEXTAREA = document.querySelector('textarea');
+const TEXTAREA_VALUE = TEXTAREA.value;
+
+function doTest() {
+ is(document.queryCommandSupported("copy"), false,
+ "Copy support should have been disabled");
+ is(document.queryCommandSupported("cut"), false,
+ "Cut support should have been disabled");
+
+ document.addEventListener("keydown", tryCopy);
+ sendString("Q");
+}
+
+function tryCopy(evt) {
+ evt.preventDefault();
+ document.removeEventListener("keydown", tryCopy);
+ TEXTAREA.setSelectionRange(0, TEXTAREA_VALUE.length);
+ TEXTAREA.focus();
+
+ SimpleTest.waitForClipboard(null, function () {
+ is(document.queryCommandEnabled("copy"), false,
+ "Copy should not be allowed when dom.allow_cut_copy is off");
+ is(document.execCommand("copy"), false,
+ "Copy should not be executed when dom.allow_cut_copy is off");
+ is(TEXTAREA.value, TEXTAREA_VALUE,
+ "Content in the textarea shouldn't be changed");
+ TEXTAREA.value = TEXTAREA_VALUE;
+ },
+ /* success fn */ SimpleTest.finish,
+ /* failure fn */ function () {
+ document.addEventListener("keydown", tryCut);
+ sendString("Q");
+ },
+ /* flavor */ undefined,
+ /* timeout */ undefined,
+ /* expect failure */ true);
+}
+
+function tryCut(evt) {
+ evt.preventDefault();
+ document.removeEventListener("keydown", tryCut);
+ TEXTAREA.setSelectionRange(0, TEXTAREA_VALUE.length);
+ TEXTAREA.focus();
+
+ SimpleTest.waitForClipboard(null, function () {
+ is(document.queryCommandEnabled("cut"), false,
+ "Cut should not be allowed when dom.allow_cut_copy is off");
+ is(document.execCommand("cut"), false,
+ "Cut should not be executed when dom.allow_cut_copy is off");
+ is(TEXTAREA.value, TEXTAREA_VALUE,
+ "Content in the textarea shouldn't be changed");
+ },
+ /* success fn */ SimpleTest.finish,
+ /* failure fn */ SimpleTest.finish,
+ /* flavor */ undefined,
+ /* timeout */ undefined,
+ /* expect failure */ true);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(() => {
+ SpecialPowers.pushPrefEnv({"set": [["dom.allow_cut_copy", false]]}, doTest);
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug1208217.html b/dom/tests/mochitest/general/test_bug1208217.html
new file mode 100644
index 0000000000..1f76ba34de
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1208217.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1208217
+-->
+<head>
+ <title>Test for Bug 1208217</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1208217">Mozilla Bug 1208217</a>
+<script type="application/javascript">
+
+ add_task(async function() {
+ let pasteCount = 0;
+ document.addEventListener('paste', function() {
+ pasteCount++;
+ });
+
+ is(pasteCount, 0);
+
+ synthesizeKey("V", {accelKey: true});
+
+ is(pasteCount, 1);
+ });
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug1313753.html b/dom/tests/mochitest/general/test_bug1313753.html
new file mode 100644
index 0000000000..e684f29136
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1313753.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for bug 1313753</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<div id="log"></div>
+<script>
+function runTest() {
+ // Change visible region of |closure| element.
+ document.getElementById("target").classList.add("rotate");
+ window.setTimeout(function() {
+ var target = document.getElementById("target");
+ var bounds = target.getBoundingClientRect();
+ var x = bounds.x + bounds.width / 2;
+ var y = bounds.y + bounds.height / 2;
+ is(document.elementFromPoint(x, y).id, target.id,
+ "it should be |target| element if visible regions of closure is correct");
+ SimpleTest.finish();
+ }, 0);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(runTest);
+</script>
+
+<style>
+.panel {
+ transform: rotateX(-150deg);
+ backface-visibility: hidden;
+ transform-origin: 0px 0px;
+ position: absolute;
+ display: block;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+#closure .rotate {
+ transform: rotateX(0deg);
+}
+#closure {
+ perspective: 100px;
+ width: 200px;
+ z-index: 1;
+}
+#outer {
+ height: 400px;
+ width: 200px;
+}
+</style>
+<div id="outer">
+ <div id="closure">
+ <div style="transform-style: preserve-3d;">
+ <div style="transform-style: preserve-3d; background-color: blue;">
+ <ul style="transform-style: preserve-3d;">
+ <li style="transform-style:preserve-3d;">
+ <div style="display: contents">
+ <div id="target" class="panel"></div>
+ </div>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/dom/tests/mochitest/general/test_bug1434273.html b/dom/tests/mochitest/general/test_bug1434273.html
new file mode 100644
index 0000000000..89556d1a0d
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1434273.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1434273
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1434273</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ #test::before { content: url(image_200.png); }
+ </style>
+ <script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ /** Test for Bug 1434273 **/
+ addLoadEvent(function() {
+ synthesizeMouse($("test"), 100, 100, {});
+ ok(true, "We did not crash!");
+ SimpleTest.finish();
+ });
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1434273">Mozilla Bug 1434273</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug504220.html b/dom/tests/mochitest/general/test_bug504220.html
new file mode 100644
index 0000000000..7223c67d91
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug504220.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=504220
+-->
+<head>
+ <title>Test for Bug 504220</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body onload="run_test();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=504220">Mozilla Bug 504220</a>
+<p id="display"></p>
+<div id="content">
+ <iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
+ <div id="status" style="display: none"></div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 504220 **/
+
+function run_test() {
+ ok("onhashchange" in document.body,
+ "document.body should contain 'onhashchange'.");
+
+ ok("onhashchange" in window, "window should contain 'onhashchange'.");
+
+ // window.onhashchange should mirror document.body.onhashchange.
+ var func = function() { return 42; };
+ document.body.onhashchange = func;
+ is(window.onhashchange, func);
+
+ // Likewise, document.body.hashchange should mirror window.onhashchange
+ numEvents = 0;
+ var func2 = function() { numEvents++; gGen.next() };
+ window.onhashchange = func2;
+ is(document.body.onhashchange, func2);
+
+ SimpleTest.waitForExplicitFinish();
+
+ function* waitForHashchange() {
+ // Change the document's hash. If we've been running this test manually,
+ // the hash might already be "#foo", so we need to check in order to be
+ // sure we trigger a hashchange.
+ if (location.hash != "#foo")
+ location.hash = "#foo";
+ else
+ location.hash = "#bar";
+
+ yield undefined;
+
+ is(numEvents, 1, "Exactly one hashchange should have been fired.");
+ SimpleTest.finish();
+ }
+
+ var gGen = waitForHashchange();
+ gGen.next();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug628069_1.html b/dom/tests/mochitest/general/test_bug628069_1.html
new file mode 100644
index 0000000000..fef2307a45
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug628069_1.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=628069
+-->
+<head>
+ <title>Test for Bug 628069</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=628069">Mozilla Bug 628069</a>
+<p id="display"></p>
+<div id="content">
+ <iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
+ <div id="status" style="display: none"></div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 628069 **/
+
+SimpleTest.waitForExplicitFinish();
+
+popup = window.open('file_bug628069.html');
+
+// Control flows into childLoad, once the popup loads.
+
+gOrigURL = null;
+function childLoad() {
+ gOrigURL = popup.location + '';
+
+ popup.location.hash = '#hash';
+
+ // This should trigger a hashchange, so control should flow down to
+ // childHashchange.
+}
+
+function childHashchange(e) {
+ is(e.oldURL, gOrigURL, 'event.oldURL');
+ is(e.newURL, gOrigURL + '#hash', 'event.newURL');
+ is(e.isTrusted, true, 'Hashchange event should be trusted.');
+ popup.close();
+ SimpleTest.finish();
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug628069_2.html b/dom/tests/mochitest/general/test_bug628069_2.html
new file mode 100644
index 0000000000..e9c5b623eb
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug628069_2.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=628069
+-->
+<head>
+ <title>Test for Bug 628069</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=628069">Mozilla Bug 628069</a>
+<p id="display"></p>
+<div id="content">
+ <iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
+ <div id="status" style="display: none"></div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 628069 **/
+
+gotHashChange = 0;
+document.addEventListener("hashChange", function(e) {
+ gotHashChange = 1;
+ is(e.oldURL, "oldURL");
+ is(e.newURL, "newURL");
+ is(e.isTrusted, false, "Hashchange event shouldn't be trusted.");
+}, true);
+
+let hc = new HashChangeEvent("hashChange", { bubbles: true,
+ cancelable: false,
+ oldURL: "oldURL",
+ newURL: "newURL" });
+document.documentElement.dispatchEvent(hc);
+is(gotHashChange, 1, 'Document received hashchange event.');
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug631440.html b/dom/tests/mochitest/general/test_bug631440.html
new file mode 100644
index 0000000000..8228a0af99
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug631440.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=631440
+-->
+<head>
+ <title>Test for Bug 631440</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=631440">Mozilla Bug 631440</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var w = window.open("about:blank");
+w.addEventListener("load", function() {
+ w.close();
+ SimpleTest.finish();
+});
+
+try {
+ w.history.pushState(null, "title", "pushState.html");
+ ok(false, "Should have thrown a security exception");
+}
+catch (e) {
+ ok(true, "Should have thrown a security exception");
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug653364.html b/dom/tests/mochitest/general/test_bug653364.html
new file mode 100644
index 0000000000..2db81254eb
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug653364.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=653364
+-->
+<head>
+ <title>Test for Bug 653364</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=653364">Mozilla Bug 653364</a>
+<p id="display"></p>
+<div id="content">
+ <iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
+ <div id="status" style="display: none"></div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 653364 **/
+
+gotPopState = 0;
+document.addEventListener("popState", function(e) {
+ gotPopState = 1;
+ is(e.state.foo, 'bar', "PopState event should have state we set.");
+ is(e.isTrusted, false, "PopState event shouldn't be trusted.");
+}, true);
+
+let ps = new PopStateEvent("popState", { bubbles: true,
+ cancelable: false,
+ state: {'foo': 'bar'} });
+document.documentElement.dispatchEvent(ps);
+is(gotPopState, 1, 'Document received PopState event.');
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug861217.html b/dom/tests/mochitest/general/test_bug861217.html
new file mode 100644
index 0000000000..1af3f58ff6
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug861217.html
@@ -0,0 +1,115 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=861217
+-->
+<head>
+ <title>Test for Bug 861217</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body onload="runTest()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=861217">Mozilla Bug 861217</a>
+<p id="display"></p>
+<div id="content">
+ <table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed; width: 50px">
+ <tbody>
+ <tr>
+ <td id="tableCell1" style="overflow: hidden"><div style="width: 100px; height: 100px; background-color: DodgerBlue">1</div></td>
+ </tr>
+ <tr>
+ <td id="tableCell2" style="overflow: hidden"><div style="margin-top: 5px; margin-left: 7px; width: 100px; height: 100px; background-color: SkyBlue">2</div></td>
+ </tr>
+ <tr>
+ <td id="tableCell3" style="overflow: hidden"><div style="display: inline-block; margin-right: 8px; margin-bottom: 10px; width: 100px; height: 100px; background-color: Khaki">3</div></td>
+ </tr>
+ <tr>
+ <td id="tableCell4" style="overflow: hidden"><div style="display: inline-block; margin-right: 3px; margin-left: 1px; box-sizing: border-box; width: 100px; height: 100px; border-left: 6px solid black; border-bottom: 2px solid black; background-color: LightCoral">4</div></td>
+ </tr>
+ <tr>
+ <td id="tableCell5" style="overflow: hidden"><div style="display: inline-block; border-right: 9px solid black; width: 100px; height: 100px; background-color: LightSeaGreen">5</div></td>
+ </tr>
+ <tr>
+ <td id="tableCell6" style="overflow: hidden"><div style="box-sizing: border-box; width: 100px; height: 100px; padding-top: 3px; padding-right: 13px; background-color: Orange">6</div></td>
+ </tr>
+ <tr>
+ <td id="tableCell7" style="overflow: hidden"><div style="display: inline-block; margin-right: 11px; margin-left: 4px; box-sizing: border-box; width: 100px; height: 100px; border-right: 6px solid black; border-bottom: 8px solid black; padding-top: 5px; padding-right: 9px; padding-bottom: 8px; padding-left: 7px; background-color: Silver">7</div></td>
+ </tr>
+ <tr>
+ <td id="tableCell8" style="overflow: hidden"><div style="display: inline-block; margin-top: 7px; margin-bottom: 1px; border-right: 6px solid black; border-bottom: 8px solid black; padding-top: 5px; padding-right: 9px; padding-bottom: 8px; padding-left: 7px; width: 100px; height: 100px; background-color: Turquoise">8</div></td>
+ </tr>
+ </tbody>
+ </table>
+ <div id="status" style="display: none"></div>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+/** Test for Bug 861217 **/
+function runTest() {
+ var tableCell1 = document.getElementById("tableCell1"),
+ bcr1 = tableCell1.getBoundingClientRect(),
+ tableCell2 = document.getElementById("tableCell2"),
+ bcr2 = tableCell2.getBoundingClientRect(),
+ tableCell3 = document.getElementById("tableCell3"),
+ bcr3 = tableCell3.getBoundingClientRect(),
+ tableCell4 = document.getElementById("tableCell4"),
+ bcr4 = tableCell4.getBoundingClientRect(),
+ tableCell5 = document.getElementById("tableCell5"),
+ bcr5 = tableCell5.getBoundingClientRect(),
+ tableCell6 = document.getElementById("tableCell6"),
+ bcr6 = tableCell6.getBoundingClientRect(),
+ tableCell7 = document.getElementById("tableCell7"),
+ bcr7 = tableCell7.getBoundingClientRect(),
+ tableCell8 = document.getElementById("tableCell8"),
+ bcr8 = tableCell8.getBoundingClientRect();
+
+ is(bcr1.width, 50, "Width of bounding client rect of #tableCell1");
+ is(tableCell1.scrollWidth, 100, "scrollWidth of #tableCell1");
+ is(bcr1.height, 100, "Height of bounding client rect of #tableCell1");
+ is(tableCell1.scrollHeight, 100, "scrollHeight of #tableCell1");
+
+ is(bcr2.width, 50, "Width of bounding client rect of #tableCell2");
+ is(tableCell2.scrollWidth, 107, "scrollWidth of #tableCell2");
+ is(bcr2.height, 105, "Height of bounding client rect of #tableCell2");
+ is(tableCell2.scrollHeight, 105, "scrollHeight of #tableCell2");
+
+ is(bcr3.width, 50, "Width of bounding client rect of #tableCell3");
+ is(tableCell3.scrollWidth, 108, "scrollWidth of #tableCell3");
+ is(bcr3.height, 110, "Height of bounding client rect of #tableCell3");
+ is(tableCell3.scrollHeight, 110, "scrollHeight of #tableCell3");
+
+ is(bcr4.width, 50, "Width of bounding client rect of #tableCell4");
+ is(tableCell4.scrollWidth, 104, "scrollWidth of #tableCell4");
+ is(bcr4.height, 100, "Height of bounding client rect of #tableCell4");
+ is(tableCell4.scrollHeight, 100, "scrollHeight of #tableCell4");
+
+ is(bcr5.width, 50, "Width of bounding client rect of #tableCell5");
+ is(tableCell5.scrollWidth, 109, "scrollWidth of #tableCell5");
+ is(bcr5.height, 100, "Height of bounding client rect of #tableCell5");
+ is(tableCell5.scrollHeight, 100, "scrollHeight of #tableCell5");
+
+ is(bcr6.width, 50, "Width of bounding client rect of #tableCell6");
+ is(tableCell6.scrollWidth, 100, "scrollWidth of #tableCell6");
+ is(bcr6.height, 100, "Height of bounding client rect of #tableCell6");
+ is(tableCell6.scrollHeight, 100, "scrollHeight of #tableCell6");
+
+ is(bcr7.width, 50, "Width of bounding client rect of #tableCell7");
+ is(tableCell7.scrollWidth, 115, "scrollWidth of #tableCell7");
+ is(bcr7.height, 100, "Height of bounding client rect of #tableCell7");
+ is(tableCell7.scrollHeight, 100, "scrollHeight of #tableCell7");
+
+ is(bcr8.width, 50, "Width of bounding client rect of #tableCell8");
+ is(tableCell8.scrollWidth, 122, "scrollWidth of #tableCell8");
+ is(bcr8.height, 129, "Height of bounding client rect of #tableCell8");
+ is(tableCell8.scrollHeight, 129, "scrollHeight of #tableCell8");
+
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_clientRects.html b/dom/tests/mochitest/general/test_clientRects.html
new file mode 100644
index 0000000000..bcfe1ee909
--- /dev/null
+++ b/dom/tests/mochitest/general/test_clientRects.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML>
+<html id="d9" style="width:800px; height:1000px">
+<head>
+ <title>Tests for getClientRects/getBoundingClientRect</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body style="margin:0" onload="doTest()">
+
+<script>
+function isWithinEps(v1, v2, eps, msg) {
+ if (eps) {
+ ok(Math.abs(v1 - v2) < eps, msg + " (within " + eps + "); got " + v1 + ", expected " + v2);
+ } else {
+ is(v1, v2, msg);
+ }
+}
+function checkRect(clientRect, r, eps, exprMsg, restMsg) {
+ isWithinEps(clientRect.left, r[0], eps, exprMsg + ".left" + restMsg);
+ isWithinEps(clientRect.top, r[1], eps, exprMsg + ".top" + restMsg);
+ isWithinEps(clientRect.right, r[2], eps, exprMsg + ".right" + restMsg);
+ isWithinEps(clientRect.bottom, r[3], eps, exprMsg + ".bottom" + restMsg);
+ isWithinEps(clientRect.width, r[2] - r[0], eps, exprMsg + ".width" + restMsg);
+ isWithinEps(clientRect.height, r[3] - r[1], eps, exprMsg + ".height" + restMsg);
+}
+function doc(id) {
+ return document.getElementById(id).contentDocument;
+}
+function checkElement(id, list, eps, doc) {
+ var e = (doc || document).getElementById(id);
+ var clientRects = e.getClientRects();
+ ok(!(clientRects instanceof e.ownerDocument.defaultView.Array),
+ "getClientRects retval should not have Array.prototype on its proto chain");
+ is(clientRects.length, list.length, "getClientRects().length for element '" + id + "'");
+ var bounds = list.length ? list[0] : [0,0,0,0];
+ for (var i = 0; i < clientRects.length && i < list.length; ++i) {
+ var r = list[i];
+ r[2] += r[0];
+ r[3] += r[1];
+ checkRect(clientRects[i], r, eps, "getClientRects()[" + i + "]", " for element '" + id + "'");
+ if (r[2] != r[0] && r[3] != r[1]) {
+ bounds[0] = Math.min(bounds[0], r[0]);
+ bounds[1] = Math.min(bounds[1], r[1]);
+ bounds[2] = Math.max(bounds[2], r[2]);
+ bounds[3] = Math.max(bounds[3], r[3]);
+ }
+ }
+ checkRect(e.getBoundingClientRect(), bounds, eps, "getBoundingClientRect()", " for element '" + id + "'");
+}
+</script>
+
+<!-- Simple case -->
+<div id="d1" style="position:absolute; left:50px; top:50px; width:20px; height:30px; background:pink;"></div>
+<!-- Multiple boxes -->
+<div style="position:absolute; left:50px; top:100px; width:400px; height:100px; column-count:2; column-gap:0">
+ <div id="d2">
+ <div style="width:200px; height:100px; background:yellow"></div>
+ <div style="width:200px; height:100px; background:lime"></div>
+ </div>
+</div>
+<!-- No boxes -->
+<div id="d3" style="display:none"></div>
+<!-- Element in transform -->
+<div style="-moz-transform:translate(50px, 50px); transform:translate(50px,50px); position:absolute; left:0; top:200px">
+ <div id="d4" style="width:50px; height:50px; background:blue;"></div>
+</div>
+<svg style="position:absolute; left:50px; top:300px; width:100px; height:100px;">
+ <!-- Element in SVG foreignobject -->
+ <foreignObject x="20" y="30" width="40" height="40">
+ <div id="d5" style="width:40px; height:40px; background:pink;"></div>
+ </foreignObject>
+ <!-- SVG Element -->
+ <circle id="s1" cx="60" cy="60" r="10" fill="yellow"/>
+</svg>
+<!-- Element in transform with bounding-box -->
+<div style="-moz-transform:rotate(45deg); transform:rotate(45deg); position:absolute; left:50px; top:450px; width:100px; height:100px;">
+ <div id="d6" style="width:100px; height:100px; background:orange;"></div>
+</div>
+<!-- Element in two transforms; we should combine transforms instead of taking bounding-box twice -->
+<div style="-moz-transform:rotate(45deg); transform:rotate(45deg); position:absolute; left:50px; top:550px; width:100px; height:100px;">
+ <div style="-moz-transform:rotate(-45deg); transform:rotate(-45deg); width:100px; height:100px;">
+ <div id="d7" style="width:100px; height:100px; background:lime;"></div>
+ </div>
+</div>
+<!-- Fixed-pos element -->
+<div id="d8" style="position:fixed; left:50px; top:700px; width:100px; height:100px; background:gray;"></div>
+<!-- Root element; see d9 -->
+<!-- Element in iframe -->
+<iframe id="f1" style="position:absolute; left:300px; top:0; width:100px; height:200px; border:none"
+ srcdoc="<div id='d10' style='position:absolute; left:0; top:25px; width:100px; height:100px; background:cyan'>">
+</iframe>
+<!-- Root element in iframe -->
+<iframe id="f2" style="position:absolute; left:300px; top:250px; width:100px; height:200px; border:none"
+ srcdoc="<html id='d11' style='width:100px; height:100px; background:magenta'>">
+</iframe>
+<!-- Fixed-pos element in iframe -->
+<iframe id="f3" style="position:absolute; left:300px; top:400px; border:none"
+ srcdoc="<div id='d12' style='position:fixed; left:0; top:0; width:100px; height:100px;'>"></iframe>
+
+<script>
+function doTest() {
+ checkElement("d1", [[50,50,20,30]]);
+ checkElement("d2", [[50,100,200,100],[250,100,200,100]]);
+ checkElement("d3", []);
+ checkElement("d4", [[50,250,50,50]]);
+ checkElement("d5", [[70,330,40,40]]);
+ checkElement("s1", [[100,350,20,20]], 0.1);
+ var sqrt2 = Math.sqrt(2);
+ checkElement("d6", [[100 - 50*sqrt2,500 - 50*sqrt2,100*sqrt2,100*sqrt2]], 0.1);
+ checkElement("d7", [[50,550,100,100]]);
+ checkElement("d8", [[50,700,100,100]]);
+ checkElement("d9", [[0,0,800,1000]]);
+ checkElement("d10", [[0,25,100,100]], 0, doc("f1"));
+ checkElement("d11", [[0,0,100,100]], 0, doc("f2"));
+ checkElement("d12", [[0,0,100,100]], 0, doc("f3"));
+ SimpleTest.finish();
+}
+SimpleTest.waitForExplicitFinish();
+</script>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_clipboard_disallowed.html b/dom/tests/mochitest/general/test_clipboard_disallowed.html
new file mode 100644
index 0000000000..ce331ee253
--- /dev/null
+++ b/dom/tests/mochitest/general/test_clipboard_disallowed.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Clipboard Events</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<input id="input" value="INPUT TEXT" oncopy="checkAllowed(event)">
+
+<script>
+function doTest()
+{
+ document.getElementById("input").focus();
+ synthesizeKey("c", {accelKey: 1});
+}
+
+function checkAllowed(event)
+{
+ let clipboardData = event.clipboardData;
+
+ let disallowedTypes = [
+ "application/x-moz-file",
+ "application/x-moz-file-promise",
+ "application/x-moz-file-promise-url",
+ "application/x-moz-file-promise-dest-filename",
+ "application/x-moz-file-promise-dir",
+ "application/x-moz-nativeimage",
+ "text/x-moz-requestmime",
+ "text/x-moz-place",
+ "text/x-moz-place-container",
+ "text/x-moz-some-made-up-type",
+ ];
+
+ for (let type of disallowedTypes) {
+ let exception;
+ try {
+ clipboardData.setData(type, "Test");
+ } catch(ex) {
+ exception = ex;
+ }
+ is(String(exception).indexOf("SecurityError"), 0, "Cannot set " + type);
+ }
+
+ let allowedTypes = [
+ "application/something",
+ "x-moz-/something",
+ "something/ax-moz-",
+ ];
+
+ for (let type of allowedTypes) {
+ let exception = null;
+ try {
+ clipboardData.setData(type, "This is data");
+ } catch(ex) {
+ exception = ex;
+ }
+ is(exception, null, "Can set " + type);
+ }
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(doTest);
+</script>
diff --git a/dom/tests/mochitest/general/test_clipboard_events.html b/dom/tests/mochitest/general/test_clipboard_events.html
new file mode 100644
index 0000000000..aa99010b89
--- /dev/null
+++ b/dom/tests/mochitest/general/test_clipboard_events.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Clipboard Events</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<script>
+"use strict";
+
+// The clipboard event tests require `GlobalEventHandlers.onbeforeinput`
+// attribute which is available only when `beforeinput` event is enabled.
+// For ensuring it's available with any element in the document, we need
+// to enable it in this window and then, create elements in the new
+// document in a child window.
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(async () => {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // NOTE: The tests operate under the assumption that the protected mode of
+ // DataTransfer is enabled.
+ ["dom.events.dataTransfer.protected.enabled", true],
+ ]
+ });
+ let childWindow =
+ window.open("window_clipboard_events.html", "_blank", "width=500,height=800");
+ ok(childWindow, "A child window should've been opened");
+ childWindow.onclose = () => {
+ SimpleTest.finish();
+ };
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_consoleAPI.html b/dom/tests/mochitest/general/test_consoleAPI.html
new file mode 100644
index 0000000000..506fc7f160
--- /dev/null
+++ b/dom/tests/mochitest/general/test_consoleAPI.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>window.console test</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+
+<body id="body">
+
+<script type="application/javascript">
+
+function doTest() {
+ ok(window.console, "console exists");
+
+ try {
+ ok(!console.foo, "random property doesn't throw");
+ } catch (ex) {
+ ok(false, "random property threw: " + ex);
+ }
+
+ var expectedProps = {
+ "log": "function",
+ "info": "function",
+ "warn": "function",
+ "error": "function",
+ "exception": "function",
+ "debug": "function",
+ "trace": "function",
+ "dir": "function",
+ "group": "function",
+ "groupCollapsed": "function",
+ "groupEnd": "function",
+ "time": "function",
+ "timeLog": "function",
+ "timeEnd": "function",
+ "profile": "function",
+ "profileEnd": "function",
+ "assert": "function",
+ "count": "function",
+ "countReset": "function",
+ "table": "function",
+ "clear": "function",
+ "dirxml": "function",
+ "timeStamp": "function",
+ };
+
+ var foundProps = 0;
+ for (var prop in console) {
+ foundProps++;
+ is(typeof(console[prop]), expectedProps[prop], "expect console prop " + prop + " exists");
+ }
+ is(foundProps, Object.keys(expectedProps).length, "found correct number of properties");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(doTest);
+
+</script>
+
+<p id="display"></p>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_contentViewer_overrideDPPX.html b/dom/tests/mochitest/general/test_contentViewer_overrideDPPX.html
new file mode 100644
index 0000000000..af3f46b81b
--- /dev/null
+++ b/dom/tests/mochitest/general/test_contentViewer_overrideDPPX.html
@@ -0,0 +1,428 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIContentViewer::overrideDPPX test</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+
+<body>
+
+<iframe></iframe>
+<img>
+
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+const frameWindow = document.querySelector("iframe").contentWindow;
+const image = document.querySelector("img");
+
+const originalDPR = window.devicePixelRatio;
+const originalZoom = SpecialPowers.getFullZoom(window);
+const dppx = originalDPR * 1.5;
+const zoom = originalZoom * 0.5;
+
+const imageSets = {
+ "1x" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA" +
+ "GUlEQVQ4jWP4z8DwnxLMMGrAqAGjBgwXAwAwxP4QWURl4wAAAABJRU5ErkJggg==",
+ "1.5x": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA" +
+ "GElEQVQ4jWNgaGD4TxEeNWDUgFEDhosBAOsIfxAZ/CYXAAAAAElFTkSuQmCC",
+ "2x" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA" +
+ "GElEQVQ4jWNgYPj/nzI8asCoAaMGDBMDADKm/hBZaHKGAAAAAElFTkSuQmCC",
+ "8x" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA" +
+ "GklEQVQ4jWP4f+D0f0oww6gBowaMGjBcDAAAskKJLhIvZvgAAAAASUVORK5CYII=",
+};
+
+const setOverrideDPPX = (value) => {
+ if (value > 0) {
+ info(`override window's dppx to ${value}`);
+ } else {
+ info(`restore window's dppx to default value`);
+ }
+
+ return SpecialPowers.spawnChrome([value], dppx => {
+ browsingContext.top.overrideDPPX = dppx;
+ });
+};
+
+const setFullZoom = (value) => {
+ info(`set window's fullZoom to ${value}`);
+ SpecialPowers.setFullZoom(window, value);
+}
+
+const createFontStyleForDPPX = (doc, value, size) => {
+ info(`adding a stylesheet that set font size to ${size}px for ${value}dppx`);
+
+ let style = doc.createElement("style");
+
+ style.setAttribute("media", `(resolution: ${value}dppx)`);
+
+ doc.head.appendChild(style);
+
+ style.sheet.insertRule(`body {font-size: ${size}px}`, 0);
+
+ return style;
+}
+
+const getBodyFontSize = (w) => w.getComputedStyle(w.document.body).fontSize;
+
+const assertValuesAreInitial = () => {
+ is(window.devicePixelRatio, originalDPR,
+ "devicePixelRatio has the original value.");
+ is(SpecialPowers.getFullZoom(window), originalZoom,
+ "fullZoom has the original value.");
+
+ is(frameWindow.devicePixelRatio, originalDPR,
+ "devicePixelRatio has the original value.");
+ is(SpecialPowers.getFullZoom(frameWindow), originalZoom,
+ "fullZoom has the original value.");
+}
+
+const waitForMediaQueryListEvent = (mediaQueryList) => {
+ return new Promise(resolve => {
+ mediaQueryList.addListener(function listener() {
+ ok(true, "MediaQueryList's listener invoked for " + mediaQueryList.media);
+ mediaQueryList.removeListener(listener);
+ // We need to evacuate a media query list event to avoid changing any
+ // media features inside this callback (and microtasks for the callbacks),
+ // because we currently dispatch media query list events during flush
+ // pending styles, and we want to make sure there is no pending media
+ // feature changes after the event handling.
+ // This workaround should be dropped in bug 1437688.
+ setTimeout(resolve, 0);
+ });
+ });
+}
+
+const gTests = {
+ "test overrideDPPX with devicePixelRatio": async (done) => {
+ assertValuesAreInitial();
+
+ await setOverrideDPPX(dppx);
+
+ is(window.devicePixelRatio, dppx,
+ "devicePixelRatio overridden.");
+ is(frameWindow.devicePixelRatio, dppx,
+ "frame's devicePixelRatio overridden.");
+
+ await setOverrideDPPX(0);
+
+ is(window.devicePixelRatio, originalDPR,
+ "devicePixelRatio back to default.");
+ is(frameWindow.devicePixelRatio, originalDPR,
+ "frame's devicePixelRatio back to default.");
+
+ done();
+ },
+ "test overrideDPPX with devicePixelRatio and fullZoom": async (done) => {
+ assertValuesAreInitial();
+
+ setFullZoom(zoom);
+ await setOverrideDPPX(dppx);
+
+ is(window.devicePixelRatio, dppx,
+ "devicePixelRatio overridden; fullZoom ignored");
+ is(SpecialPowers.wrap(window).devicePixelRatio, originalDPR * zoom,
+ "devicePixelRatio is right for privileged code");
+ is(frameWindow.devicePixelRatio, dppx,
+ "frame's devicePixelRatio overridden; fullZoom ignored");
+ is(SpecialPowers.wrap(frameWindow).devicePixelRatio, originalDPR * zoom,
+ "frame's devicePixelRatio is right for privileged code");
+
+ await setOverrideDPPX(0);
+
+ is(window.devicePixelRatio, originalDPR * zoom,
+ "devicePixelRatio now is affected by fullZoom");
+ is(frameWindow.devicePixelRatio, originalDPR * zoom,
+ "frame's devicePixelRatio now is affected by fullZoom");
+ isnot(dppx, originalDPR * zoom,
+ "test is no longer testing what it should be");
+
+ setFullZoom(originalZoom);
+
+ is(window.devicePixelRatio, originalDPR,
+ "devicePixelRatio back to default.");
+ is(frameWindow.devicePixelRatio, originalDPR,
+ "frame's devicePixelRatio back to default.");
+
+ done();
+
+ },
+ "test overrideDPPX with media queries": async (done) => {
+ assertValuesAreInitial();
+
+ let frameDoc = frameWindow.document;
+
+ let originalFontSize = getBodyFontSize(window);
+ let frameOriginalFontSize = getBodyFontSize(frameWindow);
+
+ let style = createFontStyleForDPPX(document, dppx, "32");
+ let frameStyle = createFontStyleForDPPX(frameDoc, dppx, "32");
+
+ let currentFontSize = getBodyFontSize(window);
+ let frameCurrentFontSize = getBodyFontSize(frameWindow);
+
+ is(currentFontSize, originalFontSize,
+ "media queries are not applied yet");
+ is(frameCurrentFontSize, frameOriginalFontSize,
+ "frame's media queries are not applied yet");
+
+ await setOverrideDPPX(dppx);
+
+ currentFontSize = getBodyFontSize(window);
+ frameCurrentFontSize = getBodyFontSize(frameWindow);
+
+ isnot(currentFontSize, originalFontSize,
+ "media queries are applied.");
+ isnot(frameCurrentFontSize, frameOriginalFontSize,
+ "frame's media queries are applied.");
+
+ is(currentFontSize, "32px",
+ "font size has the expected value.");
+ is(frameCurrentFontSize, "32px",
+ "frame's font size has the expected value.");
+
+ await setOverrideDPPX(0);
+
+ currentFontSize = getBodyFontSize(window);
+ frameCurrentFontSize = getBodyFontSize(frameWindow);
+
+ is(currentFontSize, originalFontSize,
+ "media queries are not applied anymore.");
+ is(frameCurrentFontSize, frameOriginalFontSize,
+ "media queries are not applied anymore.");
+
+ style.remove();
+ frameStyle.remove();
+
+ done();
+ },
+ "test overrideDPPX with media queries and fullZoom": async (done) => {
+ assertValuesAreInitial();
+
+ let frameDoc = frameWindow.document;
+
+ let styles = [
+ createFontStyleForDPPX(document, originalDPR, "23"),
+ createFontStyleForDPPX(document, dppx, "32"),
+ createFontStyleForDPPX(document, originalDPR * zoom, "48"),
+ createFontStyleForDPPX(frameDoc, originalDPR, "23"),
+ createFontStyleForDPPX(frameDoc, dppx, "32"),
+ createFontStyleForDPPX(frameDoc, originalDPR * zoom, "48")
+ ];
+
+ let currentFontSize = getBodyFontSize(window);
+ let frameCurrentFontSize = getBodyFontSize(frameWindow);
+ is(currentFontSize, "23px",
+ "media queries are not applied yet");
+ is(frameCurrentFontSize, "23px",
+ "frame's media queries are not applied yet");
+
+ setFullZoom(zoom);
+ await setOverrideDPPX(dppx);
+
+ currentFontSize = getBodyFontSize(window);
+ frameCurrentFontSize = getBodyFontSize(frameWindow);
+ is(currentFontSize, "32px",
+ "media queries are applied for overridden DDPX; fullZoom ignored.");
+ is(frameCurrentFontSize, "32px",
+ "frame's media queries are applied for overridden DDPX; fullZoom ignored.");
+
+ await setOverrideDPPX(0);
+
+ currentFontSize = getBodyFontSize(window);
+ frameCurrentFontSize = getBodyFontSize(frameWindow);
+ is(currentFontSize, "48px",
+ "media queries are applied for fullZoom.");
+ is(frameCurrentFontSize, "48px",
+ "frame's media queries are applied for fullZoom.");
+
+ setFullZoom(originalZoom);
+
+ currentFontSize = getBodyFontSize(window);
+ frameCurrentFontSize = getBodyFontSize(frameWindow);
+ is(currentFontSize, "23px",
+ "media queries are not applied anymore.");
+ is(frameCurrentFontSize, "23px",
+ "frame's media queries are not applied anymore.");
+
+ styles.forEach(style => style.remove());
+
+ done();
+ },
+ "test OverrideDPPX with MediaQueryList": (done) => {
+ assertValuesAreInitial();
+
+ let promises = [
+ waitForMediaQueryListEvent(
+ window.matchMedia(`(resolution: ${dppx}dppx)`)),
+ waitForMediaQueryListEvent(
+ frameWindow.matchMedia(`(resolution: ${dppx}dppx)`)),
+ ];
+
+ Promise.all(promises)
+ .then(() => setOverrideDPPX(0))
+ .then(done, e => {throw e});
+
+ setOverrideDPPX(dppx);
+ },
+ "test OverrideDPPX with MediaQueryList and fullZoom": async (done) => {
+ assertValuesAreInitial();
+
+ let promises = [
+ waitForMediaQueryListEvent(
+ window.matchMedia(`(resolution: ${dppx}dppx)`)),
+ waitForMediaQueryListEvent(
+ window.matchMedia(`(resolution: ${originalDPR * zoom}dppx)`)),
+ ];
+
+ await setOverrideDPPX(dppx);
+ setFullZoom(zoom);
+
+ promises[0]
+ .then(() => setOverrideDPPX(0))
+ .then(promises[1])
+ .then(() => setFullZoom(originalZoom))
+ .then(done, e => {throw e});
+ },
+ "test OverrideDPPX is kept on document navigation": async (done) => {
+ assertValuesAreInitial();
+
+ let frameOriginalFontSize = getBodyFontSize(frameWindow);
+ let frameStyle = createFontStyleForDPPX(frameWindow.document, dppx, "32");
+ let frameCurrentFontSize = getBodyFontSize(frameWindow);
+
+ is(frameCurrentFontSize, frameOriginalFontSize,
+ "frame's media queries are not applied yet");
+
+ await setOverrideDPPX(dppx);
+
+ frameCurrentFontSize = getBodyFontSize(frameWindow);
+
+ is(frameWindow.devicePixelRatio, dppx,
+ "frame's devicePixelRatio overridden.");
+ isnot(frameCurrentFontSize, frameOriginalFontSize,
+ "frame's media queries are applied.");
+ is(frameCurrentFontSize, "32px",
+ "frame's font size has the expected value.");
+
+ frameWindow.frameElement.addEventListener("load", async function() {
+ frameStyle = createFontStyleForDPPX(frameWindow.document, dppx, "32");
+
+ frameCurrentFontSize = getBodyFontSize(frameWindow);
+
+ is(frameWindow.devicePixelRatio, dppx,
+ "frame's devicePixelRatio is still overridden.");
+ isnot(frameCurrentFontSize, frameOriginalFontSize,
+ "frame's media queries are still applied.");
+ is(frameCurrentFontSize, "32px",
+ "frame's font size has still the expected value.");
+
+ frameStyle.remove();
+
+ await setOverrideDPPX(0);
+
+ done();
+ }, {once: true});
+
+ frameWindow.location.reload(true);
+ },
+
+ "test overrideDPPX with srcset": async function (done) {
+ assertValuesAreInitial();
+
+ let loaded;
+
+ // Set the image srcset and default src. This is delayed until this test so
+ // that dppx overrides in other test blocks don't trigger load event on the
+ // image.
+ loaded = new Promise(resolve => image.onload = resolve);
+ image.srcset = Object.entries(imageSets).map(v => v[1] + " " + v[0]).join(", ");
+ image.src = imageSets["1x"];
+ await loaded;
+
+ let originalSrc = image.currentSrc;
+
+ // Make sure to test some very large value that can't be the default density
+ // so that the first override will always trigger a load.
+ isnot(originalDPR, 8, "originalDPR differs from final test value");
+ loaded = new Promise(resolve => image.onload = resolve);
+ await setOverrideDPPX(8);
+ await loaded;
+
+ is(image.currentSrc, imageSets["8x"],
+ "Image is properly set for 8dppx.");
+
+ loaded = new Promise(resolve => image.onload = resolve);
+ await setOverrideDPPX(1);
+ await loaded;
+
+ is(image.currentSrc, imageSets["1x"],
+ "Image url is properly set for 1dppx.");
+
+ loaded = new Promise(resolve => image.onload = resolve);
+ await setOverrideDPPX(1.5);
+ await loaded;
+
+ is(image.currentSrc, imageSets["1.5x"],
+ "Image url is properly set for 1.5dppx.");
+
+ loaded = new Promise(resolve => image.onload = resolve);
+ await setOverrideDPPX(2);
+ await loaded;
+
+ is(image.currentSrc, imageSets["2x"],
+ "Image is properly set for 2dppx.");
+
+ // Make sure to test some very large value that can't be the default density
+ // so that resetting to the default will always trigger a load.
+ isnot(originalDPR, 8, "originalDPR differs from final test value");
+ loaded = new Promise(resolve => image.onload = resolve);
+ await setOverrideDPPX(8);
+ await loaded;
+
+ is(image.currentSrc, imageSets["8x"],
+ "Image is properly set for 8dppx.");
+
+ loaded = new Promise(resolve => image.onload = resolve);
+ await setOverrideDPPX(0);
+ await loaded;
+
+ is(image.currentSrc, originalSrc,
+ "Image is properly restored to the default value.");
+
+ // Clear sources so any future dppx test blocks don't trigger image loads.
+ image.srcset = "";
+ image.src = "";
+
+ done();
+ }
+};
+
+function* runner(tests) {
+ for (let name of Object.keys(tests)) {
+ info(name);
+ tests[name](next);
+ yield undefined;
+ }
+};
+
+const gTestRunner = runner(gTests);
+
+function next() {
+ SimpleTest.executeSoon(function() {
+ if (gTestRunner.next().done) {
+ SimpleTest.finish();
+ }
+ });
+}
+
+// Run the tests
+addLoadEvent(next);
+
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_devicePixelRatio_with_zoom.html b/dom/tests/mochitest/general/test_devicePixelRatio_with_zoom.html
new file mode 100644
index 0000000000..710af8fe43
--- /dev/null
+++ b/dom/tests/mochitest/general/test_devicePixelRatio_with_zoom.html
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>DevicePixelRatios with Zoom</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+
+<body>
+
+<div>Testing devicePixelRatio with different zoom levels</div>
+
+<script type="application/javascript">
+
+// We're creating a table of zooms and expected devicePixelRatio (DPR) strings.
+// The values in the table are specific to the "native" DPR at zoom level 100%.
+// If we don't have a table for a native DPR value, we'll trivially report
+// a successful test with a note that we didn't have a table.
+// For the moment, we only have a table for native DPR of 2.
+let zoomsAndDPRsToTest;
+
+const originalZoom = SpecialPowers.getFullZoom(window);
+const zoom = 1;
+SpecialPowers.setFullZoom(window, zoom);
+
+const dprAtZoom1 = window.devicePixelRatio;
+if (dprAtZoom1 == 1) {
+ zoomsAndDPRsToTest = [
+ [300, "3"],
+ [250, "2.5"],
+ [200, "2"],
+ [167, "1.6666666666666667"],
+ [150, "1.5"],
+ [133, "1.3333333333333333"],
+ [120, "1.2"],
+ [110, "1.0909090909090908"],
+ [100, "1"],
+ [90, "0.8955223880597015"],
+ [80, "0.8"],
+ [67, "0.6666666666666666"],
+ [50, "0.5"],
+ ];
+} else if (dprAtZoom1 == 2) {
+ zoomsAndDPRsToTest = [
+ [300, "6"],
+ [250, "5"],
+ [200, "4"],
+ [167, "3.3333333333333335"],
+ [150, "3"],
+ [133, "2.608695652173913"], // there's a trailing 0 here unreported by JS
+ [120, "2.4"],
+ [110, "2.2222222222222223"],
+ [100, "2"],
+ [90, "1.8181818181818181"],
+ [80, "1.5789473684210527"],
+ [67, "1.3333333333333333"],
+ [50, "1"],
+ ];
+}
+
+if (!zoomsAndDPRsToTest.length) {
+ // Need to run at least one test function to keep mochitest harness happy.
+ ok(true, `No table of data for devicePixelRatio of ${dprAtZoom1} at zoom level 100%.`);
+}
+
+for (let i = 0; i < zoomsAndDPRsToTest.length; ++i) {
+ let data = zoomsAndDPRsToTest[i];
+ let zoomPercent = data[0];
+ let targetDPR = data[1];
+
+ let relativeZoom = zoom * zoomPercent / 100;
+ SpecialPowers.setFullZoom(window, relativeZoom);
+
+ // Force conversion to string for string comparison to targetDPR.
+ let actualDPR = window.devicePixelRatio + "";
+ is(actualDPR, targetDPR, `At ${zoomPercent}% zoom, window.devicePixelRatio is rounded correctly.`);
+}
+
+// Reset the zoom when the test is done.
+SpecialPowers.setFullZoom(window, originalZoom);
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_domWindowUtils.html b/dom/tests/mochitest/general/test_domWindowUtils.html
new file mode 100644
index 0000000000..2b0bcc9086
--- /dev/null
+++ b/dom/tests/mochitest/general/test_domWindowUtils.html
@@ -0,0 +1,183 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test nsIDOMWindowUtils</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+ <style>
+ html, body, div {
+ padding: 0;
+ margin: 0;
+ }
+
+ div.test {
+ position: absolute;
+ height: 10px;
+ width: 10px;
+ }
+ </style>
+</head>
+
+<body id="body">
+
+<div class="test" id="onscreen" style="top: 100px; background-color: red;"></div>
+<div class="test" id="offscreen" style="top: 100000px; background-color: green;"></div>
+
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
+
+var gTests = [
+/*
+ Element elementFromPoint(in long aX,
+ in long aY,
+ in boolean aIgnoreRootScrollFrame,
+ in boolean aFlushLayout);
+*/
+async function testElementFromPoint() {
+ let onscreen = document.getElementById("onscreen");
+ let offscreen = document.getElementById("offscreen");
+ let htmldoc = document.documentElement;
+ ok(onscreen, "on screen element exists");
+ ok(offscreen, "off screen element exists");
+ ok(htmldoc, "htmldoc element exists");
+
+ let testData = [
+ // default behavior is to return null for items outside the viewport
+ [[0, 100], null, onscreen],
+ [[9, 109], null, onscreen],
+ [[0, 100000], null, null],
+ [[9, 100009], null, null],
+
+ // ignore scroll frame
+ [[0, 100, true, false], null, onscreen],
+ [[9, 109, true, false], null, onscreen],
+ [[0, 100000, true, false], null, offscreen],
+ [[9, 100009, true, false], null, offscreen],
+
+ // layout flush tests
+ // test moving element 10px to the left and down, and flushing layout
+ [[10, 110, false, true], [[10, 110], onscreen], onscreen],
+ // test moving element back, not flushing layout
+ // (will get the html document instead)
+ [[0, 100, false, false], [[0, 100], onscreen], htmldoc],
+ // test element at same position, flushing layout
+ [[0, 100, false, true], [[0, 100], onscreen], onscreen],
+
+ // same tests repeated for offscreen element
+ [[10, 100010, true, true], [[10, 100010], offscreen], offscreen],
+ [[0, 100000, true, false], [[0, 100000], offscreen], htmldoc],
+ [[0, 100000, true, true], [[0, 100000], offscreen], offscreen],
+ ];
+
+ for (let i = 0; i < testData.length; ++i) {
+ let [x, y, ignoreScroll, flushLayout] = testData[i][0];
+ let moveData = testData[i][1];
+ let expected = testData[i][2];
+
+ if (moveData) {
+ let moveEl = moveData[1];
+ let [moveX, moveY] = moveData[0];
+
+ moveEl.style.left = moveX + "px";
+ moveEl.style.top = moveY + "px";
+ }
+ let found = SpecialPowers.unwrap(domWindowUtils.elementFromPoint(
+ x, y, ignoreScroll, flushLayout));
+ is(found, expected, "at index " + i + " for data " + JSON.stringify(testData[i][0]));
+ }
+},
+
+/**
+ * Test .isHandlingUserInput attribute.
+ */
+async function testHandlingUserInput() {
+ ok('isHandlingUserInput' in domWindowUtils,
+ "isHandlingUserInput should be present");
+
+ is(domWindowUtils.isHandlingUserInput, false,
+ "isHandlingUserInput should return false if nothing is happening");
+
+ var data = [
+ {
+ eventName: "click",
+ result: true,
+ },
+ {
+ eventName: "auxclick",
+ button: 1,
+ result: true,
+ },
+ {
+ eventName: "mousemove",
+ result: false,
+ },
+ {
+ eventName: "mouseup",
+ result: true,
+ },
+ {
+ eventName: "mousedown",
+ result: true,
+ },
+ {
+ eventName: "keydown",
+ result: true,
+ },
+ {
+ eventName: "keyup",
+ result: true,
+ },
+ ];
+
+ for (const {eventName, result, button} of data) {
+ let eventPromise = new Promise(resolve => {
+ document.addEventListener(eventName, function() {
+ is(domWindowUtils.isHandlingUserInput, result,
+ `isHandlingUserInput should be ${result} for ${eventName}`);
+
+ SimpleTest.executeSoon(resolve);
+ }, {once: true});
+ });
+
+ SimpleTest.executeSoon(function() {
+ if (eventName == "click") {
+ synthesizeMouseAtCenter(document.body, {});
+ } else if (eventName == "auxclick" && button) {
+ synthesizeMouseAtCenter(document.body, { button });
+ } else if (eventName.startsWith("key")) {
+ synthesizeKey("VK_A", { type: eventName });
+ } else {
+ synthesizeMouseAtCenter(document.body, { type: eventName });
+ }
+ });
+
+ await eventPromise;
+ }
+},
+];
+
+async function runner() {
+ for (let i=0; i<gTests.length; ++i) {
+ if (i > 0) {
+ await new Promise(r => SimpleTest.executeSoon(r));
+ }
+ await gTests[i]();
+ }
+
+ SimpleTest.finish();
+};
+
+// Run the test from onload, since the onscreen and offscreen divs should be in
+// the right places by then.
+addLoadEvent(runner);
+
+</script>
+
+<p id="display"></p>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_domWindowUtils_scrollXY.html b/dom/tests/mochitest/general/test_domWindowUtils_scrollXY.html
new file mode 100644
index 0000000000..6bf29f46e4
--- /dev/null
+++ b/dom/tests/mochitest/general/test_domWindowUtils_scrollXY.html
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIDOMWindowUtils::elementFromPoint test</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+ <style>
+ body {
+ /* Make room for scrolling */
+ }
+ </style>
+</head>
+
+<body id="body">
+ <script type="application/javascript">
+ /*
+ void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);
+ */
+ function doTests() {
+ testScrollXY();
+ testHiddenIframe();
+
+ SimpleTest.finish();
+ }
+
+ function testScrollXY() {
+ let iframe = document.getElementById("iframe");
+ let cwindow = iframe.contentWindow;
+ let domWindowUtils = SpecialPowers.getDOMWindowUtils(cwindow);
+
+ function checkGetScrollXYState(flush, vals, testName) {
+ let scrollX = {}, scrollY = {};
+ domWindowUtils.getScrollXY(flush, scrollX, scrollY);
+ is(Math.round(scrollX.value), vals[0], "getScrollXY x for test: " + testName);
+ is(Math.round(scrollY.value), vals[1], "getScrollXY y for test: " + testName);
+ }
+
+ function checkWindowScrollState(vals, testName) {
+ is(Math.round(cwindow.scrollX), vals[0], "scrollX for test: " + testName);
+ is(Math.round(cwindow.scrollY), vals[1], "scrollY for test: " + testName);
+ }
+
+ // Check initial state (0, 0)
+ checkGetScrollXYState(false, [0, 0], "initial getScrollXY state");
+ checkGetScrollXYState(true, [0, 0], "initial getScrollXY state+flush");
+ checkWindowScrollState([0, 0], "initial window.scroll* state");
+
+ // scroll
+ cwindow.scrollTo(900, 1000);
+ checkGetScrollXYState(false, [900, 1000], "after scroll getScrollXY state");
+ checkGetScrollXYState(true, [900, 1000], "after scroll getScrollXY state+flush");
+ checkWindowScrollState([900, 1000], "after scroll window.scroll* state");
+
+ // ensure flush=false works
+ cwindow.document.body.style.width = 'auto';
+ cwindow.document.body.style.height = 'auto';
+ checkGetScrollXYState(false, [900, 1000], "didn't flush layout for getScrollXY");
+ checkGetScrollXYState(true, [0, 0], "flushed layout for getScrollXY");
+ }
+
+ function testHiddenIframe() {
+ let iframe = document.getElementById("hidden-iframe");
+ let cwindow = iframe.contentWindow;
+ let domWindowUtils = SpecialPowers.getDOMWindowUtils(cwindow);
+
+ // make sure getScrollXY doesn't throw
+ let scrollX = {}, scrollY = {};
+ domWindowUtils.getScrollXY(false, scrollX, scrollY);
+
+ is(Math.round(scrollX.value), 0, "scrollX is zero for display:none iframe");
+ is(Math.round(scrollY.value), 0, "scrollY is zero for display:none iframe");
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ </script>
+
+ <!-- can't run this in the test document, since it potentially runs in a
+ scrolling="no" test harness iframe, and that causes a failure for some
+ reason -->
+ <iframe srcdoc="<body style='width: 100000px; height: 100000px;'><p>top</p></body>"
+ id="iframe"
+ onload="doTests();">
+ </iframe>
+
+ <iframe id="hidden-iframe" style="display: none;"></iframe>
+
+ <p id="display"></p>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html b/dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html
new file mode 100644
index 0000000000..2822a5d93c
--- /dev/null
+++ b/dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIDOMWindowUtils::getScrollbarSize test</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+
+<body id="body">
+ <script type="application/javascript">
+ function doTests() {
+ let iframe = document.getElementById("iframe");
+ let cwindow = iframe.contentWindow;
+ let utils = SpecialPowers.getDOMWindowUtils(cwindow);
+ let doc = cwindow.document;
+
+ function haveNonFloatingScrollbars() {
+ return doc.getElementById("float").offsetWidth > 200;
+ }
+
+ checkScrollbarSizeFlush(utils, (w, h) => w == 0 && h == 0,
+ "[overflow=hidden] corrrect scrollbar size after flushing");
+
+ // Some platforms (esp. mobile) may have floating scrollbars that don't
+ // affect layout. Thus getScrollbarSize() would always return zeros.
+ if (haveNonFloatingScrollbars()) {
+ let body = doc.querySelector("body");
+ body.style.overflowY = "scroll";
+
+ checkScrollbarSize(utils, (w, h) => w == 0 && h == 0,
+ "[overflowY=scroll] correct scrollbar size w/o flushing");
+
+ checkScrollbarSizeFlush(utils, (w, h) => w > 0 && h == 0,
+ "[overflowY=scroll] correct scrollbar size after flushing");
+
+ body.style.overflowX = "scroll";
+ checkScrollbarSize(utils, (w, h) => w > 0 && h == 0,
+ "[overflowXY=scroll] correct scrollbar size w/o flushing");
+
+ checkScrollbarSizeFlush(utils, (w, h) => w > 0 && h > 0,
+ "[overflowXY=scroll] correct scrollbar size after flushing");
+ }
+
+ SimpleTest.finish();
+ }
+
+ function checkScrollbarSize(utils, check, msg, flush = false) {
+ let width = {}, height = {};
+ utils.getScrollbarSize(flush, width, height);
+ ok(check(width.value, height.value), msg);
+ }
+
+ function checkScrollbarSizeFlush(utils, check, msg) {
+ checkScrollbarSize(utils, check, msg, true);
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ </script>
+
+ <iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/general/file_domWindowUtils_scrollbarSize.html"
+ id="iframe" onload="doTests();">
+ </iframe>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_donottrack.html b/dom/tests/mochitest/general/test_donottrack.html
new file mode 100644
index 0000000000..84bd383a1d
--- /dev/null
+++ b/dom/tests/mochitest/general/test_donottrack.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=629535
+-->
+<head>
+ <title>Test for Bug 629535</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=629535">Mozilla Bug 629535</a>
+
+<script type="application/javascript">
+
+const dntPref = 'privacy.donottrackheader.enabled';
+
+SimpleTest.waitForExplicitFinish();
+
+var currentTestIdx = -1;
+var tests = [];
+function nextTest() {
+ currentTestIdx++;
+ if (currentTestIdx >= tests.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ tests[currentTestIdx]();
+}
+
+tests.push(function testDefaultValues() {
+ // The default pref values depend on the OS it seems.
+ var isAndroid = !!navigator.userAgent.includes("Android");
+ var isB2G = !isAndroid && /Mobile|Tablet/.test(navigator.userAgent);
+
+ is(SpecialPowers.getBoolPref(dntPref), false,
+ 'DNT should be disabled by default');
+ is(navigator.doNotTrack, 'unspecified',
+ 'navigator.doNotTrack should initially be "unspecified".');
+
+ nextTest();
+});
+
+tests.push(function clearedEnabled() {
+ SpecialPowers.pushPrefEnv({"clear": [[dntPref]]}, function() {
+ is(navigator.doNotTrack, "unspecified", 'after clearing pref');
+ nextTest();
+ });
+});
+
+tests.push(function setEnabled() {
+ SpecialPowers.pushPrefEnv({"set": [[dntPref, true]]}, function() {
+ is(navigator.doNotTrack, "1", 'after setting pref to true');
+ nextTest();
+ });
+});
+
+tests.push(function setDisabled() {
+ SpecialPowers.pushPrefEnv({"set": [[dntPref, false]]}, function() {
+ is(navigator.doNotTrack, "unspecified", 'after setting pref to false');
+ nextTest();
+ });
+});
+
+nextTest();
+
+</script>
+
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/general/test_focus_legend_noparent.html b/dom/tests/mochitest/general/test_focus_legend_noparent.html
new file mode 100644
index 0000000000..99bc9d9f22
--- /dev/null
+++ b/dom/tests/mochitest/general/test_focus_legend_noparent.html
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+SimpleTest.requestFlakyTimeout("untriaged");
+
+function runTest()
+{
+ window.focus();
+ var g = document.createElementNS("http://www.w3.org/1999/xhtml", "legend");
+ document.body.appendChild(g);
+ setTimeout(g.focus.bind(g), 0);
+ setTimeout(done, 10);
+}
+
+function done()
+{
+ ok(document.hasFocus(), "document is still focused");
+ is(document.activeElement, document.body, "document has no focused element")
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForFocus(runTest);
+</script>
+</head>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+
+<body onblur="dump('blurred window!\n')"></body>
+</html>
diff --git a/dom/tests/mochitest/general/test_focus_scrollchildframe.html b/dom/tests/mochitest/general/test_focus_scrollchildframe.html
new file mode 100644
index 0000000000..91688a13a7
--- /dev/null
+++ b/dom/tests/mochitest/general/test_focus_scrollchildframe.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Tests for for-of loops</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body onload="doTest()">
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<script>
+function doTest() {
+ document.getElementById("button").focus();
+ is(window.scrollY, 0, "Scrolled position initially 0");
+ synthesizeKey("KEY_Tab"),
+ ok(window.scrollY > 200, "Scrolled child frame into view");
+ SimpleTest.finish();
+}
+SimpleTest.waitForExplicitFinish();
+</script>
+<button id="button">B</button><br><iframe style="margin-top:10000px;height:400px"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_focusrings.xhtml b/dom/tests/mochitest/general/test_focusrings.xhtml
new file mode 100644
index 0000000000..38882ad99c
--- /dev/null
+++ b/dom/tests/mochitest/general/test_focusrings.xhtml
@@ -0,0 +1,217 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+<script src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
+
+<html:style xmlns:html="http://www.w3.org/1999/xhtml" type="text/css">
+* { outline: none; }
+#b3:focus-visible { outline: auto }
+#l1:focus-visible, #l3:focus-visible, #b1:focus-visible { outline: 2px solid red; }
+#l2:focus, #b2:focus { outline: 2px solid red; }
+</html:style>
+
+<script>
+<![CDATA[
+
+SimpleTest.waitForExplicitFinish();
+
+const kIsMac = navigator.platform.includes("Mac");
+
+function snapShot(element) {
+ var rect = element.getBoundingClientRect();
+ adjustedRect = { left: rect.left - 6, top: rect.top - 6,
+ width: rect.width + 12, height: rect.height + 12 }
+ return SpecialPowers.snapshotRect(window, adjustedRect, "transparent");
+}
+
+async function initTest() {
+ if (kIsMac) {
+ // FIXME: Historically this pref was only respected on mac,
+ // and the test uses that assumption.
+ //
+ // Ideally it should be refactored to test with the different
+ // values of the pref, independently of the platform.
+ await SpecialPowers.pushPrefEnv({
+ "set": [
+ ['accessibility.mouse_focuses_formcontrol', 0],
+ ]
+ });
+ }
+
+ runTest();
+}
+
+function runTest()
+{
+ var isWinOrLinux = navigator.platform.includes("Win") || navigator.platform.includes("Linux");
+
+ function checkFocus(element, visible, testid)
+ {
+ var outline = getComputedStyle(element, "").outlineWidth;
+ is(outline, visible ? "2px" : "0px", testid);
+ }
+
+ // make sure that a focus ring appears on the focused button
+ if (kIsMac) {
+ var focusedButton = $("b3");
+ const retBefore = compareSnapshots(snapShot(focusedButton), snapShot($("b2")), true);
+ ok(retBefore[0], `unfocused shows no ring,\nRESULT:\n${retBefore[1]}, \nREFERENCE:\n${retBefore[2]}`);
+ focusedButton.focus();
+ const retAfter = compareSnapshots(snapShot(focusedButton), snapShot($("b2")), false);
+ ok(retAfter[0], `focus shows ring,\nRESULT:\n${retAfter[1]}, \nREFERENCE:\n${retAfter[2]}`);
+ }
+
+ checkFocus($("l1"), false, "initial appearance");
+
+ // we can't really test the situation on Windows where a dialog doesn't show
+ // focus rings until a key is pressed, as the default state depends on what
+ // kind of real user input, mouse or key, was last entered. But we can handle
+ // the test regardless of which user input last occurred.
+ $("l1").focus();
+ var expectedVisible = (!isWinOrLinux || getComputedStyle($("l1"), "").outlineWidth == "2px");
+ testHTMLElements(htmlElements, isWinOrLinux && !expectedVisible);
+
+ $("l1").focus();
+ checkFocus($("l1"), expectedVisible, "appearance on list after focus() with :moz-focusring");
+ $("l2").focus();
+
+ checkFocus($("l2"), true, "appearance on list after focus() with :focus");
+
+ is(getComputedStyle($("l1"), "").outlineWidth, "0px", "appearance on previous list after focus() with :focus");
+
+ synthesizeMouse($("l1"), 4, 4, { });
+ checkFocus($("l1"), false, "appearance on list after mouse focus with :moz-focusring");
+ synthesizeMouse($("l2"), 4, 4, { });
+ checkFocus($("l2"), true, "appearance on list after mouse focus with :focus");
+
+ synthesizeMouse($("b1"), 4, 4, { });
+ checkFocus($("b1"), false, "appearance on button after mouse focus with :moz-focusring");
+
+ synthesizeMouse($("b2"), 4, 4, { });
+ checkFocus($("b2"), !kIsMac, "appearance on button after mouse focus with :focus");
+
+ // after a key is pressed, the focus ring will always be visible
+ $("l2").focus();
+ synthesizeKey("KEY_Tab");
+ checkFocus($("l3"), true, "appearance on list after tab focus");
+
+ if (kIsMac) {
+ SpecialPowers.pushPrefEnv({"set": [['accessibility.mouse_focuses_formcontrol', 1]]}, testMacFocusesFormControl);
+ }
+ else {
+ SimpleTest.finish();
+ }
+}
+
+async function testMacFocusesFormControl()
+{
+ await SimpleTest.promiseFocus(window);
+ testHTMLElements(htmlElementsMacPrefSet, false);
+ SimpleTest.finish();
+}
+
+var htmlElements = [
+ "<button id='elem'>Button</button>",
+ "<input id='elem' type='button'>",
+ "<input id='elem' type='checkbox'>",
+ "<input id='elem' class='canfocus'>",
+ "<input id='elem' type='password' class='canfocus'>",
+ "<textarea id='elem' class='canfocus'></textarea>",
+ "<select id='elem' class='canfocus'><option>One</select>",
+ "<select id='elem' rows='5' class='canfocus'><option>One</select>",
+ "<div id='elem' tabindex='0' class='canfocus' style='width: 10px; height: 10px;'></div>",
+ "<a href='about:blank' class='canfocus' onclick='return false;'>about:blank</a>",
+];
+
+var htmlElementsMacPrefSet = [
+ "<button id='elem' class='canfocus'>Button</button>",
+ "<input id='elem' class='canfocus'>",
+ "<input id='elem' type='button' class='canfocus'>",
+ "<input id='elem' type='checkbox' class='canfocus'>",
+];
+
+function createElement(str) {
+ let doc = new DOMParser().parseFromSafeString(`<html><body>${str}</body></html>`, "text/html");
+ return doc.body.firstChild;
+}
+
+function testHTMLElements(list, expectedNoRingsOnWin) {
+ var childwin = frames[0];
+ var childdoc = childwin.document;
+ var container = childdoc.getElementById("container");
+ for (var e = 0; e < list.length; e++) {
+ // Using innerHTML would be sanitized, so use the DOM parser instead to
+ // create the elements.
+ var elem = childdoc.adoptNode(createElement(list[e]));
+ container.appendChild(elem);
+
+ var shouldFocus = !kIsMac || (elem.className == "canfocus");
+ var ringSize = (shouldFocus ? (expectedNoRingsOnWin ? 2 : 1) : 0) + "px";
+
+ var expectedMatchWithMouse = shouldFocus && !expectedNoRingsOnWin;
+ var mouseRingSize = ringSize;
+ if (shouldFocus) {
+ var textControl = (function() {
+ if (elem.localName == "textarea")
+ return true;
+ if (elem.localName == "input")
+ return elem.type == "text" || elem.type == "password";
+ return false;
+ }());
+ expectedMatchWithMouse = textControl;
+ mouseRingSize = textControl ? "1px" : "2px";
+ }
+
+ if (elem.localName == "a") {
+ mouseRingSize = ringSize = "0px";
+ expectedMatchWithMouse = expectedMatchWithMouse && !kIsMac;
+ }
+
+ synthesizeMouse(elem, 8, 8, { }, childwin);
+ is(childdoc.activeElement, shouldFocus ? elem : childdoc.body, "mouse click on " + list[e]);
+ is(childwin.getComputedStyle(elem).outlineWidth, mouseRingSize, "mouse click on " + list[e] + " ring");
+ is(elem.matches(":-moz-focusring"), expectedMatchWithMouse, "mouse click on " + list[e] + " selector");
+
+ if (childdoc.activeElement)
+ childdoc.activeElement.blur();
+
+ ringSize = mouseRingSize;
+ if (kIsMac && !shouldFocus && elem.localName != "a") {
+ ringSize = "1px";
+ }
+
+ elem.focus();
+ is(childdoc.activeElement, elem, "focus() on " + list[e]);
+ is(childwin.getComputedStyle(elem).outlineWidth, ringSize,
+ "focus() on " + list[e] + " ring");
+
+ childdoc.activeElement.blur();
+
+ // Clear out the container for the next test.
+ while (container.firstChild) {
+ container.firstChild.remove();
+ }
+ }
+}
+
+SimpleTest.waitForFocus(initTest);
+
+]]>
+</script>
+
+<richlistbox id="l1" class="plain" height="20"/>
+<richlistbox id="l2" class="plain" height="20"/>
+<richlistbox id="l3" class="plain" height="20"/>
+<button id="b1" label="Button"/>
+<button id="b2" label="Button"/>
+<button id="b3" label="Button"/>
+
+<iframe id="child" src="file_focusrings.html"/>
+
+<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
+
+</window>
diff --git a/dom/tests/mochitest/general/test_for_of.html b/dom/tests/mochitest/general/test_for_of.html
new file mode 100644
index 0000000000..d5284f10bb
--- /dev/null
+++ b/dom/tests/mochitest/general/test_for_of.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Tests for for-of loops</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body onload="doTest()">
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<script>
+function doTest() {
+ // DOM NodeLists are iterable.
+ var a = [];
+ for (var e of document.body.childNodes)
+ if (e.nodeType === 1)
+ a.push(e.tagName);
+ is("P DIV SCRIPT", a.join(" "), "for-of should see each element in the body");
+
+ SimpleTest.finish();
+}
+SimpleTest.waitForExplicitFinish();
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_frameElementWrapping.html b/dom/tests/mochitest/general/test_frameElementWrapping.html
new file mode 100644
index 0000000000..a85f0ed394
--- /dev/null
+++ b/dom/tests/mochitest/general/test_frameElementWrapping.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for same-origin and cross-origin wrapping of frameElement</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<iframe id="ifr" src="file_frameElementWrapping.html"></iframe>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+//
+// This test has sort of morphed over time to become less and less useful.
+// In the past, we had special security policy for frameElement, but that's
+// more or less gone away with compartment/proxy wrapping. So we just go
+// through the motions to make sure that, indeed, frameElement is subject
+// to the same-origin policy.
+//
+
+SimpleTest.waitForExplicitFinish();
+
+var count = 0;
+
+function runTest(result, message) {
+ ok(result === 'PASS', message);
+
+ if (++count === 2)
+ SimpleTest.finish();
+ else
+ $('ifr').contentWindow.location = 'http://example.org/tests/dom/tests/mochitest/general/file_frameElementWrapping.html';
+}
+
+window.addEventListener("message",
+ function(event) { runTest.apply(null, event.data.split(',')) });
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_framedhistoryframes.html b/dom/tests/mochitest/general/test_framedhistoryframes.html
new file mode 100644
index 0000000000..a756d38115
--- /dev/null
+++ b/dom/tests/mochitest/general/test_framedhistoryframes.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=602256
+-->
+<head>
+ <title>Test for Bug 602256</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=602256">Mozilla Bug 602256</a>
+<p id="display"></p>
+<div id="content">
+ <iframe id="iframe" src="historyframes.html"></iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 602256 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function done() {
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_img_mutations.html b/dom/tests/mochitest/general/test_img_mutations.html
new file mode 100644
index 0000000000..54b02acad6
--- /dev/null
+++ b/dom/tests/mochitest/general/test_img_mutations.html
@@ -0,0 +1,236 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Image srcset mutations</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <script type="application/javascript">
+ "use strict";
+
+ // Tests the relevant mutations part of the spec for img src and srcset
+ // and that img.src still behaves by the older spec. (Bug 1076583)
+ // https://html.spec.whatwg.org/#relevant-mutations
+ SimpleTest.waitForExplicitFinish();
+
+ // 50x50 png
+ var testPNG50 = new URL("image_50.png?noCache=" + Math.random(), location).href;
+ // 100x100 png
+ var testPNG100 = new URL("image_100.png?noCache=" + Math.random(), location).href;
+ // 200x200 png
+ var testPNG200 = new URL("image_200.png?noCache=" + Math.random(), location).href;
+
+ var tests = [];
+ var img;
+ var expectingErrors = 0;
+ var expectingLoads = 0;
+ var afterExpectCallback;
+
+ function onImgLoad() {
+ ok(expectingLoads > 0, "expected load");
+ if (expectingLoads > 0) {
+ expectingLoads--;
+ }
+ if (!expectingLoads && !expectingErrors && afterExpectCallback) {
+ setTimeout(afterExpectCallback, 0);
+ afterExpectCallback = null;
+ }
+ }
+ function onImgError() {
+ ok(expectingErrors > 0, "expected error");
+ if (expectingErrors > 0) {
+ expectingErrors--;
+ }
+ if (!expectingLoads && !expectingErrors && afterExpectCallback) {
+ setTimeout(afterExpectCallback, 0);
+ afterExpectCallback = null;
+ }
+ }
+ function expectEvents(loads, errors, callback) {
+ if (!loads && !errors) {
+ setTimeout(callback, 0);
+ } else {
+ expectingLoads += loads;
+ expectingErrors += errors;
+ info("Waiting for " + expectingLoads + " load and " + expectingErrors + " error events");
+ afterExpectCallback = callback;
+ }
+ }
+
+ //
+ // Test that img.src still does some work synchronously per the older spec (bug 1076583)
+ //
+ tests.push(function test1() {
+ info("test 1");
+ img.src = testPNG50;
+ is(img.currentSrc, testPNG50, "Should have synchronously selected source");
+
+ // Assigning a wrong URL should not trigger error event (bug 1321300).
+ img.src = '//:0'; // Wrong URL
+
+ img.src = "non_existent_image.404";
+ ok(img.currentSrc.endsWith("non_existent_image.404"), "Should have synchronously selected source");
+
+ img.removeAttribute("src");
+ is(img.currentSrc, '', "Should have dropped currentSrc");
+
+ // Load another image while previous load is still pending
+ img.src = testPNG200;
+ is(img.currentSrc, testPNG200, "Should have synchronously selected source");
+
+ // No events should have fired synchronously, now we should get just one load (and no 404 error)
+ expectEvents(1, 0, nextTest);
+ });
+
+
+ // Setting srcset should be async
+ tests.push(function () {
+ info("test 2");
+ img.srcset = testPNG100;
+ is(img.currentSrc, testPNG200, "Should still have testPNG200 as current request");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should now have testPNG100 as current request");
+ nextTest();
+ });
+ });
+
+ // Setting srcset, even to no ultimate effect, should trigger a reload
+ tests.push(function () {
+ info("test 3");
+ img.srcset = testPNG100 + " 1x, " + testPNG200 + " 2x";
+ is(img.currentSrc, testPNG100, "Should still have testPNG100 as current request");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should still have testPNG100 as current request");
+ nextTest();
+ });
+ });
+
+ // Should switch to src as 1x source
+ tests.push(function () {
+ info("test 4");
+ img.srcset = testPNG50 + " 2x";
+ is(img.currentSrc, testPNG100, "Should still have testPNG100 as current request");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG200, "Should now have testPNG200 as current request");
+ nextTest();
+ });
+ });
+
+ // Changing src while we have responsive attributes should not be sync
+ tests.push(function () {
+ info("test 5");
+ img.src = testPNG100;
+ is(img.currentSrc, testPNG200, "Should still have testPNG200 as current request");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should now have testPNG100 as current request");
+
+ // Switch to using srcset again for next test
+ img.srcset = testPNG100;
+ expectEvents(1, 0, nextTest);
+ });
+ });
+
+ // img.src = img.src should trigger an async event even in responsive mode
+ tests.push(function () {
+ info("test 6");
+ is(img.currentSrc, testPNG100, "Should now have testPNG100 as current request");
+ img.src = img.src;
+ is(img.currentSrc, testPNG100, "Should still have testPNG100 as current request");
+
+ expectEvents(1, 0, nextTest);
+ });
+
+ // img.srcset = img.srcset should be a no-op
+ tests.push(function () {
+ info("test 7");
+ img.srcset = img.srcset;
+ is(img.currentSrc, testPNG100, "Should still have testPNG100 as current request");
+
+ expectEvents(0, 0, nextTest);
+ });
+
+ // re-binding the image to the document should be a no-op
+ tests.push(function () {
+ info("test 8");
+ document.body.appendChild(img);
+ is(img.currentSrc, testPNG100, "Should still have testPNG100 as current request");
+
+ expectEvents(0, 0, nextTest);
+ });
+
+ // We should re-run our selection algorithm when any load event occurs
+ tests.push(function () {
+ info("test 9");
+ img.srcset = testPNG50 + " 1x, " + testPNG200 + " 2x";
+ is(img.currentSrc, testPNG100, "Should still have testPNG100 as current request");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should now have testPNG50 as current request");
+
+ // The preference change will trigger a load, as the image will change
+ SpecialPowers.pushPrefEnv({'set': [ ["layout.css.devPixelsPerPx", "2.0"] ] });
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG200, "Should now have testPNG200 as current request");
+ img.src = img.src;
+ is(img.currentSrc, testPNG200, "Should still have testPNG200 as current request");
+ // img.src = img.src is special-cased by the spec. It should always
+ // trigger an load event
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG200, "Should still have testPNG200 as current request");
+ expectEvents(0, 0, nextTest);
+ });
+ })
+ });
+ });
+
+ // Removing srcset attr should async switch back to src
+ tests.push(function () {
+ info("test 10");
+ is(img.currentSrc, testPNG200, "Should have testPNG200 as current request");
+
+ img.removeAttribute("srcset");
+ is(img.currentSrc, testPNG200, "Should still have testPNG200 as current request");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should now have testPNG100 as current request");
+
+ expectEvents(0, 0, nextTest);
+ });
+ });
+
+ function nextTest() {
+ if (tests.length) {
+ // Spin event loop to make sure no unexpected image events are
+ // pending (unexpected events will assert in the handlers)
+ setTimeout(function() {
+ (tests.shift())();
+ }, 0);
+ } else {
+ // Remove the event listeners to prevent the prefenv being popped from
+ // causing test failures.
+ img.removeEventListener("load", onImgLoad);
+ img.removeEventListener("error", onImgError);
+ SimpleTest.finish();
+ }
+ }
+
+ addEventListener("load", function() {
+ SpecialPowers.pushPrefEnv({'set': [["layout.css.devPixelsPerPx", "1.0"]] },
+ function() {
+ // Create this after the pref is set, as it is guarding webIDL attributes
+ img = document.createElement("img");
+ img.addEventListener("load", onImgLoad);
+ img.addEventListener("error", onImgError);
+ document.body.appendChild(img);
+ setTimeout(nextTest, 0);
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_innerScreen.xhtml b/dom/tests/mochitest/general/test_innerScreen.xhtml
new file mode 100644
index 0000000000..7e30bce63b
--- /dev/null
+++ b/dom/tests/mochitest/general/test_innerScreen.xhtml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ Tests for mozInnerScreenX/Y properties
+ -->
+<window title="Test mozInnerScreenX/Y Properties"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test resuls are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml"
+ style="height: 400px; position:relative; overflow: auto;">
+ <iframe id="f"
+ style="position:absolute; left:100px;
+ top:200px; width:200px; height:200px; border:none;"></iframe>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+
+function isRounded(a, b, msg) {
+ ok(Math.round(a) == Math.round(b),
+ msg + " (rounded), got " + a + ", expected " + b);
+}
+
+function doTests()
+{
+ var readable = false;
+ try
+ {
+ mozScreenPixelsPerCSSPixel;
+ readable = true;
+ }
+ catch(ex) { }
+ ok(!readable, "window pixels per css pixel shouldn't be readable to content");
+
+ var devPxPerCSSPx = window.devicePixelRatio;
+
+ is(window.devicePixelRatio, devPxPerCSSPx, "window.devicePixelRatio");
+
+ var rootElement = document.documentElement;
+ isRounded(window.mozInnerScreenX*devPxPerCSSPx, rootElement.screenX,
+ "window screen X");
+ isRounded(window.mozInnerScreenY*devPxPerCSSPx, rootElement.screenY,
+ "window screen Y");
+
+ var f = document.getElementById("f");
+ var fBounds = f.getBoundingClientRect();
+
+ var fbc = f.contentWindow.docShell.browsingContext;
+
+ isRounded(f.contentWindow.mozInnerScreenX,
+ window.mozInnerScreenX + fBounds.left,
+ "frame screen X");
+ isRounded(f.contentWindow.mozInnerScreenY,
+ window.mozInnerScreenY + fBounds.top,
+ "frame screen Y");
+
+ fbc.fullZoom *= 2;
+ is(f.contentWindow.devicePixelRatio, 2*devPxPerCSSPx,
+ "frame screen pixels per CSS pixel");
+
+ is(f.contentWindow.devicePixelRatio, 2*devPxPerCSSPx, "frame devicePixelRatio");
+
+ isRounded(f.contentWindow.mozInnerScreenX*2,
+ window.mozInnerScreenX + fBounds.left,
+ "zoomed frame screen X");
+ isRounded(f.contentWindow.mozInnerScreenY*2,
+ window.mozInnerScreenY + fBounds.top,
+ "zoomed frame screen Y");
+ fbc.fullZoom = 1.0;
+
+ SimpleTest.finish();
+}
+
+addLoadEvent(doTests);
+SimpleTest.waitForExplicitFinish();
+
+]]>
+</script>
+
+</window>
diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html
new file mode 100644
index 0000000000..214552ed04
--- /dev/null
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=766694
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 766694</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=766694">Mozilla Bug 766694</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<iframe id="testframe" src="about:blank"></iframe>
+<pre id="test">
+<script>
+ ok(!self.isSecureContext, "The test should not be running in a secure context");
+ ok(!document.getElementById("testframe").contentWindow.isSecureContext,
+ "The test should not be running in a secure context");
+</script>
+<script type="text/javascript" src="test_interfaces.js"></script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js
new file mode 100644
index 0000000000..1de681009e
--- /dev/null
+++ b/dom/tests/mochitest/general/test_interfaces.js
@@ -0,0 +1,2049 @@
+/** Test for Bug 766694 **/
+
+// This is a list of all interfaces that are exposed to every webpage.
+// Please only add things to this list with great care and proper review
+// from the associated module peers.
+//
+// The test is supposed to check whether our actual exposure behavior
+// matches what we expect, with the latter expressed in terms of outside
+// observables like type of build (nightly, release), platform, secure
+// context, etc. Testing based on prefs is thus the wrong check, as this
+// means we'd also have to test whether the pref value matches what we
+// expect in terms of outside observables.
+
+// This file lists global interfaces we want exposed and verifies they
+// are what we intend. Each entry in the arrays below can either be a
+// simple string with the interface name, or an object with a 'name'
+// property giving the interface name as a string, and additional
+// properties which qualify the exposure of that interface. For example:
+//
+// [
+// "AGlobalInterface",
+// {name: "ExperimentalThing", release: false},
+// {name: "ReallyExperimentalThing", nightly: true},
+// {name: "DesktopOnlyThing", desktop: true},
+// {name: "DisabledEverywhere", disabled: true},
+// ];
+//
+// See createInterfaceMap() below for a complete list of properties.
+//
+// The values of the properties need to be either literal true/false
+// (e.g. indicating whether something is enabled on a particular
+// channel/OS) or one of the is* constants below (in cases when
+// exposure is affected by channel or OS in a nontrivial way).
+
+const { AppConstants } = SpecialPowers.ChromeUtils.importESModule(
+ "resource://gre/modules/AppConstants.sys.mjs"
+);
+
+const isNightly = AppConstants.NIGHTLY_BUILD;
+const isEarlyBetaOrEarlier = AppConstants.EARLY_BETA_OR_EARLIER;
+const isRelease = AppConstants.RELEASE_OR_BETA;
+const isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
+const isMac = AppConstants.platform == "macosx";
+const isWindows = AppConstants.platform == "win";
+const isAndroid = AppConstants.platform == "android";
+const isLinux = AppConstants.platform == "linux";
+const isInsecureContext = !window.isSecureContext;
+// Currently, MOZ_APP_NAME is always "fennec" for all mobile builds, so we can't use AppConstants for this
+const isFennec =
+ isAndroid &&
+ SpecialPowers.Cc["@mozilla.org/android/bridge;1"].getService(
+ SpecialPowers.Ci.nsIAndroidBridge
+ ).isFennec;
+const isCrossOriginIsolated = window.crossOriginIsolated;
+
+// IMPORTANT: Do not change this list without review from
+// a JavaScript Engine peer!
+let wasmGlobalEntry = {
+ name: "WebAssembly",
+ insecureContext: true,
+ disabled:
+ !SpecialPowers.Cu.getJSTestingFunctions().wasmIsSupportedByHardware(),
+};
+let wasmGlobalInterfaces = [
+ { name: "Module", insecureContext: true },
+ { name: "Instance", insecureContext: true },
+ { name: "Memory", insecureContext: true },
+ { name: "Table", insecureContext: true },
+ { name: "Global", insecureContext: true },
+ { name: "CompileError", insecureContext: true },
+ { name: "LinkError", insecureContext: true },
+ { name: "RuntimeError", insecureContext: true },
+ { name: "Function", insecureContext: true, nightly: true },
+ { name: "Exception", insecureContext: true },
+ { name: "Tag", insecureContext: true },
+ { name: "compile", insecureContext: true },
+ { name: "compileStreaming", insecureContext: true },
+ { name: "instantiate", insecureContext: true },
+ { name: "instantiateStreaming", insecureContext: true },
+ { name: "validate", insecureContext: true },
+];
+// IMPORTANT: Do not change this list without review from
+// a JavaScript Engine peer!
+let ecmaGlobals = [
+ { name: "AggregateError", insecureContext: true },
+ { name: "Array", insecureContext: true },
+ { name: "ArrayBuffer", insecureContext: true },
+ { name: "Atomics", insecureContext: true },
+ { name: "BigInt", insecureContext: true },
+ { name: "BigInt64Array", insecureContext: true },
+ { name: "BigUint64Array", insecureContext: true },
+ { name: "Boolean", insecureContext: true },
+ { name: "DataView", insecureContext: true },
+ { name: "Date", insecureContext: true },
+ { name: "Error", insecureContext: true },
+ { name: "EvalError", insecureContext: true },
+ { name: "FinalizationRegistry", insecureContext: true },
+ { name: "Float32Array", insecureContext: true },
+ { name: "Float64Array", insecureContext: true },
+ { name: "Function", insecureContext: true },
+ { name: "Infinity", insecureContext: true },
+ { name: "Int16Array", insecureContext: true },
+ { name: "Int32Array", insecureContext: true },
+ { name: "Int8Array", insecureContext: true },
+ { name: "InternalError", insecureContext: true },
+ { name: "Intl", insecureContext: true },
+ { name: "JSON", insecureContext: true },
+ { name: "Map", insecureContext: true },
+ { name: "Math", insecureContext: true },
+ { name: "NaN", insecureContext: true },
+ { name: "Number", insecureContext: true },
+ { name: "Object", insecureContext: true },
+ { name: "Promise", insecureContext: true },
+ { name: "Proxy", insecureContext: true },
+ { name: "RangeError", insecureContext: true },
+ { name: "ReferenceError", insecureContext: true },
+ { name: "Reflect", insecureContext: true },
+ { name: "RegExp", insecureContext: true },
+ { name: "Set", insecureContext: true },
+ {
+ name: "SharedArrayBuffer",
+ insecureContext: true,
+ crossOriginIsolated: true,
+ },
+ { name: "String", insecureContext: true },
+ { name: "Symbol", insecureContext: true },
+ { name: "SyntaxError", insecureContext: true },
+ { name: "TypeError", insecureContext: true },
+ { name: "Uint16Array", insecureContext: true },
+ { name: "Uint32Array", insecureContext: true },
+ { name: "Uint8Array", insecureContext: true },
+ { name: "Uint8ClampedArray", insecureContext: true },
+ { name: "URIError", insecureContext: true },
+ { name: "WeakMap", insecureContext: true },
+ { name: "WeakRef", insecureContext: true },
+ { name: "WeakSet", insecureContext: true },
+ wasmGlobalEntry,
+ { name: "decodeURI", insecureContext: true },
+ { name: "decodeURIComponent", insecureContext: true },
+ { name: "encodeURI", insecureContext: true },
+ { name: "encodeURIComponent", insecureContext: true },
+ { name: "escape", insecureContext: true },
+ { name: "eval", insecureContext: true },
+ { name: "globalThis", insecureContext: true },
+ { name: "isFinite", insecureContext: true },
+ { name: "isNaN", insecureContext: true },
+ { name: "parseFloat", insecureContext: true },
+ { name: "parseInt", insecureContext: true },
+ { name: "undefined", insecureContext: true },
+ { name: "unescape", insecureContext: true },
+];
+// IMPORTANT: Do not change the list above without review from
+// a JavaScript Engine peer!
+
+// IMPORTANT: Do not change the list below without review from a DOM peer!
+// (You can request review on Phabricator via r=#webidl)
+let interfaceNamesInGlobalScope = [
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AbortController", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AbortSignal", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AbstractRange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AnalyserNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Animation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AnimationEffect", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AnimationEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AnimationPlaybackEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AnimationTimeline", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Attr", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Audio", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioBuffer", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioContext", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioBufferSourceNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioDestinationNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioListener", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioParam", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioParamMap", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioProcessingEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioScheduledSourceNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioWorklet", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioWorkletNode", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AuthenticatorAssertionResponse" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AuthenticatorAttestationResponse" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AuthenticatorResponse" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "BarProp", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "BaseAudioContext", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "BeforeUnloadEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "BiquadFilterNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Blob", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "BlobEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "BroadcastChannel", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ByteLengthQueuingStrategy", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "Cache",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "CacheStorage",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CanvasCaptureMediaStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CanvasGradient", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CanvasPattern", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CanvasRenderingContext2D", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CaretPosition", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CDATASection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ChannelMergerNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ChannelSplitterNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CharacterData", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Clipboard" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ClipboardEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CloseEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Comment", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CompositionEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CompressionStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ConstantSourceNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "ContentVisibilityAutoStateChangeEvent",
+ insecureContext: true,
+ nightly: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ConvolverNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CountQueuingStrategy", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Credential" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CredentialsContainer" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Crypto", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CryptoKey" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSS", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSS2Properties", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSAnimation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSConditionRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSContainerRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSCounterStyleRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSFontFaceRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSFontFeatureValuesRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSFontPaletteValuesRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSGroupingRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSImportRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSKeyframeRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSKeyframesRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSLayerBlockRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSLayerStatementRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSMediaRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSMozDocumentRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSNamespaceRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSPageRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSPseudoElement", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSRuleList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSStyleDeclaration", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSStyleRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSStyleSheet", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSSupportsRule", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CSSTransition", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CustomElementRegistry", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "CustomEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DecompressionStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DataTransfer", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DataTransferItem", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DataTransferItemList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DelayNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceLightEvent", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceMotionEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceOrientationEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceProximityEvent", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Directory", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Document", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DocumentFragment", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DocumentTimeline", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DocumentType", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMException", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMImplementation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMMatrix", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMMatrixReadOnly", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMParser", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMPoint", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMPointReadOnly", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMQuad", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMRect", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMRectList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMRectReadOnly", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMRequest", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMStringList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMStringMap", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DOMTokenList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DragEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DynamicsCompressorNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Element", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ElementInternals", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ErrorEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Event", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "EventCounts", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "EventSource", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "EventTarget", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "File", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileReader", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystem", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemDirectoryEntry", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemDirectoryHandle" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemDirectoryReader", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemEntry", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemFileEntry", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemFileHandle" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemHandle" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FileSystemWritableFileStream" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FocusEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FormData", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FormDataEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FontFace", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FontFaceSet", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "FontFaceSetLoadEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GainNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Gamepad", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadAxisMoveEvent", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadButtonEvent", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadButton", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadEvent", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadHapticActuator", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadLightIndicator", insecureContext: false, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadPose", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GamepadTouch", insecureContext: false, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Geolocation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GeolocationCoordinates", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GeolocationPosition", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GeolocationPositionError", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPU", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUAdapter", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUAdapterInfo", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUBindGroup", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUBindGroupLayout", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUBuffer", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUBufferUsage", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUCanvasContext", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUColorWrite", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUCommandBuffer", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUCommandEncoder", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUCompilationInfo", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUCompilationMessage", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUComputePassEncoder", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUComputePipeline", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUDevice", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUDeviceLostInfo", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUMapMode", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUOutOfMemoryError", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUPipelineLayout", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUQuerySet", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUQueue", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPURenderBundle", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPURenderBundleEncoder", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPURenderPassEncoder", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPURenderPipeline", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUSampler", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUShaderModule", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUShaderStage", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUSupportedFeatures", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUSupportedLimits", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUTexture", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUTextureUsage", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUTextureView", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUUncapturedErrorEvent", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "GPUValidationError", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HashChangeEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Headers", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "History", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLAllCollection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLAnchorElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLAreaElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLAudioElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLBaseElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLBodyElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLBRElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLButtonElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLCanvasElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLCollection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDataElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDataListElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDetailsElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDialogElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDirectoryElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDivElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDListElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLDocument", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLEmbedElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLFieldSetElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLFontElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLFormControlsCollection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLFormElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLFrameElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLFrameSetElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLHeadElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLHeadingElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLHRElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLHtmlElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLIFrameElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLImageElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLInputElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLLabelElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLLegendElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLLIElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLLinkElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLMapElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLMarqueeElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLMediaElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLMenuElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLMetaElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLMeterElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLModElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLObjectElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLOListElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLOptGroupElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLOptionElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLOptionsCollection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLOutputElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLParagraphElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLParamElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLPreElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLPictureElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLProgressElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLQuoteElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLScriptElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLSelectElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLSlotElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLSourceElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLSpanElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLStyleElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTableCaptionElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTableCellElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTableColElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTableElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTableRowElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTableSectionElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTemplateElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTextAreaElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTimeElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTitleElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLTrackElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLUListElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLUnknownElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "HTMLVideoElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IdleDeadline", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBCursor", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBCursorWithValue", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBDatabase", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBFactory", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBIndex", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBKeyRange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBObjectStore", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBOpenDBRequest", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBRequest", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBTransaction", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IDBVersionChangeEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IIRFilterNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Image", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ImageBitmap", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ImageBitmapRenderingContext", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ImageCapture", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ImageCaptureErrorEvent", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ImageData", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "InputEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "InstallTrigger",
+ insecureContext: true,
+ disabled: isEarlyBetaOrEarlier,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IntersectionObserver", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "IntersectionObserverEntry", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "KeyEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "KeyboardEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "KeyframeEffect", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Location", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "Lock",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "LockManager",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MathMLElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaCapabilities", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaCapabilitiesInfo", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaDeviceInfo", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaDevices", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaElementAudioSourceNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaError", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaKeyError", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaEncryptedEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaKeys", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaKeySession", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaKeySystemAccess", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaKeyMessageEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaKeyStatusMap", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaMetadata", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaQueryList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaQueryListEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaRecorder", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaRecorderErrorEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaSession", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaSource", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaStreamAudioDestinationNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaStreamAudioSourceNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaStreamTrackAudioSourceNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaStreamEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaStreamTrackEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MediaStreamTrack", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "MerchantValidationEvent",
+ insecureContext: false,
+ desktop: true,
+ nightly: true,
+ linux: false,
+ disabled: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MessageChannel", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MessageEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MessagePort", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIAccess", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIConnectionEvent", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIInputMap", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIInput", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIMessageEvent", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIOutputMap", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIOutput", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MIDIPort", android: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MimeType", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MimeTypeArray", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MouseEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MouseScrollEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MutationEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MutationObserver", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "MutationRecord", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "NamedNodeMap", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "NavigationPreloadManager",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Navigator", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "NetworkInformation", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Node", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "NodeFilter", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "NodeIterator", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "NodeList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Notification", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "OfflineAudioCompletionEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "OfflineAudioContext", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "OffscreenCanvas", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "OffscreenCanvasRenderingContext2D", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Option", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "OscillatorNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PageTransitionEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PaintRequest", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PaintRequestList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PannerNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Path2D", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "PaymentAddress",
+ insecureContext: false,
+ desktop: true,
+ nightly: true,
+ linux: false,
+ disabled: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "PaymentMethodChangeEvent",
+ insecureContext: false,
+ desktop: true,
+ nightly: true,
+ linux: false,
+ disabled: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "PaymentRequest",
+ insecureContext: false,
+ desktop: true,
+ nightly: true,
+ linux: false,
+ disabled: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "PaymentRequestUpdateEvent",
+ insecureContext: false,
+ desktop: true,
+ nightly: true,
+ linux: false,
+ disabled: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "PaymentResponse",
+ insecureContext: false,
+ desktop: true,
+ nightly: true,
+ linux: false,
+ disabled: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Performance", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceEntry", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceEventTiming", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceMark", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceMeasure", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceNavigation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceNavigationTiming", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceObserver", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceObserverEntryList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformancePaintTiming", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceResourceTiming", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceServerTiming", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PerformanceTiming", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PeriodicWave", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Permissions", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PermissionStatus", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Plugin", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PluginArray", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PointerEvent", insecureContext: true, fennec: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PopStateEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PopupBlockedEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ProcessingInstruction", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ProgressEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PromiseRejectionEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "PublicKeyCredential" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "PushManager",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "PushSubscription",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "PushSubscriptionOptions",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RadioNodeList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Range", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ReadableByteStreamController", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ReadableStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ReadableStreamBYOBReader", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ReadableStreamBYOBRequest", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ReadableStreamDefaultController", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ReadableStreamDefaultReader", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Request", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ResizeObserver", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ResizeObserverEntry", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ResizeObserverSize", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Response", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCCertificate", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCDataChannel", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCDataChannelEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCDtlsTransport", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCDTMFSender", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCDTMFToneChangeEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCIceCandidate", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCPeerConnection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCPeerConnectionIceEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCRtpReceiver", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCRtpSender", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCRtpTransceiver", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCSctpTransport", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCSessionDescription", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCStatsReport", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "RTCTrackEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Sanitizer", disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Scheduler", insecureContext: true, nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Screen", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ScreenOrientation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ScriptProcessorNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ScrollAreaEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SecurityPolicyViolationEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Selection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "ServiceWorker",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "ServiceWorkerContainer",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ "ServiceWorkerRegistration",
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ScopedCredential", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ScopedCredentialInfo", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ShadowRoot", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SharedWorker", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SourceBuffer", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SourceBufferList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SpeechSynthesisErrorEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SpeechSynthesisEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SpeechSynthesis", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SpeechSynthesisUtterance", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SpeechSynthesisVoice", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SpecialPowers", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "StaticRange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "StereoPannerNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Storage", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "StorageEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "StorageManager", fennec: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "StyleSheet", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "StyleSheetList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SubtleCrypto" },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SubmitEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAngle", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedAngle", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedBoolean", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedEnumeration", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedInteger", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedLength", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedLengthList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedNumber", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedNumberList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedPreserveAspectRatio", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedRect", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedString", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimatedTransformList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimateElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimateMotionElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimateTransformElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGAnimationElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGCircleElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGClipPathElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGComponentTransferFunctionElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGDefsElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGDescElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGEllipseElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEBlendElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEColorMatrixElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEComponentTransferElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFECompositeElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEConvolveMatrixElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEDiffuseLightingElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEDisplacementMapElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEDistantLightElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEDropShadowElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEFloodElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEFuncAElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEFuncBElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEFuncGElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEFuncRElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEGaussianBlurElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEImageElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEMergeElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEMergeNodeElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEMorphologyElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEOffsetElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFEPointLightElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFESpecularLightingElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFESpotLightElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFETileElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFETurbulenceElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGFilterElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGForeignObjectElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGGElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGGeometryElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGGradientElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGGraphicsElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGImageElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGLength", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGLengthList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGLinearGradientElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGLineElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGMarkerElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGMaskElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGMatrix", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGMetadataElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGMPathElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGNumber", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGNumberList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGPathElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGPatternElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGPoint", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGPointList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGPolygonElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGPolylineElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGPreserveAspectRatio", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGRadialGradientElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGRect", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGRectElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGScriptElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGSetElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGStopElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGStringList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGStyleElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGSVGElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGSwitchElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGSymbolElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTextContentElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTextElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTextPathElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTextPositioningElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTitleElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTransform", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTransformList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGTSpanElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGUnitTypes", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGUseElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "SVGViewElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TaskController", insecureContext: true, nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TaskPriorityChangeEvent", insecureContext: true, nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TaskSignal", insecureContext: true, nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Text", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextDecoder", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextDecoderStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextEncoder", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextEncoderStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextMetrics", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextTrack", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextTrackCue", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextTrackCueList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TextTrackList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TimeEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TimeRanges", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Touch", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TouchEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TouchList", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TrackEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TransformStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ {
+ name: "TransformStreamDefaultController",
+ insecureContext: true,
+ },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TransitionEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "TreeWalker", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "U2F", insecureContext: false, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "UIEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "URL", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "URLSearchParams", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "UserProximityEvent", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ValidityState", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "VideoPlaybackQuality", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "VisualViewport", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "VTTCue", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "VTTRegion", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WaveShaperNode", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebAuthnAssertion", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebAuthnAttestation", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebAuthentication", insecureContext: true, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLActiveInfo", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLBuffer", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLContextEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLFramebuffer", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLProgram", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLQuery", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLRenderbuffer", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLRenderingContext", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGL2RenderingContext", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLSampler", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLShader", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLShaderPrecisionFormat", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLSync", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLTexture", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLTransformFeedback", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLUniformLocation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebGLVertexArrayObject", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebKitCSSMatrix", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebSocket", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebTransport", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebTransportBidirectionalStream", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebTransportDatagramDuplexStream", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebTransportError", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebTransportReceiveStream", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WebTransportSendStream", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WheelEvent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Window", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Worker", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "Worklet", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WritableStream", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WritableStreamDefaultController", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "WritableStreamDefaultWriter", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XMLDocument", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XMLHttpRequest", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XMLHttpRequestEventTarget", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XMLHttpRequestUpload", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XMLSerializer", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XPathEvaluator", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XPathExpression", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XPathResult", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "XSLTProcessor", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "alert", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "atob", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "blur", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "btoa", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "caches", insecureContext: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "cancelAnimationFrame", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "cancelIdleCallback", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "captureEvents", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "clearInterval", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "clearTimeout", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "clientInformation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "close", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "closed", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "confirm", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "console", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "createImageBitmap", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "crossOriginIsolated", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "crypto", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "customElements", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "devicePixelRatio", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "document", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "dump", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "event", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "external", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "fetch", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "find", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "focus", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "frameElement", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "frames", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "fullScreen", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "getComputedStyle", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "getDefaultComputedStyle", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "getSelection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "history", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "indexedDB", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "innerHeight", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "innerWidth", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "isSecureContext", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "length", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "localStorage", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "location", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "locationbar", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "matchMedia", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "menubar", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "moveBy", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "moveTo", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "mozInnerScreenX", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "mozInnerScreenY", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "name", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "navigator", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "netscape", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onabort", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondeviceorientationabsolute", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onafterprint", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onanimationcancel", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onanimationend", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onanimationiteration", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onanimationstart", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onauxclick", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onbeforeinput", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onbeforeprint", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onbeforeunload", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onblur", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oncanplay", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oncanplaythrough", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onchange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onclick", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onclose", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oncontextmenu", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oncopy", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oncuechange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oncut", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondblclick", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondevicemotion", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondeviceorientation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondrag", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondragend", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondragenter", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondragexit", insecureContext: true, nightly: false },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondragleave", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondragover", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondragstart", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondrop", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ondurationchange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onemptied", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onended", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onerror", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onfocus", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onformdata", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ongamepadconnected", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ongamepaddisconnected", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ongotpointercapture", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onhashchange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oninput", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "oninvalid", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onkeydown", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onkeypress", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onkeyup", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onlanguagechange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onload", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onloadeddata", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onloadedmetadata", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onloadstart", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onlostpointercapture", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmessage", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmessageerror", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmousedown", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmouseenter", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmouseleave", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmousemove", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmouseout", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmouseover", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmouseup", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmozfullscreenchange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onmozfullscreenerror", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onoffline", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ononline", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onorientationchange", insecureContext: true, android: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpagehide", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpageshow", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpaste", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpause", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onplay", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onplaying", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointercancel", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointerdown", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointerenter", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointerleave", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointermove", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointerout", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointerover", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpointerup", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onpopstate", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onprogress", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onratechange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onrejectionhandled", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onreset", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onresize", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onscroll", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onscrollend", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onsecuritypolicyviolation", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onseeked", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onseeking", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onselect", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onselectionchange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onselectstart", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onslotchange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onstalled", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onstorage", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onsubmit", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onsuspend", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontimeupdate", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontoggle", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontouchcancel", insecureContext: true, android: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontouchend", insecureContext: true, android: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontouchmove", insecureContext: true, android: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontouchstart", insecureContext: true, android: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontransitioncancel", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontransitionend", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontransitionrun", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "ontransitionstart", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onunhandledrejection", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onunload", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onvolumechange", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onwaiting", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onwebkitanimationend", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onwebkitanimationiteration", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onwebkitanimationstart", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onwebkittransitionend", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "onwheel", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "open", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "opener", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "orientation", insecureContext: true, android: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "origin", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "outerHeight", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "outerWidth", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "pageXOffset", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "pageYOffset", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "parent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "performance", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "personalbar", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "postMessage", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "print", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "prompt", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "queueMicrotask", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "releaseEvents", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "reportError", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "requestAnimationFrame", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "requestIdleCallback", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "resizeBy", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "resizeTo", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scheduler", insecureContext: true, nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "screen", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "screenLeft", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "screenTop", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "screenX", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "screenY", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scroll", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollBy", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollByLines", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollByPages", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollMaxX", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollMaxY", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollTo", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollX", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollY", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "scrollbars", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "self", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "sessionStorage", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "setInterval", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "setResizable", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "setTimeout", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "sizeToContent", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "speechSynthesis", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "status", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "statusbar", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "stop", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "structuredClone", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "toolbar", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "top", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "u2f", insecureContext: false, disabled: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "updateCommands", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "visualViewport", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "webkitURL", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "window", insecureContext: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+];
+// IMPORTANT: Do not change the list above without review from a DOM peer!
+
+function entryDisabled(entry) {
+ return (
+ entry.nightly === !isNightly ||
+ (entry.nightlyAndroid === !(isAndroid && isNightly) && isAndroid) ||
+ entry.desktop === !isDesktop ||
+ entry.windows === !isWindows ||
+ entry.mac === !isMac ||
+ entry.linux === !isLinux ||
+ (entry.android === !isAndroid && !entry.nightlyAndroid) ||
+ entry.fennecOrDesktop === (isAndroid && !isFennec) ||
+ entry.fennec === !isFennec ||
+ entry.release === !isRelease ||
+ entry.releaseNonWindows === !(isRelease && !isWindows) ||
+ // The insecureContext test is very purposefully converting
+ // entry.insecureContext to boolean, so undefined will convert to
+ // false. That way entries without an insecureContext annotation
+ // will get treated as "insecureContext: false", which means exposed
+ // only in secure contexts.
+ (isInsecureContext && !entry.insecureContext) ||
+ entry.earlyBetaOrEarlier === !isEarlyBetaOrEarlier ||
+ entry.crossOriginIsolated === !isCrossOriginIsolated ||
+ entry.disabled
+ );
+}
+
+function createInterfaceMap(...interfaceGroups) {
+ var interfaceMap = {};
+
+ function addInterfaces(interfaces) {
+ for (var entry of interfaces) {
+ if (typeof entry === "string") {
+ ok(!(entry in interfaceMap), "duplicate entry for " + entry);
+ interfaceMap[entry] = !isInsecureContext;
+ } else {
+ ok(!(entry.name in interfaceMap), "duplicate entry for " + entry.name);
+ ok(!("pref" in entry), "Bogus pref annotation for " + entry.name);
+ interfaceMap[entry.name] = !entryDisabled(entry);
+ }
+ }
+ }
+
+ for (let interfaceGroup of interfaceGroups) {
+ addInterfaces(interfaceGroup);
+ }
+
+ return interfaceMap;
+}
+
+function runTest(parentName, parent, ...interfaceGroups) {
+ var interfaceMap = createInterfaceMap(...interfaceGroups);
+ for (var name of Object.getOwnPropertyNames(parent)) {
+ ok(
+ interfaceMap[name],
+ "If this is failing: DANGER, are you sure you want to expose the new interface " +
+ name +
+ " to all webpages as a property on '" +
+ parentName +
+ "'? Do not make a change to this file without a " +
+ " review from a DOM peer for that specific change!!! (or a JS peer for changes to ecmaGlobals)"
+ );
+
+ ok(
+ name in parent,
+ `${name} is exposed as an own property on '${parentName}' but tests false for "in" in the global scope`
+ );
+ ok(
+ Object.getOwnPropertyDescriptor(parent, name),
+ `${name} is exposed as an own property on '${parentName}' but has no property descriptor in the global scope`
+ );
+
+ delete interfaceMap[name];
+ }
+ for (var name of Object.keys(interfaceMap)) {
+ ok(
+ name in parent === interfaceMap[name],
+ name +
+ " should " +
+ (interfaceMap[name] ? "" : " NOT") +
+ " be defined on '" +
+ parentName +
+ "' scope"
+ );
+ if (!interfaceMap[name]) {
+ delete interfaceMap[name];
+ }
+ }
+ is(
+ Object.keys(interfaceMap).length,
+ 0,
+ "The following interface(s) are not enumerated: " +
+ Object.keys(interfaceMap).join(", ")
+ );
+}
+
+// Use an iframe because the test harness pollutes the global object with a lot
+// of functions.
+let iframeWindow = document.getElementById("testframe").contentWindow;
+is(
+ window.isSecureContext,
+ iframeWindow.isSecureContext,
+ "iframe isSecureContext must match"
+);
+runTest("window", iframeWindow, ecmaGlobals, interfaceNamesInGlobalScope);
+
+if (window.WebAssembly && !entryDisabled(wasmGlobalEntry)) {
+ runTest("WebAssembly", window.WebAssembly, wasmGlobalInterfaces);
+}
diff --git a/dom/tests/mochitest/general/test_interfaces_secureContext.html b/dom/tests/mochitest/general/test_interfaces_secureContext.html
new file mode 100644
index 0000000000..e133c6fdd4
--- /dev/null
+++ b/dom/tests/mochitest/general/test_interfaces_secureContext.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=766694
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 766694</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=766694">Mozilla Bug 766694</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<iframe id="testframe" src="about:blank"></iframe>
+<pre id="test">
+<script>
+ ok(self.isSecureContext, "The test should be running in a secure context");
+ ok(document.getElementById("testframe").contentWindow.isSecureContext,
+ "The test should be running in a secure context");
+</script>
+<script type="text/javascript" src="test_interfaces.js"></script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_media_queries_with_zoom.html b/dom/tests/mochitest/general/test_media_queries_with_zoom.html
new file mode 100644
index 0000000000..c89d7e4e95
--- /dev/null
+++ b/dom/tests/mochitest/general/test_media_queries_with_zoom.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media Queries with Zoom</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+
+<body>
+
+<div>Testing media queries with different zoom levels</div>
+
+<script type="application/javascript">
+
+const originalDPR = window.devicePixelRatio;
+const originalZoom = SpecialPowers.getFullZoom(window);
+
+const zoomsToTest = [
+300,
+240,
+200,
+170,
+150,
+133,
+120,
+110,
+100,
+90,
+80,
+67,
+50,
+30,
+];
+
+for (let i = 0; i < zoomsToTest.length; ++i) {
+ let zoomPercent = zoomsToTest[i];
+
+ let relativeZoom = originalZoom * zoomPercent / 100;
+ SpecialPowers.setFullZoom(window, relativeZoom);
+ let actualZoom = SpecialPowers.getDeviceFullZoom(window);
+ let targetDPR = (originalDPR * actualZoom);
+ let actualDPR = window.devicePixelRatio;
+ let mql = window.matchMedia(`(resolution: ${targetDPR}dppx)`);
+ ok(mql.matches, `At ${zoomPercent}% zoom, target ${targetDPR}dppx matches ${actualDPR}dppx.`);
+}
+
+// Reset the zoom when the test is done.
+SpecialPowers.setFullZoom(window, originalZoom);
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_navigation_timing.html b/dom/tests/mochitest/general/test_navigation_timing.html
new file mode 100644
index 0000000000..c0aabd1647
--- /dev/null
+++ b/dom/tests/mochitest/general/test_navigation_timing.html
@@ -0,0 +1,36 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=822480
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<pre id="test">
+<script type="application/javascript">
+
+var subwindow = null;
+
+window.onload = function() {
+ SimpleTest.waitForExplicitFinish();
+ subwindow = window.open("navigation_timing.html?x=0#_blank", "_blank");
+}
+
+function finishTests() {
+ subwindow.close();
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_network_events.html b/dom/tests/mochitest/general/test_network_events.html
new file mode 100644
index 0000000000..5763cf1fff
--- /dev/null
+++ b/dom/tests/mochitest/general/test_network_events.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=795136
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for moznetworkupload and moznetworkdownload</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795136">Mozilla Bug 795136</a>
+<p id="display"></p>
+<div id="content">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 795136 **/
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.addPermission("network-events", true, document);
+
+var gNetworkUpload = false;
+var gNetworkDownload = false;
+
+function isFinished() {
+ return gNetworkUpload && gNetworkDownload;
+}
+
+function finish() {
+ removeEventListener('moznetworkupload', uploadHandler);
+ removeEventListener('moznetworkdownload', downloadHandler);
+
+ SpecialPowers.removePermission("network-events", document);
+
+ SimpleTest.finish();
+}
+
+function uploadHandler() {
+ ok(true, 'got a network upload event');
+ gNetworkUpload = true;
+
+ if (isFinished()) {
+ finish();
+ }
+}
+
+function downloadHandler() {
+ ok(true, 'got a network download event');
+ gNetworkDownload = true;
+
+ if (isFinished()) {
+ finish();
+ }
+}
+
+addEventListener('moznetworkupload', uploadHandler);
+addEventListener('moznetworkdownload', downloadHandler);
+
+var iframe = document.createElement('iframe');
+iframe.src = 'http://mozilla.org';
+
+document.getElementById('content').appendChild(iframe);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_nodeAdoption_chrome_boundary.xhtml b/dom/tests/mochitest/general/test_nodeAdoption_chrome_boundary.xhtml
new file mode 100644
index 0000000000..eafe3cb714
--- /dev/null
+++ b/dom/tests/mochitest/general/test_nodeAdoption_chrome_boundary.xhtml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Cross chrome and content node adoption test"
+ onload="setTimeout(runTest, 0);"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <browser xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="content" type="content" src="about:blank"/>
+
+<script>
+
+SimpleTest.waitForExplicitFinish();
+function runTest()
+{
+ let browserElement = document.getElementById("content");
+ try {
+ document.adoptNode(browserElement.contentDocument.documentElement);
+ SimpleTest.ok(false, "Cross chrome and content node adoption should fail");
+ } catch (SecurityError) {
+ SimpleTest.ok(true, "Cross chrome and content node adoption fails as expected");
+ }
+ SimpleTest.finish();
+}
+</script>
+</window>
+
diff --git a/dom/tests/mochitest/general/test_offsets.css b/dom/tests/mochitest/general/test_offsets.css
new file mode 100644
index 0000000000..18231c4d9b
--- /dev/null
+++ b/dom/tests/mochitest/general/test_offsets.css
@@ -0,0 +1,3 @@
+ button, vbox, menu, menuitem, menupopup {
+ box-sizing: content-box;
+ }
diff --git a/dom/tests/mochitest/general/test_offsets.html b/dom/tests/mochitest/general/test_offsets.html
new file mode 100644
index 0000000000..4bad588913
--- /dev/null
+++ b/dom/tests/mochitest/general/test_offsets.html
@@ -0,0 +1,100 @@
+<!DOCTYPE HTML>
+<html style="margin: 5px; border: 0; padding: 1px;">
+<head>
+ <title>HTML Tests for offset/client/scroll properties</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="test_offsets.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+
+<style>
+ input {
+ box-sizing: content-box;
+ }
+</style>
+</head>
+
+<!-- We set a transform on the body element so that it creates a reference frame.
+ This makes sure that snapping of scrolled areas for the contained elements
+ is not influenced by offsets outside of this document. -->
+<body id="body" onload="setTimeout(testElements, 0, 'testelements', SimpleTest.finish);"
+ style="margin: 1px; border: 2px solid black; padding: 4px; transform: translateY(1px);">
+
+<div id="testelements" style="margin: 0; border: 0; padding: 0;">
+ <div id="div1" style="margin: 0; margin-left: 6px; margin-top: 2px; border: 1px solid green; padding: 6px; width: 50px; height: 20px"
+ _offsetLeft="13" _offsetTop="9" _offsetWidth="64" _offsetHeight="34"
+ _scrollWidth="62" _scrollHeight="32"
+ _clientLeft="1" _clientTop="1" _clientWidth="62" _clientHeight="32"></div>
+ <div id="noscroll" style="margin: 2px; border: 1px solid blue; padding: 3px;"
+ _offsetLeft="10" _offsetTop="12" _offsetWidth="64" _offsetHeight="34"
+ _scrollWidth="62" _scrollHeight="32"
+ _clientLeft="1" _clientTop="1" _clientWidth="62" _clientHeight="32">
+ <div id="inner">Inner Text</div>
+ </div>
+
+ <div id="absolute" style="position: absolute; margin: 5px; border: 2px solid blue; padding: 0;">
+ <div id="absolute-block" _offsetParent="absolute">
+ <div id="absolute-replaced" _offsetParent="absolute" style="margin: 1px; border: 0; padding: 3px;"></div>
+ </div>
+ </div>
+
+ <div id="absolutelr" style="position: absolute; margin: 5px; border: 2px solid blue; padding: 0; left: 90px; top: 130px;">
+ This is some absolute positioned text.
+ <div id="absolutelr-block" _offsetParent="absolutelr">
+ <div id="absolutelr-replaced" _offsetParent="absolutelr" style="margin: 1px; border: 0; padding: 3px;"></div>
+ </div>
+ </div>
+
+ <div id="relative" style="position: relative; margin: 2px; border: 1px solid orange; padding: 7px; left: 10px; top: 5px;">
+ This is some relative positioned text.
+ <div id="relative-block" _offsetParent="relative">
+ <div id="relative-replaced" _offsetParent="relative" style="margin: 1px; border: 0; padding: 3px;"></div>
+ </div>
+ </div>
+
+ <div id="fixed" style="position: fixed; margin: 2px; border: 1px solid orange; padding: 7px; left: 87px; top: 12px;">
+ This is some fixed positioned text.
+ <div id="fixed-block" _offsetParent="fixed">
+ <div id="fixed-replaced" _offsetParent="fixed" style="margin: 1px; border: 0; padding: 3px;"></div>
+ </div>
+ </div>
+
+ <div id="scrollbox"
+ style="overflow: scroll; padding-left: 0px; margin: 3px; border: 4px solid green; max-width: 80px; max-height: 70px"
+ _scrollWidth="62" _scrollHeight="32"
+ _clientLeft="1" _clientTop="1" _clientWidth="62" _clientHeight="32"><p id="p1" style="margin: 0; padding: 0;">One</p>
+ <p id="p2">Two</p>
+ <p id="scrollchild">Three</p>
+ <p id="lastlinebox" style="margin: 0; padding: 0;"><input id="lastline" type="button"
+ style="margin: 0px; border: 2px solid red;"
+ value="This button is much longer than the others">
+ </p></div>
+
+ <div id="overflow-visible" style="width:100px; height:100px;">
+ <div id="overflow-visible-1" style="width:200px; height:1px; background:yellow;"></div>
+ <div id="overflow-visible-2" style="height:200px; background:lime;"></div>
+ </div>
+
+ <div id="div-displaynone" style="display: none; border: 0; padding: 0;"
+ _offsetParent="null"></div>
+ <p id="p3" style="margin: 2px; border: 0; padding: 1px;"
+ _offsetLeft="9" _offsetTop="9" _offsetWidth="64" _offsetHeight="34"
+ _scrollWidth="62" _scrollHeight="32"
+ _clientLeft="1" _clientTop="1" _clientWidth="62" _clientHeight="32">
+ <div id="div-nosize" style="width: 0; height: 0; margin: 0; border: 0; padding: 0;"></div>
+ </p>
+
+</div>
+
+<div id="scrollbox-test" style="float: left; overflow: scroll; margin: 0; border: 0; padding: 0"></div>
+
+<script type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+</script>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_offsets.js b/dom/tests/mochitest/general/test_offsets.js
new file mode 100644
index 0000000000..d89b575876
--- /dev/null
+++ b/dom/tests/mochitest/general/test_offsets.js
@@ -0,0 +1,332 @@
+var scrollbarWidth = 17,
+ scrollbarHeight = 17;
+
+function testElements(baseid, callback) {
+ scrollbarWidth = scrollbarHeight = gcs($("scrollbox-test"), "width");
+
+ var elements = $(baseid).getElementsByTagName("*");
+ for (var t = 0; t < elements.length; t++) {
+ var element = elements[t];
+
+ // Ignore presentational content inside menus
+ if (
+ element.closest("menu, menuitem") &&
+ element.closest("[aria-hidden=true]")
+ ) {
+ continue;
+ }
+
+ // Ignore content inside a <button> This can be removed if/when
+ // button switches to use shadow DOM.
+ let buttonParent = element.closest("button");
+ if (buttonParent && buttonParent !== element) {
+ continue;
+ }
+
+ testElement(element);
+ }
+
+ var nonappended = document.createElementNS(
+ "http://www.w3.org/1999/xhtml",
+ "div"
+ );
+ nonappended.id = "nonappended";
+ nonappended.setAttribute("_offsetParent", "null");
+ testElement(nonappended);
+
+ checkScrolledElement($("scrollbox"), $("scrollchild"));
+
+ var div = $("noscroll");
+ div.scrollLeft = 10;
+ div.scrollTop = 10;
+ is(element.scrollLeft, 0, element.id + " scrollLeft after nonscroll");
+ is(element.scrollTop, 0, element.id + " scrollTop after nonscroll");
+
+ callback();
+}
+
+function usesSVGLayout(e) {
+ return e instanceof SVGElement && !(e instanceof SVGSVGElement);
+}
+
+function toNearestAppunit(v) {
+ // 60 appunits per CSS pixel; round result to the nearest appunit
+ return Math.round(v * 60) / 60;
+}
+
+function isEqualAppunits(a, b, msg) {
+ is(toNearestAppunit(a), toNearestAppunit(b), msg);
+}
+
+function testElement(element) {
+ var offsetParent = element.getAttribute("_offsetParent");
+ offsetParent = $(
+ offsetParent == "null" ? null : offsetParent ? offsetParent : "body"
+ );
+
+ var borderLeft = gcs(element, "borderLeftWidth");
+ var borderTop = gcs(element, "borderTopWidth");
+ var borderRight = gcs(element, "borderRightWidth");
+ var borderBottom = gcs(element, "borderBottomWidth");
+ var paddingLeft = gcs(element, "paddingLeft");
+ var paddingTop = gcs(element, "paddingTop");
+ var paddingRight = gcs(element, "paddingRight");
+ var paddingBottom = gcs(element, "paddingBottom");
+ var width = gcs(element, "width");
+ var height = gcs(element, "height");
+
+ if (element instanceof HTMLElement) {
+ checkOffsetState(
+ element,
+ -10000,
+ -10000,
+ borderLeft + paddingLeft + width + paddingRight + borderRight,
+ borderTop + paddingTop + height + paddingBottom + borderBottom,
+ offsetParent,
+ element.id
+ );
+ }
+
+ var scrollWidth, scrollHeight, clientWidth, clientHeight;
+ var doScrollCheck = true;
+ {
+ if (element.id == "scrollbox") {
+ clientWidth = paddingLeft + width + paddingRight - scrollbarWidth;
+ clientHeight = paddingTop + height + paddingBottom - scrollbarHeight;
+ } else {
+ clientWidth = paddingLeft + width + paddingRight;
+ clientHeight = paddingTop + height + paddingBottom;
+ }
+ if (element.id == "overflow-visible") {
+ scrollWidth = 200;
+ scrollHeight = 201;
+ } else if (
+ element.scrollWidth > clientWidth ||
+ element.scrollHeight > clientHeight
+ ) {
+ // The element overflows. Don't check scrollWidth/scrollHeight since the
+ // above calculation is not correct.
+ doScrollCheck = false;
+ } else {
+ scrollWidth = clientWidth;
+ scrollHeight = clientHeight;
+ }
+ }
+
+ if (doScrollCheck) {
+ if (usesSVGLayout(element)) {
+ checkScrollState(element, 0, 0, 0, 0, element.id);
+ } else {
+ checkScrollState(element, 0, 0, scrollWidth, scrollHeight, element.id);
+ }
+ }
+
+ if (usesSVGLayout(element)) {
+ checkClientState(element, 0, 0, 0, 0, element.id);
+ } else {
+ checkClientState(
+ element,
+ borderLeft,
+ borderTop,
+ clientWidth,
+ clientHeight,
+ element.id
+ );
+ }
+
+ var boundingrect = element.getBoundingClientRect();
+ isEqualAppunits(
+ boundingrect.width,
+ borderLeft + paddingLeft + width + paddingRight + borderRight,
+ element.id + " bounding rect width"
+ );
+ isEqualAppunits(
+ boundingrect.height,
+ borderTop + paddingTop + height + paddingBottom + borderBottom,
+ element.id + " bounding rect height"
+ );
+ isEqualAppunits(
+ boundingrect.right - boundingrect.left,
+ boundingrect.width,
+ element.id + " bounding rect right"
+ );
+ isEqualAppunits(
+ boundingrect.bottom - boundingrect.top,
+ boundingrect.height,
+ element.id + " bounding rect bottom"
+ );
+
+ var rects = element.getClientRects();
+ if (element.id == "div-displaynone" || element.id == "nonappended") {
+ is(rects.length, 0, element.id + " getClientRects empty");
+ } else {
+ is(rects[0].left, boundingrect.left, element.id + " getClientRects left");
+ is(rects[0].top, boundingrect.top, element.id + " getClientRects top");
+ is(
+ rects[0].right,
+ boundingrect.right,
+ element.id + " getClientRects right"
+ );
+ is(
+ rects[0].bottom,
+ boundingrect.bottom,
+ element.id + " getClientRects bottom"
+ );
+ }
+}
+
+function checkScrolledElement(element, child) {
+ var elemrect = element.getBoundingClientRect();
+ var childrect = child.getBoundingClientRect();
+
+ var topdiff = childrect.top - elemrect.top;
+
+ element.scrollTop = 20;
+ is(element.scrollLeft, 0, element.id + " scrollLeft after vertical scroll");
+ is(element.scrollTop, 20, element.id + " scrollTop after vertical scroll");
+ // If the viewport has been transformed, then we might have scrolled to a subpixel value
+ // that's slightly different from what we requested. After rounding, however, it should
+ // be the same.
+ is(
+ Math.round(childrect.top - child.getBoundingClientRect().top),
+ 20,
+ "child position after vertical scroll"
+ );
+
+ element.scrollTop = 0;
+ is(
+ element.scrollLeft,
+ 0,
+ element.id + " scrollLeft after vertical scroll reset"
+ );
+ is(
+ element.scrollTop,
+ 0,
+ element.id + " scrollTop after vertical scroll reset"
+ );
+ // Scrolling back to the top should work precisely.
+ is(
+ child.getBoundingClientRect().top,
+ childrect.top,
+ "child position after vertical scroll reset"
+ );
+
+ element.scrollTop = 10;
+ element.scrollTop = -30;
+ is(
+ element.scrollLeft,
+ 0,
+ element.id + " scrollLeft after vertical scroll negative"
+ );
+ is(
+ element.scrollTop,
+ 0,
+ element.id + " scrollTop after vertical scroll negative"
+ );
+ is(
+ child.getBoundingClientRect().top,
+ childrect.top,
+ "child position after vertical scroll negative"
+ );
+
+ element.scrollLeft = 18;
+ is(
+ element.scrollLeft,
+ 18,
+ element.id + " scrollLeft after horizontal scroll"
+ );
+ is(element.scrollTop, 0, element.id + " scrollTop after horizontal scroll");
+ is(
+ Math.round(childrect.left - child.getBoundingClientRect().left),
+ 18,
+ "child position after horizontal scroll"
+ );
+
+ element.scrollLeft = -30;
+ is(
+ element.scrollLeft,
+ 0,
+ element.id + " scrollLeft after horizontal scroll reset"
+ );
+ is(
+ element.scrollTop,
+ 0,
+ element.id + " scrollTop after horizontal scroll reset"
+ );
+ is(
+ child.getBoundingClientRect().left,
+ childrect.left,
+ "child position after horizontal scroll reset"
+ );
+}
+
+function checkOffsetState(element, left, top, width, height, parent, testname) {
+ checkCoords(element, "offset", left, top, width, height, testname);
+ is(element.offsetParent, parent, testname + " offsetParent");
+}
+
+function checkScrollState(element, left, top, width, height, testname) {
+ checkCoords(element, "scroll", left, top, width, height, testname);
+}
+
+function checkClientState(element, left, top, width, height, testname) {
+ checkCoords(element, "client", left, top, width, height, testname);
+}
+
+function checkCoord(element, type, val, testname) {
+ if (val != -10000) {
+ is(element[type], Math.round(val), testname + " " + type);
+ }
+}
+
+function checkCoordFuzzy(element, type, val, fuzz, testname) {
+ if (val != -10000) {
+ let v = element[type];
+ ok(
+ Math.abs(v - Math.round(val)) <= fuzz,
+ `${testname} ${type}: ${v} vs. ${val}`
+ );
+ }
+}
+
+function checkCoords(element, type, left, top, width, height, testname) {
+ checkCoord(element, type + "Left", left, testname);
+ checkCoord(element, type + "Top", top, testname);
+
+ if (type == "scroll") {
+ // scrollWidth and scrollHeight can deviate by 1 pixel due to snapping.
+ checkCoordFuzzy(element, type + "Width", width, 1, testname);
+ checkCoordFuzzy(element, type + "Height", height, 1, testname);
+ } else {
+ checkCoord(element, type + "Width", width, testname);
+ checkCoord(element, type + "Height", height, testname);
+ }
+
+ if (usesSVGLayout(element)) {
+ return;
+ }
+
+ if (element.id == "outerpopup" && !element.parentNode.open) {
+ // closed popup
+ return;
+ }
+
+ if (element.id == "div-displaynone" || element.id == "nonappended") {
+ // hidden elements
+ ok(
+ element[type + "Width"] == 0 && element[type + "Height"] == 0,
+ element.id + " has zero " + type + " width and height"
+ );
+ }
+}
+
+function gcs(element, prop) {
+ var propVal =
+ usesSVGLayout(element) && (prop == "width" || prop == "height")
+ ? element.getAttribute(prop)
+ : getComputedStyle(element, "")[prop];
+ if (propVal == "auto" || element.id == "nonappended") {
+ return 0;
+ }
+ return parseFloat(propVal);
+}
diff --git a/dom/tests/mochitest/general/test_offsets.xhtml b/dom/tests/mochitest/general/test_offsets.xhtml
new file mode 100644
index 0000000000..ec789c8db6
--- /dev/null
+++ b/dom/tests/mochitest/general/test_offsets.xhtml
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="test_offsets.css" type="text/css"?>
+<!--
+ XUL Tests for client/scroll properties
+ -->
+<window title="Test Offset/Client/Scroll Properties" width="500" height="600"
+ style="margin: 1px !important"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="text/javascript" src="test_offsets.js"/>
+
+<vbox id="testelements" style="margin: 0; padding: 0; border: 0;">
+<vbox id="vbox" style="margin: 5px 0 0 2px;">
+ <vbox id="noscroll" align="start">
+ <button id="button1" label="Button One" style="margin: 0px; padding: 0; border: 0;"/>
+ <button id="button2" label="Button Two" style="width: 140px; height: 120px;"/>
+ </vbox>
+ <hbox align="start">
+ <vbox id="scrollbox" style="overflow: scroll; padding: 2px; margin: 3px; border: 4px solid green; max-width: 66px; max-height: 56px">
+ <label value="One" style="margin: 0"/>
+ <label id="scrollchild" value="Two"/>
+ <label value="Three"/>
+ <label id="lastline" value="This fourth label is much longer than the others"
+ style="margin: 0; padding: 0; border: 0;"/>
+ </vbox>
+ <vbox id="scrollbox-test">
+ <scrollbar orient="vertical" style="border: 0; padding: 0;"/>
+ </vbox>
+ </hbox>
+</vbox>
+
+<!-- wrap svg in a div so that it can take its intrinsic width -->
+<div>
+<svg:svg id="svgbase" width="45" height="20" xmlns:svg="http://www.w3.org/2000/svg">
+ <svg:rect id="svgrect" x="3" y="5" width="45" height="20" fill="red"/>
+</svg:svg>
+</div>
+
+</vbox>
+
+<button id="outermenu" type="menu" label="Menu">
+ <menupopup id="outerpopup"
+ style="margin-left: 5px; padding-left: 3px; padding: 0;"
+ onpopupshown="this.firstChild.open = true"
+ onpopuphidden="if (event.target == this) SimpleTest.finish();">
+ <menu id="innermenu" label="Open"
+ style="margin: 0; padding: 0; border: 2px black solid; -moz-appearance: none;">
+ <menupopup style="margin: 0; padding: 0; border: 1px black solid; -moz-appearance: none;"
+ onpopupshown="testElements('outermenu', doneTests)">
+ <menuitem label="Document"/>
+ <menuitem id="innermenuitem" style="margin: 2px; padding: 3px;" label="Page"/>
+ </menupopup>
+ </menu>
+ <menuitem id="outermenuitem" label="Close"/>
+ </menupopup>
+</button>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+
+var gTestSet = "box";
+
+var whichpopup = "outer";
+
+SimpleTest.waitForExplicitFinish();
+
+function startTests()
+{
+ testElements('testelements', doneTests);
+}
+
+function doneTests()
+{
+ if (gTestSet == "box") {
+ gTestSet = "popup";
+ // only test this on Mac for now
+ if (navigator.platform.includes("Mac")) {
+ checkScrollState($("outerpopup"), 0, 0, 0, 0, "popup before open");
+ checkClientState($("outerpopup"), 0, 0, 0, 0, "popup before open");
+ }
+ $("outermenu").open = true;
+ }
+ else {
+ $("outermenu").open = false;
+ }
+}
+
+SimpleTest.waitForFocus(startTests);
+
+]]>
+</script>
+
+</window>
diff --git a/dom/tests/mochitest/general/test_outerHTML.html b/dom/tests/mochitest/general/test_outerHTML.html
new file mode 100644
index 0000000000..b4ebf4e866
--- /dev/null
+++ b/dom/tests/mochitest/general/test_outerHTML.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=92264
+-->
+<head>
+ <title>Test for Bug 92264</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body onload="runTest();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=92264">Mozilla Bug 92264</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<div id="wrap"><dl></dl><p id="thep">foo<span>bar</span></p><ol></ol></div>
+<table id="thetable"><tbody><tr><td>1</td></tr><tr id="thetr"><td>2</td></tr><tr><td>3</td></tr></tbody></table>
+<iframe></iframe>
+<div id="fragmentwrap"></div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 92264 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+
+ var thep = document.getElementById("thep");
+ var wrap = document.getElementById("wrap");
+ is(thep.outerHTML, '<p id="thep">foo<span>bar</span></p>', "Unexpected thep outerHTML");
+ thep.outerHTML = "<ul></ul><tr></tr><p></p>";
+ is(wrap.innerHTML, "<dl></dl><ul></ul><p></p><ol></ol>", "Bad outerHTML parsing inside wrap");
+
+ var thetr = document.getElementById("thetr");
+ thetr.outerHTML = "<tr><td>a</td></tr><div></div><tr><td>b</td></tr>";
+ var thetable = document.getElementById("thetable");
+ is(thetable.innerHTML, "<tbody><tr><td>1</td></tr><tr><td>a</td></tr><div></div><tr><td>b</td></tr><tr><td>3</td></tr></tbody>", "Wrong outerHTML parsing inside table");
+
+ var iframe = document.getElementsByTagName("iframe")[0];
+ var oldbody = iframe.contentDocument.body;
+ iframe.contentDocument.body.outerHTML = "<body></body>";
+ isnot(oldbody, iframe.contentDocument.body, "Failed to replace body");
+ is(iframe.contentDocument.getElementsByTagName("body").length, 1, "Should have gotten one body");
+ // Yes, two heads per spec. Also Ragnarök and Chrome produce two heads.
+ is(iframe.contentDocument.getElementsByTagName("head").length, 2, "Should have gotten two heads");
+
+ try {
+ document.documentElement.outerHTML = "<html></html>";
+ ok(false, "Should have thrown an exception");
+ } catch(e) {
+ is(e.name, "NoModificationAllowedError", "outerHTML should throw NoModificationAllowedError");
+ is(e.code, 7, "outerHTML should throw NO_MODIFICATION_ALLOWED_ERR");
+ }
+
+ var f = document.createDocumentFragment();
+ var dl = document.createElement("dl");
+ var p = document.createElement("p");
+ var ol = document.createElement("ol");
+ f.appendChild(dl);
+ f.appendChild(p);
+ f.appendChild(ol);
+ p.outerHTML = "<ul></ul><tr></tr><body></body><p></p>";
+ var fragmentwrap = document.getElementById("fragmentwrap");
+ fragmentwrap.appendChild(f);
+ is(fragmentwrap.innerHTML, "<dl></dl><ul></ul><p></p><ol></ol>", "Bad outerHTML parsing in fragment");
+
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_outerHTML.xhtml b/dom/tests/mochitest/general/test_outerHTML.xhtml
new file mode 100644
index 0000000000..45d7a629b1
--- /dev/null
+++ b/dom/tests/mochitest/general/test_outerHTML.xhtml
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=92264
+-->
+<head>
+ <title>Test for Bug 92264</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body onload="runTest();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=92264">Mozilla Bug 92264</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<div id="wrap"><dl></dl><p id="thep">foo<span>bar</span></p><ol></ol></div>
+<table id="thetable"><tbody><tr><td>1</td></tr><tr id="thetr"><td>2</td></tr><tr><td>3</td></tr></tbody></table>
+<iframe></iframe>
+<div id="fragmentwrap"></div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+<![CDATA[
+
+/** Test for Bug 92264 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+
+ var thep = document.getElementById("thep");
+ var wrap = document.getElementById("wrap");
+ is(thep.outerHTML, '<p xmlns="http://www.w3.org/1999/xhtml" id="thep">foo<span>bar</span></p>', "Unexpected thep outerHTML");
+ thep.outerHTML = "<ul></ul><tr></tr><p></p>";
+ is(wrap.innerHTML, '<dl xmlns="http://www.w3.org/1999/xhtml"></dl><ul xmlns="http://www.w3.org/1999/xhtml"></ul><tr xmlns="http://www.w3.org/1999/xhtml"></tr><p xmlns="http://www.w3.org/1999/xhtml"></p><ol xmlns="http://www.w3.org/1999/xhtml"></ol>', "Bad outerHTML parsing inside wrap");
+
+ var thetr = document.getElementById("thetr");
+ thetr.outerHTML = "<tr><td>a</td></tr><div></div><tr><td>b</td></tr>";
+ var thetable = document.getElementById("thetable");
+ is(thetable.innerHTML, '<tbody xmlns="http://www.w3.org/1999/xhtml"><tr><td>1</td></tr><tr><td>a</td></tr><div></div><tr><td>b</td></tr><tr><td>3</td></tr></tbody>', "Wrong outerHTML parsing inside table");
+
+ var iframe = document.getElementsByTagName("iframe")[0];
+ var oldbody = iframe.contentDocument.body;
+ iframe.contentDocument.body.outerHTML = "<body></body>";
+ isnot(oldbody, iframe.contentDocument.body, "Failed to replace body");
+ is(iframe.contentDocument.getElementsByTagName("body").length, 1, "Should have gotten one body");
+ // Yes, two heads per spec. Also Ragnarök and Chrome produce two heads.
+ is(iframe.contentDocument.getElementsByTagName("head").length, 2, "Should have gotten two heads");
+
+ try {
+ document.documentElement.outerHTML = "<html></html>";
+ ok(false, "Should have thrown an exception");
+ } catch(e) {
+ is(e.name, "NoModificationAllowedError", "outerHTML should throw NoModificationAllowedError");
+ is(e.code, 7, "outerHTML should throw NO_MODIFICATION_ALLOWED_ERR");
+ }
+
+ var f = document.createDocumentFragment();
+ var dl = document.createElement("dl");
+ var p = document.createElement("p");
+ var ol = document.createElement("ol");
+ f.appendChild(dl);
+ f.appendChild(p);
+ f.appendChild(ol);
+ p.outerHTML = "<ul></ul><tr></tr><body></body><p></p>";
+ var fragmentwrap = document.getElementById("fragmentwrap");
+ fragmentwrap.appendChild(f);
+ is(fragmentwrap.innerHTML, '<dl xmlns="http://www.w3.org/1999/xhtml"></dl><ul xmlns="http://www.w3.org/1999/xhtml"></ul><tr xmlns="http://www.w3.org/1999/xhtml"></tr><body xmlns="http://www.w3.org/1999/xhtml"></body><p xmlns="http://www.w3.org/1999/xhtml"></p><ol xmlns="http://www.w3.org/1999/xhtml"></ol>', "Bad outerHTML parsing in fragment");
+
+ SimpleTest.finish();
+}
+]]>
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_paste_selection.html b/dom/tests/mochitest/general/test_paste_selection.html
new file mode 100644
index 0000000000..b39915d165
--- /dev/null
+++ b/dom/tests/mochitest/general/test_paste_selection.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for middle-click to paste selection with paste events</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<input id="copy-area" value="CLIPBOARD">
+<input id="paste-selection-area" value="" onpaste="pastedSelection(event)">
+<input id="paste-global-area" value="" onpaste="pastedGlobal(event)">
+
+<script>
+
+var supportsSelectionClipboard = SpecialPowers.supportsSelectionClipboard();
+
+function checkSelectionClipboardText(count)
+{
+ if ((!supportsSelectionClipboard ||
+ SpecialPowers.getClipboardData("text/plain", SpecialPowers.Ci.nsIClipboard.kSelectionClipboard) == "COPY TEXT") &&
+ SpecialPowers.getClipboardData("text/plain", SpecialPowers.Ci.nsIClipboard.kGlobalClipboard) == "CLIPBOARD") {
+ pasteArea();
+ return;
+ }
+
+ if (count > 10) {
+ ok(false, "could not set clipboards");
+ pasteArea();
+ SimpleTest.finish();
+ return;
+ }
+
+ setTimeout(checkSelectionClipboardText, 5, count + 1);
+}
+
+function selectArea()
+{
+ var copyArea = document.getElementById("copy-area");
+ copyArea.focus();
+ copyArea.select();
+ synthesizeKey("x", { accelKey: true });
+
+ if (supportsSelectionClipboard) {
+ var clipboardHelper = SpecialPowers.Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(SpecialPowers.Ci.nsIClipboardHelper);
+ clipboardHelper.copyStringToClipboard("COPY TEXT",
+ SpecialPowers.Ci.nsIClipboard.kSelectionClipboard);
+ }
+
+ setTimeout(checkSelectionClipboardText, 50, 0);
+}
+
+var selectionPasted = false;
+var globalPasted = false;
+
+function pasteArea()
+{
+ var pasteArea = document.getElementById("paste-selection-area");
+ var pasteAreaRect = pasteArea.getBoundingClientRect();
+ var pasteAreaCenterX = pasteAreaRect.left + pasteAreaRect.width/2;
+ var pasteAreaCenterY = pasteAreaRect.top + pasteAreaRect.height/2;
+ var util = SpecialPowers.getDOMWindowUtils(window);
+
+ pasteArea.focus();
+ util.sendMouseEventToWindow("mousedown", pasteAreaCenterX, pasteAreaCenterY, 1, 1, 0, true);
+ util.sendMouseEventToWindow("mouseup", pasteAreaCenterX, pasteAreaCenterY, 1, 1, 0, true);
+
+ var usesMouseButtonPaste = SpecialPowers.getBoolPref("middlemouse.paste");
+ if (usesMouseButtonPaste) {
+ // The data transfer should contain the selection data when the selection clipboard is supported,
+ // not the global clipboard data.
+ var expectedText = supportsSelectionClipboard ? "COPY TEXT" : "CLIPBOARD";
+ is(document.getElementById("paste-selection-area").value, expectedText, "In pasteArea(): data pasted properly from selection");
+ ok(selectionPasted, "selection event fired");
+ }
+ else {
+ is(pasteArea.value, "", "data not pasted when middle click not supported");
+ }
+
+ var pasteArea = document.getElementById("paste-global-area");
+ pasteArea.focus();
+ synthesizeKey("v", { accelKey: true });
+
+ ok(globalPasted, "global event fired");
+ is(document.getElementById("paste-global-area").value, "CLIPBOARD", "data pasted properly from global clipboard");
+ SimpleTest.finish();
+}
+
+function pastedSelection(event)
+{
+ ok(SpecialPowers.getBoolPref("middlemouse.paste"), "paste on middle click is valid");
+
+ // Mac and Windows shouldn't get here as the middle mouse preference is false by default
+ ok(!navigator.platform.includes("Mac") && !navigator.platform.includes("Win"), "middle click enabled on right platforms");
+
+ var expectedText = supportsSelectionClipboard ? "COPY TEXT" : "CLIPBOARD";
+ is(event.clipboardData.getData("text/plain"), expectedText, "In pastedSelection(): data pasted properly from selection");
+
+ selectionPasted = true;
+}
+
+function pastedGlobal(event)
+{
+ // The data transfer should contain the global data.
+ is(event.clipboardData.getData("text/plain"), "CLIPBOARD", "data correct in global clipboard data transfer");
+ globalPasted = true;
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+SimpleTest.waitForFocus(function() {
+ SpecialPowers.pushPrefEnv({"set": [["general.autoScroll", false]]}, selectArea);
+});
+</script>
+
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/general/test_performance_nav_timing_before_onload.html b/dom/tests/mochitest/general/test_performance_nav_timing_before_onload.html
new file mode 100644
index 0000000000..af85a6edab
--- /dev/null
+++ b/dom/tests/mochitest/general/test_performance_nav_timing_before_onload.html
@@ -0,0 +1,30 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1405961 - Using PerformanceNavigationTiming before onload</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <div id="content"> </div>
+ <script>
+ SimpleTest.waitForExplicitFinish();
+
+ SpecialPowers.pushPrefEnv({"set": [["dom.enable_performance_navigation_timing", true]]}, start);
+
+ function start() {
+ var p = performance.getEntriesByName(window.location.href)[0];
+ ok(!!p, "There should be an entry for the document");
+ document.getElementById("content").textContent += JSON.stringify(p);
+
+ SimpleTest.finish();
+ }
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_performance_now.html b/dom/tests/mochitest/general/test_performance_now.html
new file mode 100644
index 0000000000..23f5f45969
--- /dev/null
+++ b/dom/tests/mochitest/general/test_performance_now.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for High Resolution Timer</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <script>
+ ok(window.performance, "Performance object should exist.");
+ ok(typeof window.performance.now == 'function', "Performance object should have a 'now' method.");
+ var n = window.performance.now(), d = Date.now();
+ ok(n >= 0, "The value of now() should be equal to or greater than 0.");
+ ok(window.performance.now() >= n, "The value of now() should monotonically increase.");
+
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.requestFlakyTimeout("using setTimeout() to measure performance.now()");
+
+ // Spin on setTimeout() until performance.now() increases. Due to recent
+ // security developments, the hr-time working group has not yet reached
+ // consensus on what the recommend minimum clock resolution should be:
+ // https://w3c.github.io/hr-time/#clock-resolution
+ // Since setTimeout might return too early/late, our goal is for
+ // performance.now() to increase before a 2 ms deadline rather than specific
+ // number of setTimeout(N) invocations.
+ // See bug 749894 (intermittent failures of this test)
+ var checks = 0;
+
+ function checkAfterTimeout() {
+ checks++;
+ var d2 = Date.now();
+ var n2 = window.performance.now();
+
+ // Spin on setTimeout() until performance.now() increases. Abort the
+ // test if it runs for more than 2 ms or 50 timeouts.
+ let elapsedTime = d2 - d;
+ let elapsedPerf = n2 - n;
+ if (elapsedPerf == 0 && elapsedTime < 2 && checks < 50) {
+ setTimeout(checkAfterTimeout, 1);
+ return;
+ }
+
+ // Our implementation provides 1 ms resolution (bug 1451790).
+ ok(elapsedPerf >= 1,
+ `Loose - the value of now() should increase by no less than 1 ms ` +
+ `after 2 ms. delta now(): ${elapsedPerf} ms`);
+
+ // If we need more than 1 iteration, then either performance.now()
+ // resolution is shorter than 1 ms or setTimeout() is returning too early.
+ ok(checks == 1,
+ `Strict - the value of now() should increase after one setTimeout. ` +
+ `iters: ${checks}, dt: ${elapsedTime}, now(): ${n2}`);
+
+ SimpleTest.finish();
+ };
+ setTimeout(checkAfterTimeout, 1);
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_performance_timeline.html b/dom/tests/mochitest/general/test_performance_timeline.html
new file mode 100644
index 0000000000..e0ec357ab7
--- /dev/null
+++ b/dom/tests/mochitest/general/test_performance_timeline.html
@@ -0,0 +1,35 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+// Resource timing is prefed off by default, so we had to use this workaround
+SpecialPowers.pushPrefEnv({"set": [["dom.enable_resource_timing", true]]}, start);
+var subwindow = null;
+
+function start() {
+ subwindow = window.open("performance_timeline_main_test.html");
+}
+
+function finishTests() {
+ subwindow.close();
+ SimpleTest.finish();
+}
+</script>
+</pre>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_picture_apng.html b/dom/tests/mochitest/general/test_picture_apng.html
new file mode 100644
index 0000000000..8fc37c04c2
--- /dev/null
+++ b/dom/tests/mochitest/general/test_picture_apng.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+
+<head>
+ <meta charset="utf-8">
+ <title>Image srcset mutations</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<script type="application/javascript">
+"use strict";
+window.onload = function() {
+ // Smoke test, check picture working as expected
+ const t0 = document.querySelector("#test0 img");
+ ok(t0.currentSrc.endsWith("apng"), `t0: expected pass.apng, got '${t0.currentSrc}'`);
+
+ // Test that the apng is selected over bogus types.
+ const t1 = document.querySelector("#test1 img");
+ ok(t1.currentSrc.endsWith("apng"), `t1: expected pass.apng, got '${t1.currentSrc}'`);
+
+ // Test that tree order precedence applies
+ const t2 = document.querySelector("#test2 img");
+ ok(t2.currentSrc.endsWith("apng"), `t2: expected pass.apng, got '${t2.currentSrc}'`);
+
+ // Test that apng doesn't alway win
+ const t3 = document.querySelector("#test3 img");
+ ok(t3.currentSrc.endsWith("apng"), `t3: expected pass.apng, got '${t3.currentSrc}'`);
+
+ // Test dynamically constructed picture, where apng is selected over a bogus
+ // source or the img src attribute
+ const pic = document.createElement("picture");
+ pic.id = "test4";
+ const t4 = document.createElement("img");
+ const bogusSource = document.createElement("source");
+ bogusSource.type = "bogus/bogus";
+ bogusSource.srcset = "fail.png";
+ const legitSource = document.createElement("source");
+ legitSource.type = "image/apng";
+ legitSource.srcset = "pass.apng";
+ pic.appendChild(bogusSource);
+ pic.appendChild(legitSource);
+ pic.appendChild(t4);
+ t4.src = "fail.png";
+ document.body.appendChild(pic);
+ t4.onload = ()=>{
+ ok(t4.currentSrc.endsWith("apng"), `t4: Expected pass.apng, got '${t4.currentSrc}'`);
+ SimpleTest.finish();
+ }
+};
+SimpleTest.waitForExplicitFinish();
+</script>
+
+<body>
+ <picture id="test0">
+ <source>
+ <img src="pass.apng">
+ </picture>
+ <picture id="test1">
+ <source type="bogus/type" srcset="fail.png">
+ <source type="image/apng" srcset="pass.apng">
+ <source type="image/jpeg" srcset="fail.png">
+ <img src="fail-fallback">
+ </picture>
+ <picture id="test2">
+ <source type="image/png" srcset="pass.apng">
+ <source srcset="fail.png">
+ <source type="bogus/type" srcset="fail.png">
+ <img src="fail-fallback">
+ </picture>
+ <picture id="test3">
+ <source type="image/jpeg" srcset="pass.apng">
+ <source type="image/apng" srcset="fail.png">
+ <img src="fail-fallback">
+ </picture>
+</body>
+
+</html>
diff --git a/dom/tests/mochitest/general/test_picture_mutations.html b/dom/tests/mochitest/general/test_picture_mutations.html
new file mode 100644
index 0000000000..b311ffc8a2
--- /dev/null
+++ b/dom/tests/mochitest/general/test_picture_mutations.html
@@ -0,0 +1,311 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Image srcset mutations</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <script type="application/javascript">
+ "use strict";
+
+ // Tests the relevant mutations part of the spec for <img> inside <picture> tags
+ // https://html.spec.whatwg.org/#relevant-mutations
+ SimpleTest.waitForExplicitFinish();
+
+ // 50x50 png
+ var testPNG50 = new URL("image_50.png", location).href;
+ // 100x100 png
+ var testPNG100 = new URL("image_100.png", location).href;
+ // 200x200 png
+ var testPNG200 = new URL("image_200.png", location).href;
+
+ var tests = [];
+ var img;
+ var picture;
+ var source1;
+ var source2;
+ var source3;
+ var expectingErrors = 0;
+ var expectingLoads = 0;
+ var afterExpectCallback;
+
+ function onImgLoad() {
+ ok(expectingLoads > 0, "expected load");
+ if (expectingLoads > 0) {
+ expectingLoads--;
+ }
+ if (!expectingLoads && !expectingErrors) {
+ setTimeout(afterExpectCallback, 0);
+ }
+ }
+ function onImgError() {
+ ok(expectingErrors > 0, "expected error");
+ if (expectingErrors > 0) {
+ expectingErrors--;
+ }
+ if (!expectingLoads && !expectingErrors) {
+ setTimeout(afterExpectCallback, 0);
+ }
+ }
+ function expectEvents(loads, errors, callback) {
+ if (!loads && !errors) {
+ setTimeout(callback, 0);
+ } else {
+ expectingLoads += loads;
+ expectingErrors += errors;
+ info("Waiting for " + expectingLoads + " load and " + expectingErrors + " error events");
+ afterExpectCallback = callback;
+ }
+ }
+
+ // Setup image outside the tree dom, make sure it loads
+ tests.push(function() {
+ info("test 1");
+ img.srcset = testPNG100;
+ img.src = testPNG50;
+ is(img.currentSrc, '', "Should not have synchronously selected source");
+
+ // No events should have fired synchronously, now we should get just one load (and no 404 error)
+ expectEvents(1, 0, nextTest);
+ });
+
+ // Binding to an empty picture should trigger an event, even if source doesn't change
+ tests.push(function() {
+ info("test 2");
+ is(img.currentSrc, testPNG100, "Should have loaded testPNG100");
+ document.body.appendChild(picture);
+ picture.appendChild(img);
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ expectEvents(1, 0, nextTest);
+ });
+
+ // inserting and removing an empty source before the image should both trigger a no-op reload
+ tests.push(function() {
+ info("test 3");
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+ picture.insertBefore(source1, img);
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // should fire one event, not change source
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+ picture.removeChild(source1);
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // Should also no-op fire
+ expectEvents(1, 0, nextTest);
+ });
+ });
+
+ // insert and remove valid source before
+ tests.push(function() {
+ info("test 4");
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // Insert source1 before img with valid candidate
+ source1.srcset = testPNG50;
+ picture.insertBefore(source1, img);
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // should fire one event, change to the source
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should have switched to testPNG50");
+ picture.removeChild(source1);
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+
+ // Should also no-op fire
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should have returned to testPNG100");
+ nextTest();
+ });
+ });
+ });
+
+ // insert and remove valid source after
+ tests.push(function() {
+ info("test 5");
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // Insert source1 before img with valid candidate
+ source1.srcset = testPNG50;
+ picture.appendChild(source1);
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // should fire nothing, no action
+ expectEvents(0, 0, function() {
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // Same with removing
+ picture.removeChild(source1);
+ expectEvents(0, 0, function() {
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+ nextTest();
+ });
+ });
+ });
+
+ // Should re-consider earlier sources when a load event occurs.
+ tests.push(function() {
+ info("test 6");
+
+ // Insert two valid sources, with MQ causing us to select the second
+ source1.srcset = testPNG50 + " 1x";
+ source1.media = "(min-resolution: 2dppx)"; // Wont match, test starts at 1x
+ source2.srcset = testPNG200;
+ picture.insertBefore(source1, img);
+ picture.insertBefore(source2, img);
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // should get one load, selecting source2
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG200, "Should have selected testPNG200");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should have switched to testPNG50");
+
+ // Now add a source *also* wanting that DPI *just before* the
+ // selected source. Properly re-running the algorithm should
+ // re-consider all sources and thus go back to the first
+ // source, not just the valid source just inserted before us.
+ source3.media = source1.media;
+ source3.srcset = testPNG100;
+ picture.insertBefore(source3, source2);
+ // This should trigger a reload, but we should re-consider
+ // source1 and remain with that, not just the newly added source2
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should have remained on testPNG50");
+ expectEvents(0, 0, nextTest);
+ });
+ });
+
+ // Switch DPI to match the first source.
+ SpecialPowers.pushPrefEnv({'set': [ ["layout.css.devPixelsPerPx", "2.0"] ] });
+ });
+ });
+
+ // insert and remove valid source after our current source should
+ // trigger a reload, but not switch source
+ tests.push(function() {
+ info("test 7");
+ // Should be using source1 from last test
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+
+ // Remove source2, should trigger an event even though we would
+ // not switch
+
+ picture.removeChild(source2);
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+
+ // Same with re-adding
+ picture.insertBefore(source2, img);
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+ expectEvents(0, 0, nextTest);
+ });
+ });
+ });
+
+ // Changing source attributes should trigger updates
+ tests.push(function() {
+ info("test 8");
+ // Should be using source1 from last test
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+
+ // Reconfigure source1 to have empty srcset. Should switch to
+ // next source due to becoming invalid.
+ source1.srcset = "";
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should have switched to testPNG100");
+
+ // Give source1 valid sizes. Should trigger an event but not switch anywhere.
+ source1.sizes = "100vw";
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG100, "Should still have testPNG100");
+
+ // And a valid MQ
+ source1.media = "(min-resolution: 1dppx)";
+ expectEvents(1, 0, function() {
+ // And a valid type...
+ source1.type = "image/png";
+ expectEvents(1, 0, function() {
+ // Finally restore srcset, should trigger load and re-consider source1 which is valid again
+ source1.srcset = testPNG50;
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should have selected testPNG50");
+ expectEvents(0, 0, nextTest);
+ });
+ });
+ });
+ });
+ });
+ });
+
+ // Inserting a source after <img> and touching its attributes should all be no-ops
+ tests.push(function() {
+ info("test 9");
+ // Setup: source2
+ picture.removeChild(source2);
+
+ expectEvents(1, 0, function() {
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+
+ source2.srcset = testPNG200;
+ source2.media = "";
+ source2.sizes = "100vw";
+ source2.type = "image/png";
+ // Append valid source
+ picture.appendChild(source2);
+ // Touch all the things (but keep it valid)
+ source2.srcset = testPNG100;
+ source2.media = "(min-resolution: 2dppx)";
+ source2.sizes = "50vw";
+ source2.type = "image/png";
+
+ // No event should fire. Source should not change.
+ expectEvents(0, 0, function() {
+ is(img.currentSrc, testPNG50, "Should still have testPNG50");
+ expectEvents(0, 0, nextTest);
+ });
+ });
+ });
+
+ function nextTest() {
+ if (tests.length) {
+ // Spin event loop to make sure no unexpected image events are
+ // pending (unexpected events will assert in the handlers)
+ setTimeout(function() {
+ (tests.shift())();
+ }, 0);
+ } else {
+ // We'll get a flood of load events due to prefs being popped while cleaning up.
+ // Ignore it all.
+ img.removeEventListener("load", onImgLoad);
+ img.removeEventListener("error", onImgError);
+ SimpleTest.finish();
+ }
+ }
+
+ addEventListener("load", function() {
+ SpecialPowers.pushPrefEnv({'set': [["layout.css.devPixelsPerPx", "1.0" ]] },
+ function() {
+ // Create these after the pref is set, as it is guarding webIDL attributes
+ img = document.createElement("img");
+ img.addEventListener("load", onImgLoad);
+ img.addEventListener("error", onImgError);
+ picture = document.createElement("picture");
+ source1 = document.createElement("source");
+ source2 = document.createElement("source");
+ source3 = document.createElement("source");
+ setTimeout(nextTest, 0);
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_pointerPreserves3D.html b/dom/tests/mochitest/general/test_pointerPreserves3D.html
new file mode 100644
index 0000000000..d99403002d
--- /dev/null
+++ b/dom/tests/mochitest/general/test_pointerPreserves3D.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for pointer events with preserve-3d</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div>
+ <div>
+ <div style="transform-style: preserve-3d; transform: rotateX(90deg);">
+ <div id="color" style="transform: rotateX(-90deg); display: block; background-color: blue; width: 200px; height: 200px;"></div>
+ </div>
+ </div>
+</div>
+<script class="testbody" type="text/javascript">
+function runTest() {
+ var target = document.elementFromPoint(100, 110);
+ ok(target == document.getElementById("color"), "Find the right target.");
+}
+
+runTest();
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_pointerPreserves3DClip.html b/dom/tests/mochitest/general/test_pointerPreserves3DClip.html
new file mode 100644
index 0000000000..82f64f5969
--- /dev/null
+++ b/dom/tests/mochitest/general/test_pointerPreserves3DClip.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for pointer events with preserve-3d and clips</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <style type="text/css">
+ .outer {
+ transform-style: preserve-3d;
+ }
+ .container {
+ overflow-y: scroll;
+ overflow-x: hidden;
+ width: 200px;
+ height: 300px;
+ }
+ .content {
+ width: 200px;
+ height: 1000px;
+ transform-style: preserve-3d;
+ }
+ #container1 {
+ background-color: green;
+ transform: translateZ(2px);
+ }
+ #container2 {
+ height: 100px;
+ transform: translateY(-200px) translateZ(10px);
+ background-color: red;
+ }
+ </style>
+ </head>
+ <body onload="runTest();">
+ <div class="outer" id="outer">
+ <div class="container" id="container1">
+ <div class="content"></div>
+ </div>
+ <div class="container" id="container2">
+ <div class="content"></div>
+ </div>
+ </div>
+<script class="testbody" type="text/javascript">
+function runTest() {
+ var outer = document.getElementById("outer");
+ var x = outer.offsetLeft;
+ var y = outer.offsetTop;
+ var target = document.elementFromPoint(x + 100, y + 250);
+ ok(target.parentNode == document.getElementById("container1"), "Find the right target.");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+</script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/test_pointerPreserves3DPerspective.html b/dom/tests/mochitest/general/test_pointerPreserves3DPerspective.html
new file mode 100644
index 0000000000..4feaf03551
--- /dev/null
+++ b/dom/tests/mochitest/general/test_pointerPreserves3DPerspective.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for pointer events with preserve-3d</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div>
+ <div>
+ <div style="perspective: 100px; transform-style:preserve-3d; transform: translateX(100px)">
+ <div style="display:inline">
+ <div id="color" style="transform-style:flat; transform: translateX(-100px); display: block; background-color: blue; width: 200px; height: 200px;"></div>
+ </div>
+ </div>
+ </div>
+</div>
+<script class="testbody" type="text/javascript">
+function runTest() {
+ var target = document.elementFromPoint(200, 200);
+ ok(target == document.getElementById("color"), "Find the right target.");
+ var target = document.elementFromPoint(16, 16);
+ ok(target == document.getElementById("color"), "Find the right target.");
+}
+
+runTest();
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_resizeby.html b/dom/tests/mochitest/general/test_resizeby.html
new file mode 100644
index 0000000000..4826e538a0
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resizeby.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Bug 1369627</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+
+
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1369627">Mozilla Bug 1369627</a>
+<p id="display"></p>
+<div id="content">
+ <button id="clicky">clicky</button>
+</div>
+<pre id="test">
+</pre>
+
+<script>
+ /** Test for Bug 1369627 **/
+ add_task(async function resizeby() {
+ await SimpleTest.promiseFocus();
+
+ let clicky = document.querySelector("#clicky");
+
+ let popupPromise = new Promise(resolve => {
+ let linkclick = () => {
+ clicky.removeEventListener('click', linkclick);
+ let popup = window.open("about:blank", "_blank", "width=500,height=500");
+ function loaded() {
+ is(popup.innerHeight, 500, "starting width is 500");
+ is(popup.innerWidth, 500, "starting height in 500");
+
+ popup.resizeBy(50, 0);
+
+ // We resized synchronously. If this happened, we sometimes won't fire
+ // an resize event, so we resolve immediately.
+ if (popup.innerWidth == 550) {
+ resolve(popup);
+ } else {
+ let popupresize = () => {
+ popup.removeEventListener('resize', popupresize);
+ resolve(popup);
+ };
+ popup.addEventListener('resize', popupresize);
+ }
+ };
+ popup.addEventListener("load", loaded, { once: true })
+ };
+
+ clicky.addEventListener('click', linkclick);
+ });
+
+ synthesizeMouseAtCenter(clicky, {}, window);
+
+ let popup = await popupPromise;
+ is(popup.innerHeight, 500, "ending height is 500");
+ is(popup.innerWidth, 550, "ending width is 550");
+ popup.close();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_resource_timing.html b/dom/tests/mochitest/general/test_resource_timing.html
new file mode 100644
index 0000000000..4b45d69941
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resource_timing.html
@@ -0,0 +1,40 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=822480
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+// Resource timing is prefed off by default, so we had to use this workaround
+SpecialPowers.pushPrefEnv({"set": [
+ ["dom.enable_resource_timing", true],
+ ["privacy.reduceTimerPrecision", false]]}, start);
+var subwindow = null;
+
+function start() {
+ subwindow = window.open("resource_timing_main_test.html");
+}
+
+function finishTests() {
+ subwindow.close();
+ SimpleTest.finish();
+}
+</script>
+</pre>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_resource_timing_cross_origin.html b/dom/tests/mochitest/general/test_resource_timing_cross_origin.html
new file mode 100644
index 0000000000..bef092abde
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resource_timing_cross_origin.html
@@ -0,0 +1,47 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=822480
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+// Resource timing is prefed off by default, so we had to use this workaround
+var subwindow = null;
+SpecialPowers.pushPrefEnv({"set": [
+ ["dom.enable_resource_timing", true],
+ ["privacy.reduceTimerPrecision", false]]}, start);
+
+function start() {
+ subwindow = window.open("resource_timing_cross_origin.html");
+}
+
+function finishTests() {
+ subwindow.close();
+ SpecialPowers.pushPrefEnv({"clear":[["dom.enable_resource_timing"]]}, SimpleTest.finish);
+}
+
+</script>
+</pre>
+
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=936814"
+ title="Cross origin resource timing">
+ Bug #936814 - Implement the "timing allow check algorithm" for cross-origin Resource Timing
+</a>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_resource_timing_cross_origin_navigate.html b/dom/tests/mochitest/general/test_resource_timing_cross_origin_navigate.html
new file mode 100644
index 0000000000..133e9a0c8a
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resource_timing_cross_origin_navigate.html
@@ -0,0 +1,73 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1789128
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<pre id="test">
+<script type="application/javascript">
+
+</script>
+</pre>
+
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1789128"
+ title="Cross origin resource timing">
+ Bug #1789128 - Cross-Origin URL Steal is possible using performance.getEntries()
+</a>
+
+<script type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+let domains = [
+ // resource_timing_location_navigate.html navigates via document.location
+ "https://example.org",
+ // resource_timing_meta_refresh.html redirects via meta refresh
+ "https://test2.example.org",
+ // resource_timing_redirect.html redirects via 302 redirect
+ "https://test1.example.org",
+ // embed_navigate.html navigates via document.location
+ "https://sub1.test1.example.org",
+ ];
+
+
+let redirectResolves = {};
+
+window.addEventListener("message", (event) => {
+ console.log("message", event);
+ redirectResolves[event.origin]();
+});
+
+// Wait for all iframes to navigate.
+Promise.all(domains.map(domain => {
+ return new Promise(resolve => {
+ redirectResolves[domain] = resolve;
+ })
+})).then(() => {
+ // Check resource timing for iframes.
+ for (let e of performance.getEntries()) {
+ ok(!e.name.includes("example.org"), `${e.name} cross origin should not be present in resource timing`)
+ }
+ SimpleTest.finish();
+});
+
+</script>
+
+<iframe src="resource_timing_location_navigate.html"></iframe>
+<iframe src="resource_timing_meta_refresh.html"></iframe>
+<iframe src="resource_timing_redirect.html"></iframe>
+<embed src="embed_navigate.html">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_resource_timing_frameset.html b/dom/tests/mochitest/general/test_resource_timing_frameset.html
new file mode 100644
index 0000000000..245bd382ee
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resource_timing_frameset.html
@@ -0,0 +1,29 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>browser_frametree_sample_frameset.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+
+ <script type="text/javascript">
+ SimpleTest.waitForExplicitFinish();
+ window.addEventListener("load", function() {
+ var frameEntries = performance.getEntriesByName("http://mochi.test:8888/tests/dom/base/test/file_empty.html");
+
+ is(frameEntries.length, 2, "correct number");
+ is(frameEntries[0].initiatorType, "frame", "correct type");
+ SimpleTest.finish();
+ });
+ </script>
+ </head>
+ <frameset id="frames" rows="50%, 50%">
+ <frame src="http://mochi.test:8888/tests/dom/base/test/file_empty.html">
+ <frame src="http://mochi.test:8888/tests/dom/base/test/file_empty.html">
+ </frameset>
+</html>
diff --git a/dom/tests/mochitest/general/test_resource_timing_nocors.html b/dom/tests/mochitest/general/test_resource_timing_nocors.html
new file mode 100644
index 0000000000..388b8f9837
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resource_timing_nocors.html
@@ -0,0 +1,37 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1180145
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv({"set": [["dom.enable_resource_timing", true]]}, start);
+var subwindow = null;
+
+function start() {
+ subwindow = window.open("file_resource_timing_nocors.html");
+}
+
+function finishTests() {
+ subwindow.close();
+ SimpleTest.finish();
+}
+</script>
+</pre>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_selectevents.html b/dom/tests/mochitest/general/test_selectevents.html
new file mode 100644
index 0000000000..bcc3526492
--- /dev/null
+++ b/dom/tests/mochitest/general/test_selectevents.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Testing Selection Events</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+
+ <body>
+ <iframe width="500"></iframe>
+ <script>
+ add_task(async function() {
+ // Push the correct preferences for the test
+ await SpecialPowers.pushPrefEnv({'set': [
+ ['dom.select_events.textcontrols.enabled', true],
+ ]});
+
+ // Start the actual test
+ await new Promise((done) => {
+ var iframe = document.querySelector('iframe');
+ iframe.addEventListener('load', done);
+ iframe.setAttribute('src', 'frameSelectEvents.html');
+ });
+
+ // The child iframe will call add_task before we reach this point,
+ // and will handle the rest of the test.
+ });
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/test_showModalDialog_removed.html b/dom/tests/mochitest/general/test_showModalDialog_removed.html
new file mode 100644
index 0000000000..a5f85ffc8e
--- /dev/null
+++ b/dom/tests/mochitest/general/test_showModalDialog_removed.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1077002
+-->
+<head>
+ <title>Test for showModalDialog unavailability in e10s</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1077002">Mozilla Bug 1077002</a>
+<p id="display"></p>
+<div id="content">
+ <iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
+ <div id="status" style="display: none"></div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for showModalDialog unavailability in Firefox. **/
+
+// showModalDialog was removed in bug 981796.
+ok(!window.showModalDialog, "showModalDialog should not exist");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_spacetopagedown.html b/dom/tests/mochitest/general/test_spacetopagedown.html
new file mode 100644
index 0000000000..39b02bc0fa
--- /dev/null
+++ b/dom/tests/mochitest/general/test_spacetopagedown.html
@@ -0,0 +1,75 @@
+<html>
+<head>
+ <meta charset="utf-8">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+
+var windowUtils = SpecialPowers.getDOMWindowUtils(window);
+
+function pressKey(isShift)
+{
+ return new Promise(resolve => {
+ synthesizeKey(" ", { shiftKey: isShift });
+ windowUtils.advanceTimeAndRefresh(100);
+ SimpleTest.executeSoon(resolve);
+ });
+}
+
+function initTest()
+{
+ SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", false]]}, runTest);
+}
+
+function runTest()
+{
+ (async function() {
+ await pressKey(false);
+
+ ok(window.scrollY > 0, "Space with no focus" + window.scrollY);
+ await pressKey(true);
+ is(window.scrollY, 0, "Shift+Space with no focus");
+
+ let checkbox = document.getElementById("checkbox");
+ checkbox.focus();
+ await pressKey(false);
+
+ is(window.scrollY, 0, "Space with checkbox focused");
+ ok(checkbox.checked, "Space with checkbox focused, checked");
+ await pressKey(true);
+ is(window.scrollY, 0, "Shift+Space with checkbox focused");
+ ok(!checkbox.checked, "Space with checkbox focused, unchecked");
+
+ let input = document.getElementById("input");
+ input.focus();
+ await pressKey(false);
+ is(window.scrollY, 0, "Space with input focused");
+ is(input.value, " ", "Space with input focused, value");
+ await pressKey(true);
+ is(window.scrollY, 0, "Shift+Space with input focused");
+ is(input.value, " ", "Space with input focused, value");
+
+ windowUtils.restoreNormalRefresh();
+ SimpleTest.finish();
+ })();
+}
+
+ </script>
+</head>
+<body onload="SimpleTest.waitForFocus(initTest)">
+
+<input id="checkbox" type="checkbox">Checkbox
+<input id="input">
+<p style="height: 4000px">Text</p>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_storagePermissionsAccept.html b/dom/tests/mochitest/general/test_storagePermissionsAccept.html
new file mode 100644
index 0000000000..ddb33de9c3
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsAccept.html
@@ -0,0 +1,44 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="storagePermissionsUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <iframe></iframe>
+
+ <script type="text/javascript">
+
+task(async function() {
+ await setCookieBehavior(BEHAVIOR_ACCEPT);
+
+ await runTestInWindow(async function() {
+ // We should be able to access storage
+ await storageAllowed();
+
+ // Same origin iframes should be allowed, unless they redirect to a URI with the null principal
+ await runIFrame("frameStorageAllowed.html");
+ await runIFrame("frameStorageNullprincipal.sjs");
+ await runIFrame("frameStorageChrome.html?allowed=yes");
+
+ // Sandboxed iframes should have the null principal, and thus can't access storage
+ document.querySelector('iframe').setAttribute('sandbox', 'allow-scripts');
+ await runIFrame("frameStoragePrevented.html#nullprincipal");
+ await runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // Thirdparty iframes should be allowed, unless they redirect to a URI with the null principal
+ await runIFrame(thirdparty + "frameStorageAllowed.html");
+ await runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ await runIFrame(thirdparty + "frameStorageChrome.html?allowed=yes");
+
+ // Workers should be able to access storage
+ await runWorker("workerStorageAllowed.js");
+ });
+});
+
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/test_storagePermissionsLimitForeign.html b/dom/tests/mochitest/general/test_storagePermissionsLimitForeign.html
new file mode 100644
index 0000000000..e2b4b93798
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsLimitForeign.html
@@ -0,0 +1,46 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="storagePermissionsUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <iframe></iframe>
+
+ <script type="text/javascript">
+
+task(async function() {
+ await setCookieBehavior(BEHAVIOR_LIMIT_FOREIGN);
+
+ await runTestInWindow(async function() {
+ // We should be able to access storage
+ await storageAllowed();
+
+ // Same origin iframes should be allowed.
+ await runIFrame("frameStorageAllowed.html");
+ await runIFrame("frameStorageChrome.html?allowed=yes");
+
+ // Null principal iframes should not.
+ await runIFrame("frameStorageNullprincipal.sjs");
+
+ // Sandboxed iframes should have the null principal, and thus can't access storage
+ document.querySelector('iframe').setAttribute('sandbox', 'allow-scripts');
+ await runIFrame("frameStoragePrevented.html#nullprincipal");
+ await runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // Thirdparty iframes should be blocked, even when accessed from chrome over Xrays.
+ await runIFrame(thirdparty + "frameStoragePrevented.html#thirdparty");
+ await runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ await runIFrame(thirdparty + "frameStorageChrome.html?allowed=no");
+
+ // Workers should be unable to access storage
+ await runWorker("workerStorageAllowed.js");
+ });
+});
+
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/test_storagePermissionsReject.html b/dom/tests/mochitest/general/test_storagePermissionsReject.html
new file mode 100644
index 0000000000..70dbe856d9
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsReject.html
@@ -0,0 +1,44 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="storagePermissionsUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <iframe></iframe>
+
+ <script type="text/javascript">
+
+task(async function() {
+ await setCookieBehavior(BEHAVIOR_REJECT);
+
+ await runTestInWindow(async function() {
+ // We should be unable to access storage
+ await storagePrevented();
+
+ // Same origin iframes should be blocked.
+ await runIFrame("frameStoragePrevented.html");
+ await runIFrame("frameStorageNullprincipal.sjs");
+ await runIFrame("frameStorageChrome.html?allowed=no&blockSessionStorage=yes");
+
+ // Sandboxed iframes should have the null principal, and thus can't access storage
+ document.querySelector('iframe').setAttribute('sandbox', 'allow-scripts');
+ await runIFrame("frameStoragePrevented.html#nullprincipal");
+ await runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // thirdparty iframes should be blocked.
+ await runIFrame(thirdparty + "frameStoragePrevented.html");
+ await runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ await runIFrame(thirdparty + "frameStorageChrome.html?allowed=no&blockSessionStorage=yes");
+
+ // Workers should be unable to access storage
+ await runWorker("workerStoragePrevented.js");
+ });
+});
+
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/test_storagePermissionsRejectForeign.html b/dom/tests/mochitest/general/test_storagePermissionsRejectForeign.html
new file mode 100644
index 0000000000..f188d46cb2
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsRejectForeign.html
@@ -0,0 +1,44 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="storagePermissionsUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <iframe></iframe>
+
+ <script type="text/javascript">
+
+task(async function() {
+ await setCookieBehavior(BEHAVIOR_REJECT_FOREIGN);
+
+ await runTestInWindow(async function() {
+ // We should be able to access storage
+ await storageAllowed();
+
+ // Same origin iframes should be allowed, unless they redirect to a URI with the null principal
+ await runIFrame("frameStorageAllowed.html");
+ await runIFrame("frameStorageNullprincipal.sjs");
+ await runIFrame("frameStorageChrome.html?allowed=yes");
+
+ // Sandboxed iframes should have the null principal, and thus can't access storage
+ document.querySelector('iframe').setAttribute('sandbox', 'allow-scripts');
+ await runIFrame("frameStoragePrevented.html#nullprincipal");
+ await runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // thirdparty iframes should be blocked.
+ await runIFrame(thirdparty + "frameStoragePrevented.html#thirdparty");
+ await runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ await runIFrame(thirdparty + "frameStorageChrome.html?allowed=no");
+
+ // Workers should be able to access storage
+ await runWorker("workerStorageAllowed.js");
+ });
+});
+
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/test_stylesheetPI.html b/dom/tests/mochitest/general/test_stylesheetPI.html
new file mode 100644
index 0000000000..2b242597d2
--- /dev/null
+++ b/dom/tests/mochitest/general/test_stylesheetPI.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=836809
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 836809</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 836809 **/
+
+ var pi = document.createProcessingInstruction('xml-stylesheet', 'href="/tests/SimpleTest/test.css" type="text/css"');
+
+ function checkSheet(e)
+ {
+ ok("sheet" in pi, "XMLStyleSheetProcessingInstruction should have a sheet property");
+ ok(pi.sheet, "XMLStyleSheetProcessingInstruction should have a sheet property");
+ }
+
+ pi.addEventListener("load", checkSheet);
+ document.insertBefore(pi, document.documentElement);
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=836809">Mozilla Bug 836809</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_toggling_performance_navigation_timing.html b/dom/tests/mochitest/general/test_toggling_performance_navigation_timing.html
new file mode 100644
index 0000000000..6e6d94dca7
--- /dev/null
+++ b/dom/tests/mochitest/general/test_toggling_performance_navigation_timing.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1511941 - Don't expose PerformanceNavigationTiming when it is disabled</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <div id="content"> </div>
+ <script type="application/javascript">
+ async function testWhetherExposed(resistFingerprinting, enable_performance_navigation_timing) {
+ await SpecialPowers.pushPrefEnv({
+ "set": [["privacy.resistFingerprinting", resistFingerprinting],
+ ["dom.enable_performance_navigation_timing", enable_performance_navigation_timing]],
+ });
+ var iframe = document.createElement("iframe");
+ document.body.append(iframe);
+ var p = iframe.contentWindow.PerformanceNavigationTiming;
+ if (enable_performance_navigation_timing && resistFingerprinting)
+ isnot(p, undefined, "window.PerformanceNavigationTiming should be exposed when"
+ + " dom.enable_performance_navigation_timing=" + enable_performance_navigation_timing
+ + " and privacy.resistFingerprinting="+ resistFingerprinting +".");
+ if (!enable_performance_navigation_timing)
+ is(p, undefined, "window.PerformanceNavigationTiming should not be exposed when"
+ + " dom.enable_performance_navigation_timing=" + enable_performance_navigation_timing
+ + " and privacy.resistFingerprinting="+ resistFingerprinting +".");
+ if (enable_performance_navigation_timing && !resistFingerprinting) {
+ isnot(p, undefined, "window.PerformanceNavigationTiming should be exposed when"
+ + " dom.enable_performance_navigation_timing=" + enable_performance_navigation_timing
+ + " and privacy.resistFingerprinting="+ resistFingerprinting +".");
+ }
+ }
+
+ async function start() {
+ await testWhetherExposed(true,true);
+ await testWhetherExposed(true,false);
+ await testWhetherExposed(false,true);
+ await testWhetherExposed(false,false);
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ start();
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_vibrator.html b/dom/tests/mochitest/general/test_vibrator.html
new file mode 100644
index 0000000000..e7085fc987
--- /dev/null
+++ b/dom/tests/mochitest/general/test_vibrator.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Vibrator</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<!-- Although we can't test that the vibrator works properly, we can test that
+ navigator.vibrate throws an exception where appropriate. -->
+
+<script class="testbody" type="text/javascript">
+function testNavigatorVibrate(testCase) {
+ result = navigator.vibrate(testCase.value);
+ is(result, true, `vibrate(${testCase.value}) must succeed.`);
+}
+
+function testNotificationVibrate(testCase) {
+ var notification = new Notification('Test notification', {
+ body: 'test vibrate',
+ vibrate: testCase.value,
+ });
+
+ isDeeply(notification.vibrate, testCase.expected, `vibrate = ${testCase.value} should be accepted.`);
+}
+
+const MAX_VIBRATE_MS = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_ms');
+const MAX_VIBRATE_LIST_LEN = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_list_len');
+const TESTCASES = [
+ {
+ value: null,
+ expected: [0],
+ },{
+ value: undefined,
+ expected: [],
+ },{
+ // -1 will be converted to the highest unsigned long then clamped.
+ value: -1,
+ expected: [MAX_VIBRATE_MS],
+ },{
+ value: 'a',
+ expected: [0],
+ },{
+ // -1 will be converted to the highest unsigned long then clamped.
+ value: [100, -1],
+ expected: [100, MAX_VIBRATE_MS],
+ },{
+ value: [100, 'a'],
+ expected: [100, 0],
+ },{
+ // If we pass a vibration pattern with a value higher than max_vibrate_ms or a
+ // pattern longer than max_vibrate_list_len, the call should succeed but the
+ // pattern should be modified to match the restrictions.
+
+ // Values will be clamped to dom.vibrator.max_vibrate_ms.
+ value: MAX_VIBRATE_MS + 1,
+ expected: [MAX_VIBRATE_MS],
+ },{
+ value: [MAX_VIBRATE_MS + 1],
+ expected: [MAX_VIBRATE_MS],
+ },{
+ // The array will be truncated to have a length equal to dom.vibrator.max_vibrate_list_len.
+ value: new Array(MAX_VIBRATE_LIST_LEN + 1).fill(0),
+ expected: new Array(MAX_VIBRATE_LIST_LEN).fill(0),
+ },{
+ value: 0,
+ expected: [0],
+ },{
+ value: [],
+ expected: [],
+ },{
+ value: '1000',
+ expected: [1000],
+ },{
+ value: 1000,
+ expected: [1000],
+ },{
+ value: 1000.1,
+ expected: [1000],
+ },{
+ value: [0, 0, 0],
+ expected: [0, 0, 0],
+ },{
+ value: ['1000', 1000],
+ expected: [1000, 1000],
+ },{
+ value: [1000, 1000],
+ expected: [1000, 1000],
+ },{
+ value: [1000, 1000.1],
+ expected: [1000, 1000],
+ }
+];
+
+function testWith(tester) {
+ for (let testCase of TESTCASES) {
+ tester(testCase);
+ }
+}
+
+add_task(async function test_notification_vibrate_enabled() {
+ await SpecialPowers.pushPrefEnv({"set": [['dom.webnotifications.vibrate.enabled', true]]});
+
+ testWith(testNotificationVibrate);
+});
+
+add_task(async function test_vibrator_vibrate() {
+ await SpecialPowers.pushPermissions([{type: 'vibration', allow: true, context: document}]);
+ await SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', true]]});
+
+ testWith(testNavigatorVibrate);
+
+ await SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', false]]});
+
+ testWith(testNavigatorVibrate);
+});
+
+add_task(async function test_vibrate_many_times() {
+ await SpecialPowers.pushPermissions([{type: 'vibration', allow: true, context: document}]);
+ await SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', true]]});
+
+ // The following loop shouldn't cause us to crash. See bug 701716.
+ for (var i = 0; i < 10000; i++) {
+ navigator.vibrate([100, 100]);
+ }
+ ok(true, "Didn't crash after issuing a lot of vibrate() calls.");
+});
+
+add_task(async function test_notification_vibrate_silent() {
+ await SpecialPowers.pushPrefEnv({"set": [['dom.webnotifications.vibrate.enabled', true],
+ ['dom.webnotifications.silent.enabled', true]]});
+
+ try {
+ var notification = new Notification('Test notification', {
+ body: 'test vibrate',
+ vibrate: [100, 100],
+ silent: true,
+ });
+ ok(false, "The above should throw if vibrate is enabled");
+ } catch (error) {
+ is(error.name, "TypeError", "A silent notification with a vibrate param should throw a TypeError");
+ }
+});
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_windowProperties.html b/dom/tests/mochitest/general/test_windowProperties.html
new file mode 100644
index 0000000000..3fe4c9ee9e
--- /dev/null
+++ b/dom/tests/mochitest/general/test_windowProperties.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test that all window properties are accessible to nonprivileged code</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+
+<body id="body">
+
+<script type="application/javascript">
+var lastProp;
+try {
+ var propVals = [];
+ for (var prop in window) {
+ lastProp = prop;
+ propVals.push(window[prop]);
+ }
+ ok(true, "Read all " + propVals.length + " window properties");
+} catch (ex) {
+ ok(false, "Exception occurred reading window." + lastProp);
+}
+</script>
+
+<p id="display"></p>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_windowedhistoryframes.html b/dom/tests/mochitest/general/test_windowedhistoryframes.html
new file mode 100644
index 0000000000..c2c148b838
--- /dev/null
+++ b/dom/tests/mochitest/general/test_windowedhistoryframes.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=602256
+-->
+<head>
+ <title>Test for Bug 602256</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=602256">Mozilla Bug 602256</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 602256 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function done() {
+ subWin.close();
+ SimpleTest.finish();
+}
+
+var subWin = window.open("historyframes.html", "_blank");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/url1_historyframe.html b/dom/tests/mochitest/general/url1_historyframe.html
new file mode 100644
index 0000000000..b86af4b3fa
--- /dev/null
+++ b/dom/tests/mochitest/general/url1_historyframe.html
@@ -0,0 +1 @@
+<p id='text'>Test1</p>
diff --git a/dom/tests/mochitest/general/url2_historyframe.html b/dom/tests/mochitest/general/url2_historyframe.html
new file mode 100644
index 0000000000..24374d1a5b
--- /dev/null
+++ b/dom/tests/mochitest/general/url2_historyframe.html
@@ -0,0 +1 @@
+<p id='text'>Test2</p>
diff --git a/dom/tests/mochitest/general/window_clipboard_events.html b/dom/tests/mochitest/general/window_clipboard_events.html
new file mode 100644
index 0000000000..ee88cc5fa0
--- /dev/null
+++ b/dom/tests/mochitest/general/window_clipboard_events.html
@@ -0,0 +1,1239 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Clipboard Events</title>
+ <script>
+ var SimpleTest = opener.SimpleTest;
+ var SpecialPowers = opener.SpecialPowers;
+ var ok = opener.ok;
+ var is = opener.is;
+ var isnot = opener.isnot;
+ var todo = opener.todo;
+ var todo_is = opener.todo_is;
+ var add_task = opener.add_task;
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="border: 3px solid black; padding: 3em;">CONTENT TEXT<input id="content-input" value="INPUT TEXT"></div>
+<img id="image" src="image_50.png">
+<button id="button">Button</button>
+
+<div id="syntheticSpot" oncut="compareSynthetic(event, 'cut')"
+ oncopy="compareSynthetic(event, 'copy')"
+ onpaste="compareSynthetic(event, 'paste')">Spot</div>
+
+<div id="contenteditableContainer"></div>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+var content = document.getElementById("content");
+var contentInput = document.getElementById("content-input");
+var contenteditableContainer = document.getElementById("contenteditableContainer");
+var clipboardInitialValue = "empty";
+
+var cachedCutData, cachedCopyData, cachedPasteData;
+
+ok(SpecialPowers.getBoolPref("dom.events.dataTransfer.protected.enabled"),
+ "The following require dom.events.dataTransfer.protected.enabled is enabled");
+isnot(typeof window.onbeforeinput, "undefined",
+ "The following tests require onbeforeinput attribute");
+
+// Before each test function is run, the clipboard is initialized
+// to clipboardInitialValue, and the contents of div#content are
+// set as the window's selection.
+
+add_task(async function initialize_for_tests() {
+ disableNonTestMouseEvents(true);
+
+ await SimpleTest.promiseFocus(window);
+
+ // Test that clearing and reading the clipboard works. A random number
+ // is used to make sure that leftover clipboard values from a previous
+ // test run don't cause a false-positive test.
+ try {
+ var cb_text = "empty_" + Math.random();
+ await putOnClipboard(cb_text, () => { setClipboardText(cb_text) },
+ "Failed to initial set/get clipboard text");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+var eventListeners = [];
+
+// Note that don't use EventTarget.addEventListener directly in this file
+// because if it's remained in next test, it makes developers harder to
+// investigate such oranges. addEventListenerTo cleans up when `reset()`
+// is called by first of next test and then, all event listeners including
+// marked as "once" are removed automatically.
+function addEventListenerTo(aEventTarget, aEventType, aListener, aOptions) {
+ eventListeners.push({
+ target: aEventTarget,
+ type: aEventType,
+ listener: aListener,
+ options: aOptions
+ });
+ aEventTarget.addEventListener(aEventType, aListener, aOptions);
+}
+
+async function reset() {
+ [content, contentInput, document, document.documentElement].forEach(eventTarget => {
+ ["oncut", "oncopy", "onpaste", "oninput", "onbeforeinput"].forEach(attr => {
+ eventTarget[attr] = null;
+ });
+ });
+ eventListeners.forEach(data => {
+ data.target.removeEventListener(data.type, data.listener, data.options);
+ });
+ eventListeners = [];
+
+ // Init clipboard
+ await putOnClipboard(clipboardInitialValue,
+ () => { setClipboardText(clipboardInitialValue) },
+ "reset clipboard");
+
+ // Reset value of editors.
+ contentInput.value = "INPUT TEXT";
+ contenteditableContainer.innerHTML = "";
+}
+
+function getClipboardText() {
+ return SpecialPowers.getClipboardData("text/plain");
+}
+
+function getHTMLEditor() {
+ let editingSession = SpecialPowers.wrap(window).docShell.editingSession;
+ if (!editingSession) {
+ return null;
+ }
+ let editor = editingSession.getEditorForWindow(window);
+ if (!editor) {
+ return null;
+ }
+ return editor.QueryInterface(SpecialPowers.Ci.nsIHTMLEditor);
+}
+
+async function putOnClipboard(expected, operationFn, desc, type) {
+ try {
+ await SimpleTest.promiseClipboardChange(expected, operationFn, type, 1000);
+ } catch (e) {
+ throw `Failed "${desc}" due to "${e.toString()}"`
+ }
+}
+
+async function wontPutOnClipboard(unexpectedData, operationFn, desc, type) {
+ try {
+ // SimpleTest.promiseClipboardChange() doesn't throw exception when
+ // it unexpectedly succeeds to copy something. Therefore, we need
+ // to throw an exception by ourselves.
+ await SimpleTest.promiseClipboardChange(null, operationFn, type, 300, true, false)
+ .then(aData => {
+ if (aData == unexpectedData) {
+ throw `Failed "${desc}", the clipboard data is modified to "${aData.toString()}"`;
+ }
+ });
+ } catch (e) {
+ throw `Failed "${desc}" due to "${e.toString()}"`
+ }
+}
+
+function setClipboardText(text) {
+ var helper = SpecialPowers.Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(SpecialPowers.Ci.nsIClipboardHelper);
+ helper.copyString(text);
+}
+
+function selectContentDiv() {
+ // Set selection
+ var selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.selectAllChildren(content);
+}
+
+function selectContentInput() {
+ contentInput.focus();
+ contentInput.select();
+}
+
+add_task(async function test_dom_oncopy() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncopy event handler, fire copy. Ensure that the event
+ // handler was called, and the clipboard contents have set to CONTENT TEXT.
+ // Test firing oncopy event on ctrl-c:
+ selectContentDiv();
+
+ var oncopy_fired = false;
+ content.oncopy = function() { oncopy_fired = true; };
+ try {
+ await putOnClipboard("CONTENT TEXT", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "copy on DOM element set clipboard correctly");
+ ok(oncopy_fired, "copy event firing on DOM element");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_dom_oncut() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncut event handler, fire cut. Ensure that the event handler
+ // was called. The <div> doesn't handle a cut, so ensure that the
+ // clipboard text shouldn't be "CONTENT TEXT".
+ selectContentDiv();
+ var oncut_fired = false;
+ content.oncut = function() { oncut_fired = true; };
+ try {
+ await wontPutOnClipboard("CONTENT TEXT", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "cut on DOM element set clipboard correctly");
+ ok(oncut_fired, "cut event firing on DOM element")
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_dom_onpaste() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an onpaste event handler, fire paste. Ensure that the event
+ // handler was called.
+ selectContentDiv();
+ var onpaste_fired = false;
+ content.onpaste = function() { onpaste_fired = true; };
+ synthesizeKey("v", {accelKey: 1});
+ ok(onpaste_fired, "paste event firing on DOM element");
+});
+
+add_task(async function test_dom_oncopy_abort() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncopy event handler that aborts the copy, and fire the copy
+ // event. Ensure that the event handler was fired, and the clipboard
+ // contents have not been modified.
+ selectContentDiv();
+ var oncopy_fired = false;
+ content.oncopy = function() { oncopy_fired = true; return false; };
+ try {
+ await wontPutOnClipboard("CONTENT TEXT", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "aborted copy on DOM element did not modify clipboard");
+ ok(oncopy_fired, "copy event (to-be-cancelled) firing on DOM element");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_oncopy() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncopy event handler, fire copy. Ensure that the event
+ // handler was called, and the clipboard contents have been set to 'PUT TE',
+ // which is the part that is selected below.
+ selectContentInput();
+ contentInput.focus();
+ contentInput.setSelectionRange(2, 8);
+
+ let oncopy_fired = false;
+ let onbeforeinput_fired = false;
+ let oninput_fired = false;
+ contentInput.oncopy = () => { oncopy_fired = true; };
+ contentInput.onbeforeinput = () => { onbeforeinput = true; };
+ contentInput.oninput = () => { oninput_fired = true; };
+ try {
+ await putOnClipboard("PUT TE", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "copy on plaintext editor set clipboard correctly");
+ ok(oncopy_fired, "copy event firing on plaintext editor");
+ ok(!onbeforeinput_fired, "beforeinput event shouldn't be fired on plaintext editor by copy");
+ ok(!oninput_fired, "input event shouldn't be fired on plaintext editor by copy");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_oncut() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncut event handler, and fire cut. Ensure that the event
+ // handler was fired, the clipboard contains the INPUT TEXT, and
+ // that the input itself is empty.
+ selectContentInput();
+ let oncut_fired = false;
+ let beforeInputEvents = [];
+ let inputEvents = [];
+ contentInput.oncut = () => { oncut_fired = true; };
+ contentInput.onbeforeinput = (aEvent) => { beforeInputEvents.push(aEvent); }
+ contentInput.oninput = (aEvent) => { inputEvents.push(aEvent); }
+ try {
+ await putOnClipboard("INPUT TEXT", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "cut on plaintext editor set clipboard correctly");
+ ok(oncut_fired, "cut event firing on plaintext editor");
+ is(beforeInputEvents.length, 1, '"beforeinput" event should be fired once by cut');
+ if (beforeInputEvents.length) {
+ is(beforeInputEvents[0].inputType, "deleteByCut", '"inputType" of "beforeinput" event should be "deleteByCut"');
+ is(beforeInputEvents[0].cancelable, true, '"beforeinput" event for "deleteByCut" should be cancelable');
+ is(beforeInputEvents[0].data, null, '"data" of "beforeinput" event for "deleteByCut" should be null');
+ is(beforeInputEvents[0].dataTransfer, null, '"dataTransfer" of "beforeinput" event for "deleteByCut" should be null');
+ is(beforeInputEvents[0].getTargetRanges().length, 0, 'getTargetRanges() of "beforeinput" event for "deleteByCut" should return empty array');
+ }
+ is(inputEvents.length, 1, '"input" event should be fired once by cut');
+ if (inputEvents.length) {
+ is(inputEvents[0].inputType, "deleteByCut", '"inputType" of "input" event should be "deleteByCut"');
+ is(inputEvents[0].cancelable, false, '"input" event for "deleteByCut" should not be cancelable');
+ is(inputEvents[0].data, null, '"data" of "input" event for "deleteByCut" should be null');
+ is(inputEvents[0].dataTransfer, null, '"dataTransfer" of "input" event for "deleteByCut" should be null');
+ is(inputEvents[0].getTargetRanges().length, 0, 'getTargetRanges() of "input" event for "deleteByCut" should return empty array');
+ }
+ is(contentInput.value, "",
+ "cut on plaintext editor emptied editor");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_onpaste() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an onpaste event handler, and fire paste. Ensure that the event
+ // handler was fired, the clipboard contents didn't change, and that the
+ // input value did change (ie. paste succeeded).
+ selectContentInput();
+ let onpaste_fired = false;
+ let beforeInputEvents = [];
+ let inputEvents = [];
+ contentInput.onpaste = () => { onpaste_fired = true; };
+ contentInput.onbeforeinput = (aEvent) => { beforeInputEvents.push(aEvent); }
+ contentInput.oninput = (aEvent) => { inputEvents.push(aEvent); }
+
+ synthesizeKey("v", {accelKey: 1});
+ ok(onpaste_fired, "paste event firing on plaintext editor");
+ is(getClipboardText(), clipboardInitialValue,
+ "paste on plaintext editor did not modify clipboard contents");
+ is(beforeInputEvents.length, 1, '"beforeinput" event should be fired once by paste');
+ if (beforeInputEvents.length) {
+ is(beforeInputEvents[0].inputType, "insertFromPaste", '"inputType" of "beforeinput" event should be "insertFromPaste"');
+ is(beforeInputEvents[0].cancelable, true, '"beforeinput" event for "insertFromPaste" should be cancelable');
+ is(beforeInputEvents[0].data, clipboardInitialValue, `"data" of "beforeinput" event for "insertFromPaste" should be "${clipboardInitialValue}"`);
+ is(beforeInputEvents[0].dataTransfer, null, '"dataTransfer" of "beforeinput" event for "insertFromPaste" should be null');
+ is(beforeInputEvents[0].getTargetRanges().length, 0, 'getTargetRanges() of "beforeinput" event for "insertFromPaste" should return empty array');
+ }
+ is(inputEvents.length, 1, '"input" event should be fired once by paste');
+ if (inputEvents.length) {
+ is(inputEvents[0].inputType, "insertFromPaste", '"inputType" of "input" event should be "insertFromPaste"');
+ is(inputEvents[0].cancelable, false, '"input" event for "insertFromPaste" should not be cancelable');
+ is(inputEvents[0].data, clipboardInitialValue, `"data" of "input" event for "insertFromPaste" should be "${clipboardInitialValue}"`);
+ is(inputEvents[0].dataTransfer, null, '"dataTransfer" of "input" event for "insertFromPaste" should be null');
+ is(inputEvents[0].getTargetRanges().length, 0, 'getTargetRanges() of "input" event for "insertFromPaste" should return empty array');
+ }
+ is(contentInput.value, clipboardInitialValue,
+ "paste on plaintext editor did modify editor value");
+});
+
+add_task(async function test_input_oncopy_abort() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncopy event handler, fire copy. Ensure that the event
+ // handler was called, and that the clipboard value did NOT change.
+ selectContentInput();
+ let oncopy_fired = false;
+ contentInput.oncopy = () => { oncopy_fired = true; return false; };
+ contentInput.onbeforeinput = () => {
+ ok(false, '"beforeinput" event should not be fired by copy but canceled');
+ };
+ contentInput.oninput = function() {
+ ok(false, '"input" event should not be fired by copy but canceled');
+ };
+ try {
+ await wontPutOnClipboard("CONTENT TEXT", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "aborted copy on plaintext editor did not modify clipboard");
+ ok(oncopy_fired, "copy event (to-be-cancelled) firing on plaintext editor");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_oncut_abort() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncut event handler, and fire cut. Ensure that the event
+ // handler was fired, the clipboard contains the INPUT TEXT, and
+ // that the input itself is empty.
+ selectContentInput();
+ let oncut_fired = false;
+ contentInput.oncut = () => { oncut_fired = true; return false; };
+ contentInput.onbeforeinput = () => {
+ ok(false, '"beforeinput" event should not be fired by cut but canceled by "cut" event listener');
+ };
+ contentInput.oninput = () => {
+ ok(false, '"input" event should not be fired by cut but canceled by "cut" event listener');
+ };
+ try {
+ await wontPutOnClipboard("CONTENT TEXT", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "aborted cut on plaintext editor did not modify clipboard");
+ ok(oncut_fired, "cut event (to-be-cancelled) firing on plaintext editor");
+ is(contentInput.value, "INPUT TEXT",
+ "aborted cut on plaintext editor did not modify editor contents");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_oncut_beforeinput_abort() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an oncut event handler, and fire cut. Ensure that the event
+ // handler was fired, the clipboard contains the INPUT TEXT, and
+ // that the input itself is empty.
+ selectContentInput();
+ let oncut_fired = false;
+ let beforeInputEvents = [];
+ let inputEvents = [];
+ contentInput.oncut = () => { oncut_fired = true; };
+ contentInput.onbeforeinput = (aEvent) => { beforeInputEvents.push(aEvent); aEvent.preventDefault(); }
+ contentInput.oninput = (aEvent) => { inputEvents.push(aEvent); }
+ try {
+ await putOnClipboard("INPUT TEXT", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "cut on plaintext editor set clipboard correctly");
+ ok(oncut_fired, "cut event firing on plaintext editor");
+ is(beforeInputEvents.length, 1, '"beforeinput" event should be fired once by cut');
+ if (beforeInputEvents.length) {
+ is(beforeInputEvents[0].inputType, "deleteByCut", '"inputType" of "beforeinput" event should be "deleteByCut"');
+ is(beforeInputEvents[0].cancelable, true, '"beforeinput" event for "deleteByCut" should be cancelable');
+ is(beforeInputEvents[0].data, null, '"data" of "beforeinput" event for "deleteByCut" should be null');
+ is(beforeInputEvents[0].dataTransfer, null, '"dataTransfer" of "beforeinput" event for "deleteByCut" should be null');
+ is(beforeInputEvents[0].getTargetRanges().length, 0, 'getTargetRanges() of "beforeinput" event for "deleteByCut" should return empty array');
+ }
+ is(inputEvents.length, 0, '"input" event should not be fired by cut if "beforeinput" event is canceled');
+ is(contentInput.value, "INPUT TEXT",
+ 'cut on plaintext editor should not change editor since "beforeinput" event was canceled');
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_onpaste_abort() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an onpaste event handler, and fire paste. Ensure that the event
+ // handler was fired, the clipboard contents didn't change, and that the
+ // input value did change (ie. paste succeeded).
+ selectContentInput();
+ let onpaste_fired = false;
+ contentInput.onpaste = () => { onpaste_fired = true; return false; };
+ contentInput.onbeforeinput = () => {
+ ok(false, '"beforeinput" event should not be fired by paste but canceled');
+ };
+ contentInput.oninput = () => {
+ ok(false, '"input" event should not be fired by paste but canceled');
+ };
+ synthesizeKey("v", {accelKey: 1});
+ ok(onpaste_fired,
+ "paste event (to-be-cancelled) firing on plaintext editor");
+ is(getClipboardText(), clipboardInitialValue,
+ "aborted paste on plaintext editor did not modify clipboard");
+ is(contentInput.value, "INPUT TEXT",
+ "aborted paste on plaintext editor did not modify modified editor value");
+});
+
+add_task(async function test_input_onpaste_beforeinput_abort() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Setup an onpaste event handler, and fire paste. Ensure that the event
+ // handler was fired, the clipboard contents didn't change, and that the
+ // input value did change (ie. paste succeeded).
+ selectContentInput();
+ let onpaste_fired = false;
+ let beforeInputEvents = [];
+ let inputEvents = [];
+ contentInput.onpaste = () => { onpaste_fired = true; };
+ contentInput.onbeforeinput = (aEvent) => { beforeInputEvents.push(aEvent); aEvent.preventDefault(); }
+ contentInput.oninput = (aEvent) => { inputEvents.push(aEvent); }
+
+ synthesizeKey("v", {accelKey: 1});
+ ok(onpaste_fired, "paste event firing on plaintext editor");
+ is(getClipboardText(), clipboardInitialValue,
+ "paste on plaintext editor did not modify clipboard contents");
+ is(beforeInputEvents.length, 1, '"beforeinput" event should be fired once by paste');
+ if (beforeInputEvents.length) {
+ is(beforeInputEvents[0].inputType, "insertFromPaste", '"inputType" of "beforeinput" event should be "insertFromPaste"');
+ is(beforeInputEvents[0].cancelable, true, '"beforeinput" event for "insertFromPaste" should be cancelable');
+ is(beforeInputEvents[0].data, clipboardInitialValue, `"data" of "beforeinput" event for "insertFromPaste" should be "${clipboardInitialValue}"`);
+ is(beforeInputEvents[0].dataTransfer, null, '"dataTransfer" of "beforeinput" event for "insertFromPaste" should be null');
+ is(beforeInputEvents[0].getTargetRanges().length, 0, 'getTargetRanges() of "beforeinput" event for "insertFromPaste" should return empty array');
+ }
+ is(inputEvents.length, 0, '"input" event should not be fired by paste when "beforeinput" is canceled');
+ is(contentInput.value, "INPUT TEXT",
+ "paste on plaintext editor did modify editor value");
+});
+
+add_task(async function test_input_cut_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Cut using event.dataTransfer. The event is not cancelled so the default
+ // cut should occur
+ selectContentInput();
+ contentInput.oncut = function(event) {
+ ok(event instanceof ClipboardEvent, "cut event is a ClipboardEvent");
+ ok(event.clipboardData instanceof DataTransfer, "cut event dataTransfer is a DataTransfer");
+ is(event.target, contentInput, "cut event target");
+ is(SpecialPowers.wrap(event.clipboardData).mozItemCount, 0, "cut event mozItemCount");
+ is(event.clipboardData.getData("text/plain"), "", "cut event getData");
+ event.clipboardData.setData("text/plain", "This is some dataTransfer text");
+ cachedCutData = event.clipboardData;
+ };
+ try {
+ await putOnClipboard("INPUT TEXT", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "cut using dataTransfer on plaintext editor set clipboard correctly");
+ is(contentInput.value, "",
+ "cut using dataTransfer on plaintext editor cleared input");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_cut_abort_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Cut using event.dataTransfer but cancel the event. The data should be
+ // put on the clipboard but since we don't modify the input value, the input
+ // should have the same value.
+ selectContentInput();
+ contentInput.oncut = function(event) {
+ event.clipboardData.setData("text/plain", "Cut dataTransfer text");
+ return false;
+ };
+ try {
+ await putOnClipboard("Cut dataTransfer text", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "aborted cut using dataTransfer on plaintext editor set clipboard correctly");
+ is(contentInput.value, "INPUT TEXT",
+ "aborted cut using dataTransfer on plaintext editor did not modify input");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_copy_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Copy using event.dataTransfer
+ selectContentInput();
+ contentInput.oncopy = function(event) {
+ ok(event instanceof ClipboardEvent, "copy event is a ClipboardEvent");
+ ok(event.clipboardData instanceof DataTransfer, "copy event dataTransfer is a DataTransfer");
+ is(event.target, contentInput, "copy event target");
+ is(SpecialPowers.wrap(event.clipboardData).mozItemCount, 0, "copy event mozItemCount");
+ is(event.clipboardData.getData("text/plain"), "", "copy event getData");
+ event.clipboardData.setData("text/plain", "Copied dataTransfer text");
+ cachedCopyData = event.clipboardData;
+ };
+ try {
+ await putOnClipboard("INPUT TEXT", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "copy using dataTransfer on plaintext editor set clipboard correctly");
+ is(contentInput.value, "INPUT TEXT",
+ "copy using dataTransfer on plaintext editor did not modify input");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_copy_abort_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Copy using event.dataTransfer but cancel the event.
+ selectContentInput();
+ contentInput.oncopy = function(event) {
+ event.clipboardData.setData("text/plain", "Copy dataTransfer text");
+ return false;
+ };
+ try {
+ await putOnClipboard("Copy dataTransfer text", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "aborted copy using dataTransfer on plaintext editor set clipboard correctly");
+ is(contentInput.value, "INPUT TEXT",
+ "aborted copy using dataTransfer on plaintext editor did not modify input");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_input_paste_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Paste using event.dataTransfer
+ selectContentInput();
+ contentInput.onpaste = function(event) {
+ ok(event instanceof ClipboardEvent, "paste event is an ClipboardEvent");
+ ok(event.clipboardData instanceof DataTransfer, "paste event dataTransfer is a DataTransfer");
+ is(event.target, contentInput, "paste event target");
+ is(SpecialPowers.wrap(event.clipboardData).mozItemCount, 1, "paste event mozItemCount");
+ is(event.clipboardData.getData("text/plain"), clipboardInitialValue, "paste event getData");
+ cachedPasteData = event.clipboardData;
+ };
+ synthesizeKey("v", {accelKey: 1});
+ is(getClipboardText(), clipboardInitialValue,
+ "paste using dataTransfer on plaintext editor did not modify clipboard contents");
+ is(contentInput.value, clipboardInitialValue,
+ "paste using dataTransfer on plaintext editor modified input");
+});
+
+add_task(async function test_input_paste_abort_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Paste using event.dataTransfer but cancel the event
+ selectContentInput();
+ contentInput.onpaste = function(event) {
+ is(event.clipboardData.getData("text/plain"), clipboardInitialValue, "get data on aborted paste");
+ contentInput.value = "Alternate Paste";
+ return false;
+ };
+ synthesizeKey("v", {accelKey: 1});
+ is(getClipboardText(), clipboardInitialValue,
+ "aborted paste using dataTransfer on plaintext editor did not modify clipboard contents");
+ is(contentInput.value, "Alternate Paste",
+ "aborted paste using dataTransfer on plaintext editor modified input");
+});
+
+add_task(async function test_input_copypaste_dataTransfer_multiple() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Cut several types of data and paste it again
+ contentInput.value = "This is a line of text";
+ contentInput.oncopy = function(event) {
+ var cd = event.clipboardData;
+ cd.setData("text/plain", "would be a phrase");
+
+ var exh = false;
+ try { SpecialPowers.wrap(cd).mozSetDataAt("text/plain", "Text", 1); } catch (ex) { exh = true; }
+ ok(exh, "exception occured mozSetDataAt 1");
+ exh = false;
+ try { SpecialPowers.wrap(cd).mozTypesAt(1); } catch (ex) { exh = true; }
+ ok(exh, "exception occured mozTypesAt 1");
+ exh = false;
+ try { SpecialPowers.wrap(cd).mozGetDataAt("text/plain", 1); } catch (ex) { exh = true; }
+ ok(exh, "exception occured mozGetDataAt 1");
+ exh = false;
+ try { cd.mozClearDataAt("text/plain", 1); } catch (ex) { exh = true; }
+ ok(exh, "exception occured mozClearDataAt 1");
+
+ cd.setData("text/x-moz-url", "http://www.mozilla.org");
+ SpecialPowers.wrap(cd).mozSetDataAt("text/x-custom", "Custom Text with \u0000 null", 0);
+ is(SpecialPowers.wrap(cd).mozItemCount, 1, "mozItemCount after set multiple types");
+ return false;
+ };
+
+ try {
+ selectContentInput();
+
+ await putOnClipboard("would be a phrase", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "copy multiple types text");
+ contentInput.oncopy = null; // XXX Not sure why this is required...
+ } catch (e) {
+ ok(false, e.toString());
+ return;
+ }
+
+ contentInput.setSelectionRange(5, 14);
+
+ contentInput.onpaste = function(event) {
+ var cd = event.clipboardData;
+ is(SpecialPowers.wrap(cd).mozItemCount, 1, "paste after copy multiple types mozItemCount");
+ is(cd.getData("text/plain"), "would be a phrase", "paste text/plain multiple types");
+
+ // Firefox for Android's clipboard code doesn't handle x-moz-url. Therefore
+ // disabling the following test. Enable this once bug #840101 is fixed.
+ if (!navigator.appVersion.includes("Android")) {
+ is(cd.getData("text/x-moz-url"), "http://www.mozilla.org", "paste text/x-moz-url multiple types");
+ is(cd.getData("text/x-custom"), "Custom Text with \u0000 null", "paste text/custom multiple types");
+ } else {
+ is(cd.getData("text/x-custom"), "", "paste text/custom multiple types");
+ }
+
+ is(cd.getData("application/x-moz-custom-clipdata"), "", "application/x-moz-custom-clipdata is not present");
+
+ exh = false;
+ try { cd.setData("application/x-moz-custom-clipdata", "Some Data"); } catch (ex) { exh = true; }
+ ok(exh, "exception occured setData with application/x-moz-custom-clipdata");
+
+ exh = false;
+ try { cd.setData("text/plain", "Text on Paste"); } catch (ex) { exh = true; }
+ ok(exh, "exception occured setData on paste");
+
+ is(cd.getData("text/plain"), "would be a phrase", "text/plain data unchanged");
+ };
+ synthesizeKey("v", {accelKey: 1});
+ is(contentInput.value, "This would be a phrase of text",
+ "default paste after copy multiple types");
+});
+
+add_task(async function test_input_copy_button_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Copy using event.dataTransfer when a button is focused.
+ var button = document.getElementById("button");
+ button.focus();
+ button.oncopy = function(event) {
+ ok(false, "should not be firing copy event on button");
+ return false;
+ };
+ try {
+ // copy should not occur here because buttons don't have any controller
+ // for the copy command
+ await wontPutOnClipboard("", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "Accel-C on the `<button>` shouldn't modify the clipboard data");
+ ok(true, "Accel-C on the <button> shouldn't modify the clipboard data");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+
+ try {
+ selectContentDiv();
+
+ await putOnClipboard("CONTENT TEXT", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "Accel-C with selecting the content <div> should modify the clipboard data with text in it");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+});
+
+add_task(async function test_eventspref_disabled() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Disable clipboard events
+ try {
+ await SpecialPowers.pushPrefEnv({
+ set: [['dom.event.clipboardevents.enabled', false]]
+ });
+
+ var event_fired = false;
+ var input_data = undefined;
+ contentInput.oncut = function() { event_fired = true; };
+ contentInput.oncopy = function() { event_fired = true; };
+ contentInput.onpaste = function() { event_fired = true; };
+ contentInput.oninput = function(event) { input_data = event.data; };
+
+ selectContentInput();
+ contentInput.setSelectionRange(1, 4);
+
+ await putOnClipboard("NPU", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "cut changed clipboard when preference is disabled");
+ is(contentInput.value, "IT TEXT", "cut changed text when preference is disabled");
+ ok(!event_fired, "cut event did not fire when preference is disabled");
+ is(input_data, null, "cut should cause input event whose data value is null");
+
+ event_fired = false;
+ input_data = undefined;
+ contentInput.setSelectionRange(3, 6);
+ await putOnClipboard("TEX", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "copy changed clipboard when preference is disabled");
+ ok(!event_fired, "copy event did not fire when preference is disabled")
+ is(input_data, undefined, "copy shouldn't cause input event");
+
+ event_fired = false;
+ contentInput.setSelectionRange(0, 2);
+ synthesizeKey("v", {accelKey: 1});
+ is(contentInput.value, "TEX TEXT", "paste changed text when preference is disabled");
+ ok(!event_fired, "paste event did not fire when preference is disabled");
+ is(input_data, "",
+ "paste should cause input event but whose data value should be empty string if clipboard event is disabled");
+ } catch (e) {
+ ok(false, e.toString());
+ } finally {
+ await SpecialPowers.popPrefEnv();
+ }
+});
+
+let expectedData = [];
+
+// Check to make that synthetic events do not change the clipboard
+add_task(async function test_synthetic_events() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ let syntheticSpot = document.getElementById("syntheticSpot");
+
+ // No dataType specified
+ let event = new ClipboardEvent("cut", { data: "something" });
+ expectedData = { type: "cut", data: null }
+ compareSynthetic(event, "before");
+ syntheticSpot.dispatchEvent(event);
+ ok(expectedData.eventFired, "cut event fired");
+ compareSynthetic(event, "after");
+
+ event = new ClipboardEvent("cut", { dataType: "text/plain", data: "something" });
+ expectedData = { type: "cut", dataType: "text/plain", data: "something" }
+ compareSynthetic(event, "before");
+ syntheticSpot.dispatchEvent(event);
+ ok(expectedData.eventFired, "cut event fired");
+ compareSynthetic(event, "after");
+
+ event = new ClipboardEvent("copy", { dataType: "text/plain", data: "something" });
+ expectedData = { type: "copy", dataType: "text/plain", data: "something" }
+ compareSynthetic(event, "before");
+ syntheticSpot.dispatchEvent(event);
+ ok(expectedData.eventFired, "copy event fired");
+ compareSynthetic(event, "after");
+
+ event = new ClipboardEvent("copy", { dataType: "text/plain" });
+ expectedData = { type: "copy", dataType: "text/plain", data: "" }
+ compareSynthetic(event, "before");
+ syntheticSpot.dispatchEvent(event);
+ ok(expectedData.eventFired, "copy event fired");
+ compareSynthetic(event, "after");
+
+ event = new ClipboardEvent("paste", { dataType: "text/plain", data: "something" });
+ expectedData = { type: "paste", dataType: "text/plain", data: "something" }
+ compareSynthetic(event, "before");
+ syntheticSpot.dispatchEvent(event);
+ ok(expectedData.eventFired, "paste event fired");
+ compareSynthetic(event, "after");
+
+ event = new ClipboardEvent("paste", { dataType: "application/unknown", data: "unknown" });
+ expectedData = { type: "paste", dataType: "application/unknown", data: "unknown" }
+ compareSynthetic(event, "before");
+ syntheticSpot.dispatchEvent(event);
+ ok(expectedData.eventFired, "paste event fired");
+ compareSynthetic(event, "after");
+});
+
+function compareSynthetic(event, eventtype) {
+ let step = (eventtype == "cut" || eventtype == "copy" || eventtype == "paste") ? "during" : eventtype;
+ if (step == "during") {
+ is(eventtype, expectedData.type, "synthetic " + eventtype + " event fired");
+ }
+
+ ok(event.clipboardData instanceof DataTransfer, "clipboardData is assigned");
+
+ is(event.type, expectedData.type, "synthetic " + eventtype + " event type");
+ if (expectedData.data === null) {
+ is(SpecialPowers.wrap(event.clipboardData).mozItemCount, 0, "synthetic " + eventtype + " empty data");
+ }
+ else {
+ is(SpecialPowers.wrap(event.clipboardData).mozItemCount, 1, "synthetic " + eventtype + " item count");
+ is(event.clipboardData.types.length, 1, "synthetic " + eventtype + " types length");
+ is(event.clipboardData.getData(expectedData.dataType), expectedData.data,
+ "synthetic " + eventtype + " data");
+ }
+
+ is(getClipboardText(), "empty", "event does not change the clipboard " + step + " dispatch");
+
+ if (step == "during") {
+ expectedData.eventFired = true;
+ }
+}
+
+async function checkCachedDataTransfer(cd, eventtype) {
+ var testprefix = "cached " + eventtype + " dataTransfer";
+
+ try {
+ await putOnClipboard("Some Clipboard Text", () => { setClipboardText("Some Clipboard Text") },
+ "change clipboard outside of event");
+ } catch (e) {
+ ok(false, e.toString());
+ return;
+ }
+
+ var oldtext = cd.getData("text/plain");
+ ok(!oldtext, "clipboard get using " + testprefix);
+
+ try {
+ SpecialPowers.wrap(cd).mozSetDataAt("text/plain", "Test Cache Data", 0);
+ } catch (ex) {}
+ ok(!cd.getData("text/plain"), "clipboard set using " + testprefix);
+
+ is(getClipboardText(), "Some Clipboard Text", "clipboard not changed using " + testprefix);
+
+ try {
+ cd.mozClearDataAt("text/plain", 0);
+ } catch (ex) {}
+ ok(!cd.getData("text/plain"), "clipboard clear using " + testprefix);
+
+ is(getClipboardText(), "Some Clipboard Text", "clipboard not changed using " + testprefix);
+}
+
+add_task(async function test_modify_datatransfer_outofevent() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Check if the cached clipboard data can be accessed or modified
+ // and whether it modifies the real clipboard
+
+ // XXX Depends on test_input_cut_dataTransfer()
+ if (cachedCutData) {
+ await checkCachedDataTransfer(cachedCutData, "cut");
+ } else {
+ todo(false, "test_input_cut_dataTransfer must have been failed, skipping tests with its dataTransfer");
+ }
+ // XXX Depends on test_input_copy_dataTransfer()
+ if (cachedCopyData) {
+ await checkCachedDataTransfer(cachedCopyData, "copy");
+ } else {
+ todo(false, "test_input_copy_dataTransfer must have been failed, skipping tests with its dataTransfer");
+ }
+ // XXX Depends on test_input_paste_dataTransfer()
+ if (cachedPasteData) {
+ await checkCachedDataTransfer(cachedPasteData, "paste");
+ } else {
+ todo(false, "test_input_paste_dataTransfer must have been failed, skipping tests with its dataTransfer");
+ }
+});
+
+add_task(async function test_input_cut_disallowed_types_dataTransfer() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ selectContentInput();
+ let oncutExecuted = false;
+ contentInput.oncut = function(event) {
+ // Setting an arbitrary type should be OK
+ try {
+ event.clipboardData.setData("apple/cider", "Anything your heart desires");
+ ok(true, "We should have successfully executed the setData call");
+ } catch(e) {
+ ok(false, "We should not have gotten an exception for trying to set that data");
+ }
+
+ // Unless that type happens to be application/x-moz-custom-clipdata
+ try {
+ event.clipboardData.setData("application/x-moz-custom-clipdata", "Anything your heart desires");
+ ok(false, "We should not have successfully executed the setData call");
+ } catch(e) {
+ is(e.name, "NotSupportedError",
+ "We should have gotten an NotSupportedError exception for trying to set that data");
+ }
+ oncutExecuted = true;
+ };
+
+ try {
+ await putOnClipboard("INPUT TEXT", () => {
+ synthesizeKey("x", {accelKey: 1});
+ }, "The oncut handler should have been executed data");
+ ok(oncutExecuted, "The oncut handler should have been executed");
+ } catch (e) {
+ ok(false, "Failed to copy the data given by the oncut");
+ }
+});
+
+// Try copying an image to the clipboard and make sure that it looks correct when pasting it.
+add_task(async function test_image_dataTransfer() {
+ // cmd_copyImageContents errors on Android (bug 1299578).
+ if (navigator.userAgent.includes("Android")) {
+ return;
+ }
+
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ // Copy the image's data to the clipboard
+ try {
+ await putOnClipboard("", () => {
+ SpecialPowers.setCommandNode(window, document.getElementById("image"));
+ SpecialPowers.doCommand(window, "cmd_copyImageContents");
+ }, "copy changed clipboard when preference is disabled");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+
+ let onpasteCalled = false;
+ document.onpaste = function(event) {
+ ok(event instanceof ClipboardEvent, "paste event is an ClipboardEvent");
+ ok(event.clipboardData instanceof DataTransfer, "paste event dataTransfer is a DataTransfer");
+ let items = event.clipboardData.items;
+ let foundData = false;
+ for (let i = 0; i < items.length; ++i) {
+ if (items[i].kind == "file") {
+ foundData = true;
+ is(items[i].type, "image/png", "The type of the data must be image/png");
+ is(items[i].getAsFile().type, "image/png", "The attached file must be image/png");
+ }
+ }
+ ok(foundData, "Should have found a file entry in the DataTransferItemList");
+ let files = event.clipboardData.files;
+ is(files.length, 1, "There should only be one file on the DataTransfer");
+ is(files[0].type, "image/png", "The only file should be an image/png");
+ onpasteCalled = true;
+ }
+
+ synthesizeKey("v", {accelKey: 1});
+ ok(onpasteCalled, "The paste event listener must have been called");
+});
+
+add_task(async function test_event_target() {
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ let copyTarget = null;
+ addEventListenerTo(document, "copy", (event) => { copyTarget = event.target; }, {once: true});
+
+ if (document.activeElement) {
+ document.activeElement.blur();
+ }
+
+ let selection = document.getSelection();
+ selection.setBaseAndExtent(content.firstChild, "CONTENT ".length,
+ content.firstChild, "CONTENT TEXT".length);
+
+ try {
+ await putOnClipboard("TEXT", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "copy text from non-editable element");
+ } catch (e) {
+ ok(false, e.toString());
+ }
+
+ is(copyTarget.getAttribute("id"), "content", "Copy event's target should be always an element");
+
+ // Create a contenteditable element to check complicated event target.
+ contenteditableContainer.innerHTML = '<div contenteditable><p id="p1">foo</p><p id="p2">bar</p></div>';
+ contenteditableContainer.firstChild.focus();
+
+ let p1 = document.getElementById("p1");
+ let p2 = document.getElementById("p2");
+ selection.setBaseAndExtent(p1.firstChild, 1, p2.firstChild, 1);
+
+ let pasteTarget = null;
+ let pasteEventCount = 0;
+ function pasteEventLogger(event) {
+ pasteTarget = event.target;
+ pasteEventCount++;
+ }
+ addEventListenerTo(document, "paste", pasteEventLogger);
+ synthesizeKey("v", {accelKey: 1});
+ is(pasteTarget.getAttribute("id"), "p1",
+ "'paste' event's target should be always an element which includes start container of the first Selection range");
+ is(pasteEventCount, 1,
+ "'paste' event should be fired only once when Accel+'v' is pressed");
+});
+
+add_task(async function test_paste_event_for_middle_click_without_HTMLEditor() {
+ await SpecialPowers.pushPrefEnv({"set": [["middlemouse.paste", true],
+ ["middlemouse.contentLoadURL", false]]});
+
+ try {
+ await reset();
+ } catch (e) {
+ ok(false, `Failed to reset (${e.toString()})`);
+ return;
+ }
+
+ contenteditableContainer.innerHTML = '<div id="non-editable-target">non-editable</div>';
+ let noneditableDiv = document.getElementById("non-editable-target");
+
+ ok(!getHTMLEditor(), "There should not be HTMLEditor");
+
+ let selection = document.getSelection();
+ selection.setBaseAndExtent(content.firstChild, 0,
+ content.firstChild, "CONTENT".length);
+
+ try {
+ await putOnClipboard("CONTENT", () => {
+ synthesizeKey("c", {accelKey: 1});
+ }, "copy text from non-editable element");
+ } catch (e) {
+ ok(false, e.toString());
+ return;
+ }
+
+ let auxclickFired = false;
+ function onAuxClick(event) {
+ auxclickFired = true;
+ }
+ addEventListenerTo(document, "auxclick", onAuxClick);
+
+ let pasteEventCount = 0;
+ function onPaste(event) {
+ pasteEventCount++;
+ ok(auxclickFired, "'auxclick' event should be fired before 'paste' event");
+ is(event.target, noneditableDiv,
+ "'paste' event should be fired on the clicked element");
+ }
+ addEventListenerTo(document, "paste", onPaste);
+
+ synthesizeMouseAtCenter(noneditableDiv, {button: 1});
+ is(pasteEventCount, 1, "'paste' event should be fired just once");
+
+ pasteEventCount = 0;
+ auxclickFired = false;
+ addEventListenerTo(document, "mouseup", (event) => { event.preventDefault(); }, {once: true});
+ synthesizeMouseAtCenter(noneditableDiv, {button: 1});
+ is(pasteEventCount, 1,
+ "Even if 'mouseup' event is consumed, 'paste' event should be fired");
+
+ pasteEventCount = 0;
+ auxclickFired = false;
+ addEventListenerTo(document, "auxclick", (event) => { event.preventDefault(); }, {once: true, capture: true});
+ synthesizeMouseAtCenter(noneditableDiv, {button: 1});
+ ok(auxclickFired, "'auxclickFired' fired");
+ is(pasteEventCount, 0,
+ "If 'auxclick' event is consumed at capturing phase at the document node, 'paste' event should not be fired");
+
+ pasteEventCount = 0;
+ auxclickFired = false;
+ addEventListenerTo(noneditableDiv, "auxclick", (event) => { event.preventDefault(); }, {once: true});
+ synthesizeMouseAtCenter(noneditableDiv, {button: 1});
+ ok(auxclickFired, "'auxclick' fired");
+ is(pasteEventCount, 0,
+ "If 'auxclick' event listener is added to the click event target, 'paste' event should not be fired");
+
+ pasteEventCount = 0;
+ auxclickFired = false;
+ addEventListenerTo(document, "auxclick", (event) => { event.preventDefault(); }, {once: true});
+ synthesizeMouseAtCenter(noneditableDiv, {button: 1});
+ ok(auxclickFired, "'auxclick' fired");
+ is(pasteEventCount, 0,
+ "If 'auxclick' event is consumed, 'paste' event should be not be fired");
+});
+
+add_task(function cleaning_up() {
+ try {
+ disableNonTestMouseEvents(false);
+ } finally {
+ window.close();
+ }
+});
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/window_storagePermissions.html b/dom/tests/mochitest/general/window_storagePermissions.html
new file mode 100644
index 0000000000..3bab23c13b
--- /dev/null
+++ b/dom/tests/mochitest/general/window_storagePermissions.html
@@ -0,0 +1,38 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+ <script type="text/javascript" src="storagePermissionsUtils.js"></script>
+ </head>
+ <body>
+ <iframe></iframe>
+
+ <script type="text/javascript">
+
+function ok(a, msg) {
+ opener.postMessage({type: "check", test: !!a, msg }, "*");
+}
+
+function is(a, b, msg) {
+ ok(a === b , msg);
+}
+
+let init = false;
+onmessage = e => {
+ if (!init) {
+ init = true;
+
+ let runnableStr = `(() => {return (${e.data});})();`;
+ let runnable = eval(runnableStr); // eslint-disable-line no-eval
+ runnable.call(this).then(_ => {
+ opener.postMessage({ type: "finish" }, "*");
+ });
+
+ return;
+ }
+
+ parent.postMessage(e.data, "*");
+}
+
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/general/workerStorageAllowed.js b/dom/tests/mochitest/general/workerStorageAllowed.js
new file mode 100644
index 0000000000..89e0a4b9ce
--- /dev/null
+++ b/dom/tests/mochitest/general/workerStorageAllowed.js
@@ -0,0 +1,78 @@
+// Unfortunately, workers can't share the code from storagePermissionsUtils.
+// These are basic mechanisms for communicating to the test runner.
+
+function ok(condition, text) {
+ if (!condition) {
+ self.postMessage("FAILURE: " + text);
+ } else {
+ self.postMessage(text);
+ }
+}
+
+function finishTest() {
+ self.postMessage("done");
+ self.close();
+}
+
+// Workers don't have access to localstorage or sessionstorage
+ok(typeof self.localStorage == "undefined", "localStorage should be undefined");
+ok(
+ typeof self.sessionStorage == "undefined",
+ "sessionStorage should be undefined"
+);
+
+// Make sure that we can access indexedDB
+try {
+ indexedDB;
+ ok(true, "WORKER getting indexedDB didn't throw");
+} catch (e) {
+ ok(false, "WORKER getting indexedDB should not throw");
+}
+
+// Make sure that we can access caches
+try {
+ var promise = caches.keys();
+ ok(true, "WORKER getting caches didn't throw");
+
+ promise.then(
+ function () {
+ ok(location.protocol == "https:", "WORKER The promise was not rejected");
+ workerTest();
+ },
+ function () {
+ ok(
+ location.protocol !== "https:",
+ "WORKER The promise should not have been rejected"
+ );
+ workerTest();
+ }
+ );
+} catch (e) {
+ ok(
+ location.protocol !== "https:",
+ "WORKER getting caches should not have thrown"
+ );
+ workerTest();
+}
+
+// Try to spawn an inner worker, and make sure that it can also access storage
+function workerTest() {
+ if (location.hash == "#inner") {
+ // Don't recurse infinitely, if we are the inner worker, don't spawn another
+ finishTest();
+ return;
+ }
+ // Create the inner worker, and listen for test messages from it
+ var worker = new Worker("workerStorageAllowed.js#inner");
+ worker.addEventListener("message", function (e) {
+ if (e.data == "done") {
+ finishTest();
+ return;
+ }
+
+ ok(
+ !e.data.match(/^FAILURE/),
+ e.data + " (WORKER = workerStorageAllowed.js#inner)"
+ );
+ });
+}
diff --git a/dom/tests/mochitest/general/workerStoragePrevented.js b/dom/tests/mochitest/general/workerStoragePrevented.js
new file mode 100644
index 0000000000..467cc09113
--- /dev/null
+++ b/dom/tests/mochitest/general/workerStoragePrevented.js
@@ -0,0 +1,75 @@
+// Unfortunately, workers can't share the code from storagePermissionsUtils.
+// These are basic mechanisms for communicating to the test runner.
+
+function ok(condition, text) {
+ if (!condition) {
+ self.postMessage("FAILURE: " + text);
+ } else {
+ self.postMessage(text);
+ }
+}
+
+function finishTest() {
+ self.postMessage("done");
+ self.close();
+}
+
+// Workers don't have access to localstorage or sessionstorage
+ok(typeof self.localStorage == "undefined", "localStorage should be undefined");
+ok(
+ typeof self.sessionStorage == "undefined",
+ "sessionStorage should be undefined"
+);
+
+// Make sure that we can't access indexedDB
+try {
+ indexedDB;
+ ok(false, "WORKER getting indexedDB should have thrown");
+} catch (e) {
+ ok(true, "WORKER getting indexedDB threw");
+}
+
+// Make sure that we can't access caches
+try {
+ var promise = caches.keys();
+ ok(true, "WORKER getting caches didn't throw");
+
+ promise.then(
+ function () {
+ ok(false, "WORKER The promise should have rejected");
+ workerTest();
+ },
+ function () {
+ ok(true, "WORKER The promise was rejected");
+ workerTest();
+ }
+ );
+} catch (e) {
+ ok(
+ location.protocol !== "https:",
+ "WORKER getting caches should not have thrown"
+ );
+ workerTest();
+}
+
+// Try to spawn an inner worker, and make sure that it also can't access storage
+function workerTest() {
+ if (location.hash == "#inner") {
+ // Don't recurse infinitely, if we are the inner worker, don't spawn another
+ finishTest();
+ return;
+ }
+ // Create the inner worker, and listen for test messages from it
+ var worker = new Worker("workerStoragePrevented.js#inner");
+ worker.addEventListener("message", function (e) {
+ if (e.data == "done") {
+ finishTest();
+ return;
+ }
+
+ ok(
+ !e.data.match(/^FAILURE/),
+ e.data + " (WORKER = workerStoragePrevented.js#inner)"
+ );
+ });
+}
diff --git a/dom/tests/mochitest/geolocation/chrome.ini b/dom/tests/mochitest/geolocation/chrome.ini
new file mode 100644
index 0000000000..1922074f17
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/chrome.ini
@@ -0,0 +1,6 @@
+[DEFAULT]
+support-files =
+ geolocation_common.js
+ network_geolocation.sjs
+
+[test_handlerSpinsEventLoop.html]
diff --git a/dom/tests/mochitest/geolocation/crossorigin_iframe.html b/dom/tests/mochitest/geolocation/crossorigin_iframe.html
new file mode 100644
index 0000000000..f370003ad8
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/crossorigin_iframe.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<pre id="test">
+<script type="application/javascript">
+/**
+ Runs inside iframe in test_crossorigin_iframe.html.
+*/
+
+const BASE_GEO_URL = "http://mochi.test:8888/tests/dom/tests/mochitest/geolocation/network_geolocation.sjs";
+var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
+
+(async () => {
+ await pushPrefs(["geo.provider.network.debug.requestCache.enabled", false],
+ ["geo.prompt.testing", true],
+ ["geo.prompt.testing.allow", true],
+ ["geo.provider.network.url", BASE_GEO_URL]);
+
+ navigator.geolocation.getCurrentPosition(() => {
+ navigator.geolocation.watchPosition(() => {
+ parent.postMessage("allowed", "*");
+ }, () => {
+ parent.postMessage("denied", "*");
+ });
+ }, () => {
+ parent.postMessage("denied", "*");
+ });
+
+})().catch(e => setTimeout(() => { throw e; }));
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/file_featurePolicy.html b/dom/tests/mochitest/geolocation/file_featurePolicy.html
new file mode 100644
index 0000000000..3028321721
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/file_featurePolicy.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test_currentPosition);
+});
+
+let tests = [];
+
+function test_currentPosition() {
+ navigator.geolocation.getCurrentPosition(() => {
+ tests.push("allowed");
+ test_watchPosition();
+ }, () => {
+ tests.push("denied");
+ test_watchPosition();
+ })
+}
+
+function test_watchPosition() {
+ navigator.geolocation.watchPosition(() => {
+ tests.push("allowed");
+ send_results();
+ }, () => {
+ tests.push("denied");
+ send_results();
+ });
+}
+
+function send_results() {
+ if (tests.length != 2 || tests[0] != tests[1]) {
+ parent.continueTest("error");
+ return;
+ }
+
+ parent.continueTest(tests[0]);
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/geolocation.html b/dom/tests/mochitest/geolocation/geolocation.html
new file mode 100644
index 0000000000..e62f13e7d3
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/geolocation.html
@@ -0,0 +1,13 @@
+<html>
+ <head>
+ <title>Simple access of geolocation</title>
+ <head>
+ <script>
+ function loadedWindow() {
+ opener.postMessage("loaded", "*");
+ }
+ navigator.geolocation.getCurrentPosition(loadedWindow, loadedWindow, {timeout:30000});
+ </script>
+ </head>
+ <body></body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/geolocation_common.js b/dom/tests/mochitest/geolocation/geolocation_common.js
new file mode 100644
index 0000000000..2868215e76
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/geolocation_common.js
@@ -0,0 +1,154 @@
+"use strict";
+
+var harness =
+ SimpleTest.harnessParameters.testRoot == "chrome" ? "chrome" : "tests";
+var BASE_URL =
+ "http://mochi.test:8888/" +
+ harness +
+ "/dom/tests/mochitest/geolocation/network_geolocation.sjs";
+
+function set_geo_wifi_uri(uri, callback) {
+ // Disable NetworkGeolocationProvider.js request cache because the cache
+ // does not remember from which location service it came from. We expect
+ // different results when we change the provider URL (geo.provider.network.url).
+ set_network_request_cache_enabled(false, () => {
+ SpecialPowers.pushPrefEnv(
+ { set: [["geo.provider.network.url", uri]] },
+ callback
+ );
+ });
+}
+
+function sleep(delay) {
+ var start = Date.now();
+ while (Date.now() < start + delay) {}
+}
+
+function force_prompt(allow, callback) {
+ SpecialPowers.pushPrefEnv(
+ {
+ set: [
+ ["geo.prompt.testing", true],
+ ["geo.prompt.testing.allow", allow],
+ ],
+ },
+ callback
+ );
+}
+
+function start_sending_garbage(callback) {
+ set_geo_wifi_uri(BASE_URL + "?action=respond-garbage", () => {
+ // we need to be sure that all location data has been purged/set.
+ sleep(1000);
+ callback.call();
+ });
+}
+
+function stop_sending_garbage(callback) {
+ set_geo_wifi_uri(BASE_URL + "", () => {
+ // we need to be sure that all location data has been purged/set.
+ sleep(1000);
+ callback.call();
+ });
+}
+
+function stop_geolocationProvider(callback) {
+ set_geo_wifi_uri(BASE_URL + "?action=stop-responding", () => {
+ // we need to be sure that all location data has been purged/set.
+ sleep(1000);
+ callback.call();
+ });
+}
+
+function set_network_request_cache_enabled(enabled, callback) {
+ SpecialPowers.pushPrefEnv(
+ { set: [["geo.provider.network.debug.requestCache.enabled", enabled]] },
+ callback
+ );
+}
+
+function worse_geolocationProvider(callback) {
+ set_geo_wifi_uri(BASE_URL + "?action=worse-accuracy", callback);
+}
+
+function resume_geolocationProvider(callback) {
+ set_geo_wifi_uri(BASE_URL + "", callback);
+}
+
+function delay_geolocationProvider(delay, callback) {
+ set_geo_wifi_uri(BASE_URL + "?delay=" + delay, callback);
+}
+
+function send404_geolocationProvider(callback) {
+ set_geo_wifi_uri(BASE_URL + "?action=send404", callback);
+}
+
+function check_geolocation(location) {
+ ok(location, "Check to see if this location is non-null");
+
+ const timestamp = location.timestamp;
+ dump(`timestamp=${timestamp}\n`);
+ ok(IsNumber(timestamp), "check timestamp type");
+ ok(timestamp > 0, "check timestamp range");
+
+ // eventually, coords may be optional (eg, when civic addresses are supported)
+ ok("coords" in location, "Check to see if this location has a coords");
+
+ const {
+ latitude,
+ longitude,
+ accuracy,
+ altitude,
+ altitudeAccuracy,
+ speed,
+ heading,
+ } = location.coords;
+
+ dump(`latitude=${latitude}\n`);
+ dump(`longitude=${longitude}\n`);
+ dump(`accuracy=${accuracy}\n`);
+ dump(`altitude=${altitude}\n`);
+ dump(`altitudeAccuracy=${altitudeAccuracy}\n`);
+ dump(`speed=${speed}\n`);
+ dump(`heading=${heading}\n`);
+
+ ok(IsNumber(latitude), "check latitude type");
+ ok(IsNumber(longitude), "check longitude type");
+
+ ok(
+ Math.abs(latitude - 37.41857) < 0.001,
+ "latitude matches hard-coded value"
+ );
+ ok(
+ Math.abs(longitude + 122.08769) < 0.001,
+ "longitude matches hard-coded value"
+ );
+
+ ok(IsNonNegativeNumber(accuracy), "check accuracy type and range");
+ ok(IsNumber(altitude) || altitude === null, "check accuracy type");
+
+ ok(
+ (IsNonNegativeNumber(altitudeAccuracy) && IsNumber(altitude)) ||
+ altitudeAccuracy === null,
+ "check altitudeAccuracy type and range"
+ );
+
+ ok(
+ IsNonNegativeNumber(speed) || speed === null,
+ "check speed type and range"
+ );
+
+ ok(
+ (IsNonNegativeNumber(heading) && heading < 360 && speed > 0) ||
+ heading === null,
+ "check heading type and range"
+ );
+}
+
+function IsNumber(x) {
+ return typeof x === "number" && !Number.isNaN(x);
+}
+
+function IsNonNegativeNumber(x) {
+ return IsNumber(x) && x >= 0;
+}
diff --git a/dom/tests/mochitest/geolocation/mochitest.ini b/dom/tests/mochitest/geolocation/mochitest.ini
new file mode 100644
index 0000000000..44caab9fa5
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/mochitest.ini
@@ -0,0 +1,82 @@
+[DEFAULT]
+tags = geolocation condprof
+scheme = https
+support-files =
+ geolocation.html
+ geolocation_common.js
+ network_geolocation.sjs
+ windowTest.html
+ popup.html
+prefs =
+ dom.security.featurePolicy.header.enabled=true
+ dom.security.featurePolicy.webidl.enabled=true
+
+[test_allowCurrent.html]
+skip-if = xorigin # Hangs
+[test_allowWatch.html]
+skip-if = xorigin # Hangs
+[test_hidden.html]
+skip-if = xorigin # Hangs
+ toolkit == 'android' # test uses popup windows
+ condprof #: timed out
+support-files = popup.html
+[test_cachedPosition.html]
+fail-if = xorigin
+[test_cancelCurrent.html]
+[test_cancelWatch.html]
+[test_clearWatch.html]
+skip-if = xorigin # Hangs
+[test_clearWatchBeforeAllowing.html]
+skip-if = xorigin # Hangs
+[test_clearWatch_invalid.html]
+[test_crossorigin_iframe.html]
+support-files = crossorigin_iframe.html
+fail-if = xorigin
+[test_enableHighAccuracy.html]
+skip-if = xorigin
+[test_errorcheck.html]
+fail-if = xorigin
+[test_geolocation_is_undefined_when_pref_is_off.html]
+support-files = test_geolocation_is_undefined_when_pref_is_off_iframe.html
+[test_manyCurrentConcurrent.html]
+fail-if = xorigin
+skip-if = condprof #: timed out
+[test_manyCurrentSerial.html]
+skip-if = xorigin # Hangs
+ condprof #: timed out
+[test_manyWatchConcurrent.html]
+fail-if = xorigin
+skip-if = condprof #: timed out
+[test_manyWatchSerial.html]
+skip-if = xorigin # Hangs
+[test_manyWindows.html]
+[test_native_provider.html]
+skip-if = toolkit != 'android'
+[test_optional_api_params.html]
+[test_shutdown.html]
+fail-if = xorigin
+[test_timeoutCurrent.html]
+fail-if = xorigin
+[test_timerRestartWatch.html]
+skip-if = xorigin # Hangs
+[test_windowClose.html]
+[test_worseAccuracyDoesNotBlockCallback.html]
+skip-if = xorigin # Hangs
+[test_featurePolicy.html]
+support-files = file_featurePolicy.html
+fail-if = xorigin
+[test_not_fully_active.html]
+skip-if = xorigin # Hangs
+support-files = popup.html
+
+# This test REQUIRES to run on HTTP (_NOT_ HTTPS).
+[test_geoWatchPositionBlockedInInsecureContext.html]
+scheme = http
+skip-if =
+ http3
+
+# This test REQUIRES to run on HTTP (_NOT_ HTTPS).
+[test_geoGetCurrentPositionBlockedInInsecureContext.html]
+scheme = http
+skip-if =
+ http3
diff --git a/dom/tests/mochitest/geolocation/network_geolocation.sjs b/dom/tests/mochitest/geolocation/network_geolocation.sjs
new file mode 100644
index 0000000000..1868aaa8f3
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/network_geolocation.sjs
@@ -0,0 +1,81 @@
+function parseQueryString(str) {
+ if (str == "") {
+ return {};
+ }
+
+ var paramArray = str.split("&");
+ var regex = /^([^=]+)=(.*)$/;
+ var params = {};
+ for (var i = 0, sz = paramArray.length; i < sz; i++) {
+ var match = regex.exec(paramArray[i]);
+ if (!match) {
+ throw "Bad parameter in queryString! '" + paramArray[i] + "'";
+ }
+ params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
+ }
+
+ return params;
+}
+
+function getPosition(action) {
+ var response = {
+ status: "OK",
+ location: {
+ lat: 37.41857,
+ lng: -122.08769,
+ },
+ accuracy: action == "worse-accuracy" ? 100 : 42,
+ };
+
+ return JSON.stringify(response);
+}
+
+var timer;
+function handleRequest(request, response) {
+ var params = parseQueryString(request.queryString);
+
+ if (params.action == "stop-responding") {
+ response.processAsync();
+ return;
+ }
+
+ var position = getPosition(params.action);
+
+ if (params.action == "respond-garbage") {
+ // better way?
+ var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
+ position = "";
+ var len = Math.floor(Math.random() * 5000);
+
+ for (var i = 0; i < len; i++) {
+ var c = Math.floor(Math.random() * chars.length);
+ position += chars.substring(c, c + 1);
+ }
+ }
+
+ var response;
+ response.processAsync();
+ response.setStatusLine("1.0", 200, "OK");
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "aplication/x-javascript", false);
+
+ var delay = 0;
+ if ("delay" in params) {
+ delay = params.delay;
+ }
+ if (params.action === "send404") {
+ response.setStatusLine("1.0", 404, "Not Found");
+ position = "";
+ }
+ timer = Components.classes["@mozilla.org/timer;1"].createInstance(
+ Components.interfaces.nsITimer
+ );
+ timer.initWithCallback(
+ function () {
+ response.write(position);
+ response.finish();
+ },
+ delay,
+ timer.TYPE_ONE_SHOT
+ );
+}
diff --git a/dom/tests/mochitest/geolocation/popup.html b/dom/tests/mochitest/geolocation/popup.html
new file mode 100644
index 0000000000..b286f16ff3
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/popup.html
@@ -0,0 +1,19 @@
+<html>
+ <head>
+ <title>Simple access of geolocation</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="geolocation_common.js"></script>
+ <meta charset="utf-8">
+ <head>
+ <script>
+ async function loadedWindow() {
+ await new Promise(r => force_prompt(true, r));
+ opener.postMessage("initialized", "*");
+ }
+ navigator.geolocation.getCurrentPosition(loadedWindow, loadedWindow, {timeout:30000});
+ </script>
+ </head>
+ <body>
+ <h1>Just a support file</h1>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_allowCurrent.html b/dom/tests/mochitest/geolocation/test_allowCurrent.html
new file mode 100644
index 0000000000..a0ebefdc60
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_allowCurrent.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Mozilla Bug 478911</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+
+function successCallback(position) {
+ check_geolocation(position);
+ SimpleTest.finish();
+}
+
+function test1() {
+ navigator.geolocation.getCurrentPosition(successCallback);
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_allowWatch.html b/dom/tests/mochitest/geolocation/test_allowWatch.html
new file mode 100644
index 0000000000..782d5ee071
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_allowWatch.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Mozilla Bug 478911</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var watchID;
+
+function successCallback(position) {
+ check_geolocation(position);
+ navigator.geolocation.clearWatch(watchID);
+ SimpleTest.finish();
+}
+
+function test1() {
+ watchID = navigator.geolocation.watchPosition(successCallback, null, null);
+ is(watchID, 1, "initially returns 1");
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_cachedPosition.html b/dom/tests/mochitest/geolocation/test_cachedPosition.html
new file mode 100644
index 0000000000..1422c3c3bb
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_cachedPosition.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=850442
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850442">Mozilla Bug 850442</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+/*
+The request cache vs. the PositionOptions cache is confusing to the reader, to explain:
+
+Testing uses mochitest httpd, so the network cache must be disabled in order for requests
+to propagate to mochitest httpd. Otherwise, every request looks like a geoip request,
+and the network request cache sees no reason to make a web request for location for geoip
+if it has already made geoip (or better) requests.
+
+We should investigate providing fake wifi and cell scans to the
+network location provider, then the network cache does not need to be shut off
+AND it will get testing coverage.
+
+*/
+resume_geolocationProvider(function() {
+ force_prompt(true, function () {
+ set_network_request_cache_enabled(false, test_cachedPosition)
+ });
+});
+
+function done() {
+ set_network_request_cache_enabled(true, function() {
+ resume_geolocationProvider(function() {
+ SimpleTest.finish();
+ });
+ });
+}
+
+function errorCallback(err) {
+ ok(false, "error callback should not have been called");
+ done();
+}
+
+function test_cachedPosition() {
+ var cached = null;
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ // first call is just to warm up the cache
+ check_geolocation(pos);
+
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ check_geolocation(pos);
+ cached = pos;
+
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ check_geolocation(pos);
+ is(pos.timestamp, cached.timestamp, "position should be equal to cached position");
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ // force new position, can't be the one we have
+ check_geolocation(pos);
+ isnot(pos.timestamp, cached.timestamp, "position should not be equal to cached position");
+ done();
+ }, errorCallback, {maximumAge: 0});
+ }, errorCallback, {maximumAge: 21600000});
+ }, errorCallback, {maximumAge: 21600000});
+ }, errorCallback, {maximumAge: 21600000});
+ }
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_cancelCurrent.html b/dom/tests/mochitest/geolocation/test_cancelCurrent.html
new file mode 100644
index 0000000000..a5357ac938
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_cancelCurrent.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Mozilla Bug 478911</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(false, test1);
+});
+
+function failureCallback(error) {
+ ok(error.code == error.PERMISSION_DENIED, "Ensure that the error was PERMISSION_DENIED");
+ SimpleTest.finish();
+}
+
+function successCallback(position){
+ ok(0, "Success was called when it shouldn't have been. major problem");
+ SimpleTest.finish();
+}
+
+function test1() {
+ navigator.geolocation.getCurrentPosition(successCallback, failureCallback, null);
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_cancelWatch.html b/dom/tests/mochitest/geolocation/test_cancelWatch.html
new file mode 100644
index 0000000000..18ca21ba18
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_cancelWatch.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Mozilla Bug 478911</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(false, test1);
+});
+
+var watchID;
+
+function failureCallback(error) {
+ ok(error.code == error.PERMISSION_DENIED, "Ensure that the error was PERMISSION_DENIED");
+ SimpleTest.finish();
+}
+
+function successCallback(position){
+ ok(0, "Success was called when it shouldn't have been. major problem");
+ SimpleTest.finish();
+}
+
+function test1() {
+ watchID = navigator.geolocation.watchPosition(successCallback, failureCallback, null);
+}
+</script>
+</pre>
+</body>
+</html>
+
+
+
diff --git a/dom/tests/mochitest/geolocation/test_clearWatch.html b/dom/tests/mochitest/geolocation/test_clearWatch.html
new file mode 100644
index 0000000000..4c1776331e
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_clearWatch.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for watchPosition and clearWatch</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Mozilla Bug 478911</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var hasBeenCleared = false;
+var successWasCalledAfterClear = false;
+var firstCallback = true;
+
+function failureCallback(error)
+{
+ ok(0, "we should not be seeing failures from this watchPosition");
+}
+
+function successCallback(position) {
+ ok(true, "successCallback was called, hasBeenCleared=" + hasBeenCleared +
+ ", successWasCalledAfterClear=" + successWasCalledAfterClear);
+ check_geolocation(position);
+ if (hasBeenCleared == true) {
+ successWasCalledAfterClear = true;
+ }
+ if (firstCallback) {
+ SimpleTest.executeSoon(clearWatch);
+ firstCallback = false;
+ }
+}
+
+let watchID;
+
+function clearWatch() {
+ ok(true, "clearWatch was called, hasBeenCleared=" + hasBeenCleared +
+ ", successWasCalledAfterClear=" + successWasCalledAfterClear);
+ navigator.geolocation.clearWatch(watchID);
+ hasBeenCleared = true;
+ SimpleTest.executeSoon(testAccepted);
+}
+
+function testAccepted() {
+ ok(true, "testAccepted was called, hasBeenCleared=" + hasBeenCleared +
+ ", successWasCalledAfterClear=" + successWasCalledAfterClear);
+ ok(!successWasCalledAfterClear, "The successCallback should not be called after clear");
+ SimpleTest.finish();
+}
+
+function test1() {
+ ok(true, "Getting the watchPosition");
+ watchID = navigator.geolocation.watchPosition(successCallback, failureCallback, null);
+ ok(true, "Waiting");
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_clearWatchBeforeAllowing.html b/dom/tests/mochitest/geolocation/test_clearWatchBeforeAllowing.html
new file mode 100644
index 0000000000..3ac82232b7
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_clearWatchBeforeAllowing.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=886026
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+href="https://bugzilla.mozilla.org/show_bug.cgi?id=886026">Mozilla Bug 886026</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+resume_geolocationProvider(function() {
+ force_prompt(true, run_test);
+});
+
+function run_test() {
+ var successCallbackCalled = false,
+ errorCallbackCalled = false;
+
+ var watchId = navigator.geolocation.watchPosition(
+ function(pos) {
+ check_geolocation(pos);
+ successCallbackCalled = true;
+ }, function(err) {
+ errorCallbackCalled = true;
+ }
+ );
+
+ navigator.geolocation.getCurrentPosition(
+ function(pos) {
+ check_geolocation(pos);
+ SimpleTest.executeSoon(function() {
+ ok(successCallbackCalled == false,
+ "getCurrentPosition : Success callback should not have been called");
+
+ ok(errorCallbackCalled == false,
+ "getCurrentPosition : Error callback should not have been called");
+
+ SimpleTest.finish();
+ });
+ }
+ );
+
+ navigator.geolocation.clearWatch(watchId);
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_clearWatch_invalid.html b/dom/tests/mochitest/geolocation/test_clearWatch_invalid.html
new file mode 100644
index 0000000000..fe2007481e
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_clearWatch_invalid.html
@@ -0,0 +1,47 @@
+ <!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=463039
+-->
+<head>
+ <title>Test for Bug 463039</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=463039">Mozilla Bug 463039</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+function test1() {
+ navigator.geolocation.watchPosition(function(){});
+
+ // there are no watches, so this should always throw
+ for (x=-10; x<10; x++) {
+ navigator.geolocation.clearWatch(x);
+ ok(1, "clearWatch should not throw");
+ }
+
+ // lets try something huge
+ navigator.geolocation.clearWatch(Number.MAX_VALUE);
+ ok(1, "clearWatch should not throw");
+
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_crossorigin_iframe.html b/dom/tests/mochitest/geolocation/test_crossorigin_iframe.html
new file mode 100644
index 0000000000..3a5080dcb0
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_crossorigin_iframe.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for geolocation is disabled by default, and set
+ allow="geolocation" in iframe could enable geolcation</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var tests = [
+ // default cross-origin permission is denied
+ [ null, "denied" ],
+ [ "geolocation", "allowed"],
+];
+
+function checkGeolocationResult(test) {
+ return new Promise(resolve => {
+ function onMessage(event) {
+ is(event.data, test[1], "Expected " + test[1] + " for " + test[0]);
+ window.removeEventListener("message", onMessage);
+ resolve();
+ }
+
+ window.addEventListener("message", onMessage);
+ });
+}
+
+async function nextTest() {
+ if (!tests.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ let test = tests.shift();
+
+ var iframe = document.createElement("iframe");
+ if (test[0]) {
+ iframe.allow = test[0];
+ }
+
+ let geolocationPromise = checkGeolocationResult(test);
+ iframe.src =
+ "https://example.org/tests/dom/tests/mochitest/geolocation/crossorigin_iframe.html";
+ document.body.appendChild(iframe);
+ await geolocationPromise;
+
+ document.body.removeChild(iframe);
+ SimpleTest.executeSoon(nextTest);
+}
+
+SpecialPowers.pushPrefEnv({"set": [
+ ["dom.security.featurePolicy.header.enabled", true],
+ ["dom.security.featurePolicy.webidl.enabled", true],
+]}).then(nextTest);
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_enableHighAccuracy.html b/dom/tests/mochitest/geolocation/test_enableHighAccuracy.html
new file mode 100644
index 0000000000..f139c15d01
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_enableHighAccuracy.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1765835
+-->
+<head>
+ <title>Tests for watchPosition and getCurrentPosition with setHighAccuracy</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1765835">Mozilla Bug 1765835</a>
+<script class="testbody" type="text/javascript">
+function mockChromeScript() {
+ function enableHighAccuracy(subject, topic, data) {
+ sendAsyncMessage("setHighAccuracy", data == "true");
+ };
+ Services.obs.addObserver(enableHighAccuracy, "testing-geolocation-high-accuracy");
+
+ addMessageListener("cleanup", () => {
+ Services.obs.removeObserver(enableHighAccuracy, "testing-geolocation-high-accuracy");
+ sendAsyncMessage("done");
+ });
+
+ sendAsyncMessage("ready");
+}
+
+add_task(async function test_watchPosition() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["geo.prompt.testing", true], ["geo.prompt.testing.allow", true]],
+ });
+
+ let chromeScript = SpecialPowers.loadChromeScript(mockChromeScript);
+ await chromeScript.promiseOneMessage("ready");
+
+ let id = navigator.geolocation.watchPosition(() => {}, () => {}, { enableHighAccuracy: true });
+ let highAccuracy = await chromeScript.promiseOneMessage("setHighAccuracy");
+ ok(highAccuracy, "enableHighAccuracy option should be enabled");
+ navigator.geolocation.clearWatch(id);
+
+ id = navigator.geolocation.watchPosition(() => {}, () => {}, { enableHighAccuracy: false });
+ highAccuracy = await chromeScript.promiseOneMessage("setHighAccuracy");
+ ok(!highAccuracy, "enableHighAccuracy option should be disabled");
+ navigator.geolocation.clearWatch(id);
+
+ chromeScript.sendAsyncMessage("cleanup");
+ await chromeScript.promiseOneMessage("done");
+ chromeScript.destroy();
+});
+
+add_task(async function test_getCurrentPosition() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["geo.prompt.testing", true], ["geo.prompt.testing.allow", true]],
+ });
+
+ let chromeScript = SpecialPowers.loadChromeScript(mockChromeScript);
+ await chromeScript.promiseOneMessage("ready");
+
+ navigator.geolocation.getCurrentPosition(() => {}, () => {}, { enableHighAccuracy: true });
+ let highAccuracy = await chromeScript.promiseOneMessage("setHighAccuracy");
+ ok(highAccuracy, "enableHighAccuracy option should be enabled");
+
+ navigator.geolocation.getCurrentPosition(() => {}, () => {}, { enableHighAccuracy: false });
+ highAccuracy = await chromeScript.promiseOneMessage("setHighAccuracy");
+ ok(!highAccuracy, "enableHighAccuracy option should be disabled");
+
+ chromeScript.sendAsyncMessage("cleanup");
+ await chromeScript.promiseOneMessage("done");
+ chromeScript.destroy();
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_errorcheck.html b/dom/tests/mochitest/geolocation/test_errorcheck.html
new file mode 100644
index 0000000000..7900aed1e2
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_errorcheck.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=684722
+-->
+<head>
+ <title>Test for ErrorChecking </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=684722">Mozilla Bug 684722</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+function test1() {
+ send404_geolocationProvider(test2);
+}
+
+function errorCallback(error) {
+ // GeolocationPositionError has no interface object, so we can't get constants off that.
+ is(error.code, error.POSITION_UNAVAILABLE,
+ "Geolocation error handler fired");
+ is(error.POSITION_UNAVAILABLE, 2,
+ "Value of POSITION_UNAVAILABLE should be correct");
+ SimpleTest.finish();
+}
+
+function successCallback(position) {
+ test2();
+}
+
+function test2() {
+ navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_featurePolicy.html b/dom/tests/mochitest/geolocation/test_featurePolicy.html
new file mode 100644
index 0000000000..f603c7f8f2
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_featurePolicy.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for geolocation + featurePolicy</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var tests = [
+ [ "geolocation 'none'", "denied"],
+ [ "geolocation", "allowed"],
+ [ "geolocation 'src'", "allowed"],
+ [ "geolocation 'self'", "allowed"],
+ [ "geolocation *", "allowed"],
+ [ "geolocation http://random.net", "denied"],
+ [ null, "allowed" ],
+];
+
+function nextTest() {
+ if (!tests.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ let test = tests.shift();
+
+ var iframe = document.createElement("iframe");
+ if (test[0]) {
+ iframe.setAttribute("allow", test[0]);
+ }
+
+ window.continueTest = msg => {
+ delete window.continueTest;
+
+ is(msg, test[1], "Expected " + test[1] + " for " + test[0]);
+ document.body.removeChild(iframe);
+ SimpleTest.executeSoon(nextTest);
+ };
+
+ iframe.src = "file_featurePolicy.html";
+ document.body.appendChild(iframe);
+}
+
+nextTest();
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_garbageWatch.html b/dom/tests/mochitest/geolocation/test_garbageWatch.html
new file mode 100644
index 0000000000..65e2fc8ac6
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_garbageWatch.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for garbage data returned from location provider </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=455327">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/** Test for Bug **/
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+function test1() {
+ start_sending_garbage(test2);
+}
+
+function successCallback(pos){
+ ok(false, "success should have never been called.");
+ stop_sending_garbage(function() {SimpleTest.finish();});
+}
+
+function errorCallback(err) {
+ ok(err.code == err.TIMEOUT, "ensure error is a timeout.");
+ stop_sending_garbage(function() { SimpleTest.finish(); });
+}
+
+var options = {
+ maximumAge: 0,
+ timeout: 1000,
+};
+
+function test2() {
+ navigator.geolocation.watchPosition(successCallback,
+ errorCallback,
+ options);
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_geoGetCurrentPositionBlockedInInsecureContext.html b/dom/tests/mochitest/geolocation/test_geoGetCurrentPositionBlockedInInsecureContext.html
new file mode 100644
index 0000000000..55435f6f16
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_geoGetCurrentPositionBlockedInInsecureContext.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1269531
+-->
+<head>
+ <title>Test for Bug 1269531</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1269531">Mozilla Bug 1269531</a>
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ </div>
+ <pre id="test">
+ <script class="testbody" type="text/javascript">
+
+ SimpleTest.waitForExplicitFinish();
+
+ // The test succeeds if the error callback is called because we expect
+ // failure when a getCurrentPosition() request is submitted in a non
+ // secure context.
+ function successCallback(position) {
+ ok(false, "Success callback is not expected to be called");
+ SimpleTest.finish();
+ }
+
+ function errorCallback(error) {
+ ok(true, "Check for the error callback to be called for insecure requests");
+ is(error.code, error.PERMISSION_DENIED, "Check error code for insecure requests");
+ SimpleTest.finish();
+ }
+
+ // Insecure requests should be blocked, for that we enable the relevant pref.
+ SpecialPowers.pushPrefEnv({"set": [["geo.security.allowinsecure", false]]}, function() {
+ force_prompt(true, function() {
+ navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+ })
+ });
+
+ </script>
+ </pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_geoWatchPositionBlockedInInsecureContext.html b/dom/tests/mochitest/geolocation/test_geoWatchPositionBlockedInInsecureContext.html
new file mode 100644
index 0000000000..60bad9f644
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_geoWatchPositionBlockedInInsecureContext.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1269531
+-->
+<head>
+ <title>Test for Bug 1269531</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1269531">Mozilla Bug 1269531</a>
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ </div>
+ <pre id="test">
+ <script class="testbody" type="text/javascript">
+
+ SimpleTest.waitForExplicitFinish();
+
+ var wid;
+
+ // The test succeeds if the error callback is called because we expect
+ // failure when a watchPosition() request is submitted in a non
+ // secure context.
+ function successCallback(position) {
+ ok(false, "Success callback is not expected to be called");
+ navigator.geolocation.clearWatch(wid);
+ SimpleTest.finish();
+ }
+
+ function errorCallback(error) {
+ ok(true, "Check for the error callback to be called for insecure requests");
+ is(error.code, error.PERMISSION_DENIED, "Check error code for insecure requests");
+ navigator.geolocation.clearWatch(wid);
+ SimpleTest.finish();
+ }
+
+ // Insecure requests should be blocked, for that we enable the relevant pref.
+ SpecialPowers.pushPrefEnv({"set": [["geo.security.allowinsecure", false]]}, function() {
+ force_prompt(true, function() {
+ wid = navigator.geolocation.watchPosition(successCallback, errorCallback);
+ })
+ });
+
+ </script>
+ </pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html b/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html
new file mode 100644
index 0000000000..cfdc537a1b
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=884921
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+href="https://bugzilla.mozilla.org/show_bug.cgi?id=884921">Mozilla Bug 884921</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+// This test loads in an iframe, to ensure that the navigator instance is
+// loaded with the correct value of the preference.
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv({set: [["geo.enabled", false]]}, function() {
+ let iframe = document.createElement("iframe");
+ iframe.id = "f1";
+ iframe.src = "test_geolocation_is_undefined_when_pref_is_off_iframe.html";
+ document.body.appendChild(iframe);
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off_iframe.html b/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off_iframe.html
new file mode 100644
index 0000000000..1be69a2212
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off_iframe.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=884921
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+href="https://bugzilla.mozilla.org/show_bug.cgi?id=884921">Mozilla Bug 884921</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+ window.parent.is(navigator.geolocation, undefined);
+ window.parent.is("geolocation" in navigator, false);
+ window.parent.SimpleTest.finish();
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_handlerSpinsEventLoop.html b/dom/tests/mochitest/geolocation/test_handlerSpinsEventLoop.html
new file mode 100644
index 0000000000..99ae586c4e
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_handlerSpinsEventLoop.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=911595
+-->
+<head>
+ <title>Test for spinning the event loop inside position handlers</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=911595 ">Mozilla Bug 911595</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/*
+ * In bug 911595 , spinning the event loop from inside position
+ * handlers could cause both success and error callbacks to be
+ * fired for the same request if that request has a small timeout.
+ */
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var successCallbackCalled = false;
+function successCallback(position) {
+ successCallbackCalled = true;
+ check_geolocation(position);
+ while (!timeoutPassed) {
+ SpecialPowers.spinEventLoop(window);
+ }
+ info("TEST-INFO | successCallback called");
+ check();
+}
+
+var errorCallbackCalled = false;
+function errorCallback(error) {
+ errorCallbackCalled = true;
+ info("TEST-INFO | errorCallback called");
+ check();
+}
+
+function check() {
+ ok(successCallbackCalled != errorCallbackCalled, "Ensure only one callback is called");
+ SimpleTest.finish();
+}
+
+var timeoutPassed = false;
+var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+function test1() {
+ SpecialPowers.pushPrefEnv({"set": [["geo.provider.network.timeToWaitBeforeSending", 10]]}, function() {
+ navigator.geolocation.getCurrentPosition(successCallback, errorCallback, {timeout: 500});
+ timer.initWithCallback(timer => {
+ timeoutPassed = true;
+ }, 600, Ci.nsITimer.TYPE_ONE_SHOT);
+ });
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_hidden.html b/dom/tests/mochitest/geolocation/test_hidden.html
new file mode 100644
index 0000000000..25f7f80d43
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_hidden.html
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1653549
+-->
+<meta charset="utf-8">
+<title>Test that geolocation position can't be gotten when document is hidden</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="geolocation_common.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1653549">Mozilla Bug 1653549</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+
+<script class="testbody">
+SimpleTest.waitForExplicitFinish();
+
+// Little promise wrapper helper.
+function p(f) {
+ return new Promise((r) => f(r));
+}
+
+resume_geolocationProvider(async () => {
+ // Initialize
+ await new Promise((r) => force_prompt(true, r));
+ const popupWindow = window.open("popup.html");
+ popupWindow.opener = window;
+ await new Promise((r) =>
+ window.addEventListener("message", r, { once: true })
+ );
+
+ // Confirm everything is working ok...
+ const geo = popupWindow.navigator.geolocation;
+ await new Promise((resolve, reject) => {
+ geo.getCurrentPosition(resolve, reject);
+ });
+
+ // Hide the document...
+ const hiddenPromise = new Promise(
+ (r) => (popupWindow.document.onvisibilitychange = r)
+ );
+ await SimpleTest.promiseFocus(window);
+ await hiddenPromise;
+
+ // The following promises only resolve successfully when document is visible,
+ // meaning that position updates are ignored when the document is hidden.
+ let success = false;
+ let watchId = null;
+ const watchPositionPromise = new Promise((resolve) => {
+ watchId = geo.watchPosition(
+ () => {
+ ok(success, "watchPosition was called.");
+ if (!success) {
+ throw new Error("watchPosition was called too early");
+ }
+ resolve();
+ },
+ () => {
+ ok(false, "Error callback of watchPosition must not be called.");
+ }
+ );
+ });
+
+ const currentPositionPromise = new Promise((resolve) => {
+ geo.getCurrentPosition(
+ () => {
+ ok(success, "getCurrentPosition was called.");
+ if (!success){
+ throw new Error("getCurrentPosition was called too early");
+ }
+ resolve();
+ },
+ () => {
+ ok(false, "Error callback of getCurrentPosition must not be called.");
+ }
+ );
+ });
+
+ // Send data to be ignored...
+ await p(start_sending_garbage);
+ await p(stop_sending_garbage);
+ await p(resume_geolocationProvider);
+
+ // Refocus popup window...
+ const visiblePopupPromise = new Promise(
+ (r) => (popupWindow.document.onvisibilitychange = r)
+ );
+ await SimpleTest.promiseFocus(popupWindow);
+ await visiblePopupPromise;
+
+ // Resuming the geolocation events must now cause the promises to resolve correctly (with success = true).
+ success = true;
+ await p(resume_geolocationProvider);
+ await Promise.all([currentPositionPromise, watchPositionPromise]);
+
+ // Cleanup and finish!
+ geo.clearWatch(watchId);
+ await SimpleTest.promiseFocus(window);
+ popupWindow.close();
+ SimpleTest.finish();
+});
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html b/dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html
new file mode 100644
index 0000000000..b70bf09633
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var successCallbackCalled = 0;
+var failureCallbackCalled = 0;
+const totalResults = 100;
+
+function successCallback(position) {
+ check_geolocation(position);
+ successCallbackCalled++;
+ testPassed();
+}
+
+function failureCallback(code) {
+ failureCallbackCalled++;
+ testPassed();
+}
+
+function test1() {
+ for (var x = 0; x < totalResults; x++)
+ navigator.geolocation.getCurrentPosition(successCallback, failureCallback);
+}
+
+function testPassed() {
+ if (successCallbackCalled + failureCallbackCalled != totalResults)
+ return;
+ is(failureCallbackCalled, 0, "no failure callbacks should have been received");
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_manyCurrentSerial.html b/dom/tests/mochitest/geolocation/test_manyCurrentSerial.html
new file mode 100644
index 0000000000..9afb62e52e
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyCurrentSerial.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var keepGoing = 10;
+
+function successCallback(position) {
+ if (keepGoing-- > 0) {
+ setTimeout(function() {navigator.geolocation.getCurrentPosition(successCallback);}, 0);
+ return;
+ }
+
+ ok(1, "100 successful calls");
+ SimpleTest.finish();
+}
+
+function test1() {
+ navigator.geolocation.getCurrentPosition(successCallback);
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html b/dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html
new file mode 100644
index 0000000000..8d22e442cb
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var successCallbackCalled = 0;
+var failureCallbackCalled = 0;
+const totalResults = 100;
+
+function test1() {
+ for (var x = 0; x < totalResults; x++) {
+ let watchID = navigator.geolocation.watchPosition(
+ position => {
+ check_geolocation(position);
+ successCallbackCalled++;
+ watchCallback(watchID);
+ },
+ error => {
+ failureCallbackCalled++;
+ watchCallback(watchID);
+ }
+ );
+ }
+}
+
+function watchCallback(watchID) {
+ navigator.geolocation.clearWatch(watchID);
+ if (successCallbackCalled + failureCallbackCalled != totalResults)
+ return;
+ is(failureCallbackCalled, 0, "no failure callbacks should have been received");
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_manyWatchSerial.html b/dom/tests/mochitest/geolocation/test_manyWatchSerial.html
new file mode 100644
index 0000000000..bb27651d56
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyWatchSerial.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var watchID = 0;
+var completeCount = 10;
+
+
+function successCallback(position) {
+ check_geolocation(position);
+
+ navigator.geolocation.clearWatch(watchID);
+
+ completeCount--;
+
+ if (completeCount==0) {
+ ok(1, "all watchPosition successCallbacks called");
+ SimpleTest.finish();
+ return;
+ }
+
+ watchID = navigator.geolocation.watchPosition(successCallback);
+}
+
+function test1() {
+ watchID = navigator.geolocation.watchPosition(successCallback);
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_manyWindows.html b/dom/tests/mochitest/geolocation/test_manyWindows.html
new file mode 100644
index 0000000000..5e6e74c61f
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyWindows.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for many windows </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Crash in Multiple Windows</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+// ensure we are using the right testing provider
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+/** Test for Bug **/
+
+var numberOfWindows = 5; // 20 seems to be the default max popups during the mochitest run
+var loadedWindows = 0;
+
+var windows = new Array(numberOfWindows);
+
+addEventListener("message", function() {
+ ++loadedWindows;
+ if (loadedWindows == numberOfWindows) {
+ SimpleTest.executeSoon(closeWindows);
+ }
+}, false);
+
+function test1() {
+ for(var i = 0; i < numberOfWindows; i++) {
+ windows[i] = window.open("geolocation.html", "_blank", "width=700,height=400");
+ }
+}
+
+function closeWindows()
+{
+ for(var i = 0; i < numberOfWindows; i++) {
+ windows[i].close();
+ }
+ SimpleTest.waitForFocus(done);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function done()
+{
+ ok(navigator.geolocation, "Opened a bunch of windows and didn't crash.");
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_native_provider.html b/dom/tests/mochitest/geolocation/test_native_provider.html
new file mode 100644
index 0000000000..e0c26c611a
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_native_provider.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1596164
+https://bugzilla.mozilla.org/show_bug.cgi?id=1765835
+-->
+<head>
+ <title>Test for getCurrentPosition with native location provider</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1596164">Mozilla Bug 1596164</a>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1765835">Mozilla Bug 1765835</a>
+<script type="text/javascript">
+"use strict";
+
+add_task(async function test_maximumAge() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["geo.provider.testing", false]],
+ });
+
+ await new Promise(resolve => {
+ navigator.geolocation.getCurrentPosition(() => {
+ ok(true, "can get position");
+ resolve();
+ }, () => {
+ ok(false, "error callback should not have been called");
+ resolve();
+ },
+ { maximumAge: 10000 });
+ });
+});
+
+add_task(async function test_highAccuracy() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["geo.provider.testing", false]],
+ });
+
+ const lowAccuracy = await new Promise(resolve => {
+ navigator.geolocation.getCurrentPosition((pos) => {
+ resolve(pos.coords.accuracy);
+ }, () => {
+ ok(false, "error callback should not have been called on low accuracy call");
+ resolve();
+ },
+ { enableHighAccuracy: false});
+ });
+
+ const highAccuracy = await new Promise(resolve => {
+ navigator.geolocation.getCurrentPosition((pos) => {
+ resolve(pos.coords.accuracy);
+ }, () => {
+ ok(false, "error callback should not have been called on high accuracy call");
+ resolve();
+ },
+ { enableHighAccuracy: true});
+ });
+
+ // Low accuracy can sometimes be the same as high accuracy
+ // if a location provider recently provided a value
+ if(highAccuracy >= lowAccuracy ){
+ ok(true, "accuracy is correct");
+ } else {
+ ok(false, "lower accuracy calls should not out perform high accuracy calls");
+ }
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_not_fully_active.html b/dom/tests/mochitest/geolocation/test_not_fully_active.html
new file mode 100644
index 0000000000..6fc7689c8c
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_not_fully_active.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>
+ Test for when geolocation is used on non fully active documents
+ </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="geolocation_common.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <script>
+ SimpleTest.waitForExplicitFinish();
+
+ async function runTest() {
+ // Create the iframe, wait for it to load...
+ const iframe = document.createElement("iframe");
+
+ // We rely on this popup.html to acquire prompt privileges.
+ iframe.src = "popup.html";
+ document.body.appendChild(iframe);
+ iframe.contentWindow.opener = window;
+ await new Promise(r => window.addEventListener("message", r, { once: true }));
+
+ // Steal geolocation.
+ const geo = iframe.contentWindow.navigator.geolocation;
+
+ // No longer fully active.
+ iframe.remove();
+
+ // Try to watch a position while not fully active...
+ const watchError = await new Promise((resolve, reject) => {
+ const result = geo.watchPosition(
+ reject, // We don't want a position
+ resolve // We want an error!
+ );
+ is(result, 0, "watchPosition returns 0 on non-fully-active document");
+ });
+ is(
+ watchError.code,
+ GeolocationPositionError.POSITION_UNAVAILABLE,
+ "watchPosition returns an error on non-fully-active document"
+ );
+
+ // Now try to get current position while not fully active...
+ const positionError = await new Promise((resolve, reject) => {
+ const result = geo.getCurrentPosition(
+ reject, // We don't want a position
+ resolve // We want an error!
+ );
+ });
+ is(
+ positionError.code,
+ GeolocationPositionError.POSITION_UNAVAILABLE,
+ "getCurrentPosition returns an error on non-fully-active document"
+ );
+
+ // Re-attach, and go back to fully active.
+ document.body.appendChild(iframe);
+ iframe.contentWindow.opener = window;
+ await new Promise(r => window.addEventListener("message", r, { once: true }));
+
+ // And we are back to fully active.
+ let watchId;
+ let position = await new Promise((resolve, reject) => {
+ watchId = iframe.contentWindow.navigator.geolocation.watchPosition(
+ resolve,
+ reject
+ );
+ });
+ ok(watchId > 0, "Expected anything greater than 0");
+ ok(position, "Expected a position");
+
+ // Finally, let's get the position from the reattached document.
+ position = await new Promise((resolve, reject) => {
+ iframe.contentWindow.navigator.geolocation.getCurrentPosition(
+ resolve,
+ reject
+ );
+ });
+ ok(position, "Expected a position");
+ iframe.contentWindow.navigator.geolocation.clearWatch(watchId);
+ iframe.remove();
+ }
+
+ resume_geolocationProvider(async () => {
+ await new Promise(r => force_prompt(true, r));
+ await runTest();
+ SimpleTest.finish();
+ });
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_optional_api_params.html b/dom/tests/mochitest/geolocation/test_optional_api_params.html
new file mode 100644
index 0000000000..4aeb488a64
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_optional_api_params.html
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=452566
+-->
+<head>
+ <title>Test for Bug 452566</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=452566">Mozilla Bug 452566</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+// ensure we are using the right testing provider
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+/** Test for Bug 452566 **/
+function test1() {
+ ok(navigator.geolocation, "Should have geolocation");
+
+ var exception = null;
+ try {
+ navigator.geolocation.getCurrentPosition();
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(exception, "Should have got an exception");
+
+ exception = null;
+ try {
+ navigator.geolocation.getCurrentPosition(function() {});
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.getCurrentPosition(function() {}, function() {});
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.getCurrentPosition(function() {}, function() {}, {});
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition();
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(exception, "Should have got an exception");
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition(function() {});
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition(function() {}, function() {});
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition(function() {}, function() {}, {});
+ } catch (ex) {
+ if (!(ex instanceof TypeError)) {
+ throw ex;
+ }
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_shutdown.html b/dom/tests/mochitest/geolocation/test_shutdown.html
new file mode 100644
index 0000000000..4b9133ef9d
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_shutdown.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=716127
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716127">Mozilla Bug 716127</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+function successCallback(position) {
+ check_geolocation(position);
+
+ SpecialPowers.pushPrefEnv({'set': [['geo.timeout', 100]]}, function() {
+ delay_geolocationProvider(1000, function() {
+ force_prompt(true, function() {
+ navigator.geolocation.getCurrentPosition(success2, handle_error, {maximumAge: 0});
+ });
+ });
+
+ });
+}
+
+function errorCallback() {
+ ok(false, "unexpected error");
+ SimpleTest.finish();
+}
+
+function test1() {
+ navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+}
+
+function success2(position) {
+ check_geolocation(position);
+ SimpleTest.finish();
+}
+
+function handle_error() {
+ ok(false, "geolocation provider should not have timed out");
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_timeoutCurrent.html b/dom/tests/mochitest/geolocation/test_timeoutCurrent.html
new file mode 100644
index 0000000000..283f26b1fe
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_timeoutCurrent.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=858827
+-->
+<head>
+ <title>Test for timeout option </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=858827">Mozilla Bug 858827</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+
+function successCallback(position) {
+ ok(false, "we should not be seeing successCallback here.");
+ SimpleTest.finish();
+}
+
+function errorCallback(err) {
+ ok(err.code == err.TIMEOUT, "ensure error is a timeout.");
+ resume_geolocationProvider(function() {
+ SimpleTest.finish();
+ });
+}
+
+
+var options = {
+ maximumAge: 0,
+ timeout: 0
+};
+
+function test1() {
+ navigator.geolocation.getCurrentPosition(successCallback,
+ errorCallback,
+ options);
+}
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_timeoutWatch.html b/dom/tests/mochitest/geolocation/test_timeoutWatch.html
new file mode 100644
index 0000000000..324886a4e7
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_timeoutWatch.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=455327
+-->
+<head>
+ <title>Test for timeout option </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=455327">Mozilla Bug 478911</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/** Test for Bug **/
+
+// ensure we are using the right testing provider
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+SimpleTest.waitForExplicitFinish();
+
+function test1() {
+ stop_geolocationProvider(test2);
+}
+
+function successCallback(pos){
+ ok(false, "success should have never been called.");
+ resume_geolocationProvider(function() {
+ SimpleTest.finish();
+ });
+}
+
+function errorCallback(err) {
+ if (err.code == err.POSITION_UNAVAILABLE)
+ ok(false, "nothing is hooked up to test against.");
+ else
+ ok(err.code == err.TIMEOUT, "ensure error is a timeout.");
+ resume_geolocationProvider(function() {
+ SimpleTest.finish();
+ });
+}
+
+
+var options = {
+ maximumAge: 0,
+ timeout: 10
+};
+
+function test2() {
+ navigator.geolocation.watchPosition(successCallback,
+ errorCallback,
+ options);
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_timerRestartWatch.html b/dom/tests/mochitest/geolocation/test_timerRestartWatch.html
new file mode 100644
index 0000000000..fe190951b7
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_timerRestartWatch.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=526326
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=526326">Mozilla Bug 526326</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+// ensure we are using the right testing provider
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+var watchID;
+var times = 0;
+
+function errorCallback(err) {
+ ok(err.code === err.TIMEOUT ||
+ err.code === err.POSITION_UNAVAILABLE, `check error code: ${err.code}`);
+
+ times++;
+ isnot(times, 0, "times should be nonzero");
+ isnot(times, 4, "should not receive more than three error callbacks");
+
+ // make sure we got at least 3 times errorCallback
+ if (times >= 3) {
+ navigator.geolocation.clearWatch(watchID);
+ resume_geolocationProvider(function() {
+ set_network_request_cache_enabled(true,
+ function() { SimpleTest.finish(); } );
+ });
+ }
+}
+
+function successCallback(position) {
+ ok(1, "on success");
+ check_geolocation(position);
+
+ // Now that we got a success callback, let's try to ensure
+ // that we get a timeout error.
+ // The network cache is already off, now stop the sjs from reponding to requests
+ stop_geolocationProvider(function(){});
+}
+
+var options = {
+ maximumAge: 0,
+ timeout: 1000
+};
+
+function test1() {
+ set_network_request_cache_enabled(false,
+ function() {
+ watchID = navigator.geolocation.watchPosition(successCallback, errorCallback, options);
+ });
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/test_windowClose.html b/dom/tests/mochitest/geolocation/test_windowClose.html
new file mode 100644
index 0000000000..4ff858e8bb
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_windowClose.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=493615
+-->
+<head>
+ <title>Test for geolocation in chrome </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=493615">Mozilla Bug 493615</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+function done() {
+ ok(1, "no crash, so pass.");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+force_prompt(true, function() {
+ window.open("windowTest.html");
+});
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/geolocation/test_worseAccuracyDoesNotBlockCallback.html b/dom/tests/mochitest/geolocation/test_worseAccuracyDoesNotBlockCallback.html
new file mode 100644
index 0000000000..76d60ac97b
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_worseAccuracyDoesNotBlockCallback.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=494924
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=494924">Mozilla Bug 494924</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+// The magic numbers 100 and 42 below are the accuracy results returned from the
+// mock geolocation service and defined in network_geolocation.sjs.
+function successCallback2(position) {
+ check_geolocation(position);
+ is(position.coords.accuracy, 100, "worse accuracy");
+ SimpleTest.finish();
+}
+
+function successCallback1(position) {
+ check_geolocation(position);
+ is(position.coords.accuracy, 42, "high accuracy");
+ worse_geolocationProvider(function() {
+ navigator.geolocation.getCurrentPosition(successCallback2, null, { maximumAge: 0 });
+ });
+}
+
+function test1() {
+ navigator.geolocation.getCurrentPosition(successCallback1, null, { maximumAge: 0 });
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/geolocation/windowTest.html b/dom/tests/mochitest/geolocation/windowTest.html
new file mode 100644
index 0000000000..0366ffbe1e
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/windowTest.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=493615
+-->
+<head>
+ <title>Test for closing a window while it is doing a geolocation request </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="geolocation_common.js"></script>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=493615">Mozilla Bug 493615</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+"use strict";
+
+var finished = false;
+
+function successCallback(position) {
+ check_geolocation(position);
+
+ // watchPosition can notify more than once.
+ if (finished) {
+ return;
+ }
+ finished = true;
+
+ var opener = window.opener;
+ window.close();
+ opener.done();
+}
+
+navigator.geolocation.watchPosition(successCallback, null, null);
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/integer-gemm/mochitest.ini b/dom/tests/mochitest/integer-gemm/mochitest.ini
new file mode 100644
index 0000000000..03ec125793
--- /dev/null
+++ b/dom/tests/mochitest/integer-gemm/mochitest.ini
@@ -0,0 +1,3 @@
+[DEFAULT]
+
+[test_unavailable_for_webpage.html]
diff --git a/dom/tests/mochitest/integer-gemm/test_unavailable_for_webpage.html b/dom/tests/mochitest/integer-gemm/test_unavailable_for_webpage.html
new file mode 100644
index 0000000000..0a2400905c
--- /dev/null
+++ b/dom/tests/mochitest/integer-gemm/test_unavailable_for_webpage.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1746631
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Mozilla integer gemm (1746631) -- Mozilla integer gemm shouldn't be available for web pages</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1746631">Feature Test 1746631</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="text/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ const gemm = "mozIntGemm";
+ is(gemm in WebAssembly, false, `"WebAssembly.${gemm}" shouldn't be defined for web pages`);
+
+ SimpleTest.finish();
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/keyhandling/browsertest.html b/dom/tests/mochitest/keyhandling/browsertest.html
new file mode 100644
index 0000000000..7121e6b02f
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/browsertest.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+
+<html>
+<body>
+<p style="white-space: nowrap">
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+ A long paragraph to make a horizontal scrollbar.
+</p>
+<p id="paragraph">Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+<p>Lots of paragraphs to make a vertical scrollbar.</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/keyhandling/chrome.ini b/dom/tests/mochitest/keyhandling/chrome.ini
new file mode 100644
index 0000000000..4199d5077d
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/chrome.ini
@@ -0,0 +1,19 @@
+[DEFAULT]
+# test_input.html and test_textarea.html are also used as mochitests, hence
+# we have to flip the skip assertion flag for the chrome tests here.
+prefs =
+ dom.security.skip_remote_script_assertion_in_system_priv_context=true
+
+# nsIWidget::SynthesizeNativeKeyEvent() required (Bug 1410525 for headless)
+skip-if = os == 'linux'
+ os == 'android'
+ headless
+
+[test_browser.xhtml]
+support-files =
+ browsertest.html
+[test_editor.xhtml]
+[test_windowed.xhtml]
+support-files =
+ test_input.html
+ test_textarea.html
diff --git a/dom/tests/mochitest/keyhandling/mochitest.ini b/dom/tests/mochitest/keyhandling/mochitest.ini
new file mode 100644
index 0000000000..bdbaba2b9e
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/mochitest.ini
@@ -0,0 +1,10 @@
+[DEFAULT]
+# nsIWidget::SynthesizeNativeKeyEvent() required (Bug 1410525 for headless)
+skip-if = os == 'linux'
+ os == 'android'
+ headless
+
+[test_input.html]
+[test_textarea.html]
+skip-if =
+ os == 'win' && asan # Bug 1658513
diff --git a/dom/tests/mochitest/keyhandling/test_browser.xhtml b/dom/tests/mochitest/keyhandling/test_browser.xhtml
new file mode 100644
index 0000000000..3cddf5ba76
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/test_browser.xhtml
@@ -0,0 +1,252 @@
+<?xml version="1.0"?>
+
+<window title="Browser element keyhandling tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="test();">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"/>
+
+ <script type="application/javascript">
+ <![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ const IS_MAC = navigator.platform.indexOf("Mac") === 0;
+ const VK = {};
+ const CHARS = {};
+
+ // Copied values from NativeKeyCodes.js and EventUtils.js
+ if (IS_MAC) {
+ VK.LEFT = MAC_VK_LeftArrow;
+ CHARS.LEFT = "\uF702";
+ VK.RIGHT = MAC_VK_RightArrow;
+ CHARS.RIGHT = "\uF703";
+ VK.UP = MAC_VK_UpArrow;
+ CHARS.UP = "\uF700";
+ VK.DOWN = MAC_VK_DownArrow;
+ CHARS.DOWN = "\uF701";
+ VK.SPACE = MAC_VK_Space;
+ VK.PGDOWN = MAC_VK_PageDown;
+ CHARS.PGDOWN = "\uF72D";
+ VK.PGUP = MAC_VK_PageUp;
+ CHARS.PGUP = "\uF72C";
+ VK.C = MAC_VK_ANSI_C;
+ VK.HOME = MAC_VK_Home;
+ CHARS.HOME = "\uF729";
+ VK.END = MAC_VK_End;
+ CHARS.END = "\uF72B";
+ } else {
+ VK.LEFT = WIN_VK_LEFT;
+ CHARS.LEFT = "";
+ VK.RIGHT = WIN_VK_RIGHT;
+ CHARS.RIGHT = "";
+ VK.UP = WIN_VK_UP;
+ CHARS.UP = "";
+ VK.DOWN = WIN_VK_DOWN;
+ CHARS.DOWN = "";
+ VK.SPACE = WIN_VK_SPACE;
+ VK.PGDOWN = WIN_VK_NEXT;
+ CHARS.PGDOWN = "";
+ VK.PGUP = WIN_VK_PRIOR;
+ CHARS.PGUP = "";
+ VK.C = WIN_VK_C;
+ VK.HOME = WIN_VK_HOME;
+ CHARS.HOME = "";
+ VK.END = WIN_VK_END;
+ CHARS.END = "";
+ }
+
+ function waitForEvent(target, event) {
+ info(`Waiting for ${event} event.`);
+ return new Promise(resolve => {
+ browser.addEventListener(event, resolve, { once: true });
+ });
+ }
+
+ function synthesizeKey(keyCode, modifiers, chars) {
+ return new Promise((resolve, reject) => {
+ if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars, resolve)) {
+ reject();
+ }
+ });
+ }
+
+ function getWindowProperties(browser, properties) {
+ let results = {};
+ for (let prop of properties) {
+ results[prop] = browser.contentWindow[prop];
+ }
+
+ return results;
+ }
+
+ function getScrollPosition(browser) {
+ return getWindowProperties(browser, ["scrollX", "scrollY"]);
+ }
+
+ async function test() {
+ // Smooth scrolling makes scroll events take time and it's difficult to know
+ // when they've ended, so turn it off for this test.
+ await SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false]] });
+
+ let browser = document.getElementById("browser");
+ browser.focus();
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, 0, "Should not be scrolled");
+
+ info("down");
+ await synthesizeKey(VK.DOWN, {}, CHARS.DOWN);
+ await waitForEvent(browser.contentWindow, "scroll");
+ let { scrollX: lineScrollX, scrollY: lineScrollY } = await getScrollPosition(browser);
+ is(lineScrollX, 0, "Should not be scrolled");
+ ok(lineScrollY > 0, "Should be scrolled");
+
+ info("up");
+ await synthesizeKey(VK.UP, {}, CHARS.UP);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, 0, "Should not be scrolled");
+ }
+
+ info("right");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await waitForEvent(browser.contentWindow, "scroll");
+ let { scrollX: rightScrollX, scrollY: rightScrollY } = await getScrollPosition(browser);
+ ok(rightScrollX > 0, "Should be scrolled");
+ is(rightScrollY, 0, "Should not be scrolled");
+
+ info("left");
+ await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, 0, "Should not be scrolled");
+ }
+
+ info("space");
+ await synthesizeKey(VK.SPACE, {}, " ");
+ await waitForEvent(browser.contentWindow, "scroll");
+ let { scrollX: pageScrollX, scrollY: pageScrollY } = await getScrollPosition(browser);
+ is(pageScrollX, 0, "Should not be scrolled");
+ ok(pageScrollY > lineScrollY, "Should be scrolled more than a single line");
+
+ info("shift+space");
+ await synthesizeKey(VK.SPACE, { shiftKey: true }, " ");
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, 0, "Should not be scrolled");
+ }
+
+ info("page down");
+ await synthesizeKey(VK.PGDOWN, {}, CHARS.PGDOWN);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, pageScrollY, "Should be scrolled a page");
+ }
+
+ info("page up");
+ await synthesizeKey(VK.PGUP, {}, CHARS.PGUP);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, 0, "Should not be scrolled");
+ }
+
+ info("accel+down");
+ await synthesizeKey(VK.DOWN, { accelKey: true }, CHARS.DOWN);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY, innerHeight } = await getWindowProperties(browser, ["scrollX", "scrollY", "innerHeight"]);
+ is(scrollX, 0, "Should not be scrolled");
+ // We can't know the scrollbar height so check that we're scrolled to within 100px of what we expect.
+ isfuzzy(scrollY, browser.contentDocument.body.clientHeight - innerHeight, 100, "Should be scrolled to the end.");
+ }
+
+ info("accel+up");
+ await synthesizeKey(VK.UP, { accelKey: true }, CHARS.UP);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, 0, "Should not be scrolled");
+ }
+
+ info("end");
+ await synthesizeKey(VK.END, {}, CHARS.END);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY, innerHeight } = await getWindowProperties(browser, ["scrollX", "scrollY", "innerHeight"]);
+ is(scrollX, 0, "Should not be scrolled");
+ // We can't know the scrollbar height so check that we're scrolled to within 100px of what we expect.
+ isfuzzy(scrollY, browser.contentDocument.body.clientHeight - innerHeight, 100, "Should be scrolled to the end.");
+ }
+
+ info("home");
+ await synthesizeKey(VK.HOME, {}, CHARS.HOME);
+ await waitForEvent(browser.contentWindow, "scroll");
+ {
+ let { scrollX, scrollY } = await getScrollPosition(browser);
+ is(scrollX, 0, "Should not be scrolled");
+ is(scrollY, 0, "Should not be scrolled");
+ }
+
+ // Select the start of the first paragraph
+ let paragraph = browser.contentDocument.getElementById("paragraph");
+ let selection = browser.contentWindow.getSelection();
+ selection.setBaseAndExtent(paragraph.firstChild, 0, paragraph.firstChild, "Lots of".length);
+
+ info("copy");
+ await SimpleTest.promiseClipboardChange("Lots of", () => {
+ synthesizeKey(VK.C, { accelKey: true }, "c");
+ });
+
+ for (let i = 0; i < " paragraphs".length; i++) {
+ info("select right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ }
+
+ info("copy");
+ await SimpleTest.promiseClipboardChange("Lots of paragraphs", () => {
+ synthesizeKey(VK.C, { accelKey: true }, "c");
+ });
+
+ for (let i = 0; i < " paragraphs".length; i++) {
+ info("select left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ }
+
+ info("copy");
+ await SimpleTest.promiseClipboardChange("Lots of", () => {
+ synthesizeKey(VK.C, { accelKey: true }, "c");
+ });
+
+ info("select down");
+ await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
+
+ info("copy");
+ await SimpleTest.promiseClipboardChange("Lots of paragraphs to make a vertical scrollbar.\n\nLots of", () => {
+ synthesizeKey(VK.C, { accelKey: true }, "c");
+ });
+
+ SimpleTest.finish();
+ }
+ ]]>
+ </script>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <p id="display"></p>
+ <div id="content" style="display:none;"></div>
+ <pre id="test"></pre>
+ </body>
+ <browser id="browser" src="browsertest.html" style="height: 500px"/>
+</window>
diff --git a/dom/tests/mochitest/keyhandling/test_editor.xhtml b/dom/tests/mochitest/keyhandling/test_editor.xhtml
new file mode 100644
index 0000000000..9ddbe4adc0
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/test_editor.xhtml
@@ -0,0 +1,268 @@
+<?xml version="1.0"?>
+
+<window title="Browser element keyhandling tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="test();">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"/>
+
+ <script type="application/javascript">
+ <![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ const IS_MAC = navigator.platform.indexOf("Mac") === 0;
+ const VK = {};
+ const CHARS = {};
+
+ // Copied values from NativeKeyCodes.js and EventUtils.js
+ if (IS_MAC) {
+ VK.LEFT = MAC_VK_LeftArrow;
+ CHARS.LEFT = "\uF702";
+ VK.RIGHT = MAC_VK_RightArrow;
+ CHARS.RIGHT = "\uF703";
+ VK.UP = MAC_VK_UpArrow;
+ CHARS.UP = "\uF700";
+ VK.DOWN = MAC_VK_DownArrow;
+ CHARS.DOWN = "\uF701";
+ VK.SPACE = MAC_VK_Space;
+ VK.X = MAC_VK_ANSI_X;
+ VK.V = MAC_VK_ANSI_V;
+ VK.A = MAC_VK_ANSI_A;
+ VK.Z = MAC_VK_ANSI_Z;
+ VK.F = MAC_VK_ANSI_F;
+ VK.O = MAC_VK_ANSI_O;
+ VK.BACKSPACE = MAC_VK_PC_Backspace;
+ CHARS.BACKSPACE = "\u007F";
+ } else {
+ VK.LEFT = WIN_VK_LEFT;
+ CHARS.LEFT = "";
+ VK.RIGHT = WIN_VK_RIGHT;
+ CHARS.RIGHT = "";
+ VK.HOME = WIN_VK_HOME;
+ CHARS.HOME = "";
+ VK.END = WIN_VK_END;
+ CHARS.END = "";
+ VK.SPACE = WIN_VK_SPACE;
+ VK.X = WIN_VK_X;
+ VK.V = WIN_VK_V;
+ VK.A = WIN_VK_A;
+ VK.Z = WIN_VK_Z;
+ VK.Y = WIN_VK_Y;
+ VK.F = WIN_VK_F;
+ VK.O = WIN_VK_O;
+ VK.BACKSPACE = WIN_VK_BACK;
+ CHARS.BACKSPACE = "";
+ }
+
+ function waitForEvent(target, event) {
+ info(`Waiting for ${event} event.`);
+ return new Promise(resolve => {
+ browser.addEventListener(event, resolve, { once: true });
+ });
+ }
+
+ function synthesizeKey(keyCode, modifiers, chars) {
+ return new Promise((resolve, reject) => {
+ if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars, resolve)) {
+ reject();
+ }
+ });
+ }
+
+ function* nodes(element) {
+ let node = element.firstChild;
+ while (node) {
+ yield node;
+
+ if (node.nodeType === Node.ELEMENT_NODE) {
+ yield* nodes(node);
+ }
+
+ node = node.nextSibling;
+ }
+ }
+
+ async function checkElement(element, start, selectedText, content = "Test text") {
+ selectionPosition = (element, range) => {
+ let pos = 0;
+ for (let node of nodes(element)) {
+ if (node.nodeType === Node.TEXT_NODE) {
+ if (node === range.startContainer) {
+ return pos + range.startOffset;
+ } else {
+ pos += node.nodeValue.length;
+ }
+ } else if (node === range.startContainer) {
+ for (let i = 0; i < range.startOffset; i++) {
+ pos += node.childNodes[i].textContent.length;
+ }
+
+ return pos;
+ }
+ }
+
+ throw new Error("startContainer of range never found.");
+ }
+
+ isReady = () => {
+ let selection = element.contentWindow.getSelection();
+ let range = selection.getRangeAt(0);
+ let pos = selectionPosition(element.contentDocument.documentElement, range);
+
+ if (start != pos) {
+ return false;
+ }
+ if (selectedText != selection.toString()) {
+ return false;
+ }
+ if (content != element.contentDocument.documentElement.textContent) {
+ return false;
+ }
+ return true;
+ };
+
+ for (let i = 0; i < 10; i++) {
+ if (isReady()) {
+ return;
+ }
+
+ SimpleTest.requestFlakyTimeout("Polling for changes to apply");
+ await new Promise(resolve => setTimeout(resolve, 50));
+ }
+ ok(false, `Timed out waiting for state ${start} "${selectedText}" "${content}"`);
+ let selection = element.contentWindow.getSelection();
+ let range = selection.getRangeAt(0);
+ info(`${selectionPosition(element.contentDocument.documentElement, range)} "${selection.toString()}" "${element.contentDocument.documentElement.textContent}"`);
+ }
+
+ async function test() {
+ let editor = document.getElementById("editor");
+ editor.contentDocument.designMode = "on";
+ editor.contentWindow.focus();
+ let edit = editor.getEditor(editor.contentWindow);
+ edit.beginningOfDocument();
+
+ await checkElement(editor, 0, "");
+
+ info("right");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await checkElement(editor, 1, "");
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(editor, 1, "e");
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(editor, 1, "es");
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(editor, 1, "e");
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(editor, 1, "");
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(editor, 0, "T");
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(editor, 1, "");
+
+ info("left");
+ await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
+ await checkElement(editor, 0, "");
+
+ if (IS_MAC) {
+ info("down");
+ await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
+ } else {
+ info("end");
+ await synthesizeKey(VK.END, { shiftKey: true }, CHARS.END);
+ }
+ await checkElement(editor, 0, "Test text");
+
+ info("cut");
+ await synthesizeKey(VK.X, { accelKey: true }, "x");
+ await checkElement(editor, 0, "", "");
+ let text = SpecialPowers.getClipboardData("text/plain");
+ is(text, "Test text", "Should have cut to the clipboard");
+ SpecialPowers.clipboardCopyString("New text");
+
+ info("paste");
+ await synthesizeKey(VK.V, { accelKey: true }, "v");
+ await checkElement(editor, 8, "", "New text");
+
+ if (IS_MAC) {
+ info("up");
+ await synthesizeKey(VK.UP, {}, CHARS.UP);
+ } else {
+ info("home");
+ await synthesizeKey(VK.HOME, {}, CHARS.HOME);
+ }
+ await checkElement(editor, 0, "", "New text");
+
+ info("select all");
+ await synthesizeKey(VK.A, { accelKey: true}, "a", "select");
+ await checkElement(editor, 0, "New text", "New text");
+
+ info("right");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await checkElement(editor, 8, "", "New text");
+
+ info("word left");
+ if (IS_MAC) {
+ await synthesizeKey(VK.LEFT, { altKey: true }, CHARS.LEFT);
+ } else {
+ await synthesizeKey(VK.LEFT, { ctrlKey: true }, CHARS.LEFT);
+ }
+ await checkElement(editor, 4, "", "New text");
+
+ info("delete word left");
+ if (IS_MAC) {
+ await synthesizeKey(VK.BACKSPACE, { altKey: true }, CHARS.BACKSPACE);
+ } else {
+ await synthesizeKey(VK.BACKSPACE, { ctrlKey: true }, CHARS.BACKSPACE);
+ }
+ await checkElement(editor, 0, "", "text");
+
+ info("undo");
+ await synthesizeKey(VK.Z, { accelKey: true }, "z");
+ await checkElement(editor, 4, "", "New text");
+
+ info("redo");
+ if (IS_MAC) {
+ await synthesizeKey(VK.Z, { accelKey: true, shiftKey: true }, "z");
+ } else {
+ await synthesizeKey(VK.Y, { accelKey: true }, "y");
+ }
+ await checkElement(editor, 0, "", "text");
+
+ info("typing");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.SPACE, {}, " ");
+ await synthesizeKey(VK.F, {}, "f");
+ await synthesizeKey(VK.O, {}, "o");
+ await synthesizeKey(VK.O, {}, "o");
+ await checkElement(editor, 8, "", "text foo");
+
+ SimpleTest.finish();
+ }
+ ]]>
+ </script>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <p id="display"></p>
+ <div id="content" style="display:none;"></div>
+ <pre id="test"></pre>
+ </body>
+ <editor id="editor" editortype="text" src="data:text/plain,Test text" style="height: 500px"/>
+</window>
diff --git a/dom/tests/mochitest/keyhandling/test_input.html b/dom/tests/mochitest/keyhandling/test_input.html
new file mode 100644
index 0000000000..f4ec1dddf5
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/test_input.html
@@ -0,0 +1,226 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>input key handling</title>
+
+<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/EventUtils.js"></script>
+<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/NativeKeyCodes.js"></script>
+<link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+const IS_MAC = navigator.platform.indexOf("Mac") == 0;
+const VK = {};
+const CHARS = {};
+
+if (IS_MAC) {
+ VK.LEFT = MAC_VK_LeftArrow;
+ CHARS.LEFT = "\uF702";
+ VK.RIGHT = MAC_VK_RightArrow;
+ CHARS.RIGHT = "\uF703";
+ VK.UP = MAC_VK_UpArrow;
+ CHARS.UP = "\uF700";
+ VK.DOWN = MAC_VK_DownArrow;
+ CHARS.DOWN = "\uF701";
+ VK.X = MAC_VK_ANSI_X;
+ VK.V = MAC_VK_ANSI_V;
+ VK.A = MAC_VK_ANSI_A;
+ VK.F = MAC_VK_ANSI_F;
+ VK.O = MAC_VK_ANSI_O;
+ VK.BACKSPACE = MAC_VK_PC_Backspace;
+ CHARS.BACKSPACE = "\u007F";
+ VK.Z = MAC_VK_ANSI_Z;
+ VK.SPACE = MAC_VK_Space;
+} else {
+ VK.LEFT = WIN_VK_LEFT;
+ CHARS.LEFT = "";
+ VK.RIGHT = WIN_VK_RIGHT;
+ CHARS.RIGHT = "";
+ VK.UP = WIN_VK_UP;
+ CHARS.UP = "";
+ VK.DOWN = WIN_VK_DOWN;
+ CHARS.DOWN = "";
+ VK.X = WIN_VK_X;
+ VK.V = WIN_VK_V;
+ VK.A = WIN_VK_A;
+ VK.F = WIN_VK_F;
+ VK.O = WIN_VK_O;
+ VK.END = WIN_VK_END;
+ CHARS.END = "";
+ VK.HOME = WIN_VK_HOME;
+ CHARS.HOME = "";
+ VK.BACKSPACE = WIN_VK_BACK;
+ CHARS.BACKSPACE = "";
+ VK.Z = WIN_VK_Z;
+ VK.SPACE = WIN_VK_SPACE;
+}
+
+if (window.arguments && window.arguments[0]) {
+ ok = window.arguments[0].ok;
+ is = window.arguments[0].is;
+}
+
+function synthesizeKey(keyCode, modifiers, chars, event = "keyup") {
+ return new Promise((resolve, reject) => {
+ window.addEventListener(event, resolve, { once: true });
+
+ if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars)) {
+ reject();
+ }
+ });
+}
+
+async function checkElement(element, start, end, content = "Test text") {
+ isReady = () => {
+ if (start != element.selectionStart) {
+ return false;
+ }
+ if (end != element.selectionEnd) {
+ return false;
+ }
+ if (content != element.value) {
+ return false;
+ }
+ return true;
+ };
+
+ for (let i = 0; i < 10; i++) {
+ if (isReady()) {
+ return;
+ }
+
+ SimpleTest.requestFlakyTimeout("Polling for changes to apply");
+ await new Promise(resolve => setTimeout(resolve, 50));
+ }
+ ok(false, "Timed out waiting for state");
+ is(element.selectionStart, start, "Should have the right selectionStart");
+ is(element.selectionEnd, end, "Should have the right selectionEnd");
+ is(element.value, content, "Should have the right value");
+}
+
+async function startTest() {
+ let input = document.getElementById("input");
+ input.focus();
+ await checkElement(input, 0, 0);
+
+ info("right");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await checkElement(input, 1, 1);
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(input, 1, 2);
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(input, 1, 3);
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(input, 1, 2);
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(input, 1, 1);
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(input, 0, 1);
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(input, 1, 1);
+
+ info("left");
+ await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
+ await checkElement(input, 0, 0);
+
+ if (IS_MAC) {
+ info("down");
+ await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
+ } else {
+ info("end");
+ await synthesizeKey(VK.END, { shiftKey: true }, CHARS.END);
+ }
+ await checkElement(input, 0, 9);
+
+ info("cut");
+ await synthesizeKey(VK.X, { accelKey: true }, "x", "input");
+ await checkElement(input, 0, 0, "");
+ let text = SpecialPowers.getClipboardData("text/plain");
+ is(text, "Test text", "Should have cut to the clipboard");
+ SpecialPowers.clipboardCopyString("New text");
+
+ info("paste");
+ await synthesizeKey(VK.V, { accelKey: true }, "v", "input");
+ await checkElement(input, 8, 8, "New text");
+
+ if (IS_MAC) {
+ info("up");
+ await synthesizeKey(VK.UP, {}, CHARS.UP);
+ } else {
+ info("home");
+ await synthesizeKey(VK.HOME, {}, CHARS.HOME);
+ }
+ await checkElement(input, 0, 0, "New text");
+
+ info("select all");
+ await synthesizeKey(VK.A, { accelKey: true}, "a", "select");
+ await checkElement(input, 0, 8, "New text");
+
+ info("right");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await checkElement(input, 8, 8, "New text");
+
+ info("word left");
+ if (IS_MAC) {
+ await synthesizeKey(VK.LEFT, { altKey: true }, CHARS.LEFT);
+ } else {
+ await synthesizeKey(VK.LEFT, { ctrlKey: true }, CHARS.LEFT);
+ }
+ await checkElement(input, 4, 4, "New text");
+
+ info("delete word left");
+ if (IS_MAC) {
+ await synthesizeKey(VK.BACKSPACE, { altKey: true }, CHARS.BACKSPACE);
+ } else {
+ await synthesizeKey(VK.BACKSPACE, { ctrlKey: true }, CHARS.BACKSPACE);
+ }
+ await checkElement(input, 0, 0, "text");
+
+ info("undo");
+ await synthesizeKey(VK.Z, { accelKey: true }, "", "input");
+ await checkElement(input, 4, 4, "New text");
+
+ info("redo");
+ await synthesizeKey(VK.Z, { accelKey: true, shiftKey: true }, "", "input");
+ await checkElement(input, 0, 0, "text");
+
+ info("typing");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.SPACE, {}, " ");
+ await synthesizeKey(VK.F, {}, "f");
+ await synthesizeKey(VK.O, {}, "o");
+ await synthesizeKey(VK.O, {}, "o");
+ await checkElement(input, 8, 8, "text foo");
+}
+
+async function runTest() {
+ // When running in windowed mode the caller will start the test once we have
+ // focus.
+ if (window.arguments && window.arguments[0]) {
+ return;
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ await startTest();
+ SimpleTest.finish();
+}
+</script>
+</head>
+<body onload="runTest();">
+<input id=input value="Test text"/>
+</body>
+</html>
diff --git a/dom/tests/mochitest/keyhandling/test_textarea.html b/dom/tests/mochitest/keyhandling/test_textarea.html
new file mode 100644
index 0000000000..613baac0c9
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/test_textarea.html
@@ -0,0 +1,226 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>input key handling</title>
+
+<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/EventUtils.js"></script>
+<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/NativeKeyCodes.js"></script>
+<link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+const IS_MAC = navigator.platform.indexOf("Mac") == 0;
+const VK = {};
+const CHARS = {};
+
+if (IS_MAC) {
+ VK.LEFT = MAC_VK_LeftArrow;
+ CHARS.LEFT = "\uF702";
+ VK.RIGHT = MAC_VK_RightArrow;
+ CHARS.RIGHT = "\uF703";
+ VK.UP = MAC_VK_UpArrow;
+ CHARS.UP = "\uF700";
+ VK.DOWN = MAC_VK_DownArrow;
+ CHARS.DOWN = "\uF701";
+ VK.X = MAC_VK_ANSI_X;
+ VK.V = MAC_VK_ANSI_V;
+ VK.A = MAC_VK_ANSI_A;
+ VK.F = MAC_VK_ANSI_F;
+ VK.O = MAC_VK_ANSI_O;
+ VK.BACKSPACE = MAC_VK_PC_Backspace;
+ CHARS.BACKSPACE = "\u007F";
+ VK.Z = MAC_VK_ANSI_Z;
+ VK.SPACE = MAC_VK_Space;
+} else {
+ VK.LEFT = WIN_VK_LEFT;
+ CHARS.LEFT = "";
+ VK.RIGHT = WIN_VK_RIGHT;
+ CHARS.RIGHT = "";
+ VK.UP = WIN_VK_UP;
+ CHARS.UP = "";
+ VK.DOWN = WIN_VK_DOWN;
+ CHARS.DOWN = "";
+ VK.X = WIN_VK_X;
+ VK.V = WIN_VK_V;
+ VK.A = WIN_VK_A;
+ VK.F = WIN_VK_F;
+ VK.O = WIN_VK_O;
+ VK.END = WIN_VK_END;
+ CHARS.END = "";
+ VK.HOME = WIN_VK_HOME;
+ CHARS.HOME = "";
+ VK.BACKSPACE = WIN_VK_BACK;
+ CHARS.BACKSPACE = "";
+ VK.Z = WIN_VK_Z;
+ VK.SPACE = WIN_VK_SPACE;
+}
+
+if (window.arguments && window.arguments[0]) {
+ ok = window.arguments[0].ok;
+ is = window.arguments[0].is;
+}
+
+function synthesizeKey(keyCode, modifiers, chars, event = "keyup") {
+ return new Promise((resolve, reject) => {
+ window.addEventListener(event, resolve, { once: true });
+
+ if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars)) {
+ reject();
+ }
+ });
+}
+
+async function checkElement(element, start, end, content = "Test text") {
+ isReady = () => {
+ if (start != element.selectionStart) {
+ return false;
+ }
+ if (end != element.selectionEnd) {
+ return false;
+ }
+ if (content != element.value) {
+ return false;
+ }
+ return true;
+ };
+
+ for (let i = 0; i < 10; i++) {
+ if (isReady()) {
+ return;
+ }
+
+ SimpleTest.requestFlakyTimeout("Polling for changes to apply");
+ await new Promise(resolve => setTimeout(resolve, 50));
+ }
+ ok(false, "Timed out waiting for state");
+ is(element.selectionStart, start, "Should have the right selectionStart");
+ is(element.selectionEnd, end, "Should have the right selectionEnd");
+ is(element.value, content, "Should have the right value");
+}
+
+async function startTest() {
+ let input = document.getElementById("input");
+ input.focus();
+ await checkElement(input, 0, 0);
+
+ info("right");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await checkElement(input, 1, 1);
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(input, 1, 2);
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(input, 1, 3);
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(input, 1, 2);
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(input, 1, 1);
+
+ info("shift+left");
+ await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
+ await checkElement(input, 0, 1);
+
+ info("shift+right");
+ await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
+ await checkElement(input, 1, 1);
+
+ info("left");
+ await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
+ await checkElement(input, 0, 0);
+
+ if (IS_MAC) {
+ info("down");
+ await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
+ } else {
+ info("end");
+ await synthesizeKey(VK.END, { shiftKey: true }, CHARS.END);
+ }
+ await checkElement(input, 0, 9);
+
+ info("cut");
+ await synthesizeKey(VK.X, { accelKey: true }, "x", "input");
+ await checkElement(input, 0, 0, "");
+ let text = SpecialPowers.getClipboardData("text/plain");
+ is(text, "Test text", "Should have cut to the clipboard");
+ SpecialPowers.clipboardCopyString("New text");
+
+ info("paste");
+ await synthesizeKey(VK.V, { accelKey: true }, "v", "input");
+ await checkElement(input, 8, 8, "New text");
+
+ if (IS_MAC) {
+ info("up");
+ await synthesizeKey(VK.UP, {}, CHARS.UP);
+ } else {
+ info("home");
+ await synthesizeKey(VK.HOME, {}, CHARS.HOME);
+ }
+ await checkElement(input, 0, 0, "New text");
+
+ info("select all");
+ await synthesizeKey(VK.A, { accelKey: true}, "a", "select");
+ await checkElement(input, 0, 8, "New text");
+
+ info("right");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await checkElement(input, 8, 8, "New text");
+
+ info("word left");
+ if (IS_MAC) {
+ await synthesizeKey(VK.LEFT, { altKey: true }, CHARS.LEFT);
+ } else {
+ await synthesizeKey(VK.LEFT, { ctrlKey: true }, CHARS.LEFT);
+ }
+ await checkElement(input, 4, 4, "New text");
+
+ info("delete word left");
+ if (IS_MAC) {
+ await synthesizeKey(VK.BACKSPACE, { altKey: true }, CHARS.BACKSPACE);
+ } else {
+ await synthesizeKey(VK.BACKSPACE, { ctrlKey: true }, CHARS.BACKSPACE);
+ }
+ await checkElement(input, 0, 0, "text");
+
+ info("undo");
+ await synthesizeKey(VK.Z, { accelKey: true }, "", "input");
+ await checkElement(input, 4, 4, "New text");
+
+ info("redo");
+ await synthesizeKey(VK.Z, { accelKey: true, shiftKey: true }, "", "input");
+ await checkElement(input, 0, 0, "text");
+
+ info("typing");
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
+ await synthesizeKey(VK.SPACE, {}, " ");
+ await synthesizeKey(VK.F, {}, "f");
+ await synthesizeKey(VK.O, {}, "o");
+ await synthesizeKey(VK.O, {}, "o");
+ await checkElement(input, 8, 8, "text foo");
+}
+
+async function runTest() {
+ // When running in windowed mode the caller will start the test once we have
+ // focus.
+ if (window.arguments && window.arguments[0]) {
+ return;
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ await startTest();
+ SimpleTest.finish();
+}
+</script>
+</head>
+<body onload="runTest();">
+<textarea id=input>Test text</textarea>
+</body>
+</html>
diff --git a/dom/tests/mochitest/keyhandling/test_windowed.xhtml b/dom/tests/mochitest/keyhandling/test_windowed.xhtml
new file mode 100644
index 0000000000..c89027b5c6
--- /dev/null
+++ b/dom/tests/mochitest/keyhandling/test_windowed.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<window title="Top-level window keyhandling tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="test();">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <script type="application/javascript">
+ <![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ async function run_test(path) {
+ let win = window.browsingContext.topChromeWindow
+ .openDialog(path, "_blank", "width=500,height=500", window);
+ await SimpleTest.promiseFocus(win);
+ await win.startTest();
+ }
+
+ async function test() {
+ await run_test("test_input.html");
+ await run_test("test_textarea.html");
+ SimpleTest.finish();
+ }
+ ]]>
+ </script>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <p id="display"></p>
+ <div id="content" style="display:none;"></div>
+ <pre id="test"></pre>
+ </body>
+</window>
diff --git a/dom/tests/mochitest/localstorage/chrome.ini b/dom/tests/mochitest/localstorage/chrome.ini
new file mode 100644
index 0000000000..6cc5562c00
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/chrome.ini
@@ -0,0 +1,11 @@
+[DEFAULT]
+skip-if = os == 'android'
+support-files =
+ page_blank.html
+ frameQuota.html
+ interOriginFrame.js
+
+[test_localStorageBasePrivateBrowsing_perwindowpb.html]
+skip-if = true # bug 1156725
+[test_localStorageFromChrome.xhtml]
+[test_localStorageQuotaPrivateBrowsing_perwindowpb.html]
diff --git a/dom/tests/mochitest/localstorage/file_tryAccessSessionStorage.html b/dom/tests/mochitest/localstorage/file_tryAccessSessionStorage.html
new file mode 100644
index 0000000000..1def32a62a
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/file_tryAccessSessionStorage.html
@@ -0,0 +1,10 @@
+<script>
+ try {
+ sessionStorage.setItem("am_i_blocked", "nope");
+ window.parent.postMessage('sessionStorage=true', '*');
+ document.body.innerHTML += 'yes';
+ } catch (ex) {
+ window.parent.postMessage('sessionStorage=false', '*');
+ document.body.innerHTML += 'no';
+ }
+</script>
diff --git a/dom/tests/mochitest/localstorage/frameChromeSlave.html b/dom/tests/mochitest/localstorage/frameChromeSlave.html
new file mode 100644
index 0000000000..fd87702e9d
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameChromeSlave.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<body>
+ <span id="data"></span>
+ <script>
+ var span = document.getElementById("data");
+ span.innerHTML = localStorage.chromekey
+ </script>
+</body>
diff --git a/dom/tests/mochitest/localstorage/frameKeySync.html b/dom/tests/mochitest/localstorage/frameKeySync.html
new file mode 100644
index 0000000000..a6b39d47d7
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameKeySync.html
@@ -0,0 +1,51 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for localStorage test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = parseInt(location.search.substring(1));
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ localStorage.clear();
+ break;
+
+ case 2:
+ localStorage.setItem("a", "1");
+ is(localStorage.a, "1", "Value a=1 set");
+ break;
+
+ case 3:
+ try {
+ is(localStorage.key(0), "a", "Key 'a' present in 'key' array")
+ }
+ catch (exc) {
+ ok(false, "Shouldn't throw when accessing key(0) " + exc);
+ }
+ is(localStorage.a, "1", "Value a=1 set");
+ break;
+
+ default:
+ return finishTest();
+ }
+
+ // Increase by two to as odd number are executed in a window separate from
+ // where even step are.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameLocalStorageCookieSettings.html b/dom/tests/mochitest/localstorage/frameLocalStorageCookieSettings.html
new file mode 100644
index 0000000000..4952a81c44
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameLocalStorageCookieSettings.html
@@ -0,0 +1,26 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage cookies settings test</title>
+
+</head>
+<body>
+<script type="text/javascript">
+ function ok(what, msg) {
+ parent.postMessage({ type: "ok", what: !!what, msg }, "*");
+ }
+
+ function is(a, b, msg) {
+ ok(a === b, msg);
+ }
+
+ try {
+ localStorage.setItem("contentkey", "test-value");
+ ok(false, "Setting localStorageItem should throw a security exception");
+ } catch(ex) {
+ is(ex.name, "SecurityError", "Got security exception");
+ }
+
+ parent.postMessage({ type: "finish" }, "*");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameLocalStorageSessionOnly.html b/dom/tests/mochitest/localstorage/frameLocalStorageSessionOnly.html
new file mode 100644
index 0000000000..f6c7f0291f
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameLocalStorageSessionOnly.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<html>
+ <body>
+ <script>
+ parent.postMessage(SpecialPowers.wrap(localStorage).isSessionOnly, "*");
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameMasterEqual.html b/dom/tests/mochitest/localstorage/frameMasterEqual.html
new file mode 100644
index 0000000000..4d83c4fef2
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameMasterEqual.html
@@ -0,0 +1,56 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for localStorage test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 1;
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ localStorage.setItem("X", "1");
+ is(localStorage.getItem("X"), "1", "X is 1 in the master");
+ break;
+
+ case 3:
+ is(localStorage.getItem("X"), "2", "X set to 2 in the master");
+ localStorage.removeItem("X");
+ is(localStorage.getItem("X"), null, "X was removed from the master");
+ break;
+
+ case 5:
+ is(localStorage.getItem("Y"), "3", "Y is 3 in the master");
+ localStorage.setItem("Z", "4");
+ is(localStorage.getItem("Z"), "4", "Z is 4 in the master");
+
+ localStorage.clear();
+ is(localStorage.length, 0, "Master is empty");
+ break;
+
+ case 7:
+ is(localStorage.length, 0, "Master is empty");
+ break;
+
+ case 9:
+ return finishTest();
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameMasterNotEqual.html b/dom/tests/mochitest/localstorage/frameMasterNotEqual.html
new file mode 100644
index 0000000000..fef476bed3
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameMasterNotEqual.html
@@ -0,0 +1,47 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for localStorage test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 1;
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ localStorage.setItem("X", "1");
+ is(localStorage.getItem("X"), "1", "X is 1 in the master");
+ break;
+
+ case 3:
+ is(localStorage.getItem("X"), "1", "X remains 1 in the master");
+ localStorage.removeItem("X");
+ is(localStorage.getItem("X"), null, "X was removed from the master");
+ break;
+
+ case 5:
+ is(localStorage.getItem("Y"), null, "Y null in the master");
+ break;
+
+ case 7:
+ return finishTest();
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameOrder.html b/dom/tests/mochitest/localstorage/frameOrder.html
new file mode 100644
index 0000000000..3b3f0ebef8
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameOrder.html
@@ -0,0 +1,27 @@
+<html>
+<head>
+</head>
+<script type="text/javascript">
+function doTest()
+{
+ var query = location.search.substring(1);
+ query = unescape(query);
+ var keyNames = eval(query);
+
+ parent.is(localStorage.a, "10", "a = 10");
+ parent.is(localStorage.b, "20", "b = 20");
+ parent.is(localStorage.c, "30", "c = 30");
+ parent.is(localStorage.d, "40", "d = 40");
+ parent.is(localStorage.e, "50", "e = 50");
+ parent.is(localStorage.length, 5, "length = 5");
+
+ for (var i = 0; i < localStorage.length; ++i)
+ parent.is(keyNames[i], localStorage.key(i), "key "+keyNames[i]+" on same index");
+
+ parent.SimpleTest.finish();
+ localStorage.clear();
+}
+</script>
+<body onload="doTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameReplace.html b/dom/tests/mochitest/localstorage/frameReplace.html
new file mode 100644
index 0000000000..145bfe8fce
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameReplace.html
@@ -0,0 +1,72 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage replace frame</title>
+
+<script type="text/javascript">
+
+var shell;
+
+function ok(a, message)
+{
+ if (!a)
+ shell.postMessage("FAILURE: " + message, "http://mochi.test:8888");
+ else
+ shell.postMessage(message, "http://mochi.test:8888");
+}
+
+function is(a, b, message)
+{
+ if (a != b)
+ shell.postMessage("FAILURE: " + message + ", expected "+b+" got "+a, "http://mochi.test:8888");
+ else
+ shell.postMessage(message + ", expected "+b+" got "+a, "http://mochi.test:8888");
+}
+
+function doTest()
+{
+ var query = location.search.substring(1);
+ var queries = query.split("&");
+
+ var action = queries[0];
+ shell = queries[1];
+ switch (shell)
+ {
+ case "frame":
+ shell = parent;
+ break;
+ case "window":
+ shell = opener;
+ break;
+ }
+
+ switch (action)
+ {
+ case "init":
+ localStorage.setItem("A", "1");
+ localStorage.setItem("B", "2");
+ localStorage.setItem("C", "3");
+ is(localStorage.getItem("A"), "1", "'A' is '1'");
+ is(localStorage.getItem("B"), "2", "'A' is '2'");
+ is(localStorage.getItem("C"), "3", "'A' is '3'");
+ break;
+
+ case "check":
+ is(localStorage.getItem("A"), null, "'A' is null");
+ is(localStorage.getItem("B"), null, "'A' is null");
+ is(localStorage.getItem("C"), null, "'A' is null");
+ break;
+
+ case "clean":
+ localStorage.clear();
+ break;
+ }
+
+ shell.postMessage(action + "_done", "http://mochi.test:8888");
+}
+
+</script>
+
+</head>
+<body onload="doTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameSlaveEqual.html b/dom/tests/mochitest/localstorage/frameSlaveEqual.html
new file mode 100644
index 0000000000..b64b8de10a
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameSlaveEqual.html
@@ -0,0 +1,51 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for localStorage test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 2;
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 2:
+ is(localStorage.getItem("X"), "1", "X is 1 in the slave");
+ localStorage.setItem("X", "2");
+ is(localStorage.getItem("X"), "2", "X set to 2 in the slave");
+ break;
+
+ case 4:
+ is(localStorage.getItem("X"), null, "X was removed from the slave");
+ localStorage.setItem("Y", "3");
+ is(localStorage.getItem("Y"), "3", "Y set to 3 in the slave");
+ break;
+
+ case 6:
+ is(localStorage.length, 0, "Slave is empty");
+ is(localStorage.getItem("X"), null, "X is null in the slave");
+ is(localStorage.getItem("Y"), null, "Y is null in the slave");
+ is(localStorage.getItem("Z"), null, "Z is null in the slave");
+ break;
+
+ case 8:
+ return finishTest();
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameSlaveNotEqual.html b/dom/tests/mochitest/localstorage/frameSlaveNotEqual.html
new file mode 100644
index 0000000000..9daf9e9f73
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameSlaveNotEqual.html
@@ -0,0 +1,44 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>frame for localStorage test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 2;
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 2:
+ is(localStorage.getItem("X"), null, "X not set in the slave");
+ localStorage.setItem("X", "2");
+ is(localStorage.getItem("X"), "2", "X set to 2 in the slave");
+ break;
+
+ case 4:
+ is(localStorage.getItem("X"), "2", "X still set to 2 in the slave");
+ localStorage.setItem("Y", "3");
+ is(localStorage.getItem("Y"), "3", "Y set to 4 (MUST FAIL!) in the slave");
+ break;
+
+ case 6:
+ return finishTest();
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/interOriginFrame.js b/dom/tests/mochitest/localstorage/interOriginFrame.js
new file mode 100644
index 0000000000..64470c4ef6
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/interOriginFrame.js
@@ -0,0 +1,53 @@
+function postMsg(message) {
+ parent.postMessage(message, "http://mochi.test:8888");
+}
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event) {
+ if (event.data == "step") {
+ var performed = false;
+ try {
+ performed = doStep();
+ } catch (ex) {
+ postMsg("FAILURE: exception threw at " + location + ":\n" + ex);
+ finishTest();
+ }
+
+ if (performed) {
+ postMsg("perf");
+ }
+
+ return;
+ }
+
+ postMsg("Invalid message");
+}
+
+function ok(a, message) {
+ if (!a) {
+ postMsg("FAILURE: " + message);
+ } else {
+ postMsg(message);
+ }
+}
+
+function is(a, b, message) {
+ if (a != b) {
+ postMsg("FAILURE: " + message + ", expected " + b + " got " + a);
+ } else {
+ postMsg(message + ", expected " + b + " got " + a);
+ }
+}
+
+function todo(a, b, message) {
+ postMsg("TODO: " + message + ", expected " + b + " got " + a);
+}
+
+function finishTest() {
+ try {
+ localStorage.clear();
+ } catch (e) {}
+ postMsg("done");
+ return false;
+}
diff --git a/dom/tests/mochitest/localstorage/interOriginTest.js b/dom/tests/mochitest/localstorage/interOriginTest.js
new file mode 100644
index 0000000000..526b5b0fb1
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/interOriginTest.js
@@ -0,0 +1,41 @@
+var slaveLoadsPending = 1;
+
+var slaveOrigin = "";
+var slave = null;
+
+var failureRegExp = new RegExp("^FAILURE");
+const slavePath = "/tests/dom/tests/mochitest/localstorage/";
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event) {
+ switch (event.data) {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--slaveLoadsPending) {
+ break;
+ }
+
+ // Indication of successfully finished step of a test
+ // fall through
+ case "perf":
+ if (event.data == "perf") {
+ doStep();
+ }
+
+ slave.postMessage("step", slaveOrigin);
+ break;
+
+ // Indication of all test parts finish (from any of the frames)
+ case "done":
+ localStorage.clear();
+ slaveLoadsPending = 1;
+ doNextTest();
+ break;
+
+ // Any other message indicates error or succes message of a test
+ default:
+ SimpleTest.ok(!event.data.match(failureRegExp), event.data);
+ break;
+ }
+}
diff --git a/dom/tests/mochitest/localstorage/interOriginTest2.js b/dom/tests/mochitest/localstorage/interOriginTest2.js
new file mode 100644
index 0000000000..d675475c76
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/interOriginTest2.js
@@ -0,0 +1,53 @@
+var t = async_test(document.title);
+
+var frameLoadsPending = 2;
+
+var callMasterFrame = true;
+var testDone = false;
+
+var masterFrameOrigin = "";
+var slaveFrameOrigin = "";
+
+var failureRegExp = new RegExp("^FAILURE");
+
+const framePath = "/tests/dom/tests/mochitest/localstorage/";
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event) {
+ switch (event.data) {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--frameLoadsPending) {
+ break;
+ }
+
+ // Indication of successfully finished step of a test
+ // Just fall through...
+ case "perf":
+ if (callMasterFrame) {
+ masterFrame.postMessage("step", masterFrameOrigin);
+ } else {
+ slaveFrame.postMessage("step", slaveFrameOrigin);
+ }
+ callMasterFrame = !callMasterFrame;
+ break;
+
+ // Indication of all test parts finish (from any of the frames)
+ case "done":
+ if (testDone) {
+ break;
+ }
+
+ testDone = true;
+ t.done();
+ break;
+
+ // Any other message indicates error, succes or todo message of a test
+ default:
+ t.step(function () {
+ assert_true(!event.data.match(failureRegExp), event.data);
+ });
+ break;
+ }
+}
diff --git a/dom/tests/mochitest/localstorage/localStorageCommon.js b/dom/tests/mochitest/localstorage/localStorageCommon.js
new file mode 100644
index 0000000000..364e708870
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/localStorageCommon.js
@@ -0,0 +1,131 @@
+function localStorageFlush(cb) {
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ SimpleTest.executeSoon(function () {
+ cb();
+ });
+ return;
+ }
+
+ var ob = {
+ observe(sub, top, dat) {
+ os().removeObserver(ob, "domstorage-test-flushed");
+ cb();
+ },
+ };
+ os().addObserver(ob, "domstorage-test-flushed");
+ notify("domstorage-test-flush-force");
+}
+
+function localStorageReload(callback) {
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ localStorage.close();
+ let qms = SpecialPowers.Services.qms;
+ let principal = SpecialPowers.wrap(document).nodePrincipal;
+ let request = qms.resetStoragesForPrincipal(principal, "default", "ls");
+ request.callback = SpecialPowers.wrapCallback(function () {
+ localStorage.open();
+ callback();
+ });
+ return;
+ }
+
+ notify("domstorage-test-reload");
+ SimpleTest.executeSoon(function () {
+ callback();
+ });
+}
+
+function localStorageFlushAndReload(callback) {
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ localStorage.close();
+ let qms = SpecialPowers.Services.qms;
+ let principal = SpecialPowers.wrap(document).nodePrincipal;
+ let request = qms.resetStoragesForPrincipal(principal, "default", "ls");
+ request.callback = SpecialPowers.wrapCallback(function () {
+ localStorage.open();
+ callback();
+ });
+ return;
+ }
+
+ localStorageFlush(function () {
+ localStorageReload(callback);
+ });
+}
+
+function localStorageClearAll(callback) {
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ let qms = SpecialPowers.Services.qms;
+ let ssm = SpecialPowers.Services.scriptSecurityManager;
+
+ qms.getUsage(
+ SpecialPowers.wrapCallback(function (request) {
+ if (request.resultCode != SpecialPowers.Cr.NS_OK) {
+ callback();
+ return;
+ }
+
+ let clearRequestCount = 0;
+ for (let item of request.result) {
+ let principal = ssm.createContentPrincipalFromOrigin(item.origin);
+ let clearRequest = qms.clearStoragesForPrincipal(
+ principal,
+ "default",
+ "ls"
+ );
+ clearRequestCount++;
+ clearRequest.callback = SpecialPowers.wrapCallback(function () {
+ if (--clearRequestCount == 0) {
+ callback();
+ }
+ });
+ }
+ })
+ );
+ return;
+ }
+
+ os().notifyObservers(null, "cookie-changed", "cleared");
+ SimpleTest.executeSoon(function () {
+ callback();
+ });
+}
+
+function localStorageClearDomain(domain, callback) {
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ let qms = SpecialPowers.Services.qms;
+ let principal = SpecialPowers.wrap(document).effectiveStoragePrincipal;
+ let request = qms.clearStoragesForPrincipal(principal, "default", "ls");
+ let cb = SpecialPowers.wrapCallback(callback);
+ request.callback = cb;
+ return;
+ }
+
+ os().notifyObservers(null, "extension:purge-localStorage", domain);
+ SimpleTest.executeSoon(function () {
+ callback();
+ });
+}
+
+function os() {
+ return SpecialPowers.Services.obs;
+}
+
+function notify(top) {
+ os().notifyObservers(null, top);
+}
+
+/**
+ * Enable testing observer notifications in DOMStorageObserver.cpp.
+ */
+function localStorageEnableTestingMode(cb) {
+ SpecialPowers.pushPrefEnv(
+ {
+ set: [
+ ["dom.storage.testing", true],
+ ["dom.quotaManager.testing", true],
+ ],
+ },
+ cb
+ );
+}
diff --git a/dom/tests/mochitest/localstorage/mochitest.ini b/dom/tests/mochitest/localstorage/mochitest.ini
new file mode 100644
index 0000000000..de5eb88304
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/mochitest.ini
@@ -0,0 +1,63 @@
+[DEFAULT]
+support-files =
+ frameChromeSlave.html
+ frameLocalStorageCookieSettings.html
+ frameKeySync.html
+ frameMasterEqual.html
+ frameMasterNotEqual.html
+ frameOrder.html
+ frameQuota.html
+ frameQuotaSessionOnly.html
+ frameReplace.html
+ frameSlaveEqual.html
+ frameSlaveNotEqual.html
+ interOriginFrame.js
+ interOriginTest.js
+ interOriginTest2.js
+ localStorageCommon.js
+ frameLocalStorageSessionOnly.html
+ file_tryAccessSessionStorage.html
+ windowProxy.html
+
+[test_brokenUTF-16.html]
+[test_bug600307-DBOps.html]
+[test_bug746272-1.html]
+[test_bug746272-2.html]
+skip-if = verify
+[test_cookieBlock.html]
+[test_embededNulls.html]
+[test_keySync.html]
+skip-if =
+ http3
+[test_localStorageBase.html]
+[test_localStorageBaseSessionOnly.html]
+[test_localStorageCookieSettings.html]
+[test_localStorageEnablePref.html]
+[test_localStorageKeyOrder.html]
+skip-if =
+ http3
+[test_localStorageOriginsDiff.html]
+skip-if =
+ http3
+[test_localStorageOriginsDomainDiffs.html]
+skip-if =
+ http3
+[test_localStorageOriginsEquals.html]
+skip-if =
+ http3
+[test_localStorageOriginsPortDiffs.html]
+skip-if =
+ http3
+[test_localStorageOriginsSchemaDiffs.html]
+skip-if =
+ http3
+[test_localStorageQuota.html]
+skip-if =
+ http3
+[test_localStorageQuotaSessionOnly.html]
+[test_localStorageQuotaSessionOnly2.html]
+skip-if = true # bug 1347690
+[test_localStorageReplace.html]
+skip-if =
+ http3
+[test_storageConstructor.html]
diff --git a/dom/tests/mochitest/localstorage/page_blank.html b/dom/tests/mochitest/localstorage/page_blank.html
new file mode 100644
index 0000000000..157317d64b
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/page_blank.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_brokenUTF-16.html b/dom/tests/mochitest/localstorage/test_brokenUTF-16.html
new file mode 100644
index 0000000000..a9289b195c
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_brokenUTF-16.html
@@ -0,0 +1,100 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>incomplete UTF-16 test</title>
+<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ // Check this works for a diacritics
+ var k = "valid UTF-16 key";
+ var v = "ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ";
+
+ localStorage.setItem(k, v);
+ is(localStorage.getItem(k), v, "UTF-16 value results from getItem");
+
+ localStorage.setItem(v, "a value");
+ is(localStorage.getItem(v), "a value", "value result using UTF-16 key from getItem");
+
+ localStorage.clear();
+
+ localStorage[k] = v;
+ is(localStorage[k], v, "UTF-16 value results from []");
+
+ localStorage[v] = "a value";
+ is(localStorage[v], "a value", "value result using UTF-16 key from []");
+
+ localStorage.clear();
+
+ localStorage.aKey = v;
+ is(localStorage.aKey, v, "UTF-16 value results from a dynamic property");
+
+ localStorage.clear();
+
+ // Broken UTF-16
+ k = "broken UTF-16 key";
+ v = "\uD800"; // broken UTF-16
+
+ localStorage.setItem(k, v);
+ is(localStorage.getItem(k), v, "broken value results from getItem");
+
+ localStorage.setItem(v, "a value");
+ is(localStorage.getItem(v), "a value", "value result using broken key from getItem");
+
+ localStorage.clear();
+
+ localStorage[k] = v;
+ is(localStorage[k], v, "broken value results from []");
+
+ localStorage[v] = "a value";
+ is(localStorage[v], "a value", "value result using broken key from []");
+
+ localStorage.clear();
+
+ localStorage.aKey = v;
+ is(localStorage.aKey, v, "broken value results from a dynamic property");
+
+ localStorage.clear();
+
+ // Another variant
+ v = "FcK"
+ + String.fromCharCode(0x8a)
+ + ".jp";
+
+ localStorage.setItem(k, v);
+ is(localStorage.getItem(k), v);
+
+ localStorage.setItem(v, "a value");
+ is(localStorage.getItem(v), "a value");
+
+ localStorage.clear();
+
+ // And yet another variant
+ v = "something"
+ + String.fromCharCode(355, 277, 349, 357, 533, 537, 101, 345);
+
+ localStorage.setItem(k, v);
+ is(localStorage.getItem(k), v);
+
+ localStorage.setItem(v, "a value");
+ is(localStorage.getItem(v), "a value");
+
+ localStorage.clear();
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_bug600307-DBOps.html b/dom/tests/mochitest/localstorage/test_bug600307-DBOps.html
new file mode 100644
index 0000000000..cfce270d5d
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_bug600307-DBOps.html
@@ -0,0 +1,178 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>bug 600307</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="localStorageCommon.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+/* eslint-disable max-nested-callbacks */
+
+/*
+This is strictly implementation specific test for dom storage code from bug 600307.
+It exercises code for asynchronous data flushing with regard to cache life time and its preload.
+
+"flush + reload" means to tell the database to store all pending data then wipe the cached content and reload it from the db
+
+"reload" only means to simulate situation when there is a pending flush for an origin but a new cache is about to preload
+which is a corner case happening rarely ; this helps check the next preload operation will load correct data from the database anyway
+
+Case 1: set | flush + reload | remove | set | remove | flush + reload | get ?= null
+ checks coalescing optimization for single key changes does work correctly for repeated removals of a key
+
+Case 2: set | set | clear | flush + reload | count ?= 0
+ checks whether clear operation superseeds setting keys, the database must be empty for the origin
+
+Case 3: set | set | clear | reload | count ?= 0
+ check the corner case when a data clear flush is pending but a new cache is about to preload
+*/
+
+function startTest()
+{
+ // Enable testing observer notifications
+ localStorageEnableTestingMode(function() {
+
+ // Have an untouched land
+ localStorage.clear();
+
+ // Initial flush
+ localStorageFlush(function() {
+ is(localStorage.length, 0, "localStorage empty at the test start");
+
+ // Basic test 1 (set a key, check presence after reload):
+ localStorage.setItem("item", "value");
+ localStorageFlushAndReload(function() {
+ is(localStorage.getItem("item"), "value", "Basic persistance works");
+ is(localStorage.length, 1, "1 item in localStorage");
+
+ // Basic test 2 (set a key twice, check presence of the last value):
+ localStorage.setItem("item", "value2");
+ localStorage.setItem("item", "value3");
+ localStorageFlushAndReload(function() {
+ is(localStorage.getItem("item"), "value3", "Basic persistance 2 works");
+
+ // Basic test 3 (remove a key, check it has been deleted):
+ localStorage.removeItem("item");
+ localStorageFlushAndReload(function() {
+ is(localStorage.getItem("item"), null, "Basic delete works");
+
+ // Basic test 4 (set and remove a key, check it is not present):
+ localStorage.setItem("item", "value4");
+ localStorage.removeItem("item");
+ localStorageFlushAndReload(function() {
+ is(localStorage.getItem("item"), null, "Basic delete 2 works");
+
+
+ // Case 1:
+ localStorage.setItem("item", "value");
+ localStorageFlushAndReload(function() {
+ localStorage.removeItem("item");
+ localStorage.setItem("item", "value2");
+ localStorage.removeItem("item");
+ localStorageFlushAndReload(function() {
+ is(localStorage.getItem("item"), null, "Item deleted in case 1");
+
+ // Case 2:
+ localStorage.setItem("item", "value");
+ localStorage.setItem("item2", "value2");
+ localStorage.clear();
+ localStorageFlushAndReload(function() {
+ is(localStorage.length, 0, "localStorage clean in case 2");
+
+ // Case 3:
+ localStorageFlush(function() {
+ localStorage.setItem("item", "value");
+ localStorage.setItem("item2", "value2");
+ localStorage.clear();
+ localStorageReload(function() {
+ is(localStorage.length, 0, "localStorage clean in case 4");
+
+ if (!SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled &&
+ SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(
+ SpecialPowers.Ci.nsIXULRuntime).processType != SpecialPowers.Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
+ // Following tests cannot be run in a child/plugin process type
+ SimpleTest.finish();
+ return;
+ }
+
+ // Cookies clean 1
+ localStorageFlush(function() {
+ localStorage.setItem("item", "value");
+ localStorageClearAll(function() {
+ is(localStorage.length, 0, "localStorage clean after cookies deletion");
+ localStorage.setItem("item2", "value2");
+ is(localStorage.getItem("item"), null, "Unexpected key 1, cookies delete");
+ is(localStorage.getItem("item2"), "value2", "Expected key 2, cookies delete");
+ localStorageFlushAndReload(function() {
+ is(localStorage.getItem("item"), null, "Unexpected key 1, cookies delete");
+ is(localStorage.getItem("item2"), "value2", "Expected key 2, cookies delete");
+
+ // Cookies clean 2
+ localStorage.clear();
+ localStorageFlush(function() {
+ localStorage.setItem("item", "value");
+ localStorageClearAll(function() {
+ is(localStorage.length, 0, "localStorage clean after cookies deletion 2");
+ localStorageFlushAndReload(function() {
+ is(localStorage.length, 0, "localStorage clean after cookies deletion 2");
+
+
+ // Domain clean 1
+ localStorageFlush(function() {
+ localStorage.setItem("item", "value");
+ localStorageClearDomain("test", function() {
+ is(localStorage.length, 0, "localStorage clean after domain deletion");
+ localStorage.setItem("item2", "value2");
+ is(localStorage.getItem("item"), null, "Unexpected key 1, domain delete");
+ is(localStorage.getItem("item2"), "value2", "Expected key 2, domain delete");
+ localStorageFlushAndReload(function() {
+ is(localStorage.getItem("item"), null, "Unexpected key 1, domain delete");
+ is(localStorage.getItem("item2"), "value2", "Expected key 2, domain delete");
+
+ // Domain clean 2
+ localStorage.clear();
+ localStorageFlush(function() {
+ localStorage.setItem("item", "value");
+ localStorageClearDomain("test", function() {
+ is(localStorage.length, 0, "localStorage clean after domain deletion 2");
+ localStorageFlushAndReload(function() {
+ is(localStorage.length, 0, "localStorage clean after domain deletion 2");
+
+ SimpleTest.finish();
+
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_bug746272-1.html b/dom/tests/mochitest/localstorage/test_bug746272-1.html
new file mode 100644
index 0000000000..36612fe79f
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_bug746272-1.html
@@ -0,0 +1,32 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>incomplete UTF-16 test</title>
+<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ localStorage.clear();
+ localStorage.setItem("test1", "value1");
+ localStorage.setItem("test2", "value2");
+ localStorage.setItem("test3", "value3");
+
+ is(localStorage.length, 3, "expected number of items");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_bug746272-2.html b/dom/tests/mochitest/localstorage/test_bug746272-2.html
new file mode 100644
index 0000000000..31edbc906a
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_bug746272-2.html
@@ -0,0 +1,31 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>incomplete UTF-16 test</title>
+<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ var test2 = localStorage.getItem("test2");
+ is(test2, "value2", "expected item");
+
+ localStorage.removeItem("test2");
+ is(localStorage.length, 2, "expected number of items");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_cookieBlock.html b/dom/tests/mochitest/localstorage/test_cookieBlock.html
new file mode 100644
index 0000000000..9cc7495d40
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_cookieBlock.html
@@ -0,0 +1,53 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>cookie blocking test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ // Let's use a new window to have the cookie permission applied.
+ let w = window.open("windowProxy.html");
+ w.onload = _ => {
+ try {
+ w.localStorage.setItem("blocked", "blockedvalue");
+ ok(false, "Exception for localStorage.setItem, ACCESS_DENY");
+ }
+ catch (ex) {
+ ok(true, "Exception for localStorage.setItem, ACCESS_DENY");
+ }
+
+ try {
+ w.localStorage.getItem("blocked");
+ ok(false, "Exception for localStorage.getItem, ACCESS_DENY");
+ }
+ catch (ex) {
+ ok(true, "Exception for localStorage.getItem, ACCESS_DENY");
+ }
+
+ w.close();
+ SpecialPowers.popPermissions(() => {
+ SimpleTest.finish();
+ });
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+// Initialize storage before setting the cookie, otherwise we won't be testing
+// the checks in setItem/getItem methods.
+var storage = localStorage;
+
+SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': false, 'context': document}], startTest);
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_embededNulls.html b/dom/tests/mochitest/localstorage/test_embededNulls.html
new file mode 100644
index 0000000000..b12a403b85
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_embededNulls.html
@@ -0,0 +1,40 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>embeded nulls test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ var k = "key with\x00null";
+ var v = "value with\x00null";
+
+ localStorage.setItem(k, v);
+
+ is(localStorage.getItem("key with"), null,
+ "not accessible by truncated key");
+
+ is(localStorage.getItem(k), "value with\x00null",
+ "value is identical to what has been stored");
+
+ isnot(localStorage.getItem(k), "value with",
+ "value is not truncated");
+
+ localStorage.clear();
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_keySync.html b/dom/tests/mochitest/localstorage/test_keySync.html
new file mode 100644
index 0000000000..3f23945e2f
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_keySync.html
@@ -0,0 +1,33 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage equal origins</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="interOriginTest2.js"></script>
+
+<!--
+ This test loads two frames from the same origin, clears in one frame,
+ sets a single key in another and then checks key(0) in the first frame.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.org:80";
+ slaveFrameOrigin = "http://example.org:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameKeySync.html?1";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameKeySync.html?2";
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageBase.html b/dom/tests/mochitest/localstorage/test_localStorageBase.html
new file mode 100644
index 0000000000..a906b42a63
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageBase.html
@@ -0,0 +1,247 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage basic test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var expectedEvents = [
+ "empty,null,",
+ "empty,,null",
+ "key1,null,value1",
+ "key1,value1,null",
+ "key1,null,value1",
+ "key2,null,value2",
+ "key2,value2,value2-2",
+ "key1,value1,value1-2",
+ "key2,value2-2,null",
+ "testA,null,valueA",
+ "testA,valueA,valueA2",
+ "testB,null,valueB",
+ "testB,valueB,valueB2",
+ "testC,null,valueC",
+ "testC,valueC,valueC2",
+ "testC,valueC2,null",
+ "testC,null,null",
+ "testC,null,null",
+ "null,null,test",
+ "null,test,null",
+ "null,null,test",
+ "null,test,null",
+ "null,null,null"
+];
+
+function startTest()
+{
+ // Initially check the localStorage is empty
+ is(localStorage.length, 0, "The storage is empty [1]");
+ is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
+ is(localStorage.nonexisting, undefined, "Nonexisting item is undefined (array access)");
+ is(localStorage.nonexisting, undefined, "Nonexisting item is undefined (property access)");
+ localStorage.removeItem("nonexisting"); // Just check there is no exception
+
+ is(typeof localStorage.getItem("nonexisting"), "object", "getItem('nonexisting') is object");
+ is(typeof localStorage.nonexisting, "undefined", "['nonexisting'] is undefined");
+ is(typeof localStorage.nonexisting, "undefined", "nonexisting is undefined");
+ is(typeof localStorage.getItem("nonexisting2"), "object", "getItem('nonexisting2') is object");
+ is(typeof localStorage.nonexisting2, "undefined", "['nonexisting2'] is undefined");
+ is(typeof localStorage.nonexisting2, "undefined", "nonexisting2 is undefined");
+
+ var localStorageCopy = localStorage;
+
+ function onStorageChanged(e) {
+ if (e.storageArea == localStorageCopy) {
+ ok(expectedEvents.length, "Not more then expected events encountered");
+ var receivedEvent = e.key + "," + e.oldValue + "," + e.newValue;
+ is(receivedEvent, expectedEvents.shift(), "Expected event data: " + receivedEvent);
+ }
+ }
+
+ // Listen for MozLocalStorageChanged
+ SpecialPowers.addChromeEventListener("MozLocalStorageChanged", onStorageChanged, true);
+
+ // add an empty-value key
+ localStorage.setItem("empty", "");
+ is(localStorage.getItem("empty"), "", "Empty value (getItem())");
+ is(localStorage.empty, "", "Empty value (array access)");
+ is(localStorage.empty, "", "Empty value (property access)");
+ is(typeof localStorage.getItem("empty"), "string", "getItem('empty') is string");
+ is(typeof localStorage.empty, "string", "['empty'] is string");
+ is(typeof localStorage.empty, "string", "empty is string");
+ localStorage.removeItem("empty");
+ is(localStorage.length, 0, "The storage has no keys");
+ is(localStorage.getItem("empty"), null, "empty item is null (getItem())");
+ is(localStorage.empty, undefined, "empty item is undefined (array access)");
+ is(localStorage.empty, undefined, "empty item is undefined (property access)");
+ is(typeof localStorage.getItem("empty"), "object", "getItem('empty') is object");
+ is(typeof localStorage.empty, "undefined", "['empty'] is undefined");
+ is(typeof localStorage.empty, "undefined", "empty is undefined");
+
+ // add one key, check it is there
+ localStorage.setItem("key1", "value1");
+ is(localStorage.length, 1, "The storage has one key-value pair");
+ is(localStorage.key(0), "key1");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+
+ // check all access method give the correct result
+ // and are of the correct type
+ is(localStorage.getItem("key1"), "value1", "getItem('key1') == value1");
+ is(localStorage.key1, "value1", "['key1'] == value1");
+ is(localStorage.key1, "value1", "key1 == value1");
+
+ is(typeof localStorage.getItem("key1"), "string", "getItem('key1') is string");
+ is(typeof localStorage.key1, "string", "['key1'] is string");
+ is(typeof localStorage.key1, "string", "key1 is string");
+
+ // remove the previously added key and check the storage is empty
+ localStorage.removeItem("key1");
+ is(localStorage.length, 0, "The storage is empty [2]");
+ is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), null, "\'key1\' removed");
+
+ is(typeof localStorage.getItem("key1"), "object", "getItem('key1') is object");
+ is(typeof localStorage.key1, "undefined", "['key1'] is object");
+ is(typeof localStorage.key1, "undefined", "key1 is object");
+
+ // add one key, check it is there
+ localStorage.setItem("key1", "value1");
+ is(localStorage.length, 1, "The storage has one key-value pair");
+ is(localStorage.key(0), "key1");
+ is(localStorage.getItem("key1"), "value1");
+
+ // add a second key
+ localStorage.setItem("key2", "value2");
+ is(localStorage.length, 2, "The storage has two key-value pairs");
+ is(localStorage.getItem("key1"), "value1");
+ is(localStorage.getItem("key2"), "value2");
+ var firstKey = localStorage.key(0);
+ var secondKey = localStorage.key(1);
+ ok((firstKey == 'key1' && secondKey == 'key2') ||
+ (firstKey == 'key2' && secondKey == 'key1'),
+ 'key() API works.');
+
+ // change the second key
+ localStorage.setItem("key2", "value2-2");
+ is(localStorage.length, 2, "The storage has two key-value pairs");
+ is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(localStorage.key(1), secondKey);
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), "value1");
+ is(localStorage.getItem("key2"), "value2-2");
+
+ // change the first key
+ localStorage.setItem("key1", "value1-2");
+ is(localStorage.length, 2, "The storage has two key-value pairs");
+ is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(localStorage.key(1), secondKey);
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), "value1-2");
+ is(localStorage.getItem("key2"), "value2-2");
+
+ // remove the second key
+ localStorage.removeItem("key2");
+ is(localStorage.length, 1, "The storage has one key-value pair");
+ is(localStorage.key(0), "key1");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), "value1-2");
+
+ // JS property test
+ localStorage.testA = "valueA";
+ is(localStorage.testA, "valueA");
+ is(localStorage.testA, "valueA");
+ is(localStorage.getItem("testA"), "valueA");
+
+ localStorage.testA = "valueA2";
+ is(localStorage.testA, "valueA2");
+ is(localStorage.testA, "valueA2");
+ is(localStorage.getItem("testA"), "valueA2");
+
+ localStorage.testB = "valueB";
+ is(localStorage.testB, "valueB");
+ is(localStorage.testB, "valueB");
+ is(localStorage.getItem("testB"), "valueB");
+
+ localStorage.testB = "valueB2";
+ is(localStorage.testB, "valueB2");
+ is(localStorage.testB, "valueB2");
+ is(localStorage.getItem("testB"), "valueB2");
+
+ localStorage.setItem("testC", "valueC");
+ is(localStorage.testC, "valueC");
+ is(localStorage.testC, "valueC");
+ is(localStorage.getItem("testC"), "valueC");
+
+ localStorage.setItem("testC", "valueC2");
+ is(localStorage.testC, "valueC2");
+ is(localStorage.testC, "valueC2");
+ is(localStorage.getItem("testC"), "valueC2");
+
+ localStorage.setItem("testC", null);
+ is("testC" in localStorage, true);
+ is(localStorage.getItem("testC"), "null");
+ is(localStorage.testC, "null");
+ is(localStorage.testC, "null");
+
+ localStorage.removeItem("testC");
+ localStorage.testC = null;
+ is("testC" in localStorage, true);
+ is(localStorage.getItem("testC"), "null");
+ is(localStorage.testC, "null");
+ is(localStorage.testC, "null");
+
+ localStorage.setItem(null, "test");
+ is("null" in localStorage, true);
+ is(localStorage.getItem("null"), "test");
+ is(localStorage.getItem(null), "test");
+ is(localStorage.null, "test");
+ localStorage.removeItem(null, "test");
+ is("null" in localStorage, false);
+
+ localStorage.setItem(null, "test");
+ is("null" in localStorage, true);
+ localStorage.removeItem("null", "test");
+ is("null" in localStorage, false);
+
+ // Clear the storage
+ localStorage.clear();
+ is("testB" in localStorage, false, "Keys are not in the JS scope of the storage");
+ is("testC" in localStorage, false, "Keys are not in the JS scope of the storage");
+ is(localStorage.length, 0, "The storage is empty [3]");
+ is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null");
+ is(localStorage.getItem("key1"), null, "key1 removed");
+ is(localStorage.getItem("key2"), null, "key2 removed");
+ localStorage.removeItem("nonexisting"); // Just check there is no exception
+ localStorage.removeItem("key1"); // Just check there is no exception
+ localStorage.removeItem("key2"); // Just check there is no exception
+
+ SimpleTest.executeSoon(function () {
+ SpecialPowers.removeChromeEventListener("MozLocalStorageChanged", onStorageChanged, true);
+ is(expectedEvents.length, 0, "received the correct number of events");
+
+ localStorage.clear();
+ SimpleTest.finish();
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageBasePrivateBrowsing_perwindowpb.html b/dom/tests/mochitest/localstorage/test_localStorageBasePrivateBrowsing_perwindowpb.html
new file mode 100644
index 0000000000..1bf1f4450e
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageBasePrivateBrowsing_perwindowpb.html
@@ -0,0 +1,256 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage basic test, while in sesison only mode</title>
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+
+<script type="text/javascript">
+
+var mainWindow;
+
+var prefBranch = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
+prefBranch.setIntPref("browser.startup.page", 0);
+prefBranch.setCharPref("browser.startup.homepage_override.mstone", "ignore");
+
+function startTest() {
+ mainWindow = window.browsingContext.topChromeWindow;
+
+ doTest();
+}
+
+var contentPage = "http://mochi.test:8888/chrome/dom/tests/mochitest/localstorage/page_blank.html";
+
+function testOnWindow(aIsPrivate, aCallback) {
+ var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
+ win.addEventListener("load", function() {
+ win.addEventListener("DOMContentLoaded", function onInnerLoad() {
+ if (win.content.location.href == "about:privatebrowsing") {
+ win.gBrowser.loadURI(Services.io.newURI(contentPage));
+ return;
+ }
+ win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
+ SimpleTest.executeSoon(function() { aCallback(win); });
+ }, true);
+ win.gBrowser.loadURI(Services.io.newURI(contentPage));
+ }, {capture: true, once: true});
+}
+
+function doTest() {
+ testOnWindow(false, function(aWin) {
+ aWin.content.localStorage.setItem("persistent", "persistent1");
+
+ testOnWindow(true, function(privateWin) {
+ is(privateWin.content.localStorage.getItem("persistent"), null, "previous values are inaccessible");
+
+ // Initially check the privateWin.content.localStorage is empty
+ is(privateWin.content.localStorage.length, 0, "The storage is empty [1]");
+ is(privateWin.content.localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
+ is(privateWin.content.localStorage.nonexisting, undefined, "Nonexisting item is null (array access)");
+ is(privateWin.content.localStorage.nonexisting, undefined, "Nonexisting item is null (property access)");
+ privateWin.content.localStorage.removeItem("nonexisting"); // Just check there is no exception
+
+ is(typeof privateWin.content.localStorage.getItem("nonexisting"), "object", "getItem('nonexisting') is object");
+ is(typeof privateWin.content.localStorage.nonexisting, "undefined", "['nonexisting'] is undefined");
+ is(typeof privateWin.content.localStorage.nonexisting, "undefined", "nonexisting is undefined");
+ is(typeof privateWin.content.localStorage.getItem("nonexisting2"), "object", "getItem('nonexisting2') is object");
+ is(typeof privateWin.content.localStorage.nonexisting2, "undefined", "['nonexisting2'] is undefined");
+ is(typeof privateWin.content.localStorage.nonexisting2, "undefined", "nonexisting2 is undefined");
+
+ // add an empty-value key
+ privateWin.content.localStorage.setItem("empty", "");
+ is(privateWin.content.localStorage.getItem("empty"), "", "Empty value (getItem())");
+ is(privateWin.content.localStorage.empty, "", "Empty value (array access)");
+ is(privateWin.content.localStorage.empty, "", "Empty value (property access)");
+ is(typeof privateWin.content.localStorage.getItem("empty"), "string", "getItem('empty') is string");
+ is(typeof privateWin.content.localStorage.empty, "string", "['empty'] is string");
+ is(typeof privateWin.content.localStorage.empty, "string", "empty is string");
+ privateWin.content.localStorage.removeItem("empty");
+ is(privateWin.content.localStorage.length, 0, "The storage has no keys");
+ is(privateWin.content.localStorage.getItem("empty"), null, "empty item is null (getItem())");
+ is(privateWin.content.localStorage.empty, undefined, "empty item is undefined (array access)");
+ is(privateWin.content.localStorage.empty, undefined, "empty item is undefined (property access)");
+ is(typeof privateWin.content.localStorage.getItem("empty"), "object", "getItem('empty') is object");
+ is(typeof privateWin.content.localStorage.empty, "undefined", "['empty'] is undefined");
+ is(typeof privateWin.content.localStorage.empty, "undefined", "empty is undefined");
+
+ // add one key, check it is there
+ privateWin.content.localStorage.setItem("key1", "value1");
+ is(privateWin.content.localStorage.length, 1, "The storage has one key-value pair");
+ is(privateWin.content.localStorage.key(0), "key1");
+ is(privateWin.content.localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(1), null, "key() should return null for out-of-bounds access");
+
+ // check all access method give the correct result
+ // and are of the correct type
+ is(privateWin.content.localStorage.getItem("key1"), "value1", "getItem('key1') == value1");
+ is(privateWin.content.localStorage.key1, "value1", "['key1'] == value1");
+ is(privateWin.content.localStorage.key1, "value1", "key1 == value1");
+
+ is(typeof privateWin.content.localStorage.getItem("key1"), "string", "getItem('key1') is string");
+ is(typeof privateWin.content.localStorage.key1, "string", "['key1'] is string");
+ is(typeof privateWin.content.localStorage.key1, "string", "key1 is string");
+
+ // remove the previously added key and check the storage is empty
+ privateWin.content.localStorage.removeItem("key1");
+ is(privateWin.content.localStorage.length, 0, "The storage is empty [2]");
+ is(privateWin.content.localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.getItem("key1"), null, "\'key1\' removed");
+
+ is(typeof privateWin.content.localStorage.getItem("key1"), "object", "getItem('key1') is object");
+ is(typeof privateWin.content.localStorage.key1, "undefined", "['key1'] is undefined");
+ is(typeof privateWin.content.localStorage.key1, "undefined", "key1 is undefined");
+
+ // add one key, check it is there
+ privateWin.content.localStorage.setItem("key1", "value1");
+ is(privateWin.content.localStorage.length, 1, "The storage has one key-value pair");
+ is(privateWin.content.localStorage.key(0), "key1");
+ is(privateWin.content.localStorage.getItem("key1"), "value1");
+
+ // add a second key
+ privateWin.content.localStorage.setItem("key2", "value2");
+ is(privateWin.content.localStorage.length, 2, "The storage has two key-value pairs");
+ is(privateWin.content.localStorage.getItem("key1"), "value1");
+ is(privateWin.content.localStorage.getItem("key2"), "value2");
+ var firstKey = privateWin.content.localStorage.key(0);
+ var secondKey = privateWin.content.localStorage.key(1);
+ ok((firstKey == 'key1' && secondKey == 'key2') ||
+ (firstKey == 'key2' && secondKey == 'key1'),
+ 'key() API works.');
+
+ // change the second key
+ privateWin.content.localStorage.setItem("key2", "value2-2");
+ is(privateWin.content.localStorage.length, 2, "The storage has two key-value pairs");
+ is(privateWin.content.localStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(privateWin.content.localStorage.key(1), secondKey);
+ is(privateWin.content.localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.getItem("key1"), "value1");
+ is(privateWin.content.localStorage.getItem("key2"), "value2-2");
+
+ // change the first key
+ privateWin.content.localStorage.setItem("key1", "value1-2");
+ is(privateWin.content.localStorage.length, 2, "The storage has two key-value pairs");
+ is(privateWin.content.localStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(privateWin.content.localStorage.key(1), secondKey);
+ is(privateWin.content.localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.getItem("key1"), "value1-2");
+ is(privateWin.content.localStorage.getItem("key2"), "value2-2");
+
+ // remove the second key
+ privateWin.content.localStorage.removeItem("key2");
+ is(privateWin.content.localStorage.length, 1, "The storage has one key-value pair");
+ is(privateWin.content.localStorage.key(0), "key1");
+ is(privateWin.content.localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.getItem("key1"), "value1-2");
+
+ // JS property test
+ privateWin.content.localStorage.testA = "valueA";
+ is(privateWin.content.localStorage.testA, "valueA");
+ is(privateWin.content.localStorage.testA, "valueA");
+ is(privateWin.content.localStorage.getItem("testA"), "valueA");
+
+ privateWin.content.localStorage.testA = "valueA2";
+ is(privateWin.content.localStorage.testA, "valueA2");
+ is(privateWin.content.localStorage.testA, "valueA2");
+ is(privateWin.content.localStorage.getItem("testA"), "valueA2");
+
+ privateWin.content.localStorage.testB = "valueB";
+ is(privateWin.content.localStorage.testB, "valueB");
+ is(privateWin.content.localStorage.testB, "valueB");
+ is(privateWin.content.localStorage.getItem("testB"), "valueB");
+
+ privateWin.content.localStorage.testB = "valueB2";
+ is(privateWin.content.localStorage.testB, "valueB2");
+ is(privateWin.content.localStorage.testB, "valueB2");
+ is(privateWin.content.localStorage.getItem("testB"), "valueB2");
+
+ privateWin.content.localStorage.setItem("testC", "valueC");
+ is(privateWin.content.localStorage.testC, "valueC");
+ is(privateWin.content.localStorage.testC, "valueC");
+ is(privateWin.content.localStorage.getItem("testC"), "valueC");
+
+ privateWin.content.localStorage.setItem("testC", "valueC2");
+ is(privateWin.content.localStorage.testC, "valueC2");
+ is(privateWin.content.localStorage.testC, "valueC2");
+ is(privateWin.content.localStorage.getItem("testC"), "valueC2");
+
+ privateWin.content.localStorage.setItem("testC", null);
+ is("testC" in privateWin.content.localStorage, true);
+ is(privateWin.content.localStorage.getItem("testC"), "null");
+ is(privateWin.content.localStorage.testC, "null");
+ is(privateWin.content.localStorage.testC, "null");
+
+ privateWin.content.localStorage.removeItem("testC");
+ privateWin.content.localStorage.testC = null;
+ is("testC" in privateWin.content.localStorage, true);
+ is(privateWin.content.localStorage.getItem("testC"), "null");
+ is(privateWin.content.localStorage.testC, "null");
+ is(privateWin.content.localStorage.testC, "null");
+
+ privateWin.content.localStorage.setItem(null, "test");
+ is("null" in privateWin.content.localStorage, true);
+ is(privateWin.content.localStorage.getItem("null"), "test");
+ is(privateWin.content.localStorage.getItem(null), "test");
+ is(privateWin.content.localStorage.null, "test");
+ privateWin.content.localStorage.removeItem(null, "test");
+ is("null" in privateWin.content.localStorage, false);
+
+ privateWin.content.localStorage.setItem(null, "test");
+ is("null" in privateWin.content.localStorage, true);
+ privateWin.content.localStorage.removeItem("null", "test");
+ is("null" in privateWin.content.localStorage, false);
+
+ // Clear the storage
+ privateWin.content.localStorage.clear();
+ is(privateWin.content.localStorage.length, 0, "The storage is empty [3]");
+ is(privateWin.content.localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(privateWin.content.localStorage.getItem("nonexisting"), null, "Nonexisting item is null");
+ is(privateWin.content.localStorage.getItem("key1"), null, "key1 removed");
+ is(privateWin.content.localStorage.getItem("key2"), null, "key2 removed");
+ privateWin.content.localStorage.removeItem("nonexisting"); // Just check there is no exception
+ privateWin.content.localStorage.removeItem("key1"); // Just check there is no exception
+ privateWin.content.localStorage.removeItem("key2"); // Just check there is no exception
+
+ privateWin.content.localStorage.setItem("must disappear", "private browsing value");
+
+ privateWin.close();
+
+ // The .close() call above will operate asynchronously, so execute the
+ // code below asynchronously as well.
+ function callback(newPrivateWin) {
+ is(newPrivateWin.content.localStorage.getItem("must disappear"), null, "private browsing values threw away");
+ is(newPrivateWin.content.localStorage.length, 0, "No items");
+
+ newPrivateWin.close();
+ is(aWin.content.localStorage.getItem("persistent"), "persistent1", "back in normal mode");
+ aWin.content.localStorage.clear();
+ aWin.close();
+
+ prefBranch.clearUserPref("browser.startup.page")
+ prefBranch.clearUserPref("browser.startup.homepage_override.mstone");
+ SimpleTest.finish();
+ };
+ SimpleTest.executeSoon(() => testOnWindow(true, callback));
+ });
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageBaseSessionOnly.html b/dom/tests/mochitest/localstorage/test_localStorageBaseSessionOnly.html
new file mode 100644
index 0000000000..39df8ac519
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageBaseSessionOnly.html
@@ -0,0 +1,211 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage basic test, while in sesison only mode</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is enabled.");
+ SimpleTest.finish();
+ return;
+ }
+
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, 'context': document}], test1);
+}
+
+function test1() {
+ // Initially check the localStorage is empty
+ is(localStorage.length, 0, "The storage is empty [1]");
+ is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
+ is(localStorage.nonexisting, undefined, "Nonexisting item is undefined (array access)");
+ is(localStorage.nonexisting, undefined, "Nonexisting item is undefined (property access)");
+ localStorage.removeItem("nonexisting"); // Just check there is no exception
+
+ is(typeof localStorage.getItem("nonexisting"), "object", "getItem('nonexisting') is object");
+ is(typeof localStorage.nonexisting, "undefined", "['nonexisting'] is undefined");
+ is(typeof localStorage.nonexisting, "undefined", "nonexisting is undefined");
+ is(typeof localStorage.getItem("nonexisting2"), "object", "getItem('nonexisting2') is object");
+ is(typeof localStorage.nonexisting2, "undefined", "['nonexisting2'] is undefined");
+ is(typeof localStorage.nonexisting2, "undefined", "nonexisting2 is undefined");
+
+ // add an empty-value key
+ localStorage.setItem("empty", "");
+ is(localStorage.getItem("empty"), "", "Empty value (getItem())");
+ is(localStorage.empty, "", "Empty value (array access)");
+ is(localStorage.empty, "", "Empty value (property access)");
+ is(typeof localStorage.getItem("empty"), "string", "getItem('empty') is string");
+ is(typeof localStorage.empty, "string", "['empty'] is string");
+ is(typeof localStorage.empty, "string", "empty is string");
+ localStorage.removeItem("empty");
+ is(localStorage.length, 0, "The storage has no keys");
+ is(localStorage.getItem("empty"), null, "empty item is null (getItem())");
+ is(localStorage.empty, undefined, "empty item is undefined (array access)");
+ is(localStorage.empty, undefined, "empty item is undefined (property access)");
+ is(typeof localStorage.getItem("empty"), "object", "getItem('empty') is object");
+ is(typeof localStorage.empty, "undefined", "['empty'] is undefined");
+ is(typeof localStorage.empty, "undefined", "empty is undefined");
+
+ // add one key, check it is there
+ localStorage.setItem("key1", "value1");
+ is(localStorage.length, 1, "The storage has one key-value pair");
+ is(localStorage.key(0), "key1");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+
+ // check all access method give the correct result
+ // and are of the correct type
+ is(localStorage.getItem("key1"), "value1", "getItem('key1') == value1");
+ is(localStorage.key1, "value1", "['key1'] == value1");
+ is(localStorage.key1, "value1", "key1 == value1");
+
+ is(typeof localStorage.getItem("key1"), "string", "getItem('key1') is string");
+ is(typeof localStorage.key1, "string", "['key1'] is string");
+ is(typeof localStorage.key1, "string", "key1 is string");
+
+ // remove the previously added key and check the storage is empty
+ localStorage.removeItem("key1");
+ is(localStorage.length, 0, "The storage is empty [2]");
+ is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), null, "\'key1\' removed");
+
+ is(typeof localStorage.getItem("key1"), "object", "getItem('key1') is object");
+ is(typeof localStorage.key1, "undefined", "['key1'] is undefined");
+ is(typeof localStorage.key1, "undefined", "key1 is undefined");
+
+ // add one key, check it is there
+ localStorage.setItem("key1", "value1");
+ is(localStorage.length, 1, "The storage has one key-value pair");
+ is(localStorage.key(0), "key1");
+ is(localStorage.getItem("key1"), "value1");
+
+ // add a second key
+ localStorage.setItem("key2", "value2");
+ is(localStorage.length, 2, "The storage has two key-value pairs");
+ is(localStorage.getItem("key1"), "value1");
+ is(localStorage.getItem("key2"), "value2");
+ var firstKey = localStorage.key(0);
+ var secondKey = localStorage.key(1);
+ ok((firstKey == 'key1' && secondKey == 'key2') ||
+ (firstKey == 'key2' && secondKey == 'key1'),
+ 'key() API works.');
+
+ // change the second key
+ localStorage.setItem("key2", "value2-2");
+ is(localStorage.length, 2, "The storage has two key-value pairs");
+ is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(localStorage.key(1), secondKey);
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), "value1");
+ is(localStorage.getItem("key2"), "value2-2");
+
+ // change the first key
+ localStorage.setItem("key1", "value1-2");
+ is(localStorage.length, 2, "The storage has two key-value pairs");
+ is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(localStorage.key(1), secondKey);
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), "value1-2");
+ is(localStorage.getItem("key2"), "value2-2");
+
+ // remove the second key
+ localStorage.removeItem("key2");
+ is(localStorage.length, 1, "The storage has one key-value pair");
+ is(localStorage.key(0), "key1");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("key1"), "value1-2");
+
+ // JS property test
+ localStorage.testA = "valueA";
+ is(localStorage.testA, "valueA");
+ is(localStorage.testA, "valueA");
+ is(localStorage.getItem("testA"), "valueA");
+
+ localStorage.testA = "valueA2";
+ is(localStorage.testA, "valueA2");
+ is(localStorage.testA, "valueA2");
+ is(localStorage.getItem("testA"), "valueA2");
+
+ localStorage.testB = "valueB";
+ is(localStorage.testB, "valueB");
+ is(localStorage.testB, "valueB");
+ is(localStorage.getItem("testB"), "valueB");
+
+ localStorage.testB = "valueB2";
+ is(localStorage.testB, "valueB2");
+ is(localStorage.testB, "valueB2");
+ is(localStorage.getItem("testB"), "valueB2");
+
+ localStorage.setItem("testC", "valueC");
+ is(localStorage.testC, "valueC");
+ is(localStorage.testC, "valueC");
+ is(localStorage.getItem("testC"), "valueC");
+
+ localStorage.setItem("testC", "valueC2");
+ is(localStorage.testC, "valueC2");
+ is(localStorage.testC, "valueC2");
+ is(localStorage.getItem("testC"), "valueC2");
+
+ localStorage.setItem("testC", null);
+ is("testC" in localStorage, true);
+ is(localStorage.getItem("testC"), "null");
+ is(localStorage.testC, "null");
+ is(localStorage.testC, "null");
+
+ localStorage.removeItem("testC");
+ localStorage.testC = null;
+ is("testC" in localStorage, true);
+ is(localStorage.getItem("testC"), "null");
+ is(localStorage.testC, "null");
+ is(localStorage.testC, "null");
+
+ localStorage.setItem(null, "test");
+ is("null" in localStorage, true);
+ is(localStorage.getItem("null"), "test");
+ is(localStorage.getItem(null), "test");
+ is(localStorage.null, "test");
+ localStorage.removeItem(null, "test");
+ is("null" in localStorage, false);
+
+ localStorage.setItem(null, "test");
+ is("null" in localStorage, true);
+ localStorage.removeItem("null", "test");
+ is("null" in localStorage, false);
+
+ // Clear the storage
+ localStorage.clear();
+ is(localStorage.length, 0, "The storage is empty [3]");
+ is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null");
+ is(localStorage.getItem("key1"), null, "key1 removed");
+ is(localStorage.getItem("key2"), null, "key2 removed");
+ localStorage.removeItem("nonexisting"); // Just check there is no exception
+ localStorage.removeItem("key1"); // Just check there is no exception
+ localStorage.removeItem("key2"); // Just check there is no exception
+
+ localStorage.clear();
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html b/dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html
new file mode 100644
index 0000000000..9860c67661
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html
@@ -0,0 +1,75 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage cookies settings test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+</head>
+<body>
+
+<script type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+// Set cookies behavior to "always reject".
+SpecialPowers.pushPrefEnv({"set": [
+ ["network.cookie.cookieBehavior", 2],
+]}, test1);
+
+function test1() {
+ let w = window.open("windowProxy.html");
+ w.onload = _ => {
+ try {
+ w.localStorage.setItem("contentkey", "test-value");
+ ok(false, "Setting localStorageItem should throw a security exception");
+ }
+ catch(ex) {
+ is(ex.name, "SecurityError", "Got security exception");
+ }
+
+ w.close();
+
+ // Set cookies behavior to "reject 3rd party"
+ SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 1]], }, test2);
+ }
+}
+
+function test2() {
+ let w = window.open("windowProxy.html");
+ w.onload = _ => {
+ try {
+ w.localStorage.setItem("contentkey", "test-value");
+ ok(true, "Setting localStorageItem should not throw a security exception");
+ }
+ catch(ex) {
+ ok(false, "Setting localStorageItem should not throw a security exception");
+ }
+
+ var fileTest = (location.protocol + "//example.com" + location.pathname)
+ .replace("test_l", "frameL");
+
+ var myframe = w.document.createElement("iframe");
+ w.document.body.appendChild(myframe);
+ myframe.src = fileTest;
+
+ w.onmessage = function(e) {
+ switch (e.data.type || "") {
+ case "ok":
+ ok(e.data.what, e.data.msg);
+ break;
+ case "finish":
+ w.close();
+ SimpleTest.finish();
+ break;
+ default:
+ ok(false, "Invalid type.");
+ }
+ };
+ }
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageEnablePref.html b/dom/tests/mochitest/localstorage/test_localStorageEnablePref.html
new file mode 100644
index 0000000000..485f4e010a
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageEnablePref.html
@@ -0,0 +1,65 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage enable preference test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+SimpleTest.requestCompleteLog();
+
+function checkException(func, exc)
+{
+ var exceptionThrew = false;
+ try {
+ func();
+ }
+ catch (ex) {
+ exceptionThrew = true;
+ is(ex.name, exc, "Expected "+exc+" exception");
+ if (ex.name != exc) {
+ info("The exception which was thrown is: " + ex);
+ }
+ }
+ ok(exceptionThrew, "Exception "+exc+" threw");
+}
+
+var storage;
+function test1() {
+ is(typeof(window.localStorage), "object", "Storage is present");
+ storage = window.localStorage;
+
+ SpecialPowers.pushPrefEnv({"set": [["dom.storage.enabled", false]]}, test2);
+}
+
+function test2() {
+ is(window.localStorage, null, "Storage is null");
+
+ checkException(function() {storage.setItem("test", "value");}, "SecurityError");
+
+ SpecialPowers.pushPrefEnv({"set": [["dom.storage.enabled", true]]}, test3);
+}
+
+function test3() {
+ is(typeof(window.localStorage), "object", "Storage is present again");
+ storage.setItem("test", "value");
+ is(storage.getItem("test"), "value", "value can be set");
+ window.localStorage.clear();
+ SimpleTest.finish();
+}
+
+function doTest() {
+ SpecialPowers.pushPrefEnv({"set": [["dom.storage.enabled", true]]}, test1);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="doTest();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml b/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml
new file mode 100644
index 0000000000..fe7be443e9
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml
@@ -0,0 +1,60 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage basic test</title>
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+async function startTest()
+{
+ await SpecialPowers.pushPrefEnv({"set": [["dom.storage.client_validation", false]]});
+
+ var url = "http://example.com/tests/dom/tests/mochitest/localstorage/frameChromeSlave.html";
+ var ios = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+ var ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+ .getService(Components.interfaces.nsIScriptSecurityManager);
+ var dsm = Components.classes["@mozilla.org/dom/localStorage-manager;1"]
+ .getService(Components.interfaces.nsIDOMStorageManager);
+
+ var uri = ios.newURI(url);
+ var principal = ssm.createContentPrincipal(uri, {});
+ var storage = dsm.createStorage(window, principal, principal, "");
+
+ storage.setItem("chromekey", "chromevalue");
+
+ var aframe = document.getElementById("aframe");
+ aframe.onload = function()
+ {
+ is(storage.getItem("chromekey"), "chromevalue");
+ is(aframe.contentDocument.getElementById("data").innerHTML, "chromevalue");
+ SimpleTest.finish();
+ }
+ aframe.src = "http://example.com/tests/dom/tests/mochitest/localstorage/frameChromeSlave.html";
+
+ // Additionally check that we do not crash when we access the localStorage
+ // object in the owning chrome window (but we should throw). See bug 485396.
+ var exceptionCaught = false;
+ try {
+ localStorage;
+ }
+ catch (e) {
+ is(e.result, Components.results.NS_ERROR_NOT_AVAILABLE,
+ "Testing that we get the expected exception.");
+ exceptionCaught = true;
+ }
+ is(exceptionCaught, true, "Testing that an exception was thrown.");
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" id="aframe"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageKeyOrder.html b/dom/tests/mochitest/localstorage/test_localStorageKeyOrder.html
new file mode 100644
index 0000000000..a5dbb28b42
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageKeyOrder.html
@@ -0,0 +1,73 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage key order test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<!--
+ Check we preserve order of keys in localStorage when
+ keys are just modified. When a new key is added or
+ a key is removed order is again unspecified.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ try
+ {
+ var keyNames = new Array;
+ localStorage.a = "1";
+ localStorage.b = "2";
+ localStorage.c = "3";
+ localStorage.d = "4";
+ localStorage.e = "5";
+
+ is(localStorage.a, "1", "a = 1");
+ is(localStorage.b, "2", "b = 2");
+ is(localStorage.c, "3", "c = 3");
+ is(localStorage.d, "4", "d = 4");
+ is(localStorage.e, "5", "e = 5");
+ is(localStorage.length, 5, "length = 5");
+
+ for (var i = 0; i < localStorage.length; ++i)
+ keyNames[i] = localStorage.key(i);
+
+ localStorage.a = "10";
+ localStorage.b = "20";
+ localStorage.c = "30";
+ localStorage.d = "40";
+ localStorage.e = "50";
+
+ is(localStorage.a, "10", "a = 10");
+ is(localStorage.b, "20", "b = 20");
+ is(localStorage.c, "30", "c = 30");
+ is(localStorage.d, "40", "d = 40");
+ is(localStorage.e, "50", "e = 50");
+ is(localStorage.length, 5, "length = 5");
+
+ for (var i = 0; i < localStorage.length; ++i)
+ is(keyNames[i], localStorage.key(i), "key "+keyNames[i]+" on same index");
+
+ keyNamesStringify = "[\"" + keyNames.join("\",\"") + "\"]";
+ frame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/localstorage/frameOrder.html?" +
+ keyNamesStringify;
+ }
+ catch (ex)
+ {
+ localStorage.clear();
+ throw ex;
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="frame"></frame>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageOriginsDiff.html b/dom/tests/mochitest/localstorage/test_localStorageOriginsDiff.html
new file mode 100644
index 0000000000..96a93171ca
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageOriginsDiff.html
@@ -0,0 +1,41 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage different origins</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="interOriginTest2.js"></script>
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.org:80";
+ slaveFrameOrigin = "http://example.com:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameMasterNotEqual.html";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameSlaveNotEqual.html";
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageOriginsDomainDiffs.html b/dom/tests/mochitest/localstorage/test_localStorageOriginsDomainDiffs.html
new file mode 100644
index 0000000000..c1a4417727
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageOriginsDomainDiffs.html
@@ -0,0 +1,41 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage different domains</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="interOriginTest2.js"></script>
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.org:80";
+ slaveFrameOrigin = "http://test1.example.org:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameMasterNotEqual.html";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameSlaveNotEqual.html";
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageOriginsEquals.html b/dom/tests/mochitest/localstorage/test_localStorageOriginsEquals.html
new file mode 100644
index 0000000000..35cdd86b32
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageOriginsEquals.html
@@ -0,0 +1,42 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage equal origins</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="interOriginTest2.js"></script>
+
+<!--
+ This test loads two frames from equal
+ origins and checks that entries of localStorage
+ objects are kept up-to-date and synchronized
+ between both frames.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.org:80";
+ slaveFrameOrigin = "http://example.org:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameMasterEqual.html";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameSlaveEqual.html";
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageOriginsPortDiffs.html b/dom/tests/mochitest/localstorage/test_localStorageOriginsPortDiffs.html
new file mode 100644
index 0000000000..d34e0dbcd1
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageOriginsPortDiffs.html
@@ -0,0 +1,41 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage different port numbers</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="interOriginTest2.js"></script>
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.org:80";
+ slaveFrameOrigin = "http://example.org:8000";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameMasterNotEqual.html";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameSlaveNotEqual.html";
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageOriginsSchemaDiffs.html b/dom/tests/mochitest/localstorage/test_localStorageOriginsSchemaDiffs.html
new file mode 100644
index 0000000000..57e4fb5ab3
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageOriginsSchemaDiffs.html
@@ -0,0 +1,41 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage different domains</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="interOriginTest2.js"></script>
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.com";
+ slaveFrameOrigin = "https://example.com";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameMasterNotEqual.html";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameSlaveNotEqual.html";
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageQuota.html b/dom/tests/mochitest/localstorage/test_localStorageQuota.html
new file mode 100644
index 0000000000..a26252b313
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuota.html
@@ -0,0 +1,136 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+//Note: this test is currently giving failures when running standalone, see bug 914865
+
+var currentTest = 1;
+
+function doNextTest()
+{
+ slave = frame;
+
+ switch (currentTest)
+ {
+ case 1:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ slaveOrigin = "http://test1.example.com";
+ } else {
+ slaveOrigin = "http://example.com";
+ }
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
+ break;
+
+ // Now set another key with length 500 bytes, i.e. allocate 501 bytes
+ case 2:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
+ break;
+
+ // Try to set the same key value again to check we don't fail
+ // even 1002 bytes has already been exhausted from the quota
+ // We just change the value of an existing key.
+ case 3:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
+ break;
+
+ // Try to set the same key to a larger value that would lead to
+ // quota reach and check that the value is still the old one
+ case 4:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add2&B&failure";
+ break;
+
+ // Try to set a new 500 bytes key and check we fail because we are over the
+ // quota.
+ case 5:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ slaveOrigin = "http://test1.example.com";
+ } else if (SpecialPowers.Services.appinfo.fissionAutostart){
+ // Fission makes the "https://test2.example.com" run in the different
+ // process with the other two and Legacy LS has issues with usage
+ // synchronization within processes, see Bug 1683299 for more details.
+ slaveOrigin = "http://test2.example.com";
+ } else {
+ slaveOrigin = "https://test2.example.com";
+ }
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
+ break;
+
+ // Remove the second key, it must not fail. This should release the
+ // allocated space of the quota assigned to test1.example.com.
+ case 6:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?remove&B&success";
+ break;
+
+ // Now try again to set 500 bytes key, it must succeed.
+ case 7:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ slaveOrigin = "http://test1.example.com";
+ } else if (SpecialPowers.Services.appinfo.fissionAutostart){
+ slaveOrigin = "http://test2.example.com";
+ } else {
+ slaveOrigin = "https://test2.example.com";
+ }
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
+ break;
+
+ case 8:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ SimpleTest.executeSoon(doNextTest);
+ } else {
+ // Do a clean up...
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
+ }
+ break;
+
+ case 9:
+ // Do a clean up...
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
+ break;
+
+ case 10:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ SimpleTest.executeSoon(doNextTest);
+ } else {
+ // Do a clean up...
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
+ }
+ break;
+
+ default: // end
+ SimpleTest.finish();
+ }
+
+ ++currentTest;
+}
+
+function doStep()
+{
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function startTest() {
+ // Initialy setup the quota to testing value of 1024B and
+ // set a 500 bytes key with name length 1 (allocate 501 bytes)
+ SpecialPowers.pushPrefEnv({"set": [["dom.storage.default_quota", 1], ["dom.storage.default_site_quota", 1], ["security.mixed_content.block_display_content", false], ["security.mixed_content.block_active_content", false]]}, doNextTest);
+}
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="frame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html b/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html
new file mode 100644
index 0000000000..ab04360821
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html
@@ -0,0 +1,189 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+
+<script type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+
+const CONTENT_PAGE = "http://mochi.test:8888/chrome/dom/tests/mochitest/localstorage/page_blank.html";
+const slavePath = "/chrome/dom/tests/mochitest/localstorage/";
+var currentTest = 1;
+var quota = Services.prefs.getIntPref("dom.storage.default_quota", 5 * 1024);
+var siteQuota = Services.prefs.getIntPref("dom.storage.default_site_quota", 25 * 1024);
+Services.prefs.setIntPref("browser.startup.page", 0);
+Services.prefs.setIntPref("dom.storage.default_quota", 1);
+Services.prefs.setIntPref("dom.storage.default_site_quota", 1);
+
+var slaveLoadsPending = 1;
+var slaveOrigin = "";
+var slave = null;
+var failureRegExp = new RegExp("^FAILURE");
+
+function startTest() {
+ testOnWindow(true, function(aWindow) {
+ info("Private window loaded");
+ var frame = aWindow.content.document.createElement("iframe");
+ aWindow.content.document.body.appendChild(frame);
+ aWindow.content.addEventListener("message", function(aEvent) {
+ onMessageReceived(aEvent, aWindow)
+ });
+ slave = aWindow.content.frames[0];
+
+ SimpleTest.waitForFocus(() => doNextTest(aWindow), aWindow);
+ });
+}
+
+function doNextTest(aWindow) {
+ info("Running test: " + currentTest);
+ switch (currentTest) {
+ // Initialy setup the quota to testing value of 1024B and
+ // set a 500 bytes key with name length 1 (allocate 501 bytes)
+ case 1:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ slaveOrigin = "http://test1.example.com";
+ } else {
+ slaveOrigin = "http://example.com";
+ }
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
+ break;
+
+ // Now set another key with length 500 bytes, i.e. allocate 501 bytes
+ case 2:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
+ break;
+
+ // Try to set the same key value again to check we don't fail
+ // even 1002 bytes has already been exhausted from the quota
+ // We just change the value of an existing key.
+ case 3:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
+ break;
+
+ // Try to set the same key to a larger value that would lead to
+ // quota reach and check that the value is still the old one
+ case 4:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add2&B&failure";
+ break;
+
+ // Try to set a new 500 bytes key and check we fail because we are over the
+ // quota.
+ case 5:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ slaveOrigin = "http://test1.example.com";
+ } else {
+ slaveOrigin = "https://test2.example.com";
+ }
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
+ break;
+
+ // Remove the second key, it must not fail. This should release the
+ // allocated space of the quota assigned to test1.example.com.
+ case 6:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?remove&B&success";
+ break;
+
+ // Now try again to set 500 bytes key, it must succeed.
+ case 7:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ slaveOrigin = "http://test1.example.com";
+ } else {
+ slaveOrigin = "https://test2.example.com";
+ }
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
+ break;
+
+ case 8:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ SimpleTest.executeSoon(() => doNextTest(aWindow));
+ } else {
+ // Do a clean up...
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
+ }
+ break;
+
+ case 9:
+ // Do a clean up...
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
+ break;
+
+ case 10:
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ SimpleTest.executeSoon(() => doNextTest(aWindow));
+ } else {
+ // Do a clean up...
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
+ }
+ break;
+
+ default:
+ Services.prefs.clearUserPref("browser.startup.page")
+ Services.prefs.setIntPref("dom.storage.default_quota", quota);
+ Services.prefs.setIntPref("dom.storage.default_site_quota", siteQuota);
+ aWindow.close();
+ SimpleTest.finish();
+ }
+
+ ++currentTest;
+}
+
+function onMessageReceived(event, aWindow) {
+ info("Message received: " + event.data);
+ switch (event.data) {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--slaveLoadsPending)
+ break;
+ // Indication of successfully finished step of a test
+ // Just fall through...
+ case "perf":
+ // postMessage should send to the slaveOrigin. However with the addition of private
+ // browsing flags in origin attributes this will cause postMessage to fail. The origin of this
+ // window has false privatebrowsing, while the recipient is in a private window.
+ // To fix this issue and preserve the integrity of the test a * is passed to get around origin equality.
+ slave.postMessage("step", "*");
+ break;
+ // Indication of all test parts finish (from any of the frames)
+ case "done":
+ aWindow.content.localStorage.clear();
+ slaveLoadsPending = 1;
+ doNextTest(aWindow);
+ break;
+ // Any other message indicates error or succes message of a test
+ default:
+ SimpleTest.ok(!event.data.match(failureRegExp), event.data);
+ break;
+ }
+}
+
+function whenDelayedStartupFinished(aCallback) {
+ Services.obs.addObserver(function observer(aSubject, aTopic) {
+ Services.obs.removeObserver(observer, aTopic);
+
+ aSubject.addEventListener("DOMContentLoaded", function() {
+ SimpleTest.executeSoon(function() { aCallback(aSubject); });
+ }, {capture: true, once: true});
+ }, "browser-delayed-startup-finished");
+}
+
+function testOnWindow(aIsPrivate, callback) {
+ var mainWindow = window.browsingContext.topChromeWindow;
+
+ mainWindow.openWebLinkIn(CONTENT_PAGE, "window", {
+ private: aIsPrivate });
+ whenDelayedStartupFinished(callback);
+};
+</script>
+</head>
+<body onload="startTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
new file mode 100644
index 0000000000..1d32776907
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
@@ -0,0 +1,134 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var currentTest = 1;
+
+function doNextTest()
+{
+ slave = frame;
+
+ switch (currentTest)
+ {
+ case 1:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
+ break;
+
+ // In subdomain now set another key with length 500 bytes, i.e.
+ // allocate 501 bytes
+ case 2:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
+ break;
+
+ // Try to set the same key value again to check we don't fail
+ // even 1002 bytes has already been exhausted from the quota
+ // We just change the value of an existing key.
+ case 3:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
+ break;
+
+ // Try to set the same key to a larger value that would lead to
+ // quota reach and check that the value is still the old one
+ case 4:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add2&B&failure";
+ break;
+
+ // In a different subdomain try to set a new 500 bytes key
+ // and check we fail because we are over the quota
+ case 5:
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&failure";
+ break;
+
+ // Remove from the second subdomain the second key, it must not fail
+ // This should release the allocated space of the quota assigned to
+ // example.com.
+ case 6:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?remove&B&success";
+ break;
+
+ // Now try again to set 500 bytes key, it must succeed.
+ case 7:
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&success";
+ break;
+
+ case 8:
+ // Do a clean up...
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
+ break;
+
+ case 9:
+ // Do a clean up...
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
+ break;
+
+ case 10:
+ // Do a clean up...
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
+ break;
+
+ default:
+ SimpleTest.finish();
+ }
+
+ ++currentTest;
+}
+
+function doStep()
+{
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function startTest() {
+ if (SpecialPowers.Services.domStorageManager.nextGenLocalStorageEnabled) {
+ ok(true, "Test ignored when the next gen local storage is enabled.");
+ SimpleTest.finish();
+ return;
+ }
+
+ SpecialPowers.pushPermissions([
+ {
+ type: "cookie",
+ allow: SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION,
+ context: "http://example.com",
+ },
+ {
+ type: "cookie",
+ allow: SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION,
+ context: "http://test1.example.com",
+ },
+ {
+ type: "cookie",
+ allow: SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION,
+ context: "https://test2.example.com",
+ },
+ ], function() {
+ // Initialy setup the quota to testing value of 1024B and
+ // set a 500 bytes key with name length 1 (allocate 501 bytes)
+ SpecialPowers.pushPrefEnv({"set": [["dom.storage.default_quota", 1], ["dom.storage.default_site_quota", 1], ["security.mixed_content.block_display_content", false], ["security.mixed_content.block_active_content", false]]}, doNextTest);
+ });
+}
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="frame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
new file mode 100644
index 0000000000..156ff02bf6
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
@@ -0,0 +1,98 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var currentTest = 1;
+
+function doNextTest()
+{
+ slave = frame;
+
+ switch (currentTest)
+ {
+ case 1:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
+ break;
+
+ // In subdomain now set another key with length 500 bytes, i.e.
+ // allocate 501 bytes
+ case 2:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
+ break;
+
+ // Try to set the same key value again to check we don't fail
+ // even 1002 bytes has already been exhausted from the quota
+ // We just change the value of an existing key.
+ case 3:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
+ break;
+
+ // Try to set the same key to a larger value that would lead to
+ // quota reach and check that the value is still the old one
+ case 4:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add2&B&failure";
+ break;
+
+ // Try to set a new 500 bytes key
+ // and check we fail because we are over the quota
+ case 5:
+ slaveOrigin = "https://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&failure";
+ break;
+
+ // Remove the key inherited from the non-session-only database
+ case 6:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?remove&A&success";
+ break;
+
+ // Now try again to set 500 bytes key, it must succeed.
+ case 7:
+ slaveOrigin = "https://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&success";
+ break;
+
+ case 8:
+ // Do a clean up...
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
+ break;
+
+ default:
+ SimpleTest.finish();
+ }
+
+ ++currentTest;
+}
+
+function doStep()
+{
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function startTest() {
+ // Initialy setup the quota to testing value of 1024B and
+ // set a 500 bytes key with name length 1 (allocate 501 bytes)
+ SpecialPowers.pushPrefEnv({"set": [["dom.storage.default_quota", 1], ["dom.storage.default_site_quota", 1], ["security.mixed_content.block_display_content", false], ["security.mixed_content.block_active_content", false]]}, function() {
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, 'context': document}], doNextTest);
+ });
+}
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="frame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_localStorageReplace.html b/dom/tests/mochitest/localstorage/test_localStorageReplace.html
new file mode 100644
index 0000000000..b80c35dbc5
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageReplace.html
@@ -0,0 +1,80 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage replace test</title>
+
+<!--
+ This test checks that localStorage object doesn't leak
+ in a window that changes its location. We do this by switching
+ frame location inside of this window and then by changing location
+ of a top level window.
+-->
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var shell;
+var shellType;
+var failureRegExp = new RegExp("^FAILURE");
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event)
+{
+ switch (event.data)
+ {
+ case "init_done":
+ // This is frame with different origin in the same browsing context
+ // as the first frame adding data to localStorage of the first origin.
+ shell.location = "http://example.com:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?check&" + shellType;
+ break;
+
+ case "check_done":
+ // Clean the localStorage of the first origin.
+ shell.location = "http://example.org:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?clean&" + shellType;
+ break;
+
+ case "clean_done":
+ switch (shellType)
+ {
+ case "frame":
+ // We finished testing in a frame
+ // proceed with test in a separate window
+ shellType = "window";
+ shell = window.open("http://example.org:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?init&" + shellType);
+ break;
+
+ case "window":
+ shell.close();
+ window.setTimeout(function() {SimpleTest.finish();}, 0);
+ break;
+ }
+ break;
+
+ default:
+ SimpleTest.ok(!event.data.match(failureRegExp), event.data);
+ break;
+ }
+}
+
+function startTest() {
+ SpecialPowers.pushPrefEnv({"set": [["security.mixed_content.block_display_content", false], ["security.mixed_content.block_active_content", false]]}, test1);
+}
+
+function test1() {
+ shellType = "frame";
+ shell = frame;
+ shell.location = "http://example.org:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?init&" + shellType;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="frame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_storageConstructor.html b/dom/tests/mochitest/localstorage/test_storageConstructor.html
new file mode 100644
index 0000000000..e0aa4e11dc
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_storageConstructor.html
@@ -0,0 +1,35 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Storage interface</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ var functionCalled = false;
+ is(localStorage instanceof Storage, true, "localStorage is instance of Storage");
+ Storage.prototype.exists = function(key) {
+ functionCalled = true;
+ return this.getItem(key) != null;
+ }
+ localStorage.setItem("test_prototype", "value");
+ is(functionCalled, false, "Overridden function not called");
+ is(localStorage.exists("test_prototype"), true, "Prototype overridden");
+ is(functionCalled, true, "Overridden function called");
+ localStorage.clear();
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/windowProxy.html b/dom/tests/mochitest/localstorage/windowProxy.html
new file mode 100644
index 0000000000..39ba8eab0f
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/windowProxy.html
@@ -0,0 +1,3 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body></body>
+</html>
diff --git a/dom/tests/mochitest/orientation/bug507902-frame.html b/dom/tests/mochitest/orientation/bug507902-frame.html
new file mode 100644
index 0000000000..5a352f3ee4
--- /dev/null
+++ b/dom/tests/mochitest/orientation/bug507902-frame.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Frame for watchPosition </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+</head>
+<body>
+<script type="text/javascript">
+
+var ok = window.parent.ok;
+var SimpleTest = window.parent.SimpleTest;
+
+function boom()
+{
+ window.addEventListener("unload", function(){});
+ window.addEventListener("devicemotion", function(){});
+ location = "data:text/html,2";
+
+ ok(1, "leak will be at the end of mochitests. so pass.");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+window.addEventListener("load", function() { setTimeout(boom, 0); });
+
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/orientation/mochitest.ini b/dom/tests/mochitest/orientation/mochitest.ini
new file mode 100644
index 0000000000..16ffd62de3
--- /dev/null
+++ b/dom/tests/mochitest/orientation/mochitest.ini
@@ -0,0 +1,4 @@
+[DEFAULT]
+support-files = bug507902-frame.html
+
+[test_bug507902.html]
diff --git a/dom/tests/mochitest/orientation/test_bug507902.html b/dom/tests/mochitest/orientation/test_bug507902.html
new file mode 100644
index 0000000000..aaf5290da4
--- /dev/null
+++ b/dom/tests/mochitest/orientation/test_bug507902.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=507902
+-->
+<head>
+ <title>Test for devicemotion</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=507902">Mozilla Bug 507902</a>
+<p id="display"></p>
+<div id="content">
+<iframe id="frame" src="bug507902-frame.html"></iframe>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+function boom()
+{
+ window.addEventListener("unload", function(){});
+ window.addEventListener("devicemotion", function(){});
+ location = "data:text/html,2";
+
+ ok(1, "leak will be at the end of mochitests. so pass.");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html b/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html
new file mode 100644
index 0000000000..33f550f7d7
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html
@@ -0,0 +1,96 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=784402
+ -->
+ <head>
+ <title>Bug 784402</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=784402">
+ Mozilla Bug 784402</a>
+ <p id="display"></p>
+
+ <iframe src ="iframe_differentDOM.html" allowfullscreen="true" id="iframe"
+ onload="startTest()"
+ sandbox="allow-scripts allow-same-origin allow-pointer-lock">
+ </iframe>
+
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 784402
+ * Test allow-pointer-lock sandbox flag.
+ */
+
+ SimpleTest.waitForExplicitFinish(1);
+
+ var iframe = document.getElementById("iframe")
+ , iframeDiv
+ , contentDocument
+ , pointerLocked = 0
+ , numberOfRuns = 0;
+
+ function runTests () {
+ is(pointerLocked, 1, "Pointer should only have been locked once. " +
+ "Without allow-pointer-lock flag, a sandboxed document should not be " +
+ "able to lock the pointer");
+ SimpleTest.finish();
+ }
+
+ function resetIframe () {
+ contentDocument.exitFullscreen();
+
+ // remove allow-pointer-lock sandbox flag
+ iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
+ // reloads the iframe, startTest function gets called again
+ iframe.setAttribute("src", "iframe_differentDOM.html");
+ }
+
+ function startTest () {
+ SimpleTest.waitForFocus(doStartTest, iframe.contentWindow);
+ }
+ function doStartTest() {
+ contentDocument = iframe.contentDocument;
+ iframeDiv = contentDocument.getElementById("div");
+
+ numberOfRuns++;
+
+ contentDocument.addEventListener("pointerlockchange", function () {
+ if (contentDocument.pointerLockElement === iframeDiv) {
+ pointerLocked++;
+ contentDocument.exitFullscreen();
+ }
+ });
+
+ contentDocument.addEventListener("pointerlockerror", function () {
+ contentDocument.exitFullscreen();
+ });
+
+ contentDocument.addEventListener("fullscreenchange", function () {
+ if (contentDocument.fullscreenElement) {
+ ok(contentDocument.fullscreenElement === iframeDiv,
+ "Fullscreen element can only be iframe div");
+ // during second run iframe won't have allow-pointer-lock flag and
+ // requestPointerLock will fail, pointerlockerror should be fired
+ iframeDiv.requestPointerLock();
+ } else if (numberOfRuns === 1) {
+ resetIframe();
+ } else if (numberOfRuns === 2) {
+ runTests();
+ }
+ });
+
+ iframeDiv.requestFullscreen();
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_changeLockElement.html b/dom/tests/mochitest/pointerlock/file_changeLockElement.html
new file mode 100644
index 0000000000..62c5b27956
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_changeLockElement.html
@@ -0,0 +1,115 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 1284788</title>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+ <style>
+ #block1, #block2, #block3 {
+ background: blue;
+ width: 50px; height: 50px;
+ margin: 10px;
+ }
+ </style>
+</head>
+<body>
+ <div id="block1"></div>
+ <div id="block2"></div>
+ <div id="block3"></div>
+ <div id="test">
+ <script>
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.requestFlakyTimeout("For changing pointer lock element not in a valid user event handler");
+
+ var block1 = document.getElementById("block1");
+ var block2 = document.getElementById("block2");
+ var block3 = document.getElementById("block3");
+
+ class ClickTester {
+ constructor(target) {
+ this._target = target;
+ this._callback = null;
+ document.addEventListener("click", this);
+ }
+
+ synthesize(callback) {
+ ok(!this._callback, "No callback should have been hooked");
+ this._callback = callback;
+ synthesizeMouseAtCenter(this._target, {}, window);
+ }
+
+ handleEvent(e) {
+ ok(!!this._callback, "Should have hooked a callback");
+ var callback = this._callback;
+ this._callback = null;
+ callback(e);
+ }
+ };
+
+ var tester = new ClickTester(block3);
+ // It would be called in handler of load event in pointerlock_utils.js
+ function start() {
+ tester.synthesize(firstClick);
+ }
+
+ function firstClick(e) {
+ is(e.target, block3, "Click is triggered inside block3");
+ document.addEventListener("pointerlockchange", lockedPointerOnBlock1);
+ block1.requestPointerLock();
+ }
+
+ function lockedPointerOnBlock1() {
+ document.removeEventListener("pointerlockchange", lockedPointerOnBlock1);
+ is(document.pointerLockElement, block1, "Pointer should be locked on #block1");
+ SimpleTest.executeSoon(() => {
+ tester.synthesize(secondClick);
+ });
+ }
+
+ function secondClick(e) {
+ is(e.target, block1, "Event should be redirected to block1");
+ // Use 2s to ensure that we never consider this as an extension of user input.
+ setTimeout(() => {
+ document.addEventListener("pointerlockchange", lockedPointerOnBlock2);
+ block2.requestPointerLock();
+ }, 2000);
+ }
+
+ function lockedPointerOnBlock2() {
+ document.removeEventListener("pointerlockchange", lockedPointerOnBlock2);
+ is(document.pointerLockElement, block2, "Pointer should be locked on #block2");
+ SimpleTest.executeSoon(() => {
+ tester.synthesize(thirdClick);
+ });
+ }
+
+ function thirdClick(e) {
+ is(e.target, block2, "Event should be redirected to block2");
+ // Use 2s to ensure that we never consider this as an extension of user input.
+ setTimeout(() => {
+ document.addEventListener("pointerlockchange", lockedPointerOnBlock1Again);
+ block1.requestPointerLock();
+ }, 2000);
+ }
+
+ function lockedPointerOnBlock1Again() {
+ document.removeEventListener("pointerlockchange", lockedPointerOnBlock1Again);
+ is(document.pointerLockElement, block1, "Pointer should be locked on #block1 again");
+ SimpleTest.executeSoon(() => {
+ tester.synthesize(fourthClick);
+ });
+ }
+
+ function fourthClick(e) {
+ is(e.target, block1, "Event should be redirected to block1 again");
+ document.addEventListener("pointerlockchange", () => SimpleTest.finish());
+ document.exitPointerLock();
+ }
+
+ </script>
+ </div>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_childIframe.html b/dom/tests/mochitest/pointerlock/file_childIframe.html
new file mode 100644
index 0000000000..9ee3153d2e
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_childIframe.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - file_childIframe.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ #parent, #childDiv, #iframe, #table, #table td {
+ margin: 0;
+ padding: 0;
+ border: none;
+ }
+ #iframe, #table {
+ background-color: red;
+ width: 100%;
+ height: 100%;
+ }
+ #childDiv, #table td {
+ background-color: blue;
+ width: 50%;
+ height: 50%;
+ }
+ </style>
+</head>
+<body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+
+ <div id="parent">
+ <table id="childTable">
+ <tr>
+ <td>
+ <iframe id="iframe" src="iframe_differentDOM.html">
+ </iframe>
+ </td>
+ <td>
+ <div id="childDiv">
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Check if pointer is locked when over a child iframe of
+ * the locked element
+ * Check if pointer is being repositioned back to center of
+ * the locked element even when pointer goes over a child ifame
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var parent = document.getElementById("parent")
+ , childDiv = document.getElementById("childDiv")
+ , iframe = document.getElementById("iframe");
+
+ function MovementStats() {
+ this.movementX = false;
+ this.movementY = false;
+ }
+
+ var firstMove = new MovementStats()
+ , secondMove = new MovementStats()
+ , hoverIframe = false;
+
+ function runTests () {
+ ok(hoverIframe, "Pointer should be locked even when pointer " +
+ "hovers over a child iframe");
+ is(firstMove.movementX, secondMove.movementX, "MovementX of first " +
+ "move to childDiv should be equal to movementX of second move " +
+ "to child div");
+ is(firstMove.movementY, secondMove.movementY, "MovementY of first " +
+ "move to childDiv should be equal to movementY of second move " +
+ "to child div");
+ }
+
+ var firstMoveChild = function (e) {
+ firstMove.movementX = e.movementX;
+ firstMove.movementY = e.movementY;
+
+ parent.removeEventListener("mousemove", firstMoveChild);
+ parent.addEventListener("mousemove", moveIframe);
+
+ synthesizeMouseAtCenter(iframe, {type: "mousemove"}, window);
+ };
+
+ var moveIframe = function (e) {
+ hoverIframe = !!document.pointerLockElement;
+
+ parent.removeEventListener("mousemove", moveIframe);
+ parent.addEventListener("mousemove", secondMoveChild);
+
+ synthesizeMouseAtCenter(childDiv, {type: "mousemove"}, window);
+ };
+
+ var secondMoveChild = function (e) {
+ secondMove.movementX = e.movementX;
+ secondMove.movementY = e.movementY;
+ parent.removeEventListener("mousemove", secondMoveChild);
+
+ addFullscreenChangeContinuation("exit", function() {
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ };
+
+ document.addEventListener("pointerlockchange", function () {
+ if (document.pointerLockElement === parent) {
+ parent.addEventListener("mousemove", firstMoveChild);
+ synthesizeMouseAtCenter(childDiv, {type: "mousemove"}, window);
+ }
+ });
+
+ function start() {
+ addFullscreenChangeContinuation("enter", function() {
+ parent.requestPointerLock();
+ });
+ parent.requestFullscreen();
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_doubleLock.html b/dom/tests/mochitest/pointerlock/file_doubleLock.html
new file mode 100644
index 0000000000..93e156a0b0
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_doubleLock.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - file_doubleLockCallBack.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style type="text/css">
+ #test-element { background-color: #94E01B; width:100px; height:100px; }
+ </style>
+</head>
+<body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602</a>
+ <div id="div"></div>
+ <pre id="test">
+ <script type="text/javascript">
+ /*
+ * Test for Bug 633602
+ * If element requests pointerlock on itself while in pointerlock state
+ * pointerlockchange event should be dispatched
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div = document.getElementById("div")
+ , numberOfLocks = 0;
+
+ function runTests () {
+ is(numberOfLocks, 2, "Requesting pointer lock on a locked element " +
+ "should dispatch pointerlockchange event");
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === div) {
+ if (numberOfLocks === 2) {
+ addFullscreenChangeContinuation("exit", function() {
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ else {
+ numberOfLocks++;
+ div.requestPointerLock();
+ }
+ }
+ });
+
+ function start() {
+ console.log('started');
+ addFullscreenChangeContinuation("enter", function() {
+ div.requestPointerLock();
+ });
+ div.requestFullscreen();
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_escapeKey.html b/dom/tests/mochitest/pointerlock/file_escapeKey.html
new file mode 100644
index 0000000000..987b880232
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_escapeKey.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+<!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
+<head>
+ <title>Bug 633602</title>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <div id="div"></div>
+ <pre id="test">
+ <script type="text/javascript">
+ /*
+ * Test for Bug 633602
+ * Escape key should unlock the pointer
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div = document.getElementById("div")
+ , pointerUnLocked = false;
+
+ function start() {
+ addFullscreenChangeContinuation("enter", enteredFullscreen);
+ div.requestFullscreen();
+ }
+
+ function enteredFullscreen(e) {
+ is(document.fullscreenElement, div, "Element #div should entered fullscreen");
+ ok(!document.pointerLockElement, "Pointer shouldn't have been locked");
+ document.addEventListener("pointerlockchange", lockedPointer);
+ div.requestPointerLock();
+ }
+
+ function lockedPointer(e) {
+ document.removeEventListener("pointerlockchange", lockedPointer);
+ is(document.pointerLockElement, div, "Pointer should have been locked on #div");
+ document.addEventListener("pointerlockchange", unlockedPointer);
+ addFullscreenChangeContinuation("exit", leavedFullscreen);
+ SimpleTest.executeSoon(() => synthesizeKey("KEY_Escape"));
+ }
+
+ var pointerUnlocked = false;
+ var exitedFullscreen = false;
+
+ function unlockedPointer() {
+ document.removeEventListener("pointerlockchange", unlockedPointer);
+ ok(!pointerUnlocked, "Shouldn't have unlocked pointer before");
+ ok(!document.pointerLockElement, "Pointer should have been unlocked now");
+ pointerUnlocked = true;
+ finishTest();
+ }
+
+ function leavedFullscreen() {
+ ok(!exitedFullscreen, "Shouldn't have exited fullscreen before");
+ ok(!document.fullscreenElement, "Should have exited fullscreen now");
+ exitedFullscreen = true;
+ finishTest();
+ }
+
+ function finishTest() {
+ if (pointerUnlocked && exitedFullscreen) {
+ SimpleTest.finish();
+ }
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_infiniteMovement.html b/dom/tests/mochitest/pointerlock/file_infiniteMovement.html
new file mode 100644
index 0000000000..995d99843b
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_infiniteMovement.html
@@ -0,0 +1,114 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+ <head>
+ <title>Bug 633602 - file_movementXY.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <div id="div"></div>
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * This test checks if movementX and movementY
+ * are present in a mouse event object.
+ * It also checks the values for movementXY.
+ * They should be equal to the current screenXY minus
+ * the last screenXY
+ * This test will also test that the incremental movement is
+ * not constrained to the width of the screen.
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div = document.getElementById("div")
+ , divCenterWidth = 0
+ , divCenterHeight = 0
+ , totalMovementX = 0
+ , totalMovementY = 0
+ , mouseMoveIntervalID;
+
+ function runTests () {
+ ok(totalMovementX > div.getBoundingClientRect().width,
+ "Should have moved more than one screen's worth in width." +
+ "TotalX: " + totalMovementX + " Screensize X: " + div.getBoundingClientRect().width);
+ ok(totalMovementY > div.getBoundingClientRect().height,
+ "Should have moved more than one screen's worth in height." +
+ "TotalY: " + totalMovementY + " Screensize Y: " + div.getBoundingClientRect().height);
+ }
+
+ var firstMoveListener = function (e) {
+ info("Got first mousemove");
+ clearInterval(mouseMoveIntervalID);
+ div.removeEventListener("mousemove", firstMoveListener);
+ div.addEventListener("mousemove", secondMoveListener);
+
+ // Bug 1357082
+ // Retrigger synthesizeMouse until it actually happens.
+ mouseMoveIntervalID = setInterval(() => {
+ synthesizeMouse(div,(divCenterWidth/2) * 3,
+ (divCenterHeight/2) * 3, {
+ type: "mousemove"
+ }, window);
+ }, 100);
+ }
+
+ var secondMoveListener = function (e) {
+ info("Got second mousemove");
+ clearInterval(mouseMoveIntervalID);
+ totalMovementX = divCenterWidth + ((divCenterWidth / 2) * 3);
+ totalMovementY = divCenterHeight + ((divCenterHeight / 2) * 3);
+
+ div.removeEventListener("mousemove", secondMoveListener);
+ addFullscreenChangeContinuation("exit", function() {
+ info("Got fullscreenchange for exiting");
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === div) {
+ info("Got pointerlockchange for entering");
+ div.addEventListener("mousemove", firstMoveListener);
+
+ divCenterWidth = Math.round(div.getBoundingClientRect().width / 2);
+ divCenterHeight = Math.round(div.getBoundingClientRect().height / 2);
+
+ // Bug 1357082
+ // Retrigger synthesizeMouse until it actually happens.
+ mouseMoveIntervalID = setInterval(() => {
+ synthesizeMouse(div, divCenterWidth, divCenterHeight, {
+ type: "mousemove"
+ }, window);
+ }, 100);
+ } else {
+ info("Got pointerlockchange for exiting");
+ }
+ });
+
+ function start() {
+ info("Requesting fullscreen on parent");
+ addFullscreenChangeContinuation("enter", function() {
+ info("Got fullscreenchange for entering");
+ div.requestPointerLock();
+ });
+ div.requestFullscreen();
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_locksvgelement.html b/dom/tests/mochitest/pointerlock/file_locksvgelement.html
new file mode 100644
index 0000000000..edbfa45995
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_locksvgelement.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+ -->
+ <head>
+ <title>Bug 633602</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602</a>
+ <p id="display"></p>
+
+ <svg id="svg-elem" width="100" height="100" viewbox="0 0 100 100">
+ <rect x="10" y="10" width="50" height="50"
+ fill="black" stroke="blue" stroke-width="2"/>
+ </svg>
+
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Test locking non-html element.
+ */
+
+ SimpleTest.waitForExplicitFinish(1);
+
+ var elem,
+ elemWasLocked = false;
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.fullscreenElement &&
+ document.pointerLockElement === elem) {
+ elemWasLocked = true;
+ document.exitPointerLock();
+ } else {
+ addFullscreenChangeContinuation("exit", function() {
+ ok(elemWasLocked, "Expected SVG elem to become locked.");
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ });
+
+ function start() {
+ elem = document.getElementById("svg-elem");
+ addFullscreenChangeContinuation("enter", function() {
+ elem.requestPointerLock();
+ });
+ elem.requestFullscreen();
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_movementXY.html b/dom/tests/mochitest/pointerlock/file_movementXY.html
new file mode 100644
index 0000000000..7ef47cfaa9
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_movementXY.html
@@ -0,0 +1,106 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+ <head>
+ <title>Bug 633602 - file_movementXY.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <div id="div"></div>
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Checks if movementX and movementY are present
+ * in the mouse event object.
+ * It also checks the values for movementXY.
+ * They should be equal to the current screenXY minus
+ * the last screenXY
+ */
+
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.requestFlakyTimeout("We may need to wait for window's moving");
+
+ function MouseMovementStats() {
+ this.screenX = false;
+ this.screenY = false;
+ this.movementX = false;
+ this.movementY = false;
+ }
+
+ var div = document.getElementById("div")
+ , divCenterWidth = 0
+ , divCenterHeight = 0
+ , movementX = false
+ , movementY = false
+ , firstMove = new MouseMovementStats()
+ , secondMove = new MouseMovementStats();
+
+ function runTests () {
+ ok(movementX && movementY, "movementX and " +
+ "movementY should exist in mouse events objects.");
+ is(secondMove.movementX, secondMove.screenX - firstMove.screenX,
+ "movementX should be equal to eNow.screenX-ePrevious.screenX");
+ is(secondMove.movementY, secondMove.screenY - firstMove.screenY,
+ "movementY should be equal to eNow.screenY-ePrevious.screenY");
+ }
+
+ var moveMouse = function(e) {
+ info("Got mouse move");
+ movementX = ("movementX" in e);
+ movementY = ("movementY" in e);
+
+ div.removeEventListener("mousemove", moveMouse);
+ div.addEventListener("mousemove", moveMouseAgain);
+
+ firstMove.screenX = e.screenX;
+ firstMove.screenY = e.screenY;
+
+ divCenterWidth = Math.round(div.getBoundingClientRect().width / 2);
+ divCenterHeight = Math.round(div.getBoundingClientRect().height / 2);
+
+ synthesizeMouse(div, (divCenterWidth + 10), (divCenterHeight + 10), {
+ type: "mousemove"
+ }, window);
+ };
+
+ var moveMouseAgain = function(e) {
+ info("Got mouse move again");
+ secondMove.screenX = e.screenX;
+ secondMove.screenY = e.screenY;
+ secondMove.movementX = e.movementX;
+ secondMove.movementY = e.movementY;
+
+ div.removeEventListener("mousemove", moveMouseAgain);
+ addFullscreenChangeContinuation("exit", function() {
+ info("Got fullscreenchange for exiting");
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ };
+
+ function start() {
+ info("Requesting fullscreen on parent");
+ addFullscreenChangeContinuation("enter", function() {
+ info("Got fullscreenchange for entering");
+ div.addEventListener("mousemove", moveMouse);
+ synthesizeMouseAtCenter(div, {type: "mousemove"}, window);
+ });
+ div.requestFullscreen();
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html b/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html
new file mode 100644
index 0000000000..8d625b6704
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+ -->
+ <head>
+ <title>Bug 633602 - file_nestedFullScreen.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+
+ <div id="parentDiv">
+ <div id="childDiv"></div>
+ </div>
+
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Requesting fullscreen on a child element of the element with
+ * the pointer locked should unlock the pointer
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var parentDiv = document.getElementById("parentDiv")
+ , childDiv = document.getElementById("childDiv")
+ , parentDivLocked = false
+ , parentDivFullScreen = false
+ , pointerLocked = false;
+
+ function runTests () {
+ ok(parentDivLocked, "After requesting pointerlock on parentDiv " +
+ "document.pointerLockElement should be equal to " +
+ " parentDiv element");
+ isnot(pointerLocked, true, "Requesting fullscreen on " +
+ "childDiv while parentDiv still in fullscreen should " +
+ "unlock the pointer");
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === parentDiv) {
+ parentDivLocked = true;
+ addFullscreenChangeContinuation("enter", function() {
+ pointerLocked = !!document.pointerLockElement;
+ addFullscreenChangeContinuation("exit", function() {
+ addFullscreenChangeContinuation("exit", function() {
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ });
+ document.exitFullscreen();
+ });
+ childDiv.requestFullscreen();
+ }
+ });
+
+ function start() {
+ addFullscreenChangeContinuation("enter", function() {
+ parentDivFullScreen = true;
+ parentDiv.requestPointerLock();
+ });
+ parentDiv.requestFullscreen();
+ }
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_pointerLockPref.html b/dom/tests/mochitest/pointerlock/file_pointerLockPref.html
new file mode 100644
index 0000000000..09c3b42052
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_pointerLockPref.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+ -->
+ <head>
+ <title>Bug 633602</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602</a>
+ <p id="display"></p>
+ <div id="div"></div>
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Tests full-screen-api.pointer-lock pref
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div = document.getElementById("div")
+ , prefEnabled = false
+ , prefDisabled = false;
+
+ function runTests () {
+ ok(prefEnabled, "Element should be able to lock the pointer " +
+ "if pointer-lock pref is set to TRUE");
+ ok(prefDisabled, "Element should NOT be able to lock the pointer " +
+ "if pointer-lock pref is set to FALSE");
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === div) {
+ prefEnabled = true;
+ document.exitPointerLock();
+ }
+ else {
+ SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
+ false );
+ div.requestPointerLock();
+ }
+ });
+
+ document.addEventListener("pointerlockerror", function (e) {
+ prefDisabled = true;
+ addFullscreenChangeContinuation("exit", function() {
+ SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
+ true );
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ });
+
+ function start() {
+ addFullscreenChangeContinuation("enter", function() {
+ SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
+ true );
+ div.requestPointerLock();
+ });
+ div.requestFullscreen();
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_pointerlock-api-with-shadow.html b/dom/tests/mochitest/pointerlock/file_pointerlock-api-with-shadow.html
new file mode 100644
index 0000000000..a9c2d525de
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_pointerlock-api-with-shadow.html
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML>
+<html>
+<!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
+<head>
+ <title>Bug 633602</title>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <div id="host"></div>
+ <pre id="test">
+ <script type="text/javascript">
+ /*
+ * Test for Bug 1430303
+ * Make sure DOM API is correct.
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div,
+ host,
+ hasRequestPointerLock = false,
+ pointerLockChangeEventFired = false,
+ pointerUnlocked = false,
+ pointerLocked = false,
+ hasExitPointerLock = false,
+ pointerLockElement = false,
+ hasMovementX = false,
+ hasMovementY = false;
+ gotContextMenuEvent = false;
+
+ function runTests () {
+ ok(hasRequestPointerLock, "Element should have requestPointerLock.");
+ ok(pointerLockChangeEventFired, "pointerlockchange event should fire.");
+ ok(pointerUnlocked, "Should be able to unlock pointer locked element.");
+ ok(pointerLocked, "Requested element should be able to lock.");
+ ok(hasExitPointerLock, "Document should have exitPointerLock");
+ ok(pointerLockElement, "Document should keep track of correct pointer locked element");
+ ok(hasMovementX, "Mouse Event should have movementX.");
+ ok(hasMovementY, "Mouse Event should have movementY.");
+ ok(!gotContextMenuEvent, "Shouldn't have got a contextmenu event.");
+ }
+
+ function mouseMoveHandler(e) {
+ info("Got mousemove");
+ document.removeEventListener("mousemove", mouseMoveHandler);
+
+ hasMovementX = "movementX" in e;
+ hasMovementY = "movementY" in e;
+
+ hasExitPointerLock = "exitPointerLock" in document;
+ document.exitPointerLock();
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ pointerLockChangeEventFired = true;
+
+ if (document.pointerLockElement) {
+ info("Got pointerlockchange for entering");
+ pointerLocked = true;
+ pointerLockElement = document.pointerLockElement === host;
+ is(host.shadowRoot.firstChild, host.shadowRoot.pointerLockElement,
+ "ShadowRoot's pointerLockElement shouldn't be retargeted.");
+
+ window.addEventListener("contextmenu",
+ function() { gotContextMenuEvent = true; },
+ true);
+ synthesizeMouse(document.body, 4, 4,
+ { type: "contextmenu", button: 2 },
+ window);
+
+ document.addEventListener("mousemove", mouseMoveHandler);
+ synthesizeMouseAtCenter(host, {type: "mousemove"}, window);
+ } else {
+ info("Got pointerlockchange for exiting");
+ pointerUnlocked = true;
+ addFullscreenChangeContinuation("exit", function() {
+ info("Got fullscreenchange for exiting");
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ });
+
+ function start() {
+ host = document.getElementById("host");
+ var sr = host.attachShadow({mode: "open"});
+ sr.innerHTML = "<div><div>";
+ div = sr.firstChild;
+ info("Requesting fullscreen on parent");
+ addFullscreenChangeContinuation("enter", function() {
+ info("Got fullscreenchange for entering");
+ hasRequestPointerLock = "requestPointerLock" in div;
+ div.requestPointerLock();
+ });
+ host.requestFullscreen();
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_pointerlock-api.html b/dom/tests/mochitest/pointerlock/file_pointerlock-api.html
new file mode 100644
index 0000000000..6f5fb537be
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_pointerlock-api.html
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML>
+<html>
+<!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
+<head>
+ <title>Bug 633602</title>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <div id="div"></div>
+ <pre id="test">
+ <script type="text/javascript">
+ /*
+ * Test for Bug 633602
+ * Make sure DOM API is correct.
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div,
+ hasRequestPointerLock = false,
+ pointerLockChangeEventFired = false,
+ pointerUnlocked = false,
+ pointerLocked = false,
+ hasExitPointerLock = false,
+ pointerLockElement = false,
+ hasMovementX = false,
+ hasMovementY = false;
+ gotContextMenuEvent = false;
+
+ function runTests () {
+ ok(hasRequestPointerLock, "Element should have requestPointerLock.");
+ ok(pointerLockChangeEventFired, "pointerlockchange event should fire.");
+ ok(pointerUnlocked, "Should be able to unlock pointer locked element.");
+ ok(pointerLocked, "Requested element should be able to lock.");
+ ok(hasExitPointerLock, "Document should have exitPointerLock");
+ ok(pointerLockElement, "Document should keep track of correct pointer locked element");
+ ok(hasMovementX, "Mouse Event should have movementX.");
+ ok(hasMovementY, "Mouse Event should have movementY.");
+ ok(!gotContextMenuEvent, "Shouldn't have got a contextmenu event.");
+ }
+
+ function mouseMoveHandler(e) {
+ info("Got mousemove");
+ document.removeEventListener("mousemove", mouseMoveHandler);
+
+ hasMovementX = "movementX" in e;
+ hasMovementY = "movementY" in e;
+
+ hasExitPointerLock = "exitPointerLock" in document;
+ document.exitPointerLock();
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ pointerLockChangeEventFired = true;
+
+ if (document.pointerLockElement) {
+ info("Got pointerlockchange for entering");
+ pointerLocked = true;
+ pointerLockElement = document.pointerLockElement === div;
+
+ window.addEventListener("contextmenu",
+ function() { gotContextMenuEvent = true; },
+ true);
+ synthesizeMouse(document.body, 4, 4,
+ { type: "contextmenu", button: 2 },
+ window);
+
+ document.addEventListener("mousemove", mouseMoveHandler);
+ synthesizeMouseAtCenter(div, {type: "mousemove"}, window);
+ } else {
+ info("Got pointerlockchange for exiting");
+ pointerUnlocked = true;
+ addFullscreenChangeContinuation("exit", function() {
+ info("Got fullscreenchange for exiting");
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ });
+
+ function start() {
+ div = document.getElementById("div");
+ info("Requesting fullscreen on parent");
+ addFullscreenChangeContinuation("enter", function() {
+ info("Got fullscreenchange for entering");
+ hasRequestPointerLock = "requestPointerLock" in div;
+ div.requestPointerLock();
+ });
+ div.requestFullscreen();
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe.html b/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe.html
new file mode 100644
index 0000000000..f8e34ef64b
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML>
+<html>
+<!--https://bugzilla.mozilla.org/show_bug.cgi?id=1662587-->
+<head>
+<title>Bug 1662587</title>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="pointerlock_utils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+<style>
+#target {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+iframe {
+ width: 400px;
+ height: 300px;
+ border: 1px solid blue;
+}
+</style>
+</head>
+<body>
+<a target="_blank"href="https://bugzilla.mozilla.org/show_bug.cgi?id=1662587">Mozilla Bug 1662587</a>
+<div id="target"></div>
+<iframe src="https://example.com/tests/dom/tests/mochitest/pointerlock/iframe_differentDOM.html"></iframe>
+
+<pre id="test">
+<script type="text/javascript">
+/**
+ * Test for Bug 1662587
+ */
+SimpleTest.waitForExplicitFinish();
+
+async function requestPointerLock(aElement, aExpectError = false) {
+ let doc = aElement.ownerDocument;
+ let waitForPointerLockEvent = function() {
+ return new Promise((aResolve) => {
+ let eventHandler = function(aEvent) {
+ is(aEvent.type, aExpectError ? 'pointerlockerror' : 'pointerlockchange',
+ `got ${aEvent.type}`);
+ doc.removeEventListener('pointerlockchange', eventHandler);
+ doc.removeEventListener('pointerlockerror', eventHandler);
+ aResolve();
+ };
+
+ doc.addEventListener('pointerlockchange', eventHandler);
+ doc.addEventListener('pointerlockerror', eventHandler);
+ });
+ };
+
+ SpecialPowers.wrap(doc).notifyUserGestureActivation();
+ aElement.requestPointerLock();
+ await waitForPointerLockEvent();
+ is(doc.pointerLockElement, aExpectError ? null : aElement, "target pointer locked");
+}
+
+async function exitPointerLock() {
+ if (document.pointerLockElement) {
+ document.exitPointerLock();
+ await new Promise((aResolve) => {
+ document.addEventListener("pointerlockchange", (aEvent) => {
+ ok(true, `got ${aEvent.type}`);
+ aResolve();
+ }, { once: true });
+ });
+ }
+ is(document.pointerLockElement, null, "pointer unlocked");
+}
+
+async function start() {
+ let iframe = document.querySelector("iframe");
+ let target = document.getElementById("target");
+ await requestPointerLock(target);
+
+ // Mouse event should be dispatched to locked element.
+ synthesizeMouse(iframe, 10, 10, { type: "mousemove" });
+ await new Promise((aResolve) => {
+ document.addEventListener("mousemove", function(e) {
+ info("Got mousemove");
+ ok("movementX" in e, "has movementX");
+ ok("movementY" in e, "has movementY");
+ is(e.target, target, "event.target");
+ aResolve();
+ }, { once: true });
+ });
+
+ // Mouse wheel event should be dispatched to locked element.
+ synthesizeWheel(iframe, 10, 10, { deltaY: 3.0, deltaMode: WheelEvent.DOM_DELTA_LINE });
+ await new Promise((aResolve) => {
+ document.addEventListener("wheel", function(e) {
+ info("Got wheel");
+ is(e.target, target, "event.target");
+ aResolve();
+ }, { once: true });
+ });
+
+ // Pointer lock requested in iframe should be rejected.
+ let win = iframe.contentWindow;
+ win.focus()
+ await SpecialPowers.spawn(win, [], async () => {
+ info("request pointer lock in xorigin iframe");
+ content.document.querySelector("input").focus();
+ SpecialPowers.wrap(content.document).notifyUserGestureActivation();
+ content.document.body.requestPointerLock();
+ await new Promise((aResolve) => {
+ let handler = function(aEvent) {
+ is(aEvent.type, 'pointerlockerror', `got ${aEvent.type}`);
+ content.document.onpointerlockchange = null;
+ content.document.onpointerlockerror = null;
+ aResolve();
+ };
+ content.document.onpointerlockchange = handler;
+ content.document.onpointerlockerror = handler;
+ });
+ content.document.exitPointerLock();
+ });
+
+ await exitPointerLock();
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_no_user_gesture.html b/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_no_user_gesture.html
new file mode 100644
index 0000000000..68977ffada
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_no_user_gesture.html
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML>
+<html>
+<!--https://bugzilla.mozilla.org/show_bug.cgi?id=1672330-->
+<head>
+<title>Bug 1672330</title>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script>
+<script src="pointerlock_utils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+<style>
+#target {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+iframe {
+ width: 400px;
+ height: 300px;
+ border: 1px solid blue;
+}
+</style>
+</head>
+<body>
+<a target="_blank"href="https://bugzilla.mozilla.org/show_bug.cgi?id=1672330">Mozilla Bug 1672330</a>
+<div id="target"></div>
+<iframe src="https://example.com/tests/dom/tests/mochitest/pointerlock/iframe_differentDOM.html"></iframe>
+
+<pre id="test">
+<script type="text/javascript">
+/**
+ * Test for Bug 1672330
+ */
+SimpleTest.waitForExplicitFinish();
+
+async function requestPointerLock(aElement, aExpectError = false) {
+ let doc = aElement.ownerDocument;
+ let waitForPointerLockEvent = function() {
+ return new Promise((aResolve) => {
+ let eventHandler = function(aEvent) {
+ is(aEvent.type, aExpectError ? 'pointerlockerror' : 'pointerlockchange',
+ `got ${aEvent.type}`);
+ doc.removeEventListener('pointerlockchange', eventHandler);
+ doc.removeEventListener('pointerlockerror', eventHandler);
+ aResolve();
+ };
+
+ doc.addEventListener('pointerlockchange', eventHandler);
+ doc.addEventListener('pointerlockerror', eventHandler);
+ });
+ };
+
+ aElement.requestPointerLock();
+ await waitForPointerLockEvent();
+ is(doc.pointerLockElement, aExpectError ? null : aElement, "target pointer locked");
+}
+
+async function start() {
+ await waitUntilApzStable();
+
+ let target = document.getElementById("target");
+ SpecialPowers.wrap(document).clearUserGestureActivation();
+ // Pointer lock request should be rejected due to the lack of user gesture.
+ await requestPointerLock(target, true);
+
+ // Test mouse event should not be dispatched to document.
+ document.addEventListener("mousemove", function(e) {
+ ok(false, "Got unexpected mousemove");
+ });
+
+ info("test sending mouse event to iframe");
+ let iframe = document.querySelector("iframe");
+ synthesizeMouse(iframe, 10, 10, { type: "mousemove" });
+ await new Promise(resolve => { SimpleTest.executeSoon(resolve); });
+
+ info("test sending mouse event to another window");
+ await new Promise((aResolve) => {
+ let win = window.open("iframe_differentDOM.html");
+ win.addEventListener("load", async function() {
+ info("win onload");
+ await waitUntilApzStable();
+ synthesizeMouse(win.document.body, 10, 10, { type: "mousemove" }, win);
+ win.close();
+ aResolve();
+ });
+ });
+ await new Promise(resolve => { SimpleTest.executeSoon(resolve); });
+
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_not_focused.html b/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_not_focused.html
new file mode 100644
index 0000000000..a6c0058657
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_pointerlock_xorigin_iframe_not_focused.html
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML>
+<html>
+<!--https://bugzilla.mozilla.org/show_bug.cgi?id=1662587-->
+<head>
+<title>Bug 1662587</title>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="pointerlock_utils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+<style>
+#target {
+ width: 50px;
+ height: 50px;
+ background-color: green;
+}
+iframe {
+ width: 400px;
+ height: 300px;
+ border: 1px solid blue;
+}
+</style>
+</head>
+<body>
+<a target="_blank"href="https://bugzilla.mozilla.org/show_bug.cgi?id=1698611">Mozilla Bug 1698611</a>
+<div id="target"></div>
+<iframe src="https://example.com/tests/dom/tests/mochitest/pointerlock/iframe_differentDOM.html"></iframe>
+
+<pre id="test">
+<script type="text/javascript">
+/**
+ * Test for Bug 1698611
+ */
+SimpleTest.waitForExplicitFinish();
+
+async function requestPointerLock(aWin) {
+ await SpecialPowers.spawn(aWin, [], async () => {
+ info("request pointer lock in xorigin iframe");
+ SpecialPowers.wrap(content.document).notifyUserGestureActivation();
+ content.document.body.requestPointerLock();
+ await new Promise((aResolve) => {
+ let handler = function(aEvent) {
+ is(aEvent.type, 'pointerlockchange', `got ${aEvent.type}`);
+ content.document.onpointerlockchange = null;
+ content.document.onpointerlockerror = null;
+ aResolve();
+ };
+ content.document.onpointerlockchange = handler;
+ content.document.onpointerlockerror = handler;
+ });
+ });
+}
+
+async function exitPointerLock(aWin) {
+ await SpecialPowers.spawn(aWin, [], async () => {
+ info("exit pointer lock in xorigin iframe");
+ if (content.document.pointerLockElement) {
+ content.document.exitPointerLock();
+ await new Promise((aResolve) => {
+ content.document.addEventListener("pointerlockchange", (aEvent) => {
+ ok(true, `got ${aEvent.type}`);
+ aResolve();
+ }, { once: true });
+ });
+ }
+ is(content.document.pointerLockElement, null, "pointer unlocked");
+ });
+}
+
+function addEventListenerOnRemote(aWin, aEvent) {
+ return SpecialPowers.spawn(aWin, [aEvent], async (aEvent) => {
+ info(`wait for ${aEvent} event on remote`);
+ content.document.addEventListener(aEvent, function(e) {
+ info(`get ${aEvent} event on remote`);
+ content.parent.postMessage(aEvent, "*");
+ });
+ });
+}
+
+function waitForMessage(aWin, aMessage) {
+ return new Promise((aResolve) => {
+ info(`wait for ${aMessage} message`);
+ window.addEventListener("message", function handler(e) {
+ info(`get ${e.data} message`);
+ if (e.data === aMessage) {
+ window.removeEventListener("message", handler);
+ aResolve();
+ }
+ });
+ });
+}
+
+async function start() {
+ info("Put the focus on top-level document");
+ await SimpleTest.promiseFocus(window);
+
+ let iframe = document.querySelector("iframe");
+ let win = iframe.contentWindow;
+ await requestPointerLock(win);
+ await addEventListenerOnRemote(win, "mousemove");
+
+ let promise = waitForMessage(win, "mousemove");
+ let div = document.querySelector("div");
+ synthesizeMouseAtCenter(div, { type: "mousemove" });
+ await promise;
+
+ await exitPointerLock(win);
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_pointerlockerror.html b/dom/tests/mochitest/pointerlock/file_pointerlockerror.html
new file mode 100644
index 0000000000..0948a19452
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_pointerlockerror.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
+<head>
+ <title>Bug 633602</title>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+
+ <pre id="test">
+ <script type="text/javascript">
+ /*
+ * Test for Bug 633602
+ * Make sure pointerlockerror event fires.
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ document.addEventListener("pointerlockerror", function (e) {
+ ok(true, "pointerlockerror event should fire.");
+ SimpleTest.finish();
+ });
+
+ function start() {
+ // element not in the DOM, not fullscreen, should fail to lock
+ div = document.createElement("div");
+ div.requestPointerLock();
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_removedFromDOM.html b/dom/tests/mochitest/pointerlock/file_removedFromDOM.html
new file mode 100644
index 0000000000..3e2f9ca866
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_removedFromDOM.html
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+
+ Test DOM tree in full screen
+ -->
+<head>
+<title>Bug 633602 - file_DOMtree.html</title>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript" src="pointerlock_utils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+</a>
+<div id="div"></div>
+<div id="outer"><div id="inner"></div></div>
+<pre id="test">
+<script type="text/javascript">
+/*
+ * Test for Bug 633602
+ * Checks if pointer is unlocked when element is removed from
+ * the DOM Tree
+ */
+
+SimpleTest.waitForExplicitFinish();
+
+var div = document.getElementById("div");
+var outer = document.getElementById("outer");
+var inner = document.getElementById("inner");
+
+function listenOneDocEvent(type, handler) {
+ function callback(event) {
+ document.removeEventListener(type, callback);
+ SimpleTest.executeSoon(() => handler(event));
+ }
+ document.addEventListener(type, callback);
+}
+
+function checkPointerLockElement(elem) {
+ if (elem) {
+ is(document.pointerLockElement, elem,
+ `#${elem.id} should have locked the pointer`);
+ } else {
+ ok(!document.pointerLockElement, "Pointer should have been unlocked");
+ }
+}
+
+function start() {
+ addFullscreenChangeContinuation("enter", enteredFullscreen);
+ document.documentElement.requestFullscreen();
+}
+
+function enteredFullscreen() {
+ is(document.fullscreenElement, document.documentElement,
+ "Root element should have entered fullscreen");
+ listenOneDocEvent("pointerlockchange", lockedPointerOnDiv);
+ div.requestPointerLock();
+}
+
+function lockedPointerOnDiv() {
+ checkPointerLockElement(div);
+ listenOneDocEvent("pointerlockchange", unlockedPointerFromDiv);
+ document.body.removeChild(div);
+}
+
+function unlockedPointerFromDiv() {
+ checkPointerLockElement(null);
+ listenOneDocEvent("pointerlockchange", lockedPointerOnInner);
+ inner.requestPointerLock();
+}
+
+function lockedPointerOnInner() {
+ checkPointerLockElement(inner);
+ listenOneDocEvent("pointerlockchange", unlockedPointerFromInner);
+ document.body.removeChild(outer);
+}
+
+function unlockedPointerFromInner() {
+ checkPointerLockElement(null);
+ addFullscreenChangeContinuation("exit", exitedFullscreen);
+ document.exitFullscreen();
+}
+
+function exitedFullscreen() {
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html b/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html
new file mode 100644
index 0000000000..2cd329bb33
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html
@@ -0,0 +1,212 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - file_retargetMouseEvents.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+
+ <div id="parent">
+ <div id="child" style="width: 100%; height: 100%;">
+ </div>
+ </div>
+
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Retarget mouse events to the locked element
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ function MouseEventStats() {
+ this.mouseMove = false;
+ this.mouseDown = false;
+ this.mouseUp = false;
+ this.mouseClick = false;
+ this.mouseScroll = false;
+ this.wheel = false;
+ }
+
+ var parent = document.getElementById("parent")
+ , child = document.getElementById("child")
+ , parentStats = new MouseEventStats()
+ , childStats = new MouseEventStats()
+ , mouseMoveIntervalID;
+
+ function runTests () {
+ is(childStats.mouseMove, false, "Child shound not receive mousemove event.");
+ is(childStats.mouseDown, false, "Child should not receive mousedown event.");
+ is(childStats.mouseUp, false, "Child should not receive mouseup event.");
+ is(childStats.mouseClick, false, "Child should not receive click event.");
+ is(childStats.mouseScroll, false, "Child should not receive DOMMouseScroll event.");
+ is(childStats.wheel, false, "Child should not receive wheel event.");
+
+ ok(parentStats.mouseMove, "Parent should receive mousemove event.");
+ ok(parentStats.mouseDown, "Parent should receive mousedown event.");
+ ok(parentStats.mouseUp, "Parent should receive mouseup event.");
+ ok(parentStats.mouseClick, "Parent should receive click event.");
+ ok(parentStats.mouseScroll, "Parent should receive DOMMouseScroll event.");
+ ok(parentStats.wheel, "Parent should receive wheel event.");
+ }
+
+
+ /**
+ * The event listeners for the child element shouldn't be fired
+ * Mouse events will only happen when the pointer is locked
+ * and if the pointer is locked all the mouse events should be
+ * retargetted to the locked element
+ **/
+ var childMoveTest = function() {
+ clearInterval(mouseMoveIntervalID);
+ childStats.mouseMove = true;
+ }
+
+ var childDownTest = function() {
+ childStats.mouseDown = true;
+ };
+
+ var childUpTest = function() {
+ childStats.mouseUp = true;
+ };
+
+ var childClickTest = function() {
+ childStats.mouseClick = true;
+ };
+
+ var childScrollTest = function() {
+ childStats.mouseScroll = true;
+ };
+
+ var childWheelTest = function() {
+ childStats.wheel = true;
+ };
+
+ // Event listeners for the parent element
+ var startMouseTests = function() {
+ info("Got parent mousemove");
+ clearInterval(mouseMoveIntervalID);
+ parent.removeEventListener("mousemove", startMouseTests);
+ parent.addEventListener("DOMMouseScroll", parentScrollTest);
+ child.addEventListener("DOMMouseScroll", childScrollTest);
+ SimpleTest.executeSoon(function () {
+ synthesizeWheel(child, 5, 5, {'deltaY': 10, 'lineOrPageDeltaY': 10,
+ 'deltaMode': WheelEvent.DOM_DELTA_LINE});
+ });
+ };
+
+ var parentScrollTest = function (e) {
+ info("Got parent DOMMouseScroll");
+ parentStats.mouseScroll = true;
+ parent.removeEventListener("DOMMouseScroll", parentScrollTest);
+ child.removeEventListener("DOMMouseScroll", childScrollTest);
+ parent.addEventListener("wheel", parentWheelTest);
+ child.addEventListener("wheel", childWheelTest);
+ SimpleTest.executeSoon(function () {
+ synthesizeWheel(child, 5, 5, {'deltaY': 10, 'lineOrPageDeltaY': 10,
+ 'deltaMode': WheelEvent.DOM_DELTA_LINE});
+ });
+ };
+
+ var parentWheelTest = function (e) {
+ info("Got parent wheel");
+ parentStats.wheel = true;
+ parent.removeEventListener("wheel", parentWheelTest);
+ child.removeEventListener("wheel", childWheelTest);
+ parent.addEventListener("mousedown", parentDownTest);
+ child.addEventListener("mousedown", childDownTest);
+ SimpleTest.executeSoon(function () {
+ synthesizeMouseAtCenter(child, {type: "mousedown"}, window);
+ });
+ };
+
+ var parentDownTest = function (e) {
+ info("Got parent mousedown");
+ parentStats.mouseDown = true;
+ parent.removeEventListener("mousedown", parentDownTest);
+ child.removeEventListener("mousedown", childDownTest);
+ parent.addEventListener("mouseup", parentUpTest);
+ child.addEventListener("mouseup", childUpTest);
+ SimpleTest.executeSoon(function () {
+ synthesizeMouseAtCenter(child, {type: "mouseup"}, window);
+ });
+ };
+
+ var parentUpTest = function (e) {
+ info("Got parent mouseup");
+ parentStats.mouseUp = true;
+ parent.removeEventListener("mouseup", parentUpTest);
+ child.removeEventListener("mouseup", childUpTest);
+ parent.addEventListener("click", parentClickTest);
+ child.addEventListener("click", childClickTest);
+ SimpleTest.executeSoon(function () {
+ synthesizeMouseAtCenter(child, {}, window);
+ });
+ };
+
+ var parentClickTest = function (e) {
+ info("Got parent click");
+ parentStats.mouseClick = true;
+ parent.removeEventListener("click", parentClickTest);
+ child.removeEventListener("click", childClickTest);
+ parent.addEventListener("mousemove", parentMoveTest);
+ child.addEventListener("mousemove", childMoveTest);
+ SimpleTest.executeSoon(function () {
+ synthesizeMouseAtCenter(child, {type: "mousemove"}, window);
+ });
+ };
+
+ var parentMoveTest = function (e) {
+ info("Got parent mousemove");
+ parentStats.mouseMove = true;
+ parent.removeEventListener("mousemove", parentMoveTest);
+ child.removeEventListener("mousemove", childMoveTest);
+ SimpleTest.executeSoon(function () {
+ info("Exit fullscreen");
+ addFullscreenChangeContinuation("exit", function() {
+ info("Got fullscreenchange for exiting");
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ });
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === parent) {
+ info("Got pointerlockchange for entering");
+ parent.addEventListener("mousemove", startMouseTests);
+ child.addEventListener("mousemove", childMoveTest);
+ // Bug 1357082
+ // Retrigger synthesizeMouseAtCenter until it actually happens.
+ mouseMoveIntervalID = setInterval(() => {
+ synthesizeMouseAtCenter(parent, {type: "mousemove"}, window);
+ }, 100);
+ } else {
+ info("Got pointerlockchange for exiting");
+ }
+ });
+
+ function start() {
+ info("Requesting fullscreen on parent");
+ addFullscreenChangeContinuation("enter", function() {
+ info("Got fullscreenchange for entering");
+ parent.requestPointerLock();
+ });
+ parent.requestFullscreen();
+ }
+ </script>
+ </pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html
new file mode 100644
index 0000000000..31bd232a57
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - constantXY.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <div id="div"></div>
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Confirm that screenX/Y and clientX/Y are constants when the pointer
+ * is locked.
+ */
+
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.requestFlakyTimeout("We may need to wait for window's moving");
+
+ var div
+ , divRect
+ , unLockedCoords
+ , lockedCoords
+ , mouseMoveIntervalID
+ , isUnlocked = false
+ , isLocked = false;
+
+ function runTests () {
+ ok(isUnlocked, "Pointer should be unlocked");
+ ok(isLocked, "Pointer should be locked");
+
+ // Confirm that pointer coords are constant while locked
+ is(unLockedCoords.clientX, lockedCoords.clientX,
+ "clientX should be equal to where the mouse was originaly locked");
+ is(unLockedCoords.clientY, lockedCoords.clientY,
+ "clientY should be equal to where the mouse was originaly locked");
+ is(unLockedCoords.screenX, lockedCoords.screenX,
+ "screenX should be equal to where the mouse was originaly locked");
+ is(unLockedCoords.screenY, lockedCoords.screenY,
+ "screenY should be equal to where the mouse was originaly locked");
+ }
+
+ function moveUnlocked(e) {
+ info("Got mousemove via moveUnlocked");
+ clearInterval(mouseMoveIntervalID);
+ var firstCall = !unLockedCoords;
+ if (!firstCall) {
+ todo(false, "mousemove is fired twice.");
+ }
+
+ unLockedCoords = {
+ screenX: e.screenX,
+ screenY: e.screenY,
+ clientX: e.clientX,
+ clientY: e.clientY
+ };
+
+ if (!firstCall) {
+ return;
+ }
+
+ isUnlocked = !document.pointerLockElement;
+ div.requestPointerLock();
+ }
+
+ function moveLocked(e) {
+ info("Got mousemove via moveLocked");
+ clearInterval(mouseMoveIntervalID);
+ div.removeEventListener("mousemove", moveLocked);
+
+ isLocked = !!document.pointerLockElement;
+ lockedCoords = {
+ screenX: e.screenX,
+ screenY: e.screenY,
+ clientX: e.clientX,
+ clientY: e.clientY
+ };
+
+ addFullscreenChangeContinuation("exit", function() {
+ info("Got fullscreenchange for exiting");
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === div) {
+ info("Got pointerlockchange for entering");
+ div.removeEventListener("mousemove", moveUnlocked);
+ div.addEventListener("mousemove", moveLocked);
+ divRect = div.getBoundingClientRect();
+ // Bug 1295815
+ // Retrigger synthesizeNativeMouseEvent until it actually happens.
+ mouseMoveIntervalID = setInterval(() => {
+ synthesizeNativeMouseEvent({
+ type: "mousemove",
+ target: div,
+ offsetX: (divRect.width / 4) * 3,
+ offsetY: (divRect.height / 4) * 3,
+ });
+ }, 100);
+ } else {
+ info("Got pointerlockchange for exiting");
+ }
+ });
+
+ function start() {
+ div = document.getElementById("div");
+ info("Requesting fullscreen on parent");
+ addFullscreenChangeContinuation("enter", async () => {
+ info("Got fullscreenchange for entering");
+ await promiseNativeMouseEvent({
+ type: "mousemove",
+ target: div,
+ offsetX: 0,
+ offsetY: 0,
+ });
+ div.addEventListener("mousemove", moveUnlocked);
+ // Bug 1295815
+ // Retrigger synthesizeNativeMouseEvent until it actually happens.
+ mouseMoveIntervalID = setInterval(() => {
+ synthesizeNativeMouseEvent({
+ type: "mousemove",
+ target: div,
+ atCenter: true,
+ });
+ }, 100);
+ });
+ div.requestFullscreen();
+ }
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html b/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html
new file mode 100644
index 0000000000..bc1e1e64a5
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - file_cursorPosEvents.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style type="text/css">
+ #child {
+ width: 100px;
+ height: 100px;
+ background-color:Green;
+ }
+ </style>
+</head>
+<body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602</a>
+
+ <div id="parent">
+ <div id="child"></div>
+ </div>
+
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Test will check to make sure that the following mouse events are no
+ * longer executed in pointer lock.
+ * - mouseover, mouseout, mouseenter, mouseleave
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ function PointerEventStats() {
+ this.mouseEnter = false;
+ this.mouseLeave = false;
+ this.mouseOver = false;
+ this.mouseOut = false;
+ }
+
+ var parent
+ , child
+ , parentStats = new PointerEventStats()
+ , childStats = new PointerEventStats()
+ , isPointerLocked = false;
+
+ function runTests () {
+ ok(isPointerLocked, "expected mouse to be locked, but wasn't.");
+
+ is(childStats.mouseEnter, false,
+ "child's mouseenter should not be firing in Full Screen and Pointer Lock.");
+ is(childStats.mouseOver, false,
+ "child's mouseover should not be firing in Full Screen and Pointer Lock.");
+ is(childStats.mouseLeave, false,
+ "child's mouseleave should not be firing in Full Screen and Pointer Lock.");
+ is(childStats.mouseOut, false,
+ "child's mouseout should not be firing in Full Screen and Pointer Lock.");
+
+ is(parentStats.mouseEnter, false,
+ "parent's mouseenter should not be firing in Full Screen and Pointer Lock.");
+ is(parentStats.mouseOver, false,
+ "parent's mouseover should not be firing in Full Screen and Pointer Lock.");
+ is(parentStats.mouseLeave, false,
+ "parent's mouseleave should not be firing in Full Screen and Pointer Lock.");
+ is(parentStats.mouseOut, false,
+ "parent's mouseout should not be firing in Full Screen and Pointer Lock.");
+ }
+
+ var parentMoveListener = function () {
+ isPointerLocked = !!document.pointerLockElement;
+ removeEventListeners();
+ document.exitPointerLock();
+ };
+
+ var parentOutListener = function (e) {
+ parentStats.mouseOut = true;
+ };
+ var parentLeaveListener = function (e) {
+ parentStats.mouseLeave = true;
+ };
+ var parentOverListener = function (e) {
+ parentStats.mouseOver = true;
+ };
+ var parentEnterListener = function (e) {
+ parentStats.mouseEnter = true;
+ };
+
+ var childOutListener = function (e) {
+ childStats.mouseOut = true;
+ };
+ var childLeaveListener = function (e) {
+ childStats.mouseLeave = true;
+ };
+ var childOverListener = function (e) {
+ childStats.mouseOver = true;
+ };
+ var childEnterListener = function (e) {
+ childStats.mouseEnter = true;
+ };
+
+ function addEventListeners() {
+ parent.addEventListener("mousemove", parentMoveListener);
+
+ parent.addEventListener("mouseout", parentOutListener);
+ parent.addEventListener("mouseleave", parentLeaveListener);
+ parent.addEventListener("mouseover", parentOverListener);
+ parent.addEventListener("mouseenter", parentEnterListener);
+
+ child.addEventListener("mouseout", childOutListener);
+ child.addEventListener("mouseleave", childLeaveListener);
+ child.addEventListener("mouseover", childOverListener);
+ child.addEventListener("mouseenter", childEnterListener);
+ }
+
+ function removeEventListeners() {
+ parent.removeEventListener("mousemove", parentMoveListener);
+
+ parent.removeEventListener("mouseout", parentOutListener);
+ parent.removeEventListener("mouseleave", parentLeaveListener);
+ parent.removeEventListener("mouseover", parentOverListener);
+ parent.removeEventListener("mouseenter", parentEnterListener);
+
+ child.removeEventListener("mouseout", childOutListener);
+ child.removeEventListener("mouseleave", childLeaveListener);
+ child.removeEventListener("mouseover" , childOverListener);
+ child.removeEventListener("mouseenter", childEnterListener);
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === parent) {
+ addEventListeners();
+ synthesizeMouseAtCenter(child, { type: "mousemove" }, window);
+ }
+ else {
+ addFullscreenChangeContinuation("exit", function() {
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ });
+
+ function start() {
+ parent = document.getElementById("parent");
+ child = document.getElementById("child");
+ addFullscreenChangeContinuation("enter", function() {
+ parent.requestPointerLock();
+ });
+ parent.requestFullscreen();
+ }
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html b/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html
new file mode 100644
index 0000000000..4a6b9084bb
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+ -->
+ <head>
+ <title>Bug 633602 - file_targetOutOfFocus.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <p id="display"></p>
+ <div id="content">
+ </div>
+ <div id="div">
+ <input id="input" type="text" />
+ </div>
+ <pre id="test">
+ <script type="application/javascript">
+ /*
+ * Test for Bug 633602
+ * Element doesn't need to have focus to request
+ * pointer lock
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div = document.getElementById("div")
+ , input = document.getElementById("input")
+ , divPointerLock = false;
+
+ function runTests () {
+ ok(divPointerLock, "Pointer should be locked even if " +
+ "the element being locked is not focused");
+ }
+
+ input.addEventListener("focus", function() {
+ div.requestPointerLock();
+ }, { once: true });
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === div) {
+ divPointerLock = true;
+ addFullscreenChangeContinuation("exit", function() {
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ });
+
+ function start() {
+ addFullscreenChangeContinuation("enter", function() {
+ input.focus();
+ });
+ div.requestFullscreen();
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/file_withoutDOM.html b/dom/tests/mochitest/pointerlock/file_withoutDOM.html
new file mode 100644
index 0000000000..c63a72cf9a
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_withoutDOM.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+
+ Test DOM tree in full screen
+ -->
+ <head>
+ <title>Bug 633602 - file_DOMtree.html</title>
+ <script src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" src="pointerlock_utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ </style>
+ </head>
+ <body>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <pre id="test">
+ <script type="text/javascript">
+ /*
+ * Test for Bug 633602
+ * Checks if element is attached to the DOM Tree before locking
+ * the pointer
+ */
+
+ SimpleTest.waitForExplicitFinish();
+
+ var div = document.createElement("div")
+ , withouthDOM = false;
+
+ function runTests () {
+ ok(withouthDOM, "If an element is NOT in the " +
+ "DOM Tree pointer should NOT be locked");
+ }
+
+ document.addEventListener("pointerlockerror", function (e) {
+ withouthDOM = true;
+ runTests();
+ SimpleTest.finish();
+ });
+
+ function start() {
+ div.requestPointerLock();
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/iframe_differentDOM.html b/dom/tests/mochitest/pointerlock/iframe_differentDOM.html
new file mode 100644
index 0000000000..0e3eac19b9
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/iframe_differentDOM.html
@@ -0,0 +1,7 @@
+<html>
+ <head>
+ </head>
+ <body>
+ <div id="div"></div><input>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/mochitest.ini b/dom/tests/mochitest/pointerlock/mochitest.ini
new file mode 100644
index 0000000000..54106104b2
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/mochitest.ini
@@ -0,0 +1,37 @@
+[DEFAULT]
+support-files =
+ pointerlock_utils.js
+ iframe_differentDOM.html
+ !/gfx/layers/apz/test/mochitest/apz_test_utils.js
+
+[test_closewindow-with-pointerlock.html]
+[test_pointerlock_target_not_in_active_document.html]
+[test_pointerlock-api.html]
+tags = fullscreen
+skip-if = (os == 'android') # Bug 1612553
+support-files =
+ file_pointerlock-api.html
+ file_pointerlock-api-with-shadow.html
+ file_pointerlockerror.html
+ file_escapeKey.html
+ file_withoutDOM.html
+ file_removedFromDOM.html
+ file_pointerLockPref.html
+ file_nestedFullScreen.html
+ file_doubleLock.html
+ file_childIframe.html
+ file_movementXY.html
+ file_infiniteMovement.html
+ file_retargetMouseEvents.html
+ file_targetOutOfFocus.html
+ file_screenClientXYConst.html
+ file_suppressSomeMouseEvents.html
+ file_locksvgelement.html
+ file_allowPointerLockSandboxFlag.html
+ file_changeLockElement.html
+[test_pointerlock_focus.html]
+[test_pointerlock_xorigin_iframe.html]
+support-files =
+ file_pointerlock_xorigin_iframe.html
+ file_pointerlock_xorigin_iframe_no_user_gesture.html
+ file_pointerlock_xorigin_iframe_not_focused.html
diff --git a/dom/tests/mochitest/pointerlock/pointerlock_utils.js b/dom/tests/mochitest/pointerlock/pointerlock_utils.js
new file mode 100644
index 0000000000..480f8b3c7d
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/pointerlock_utils.js
@@ -0,0 +1,99 @@
+// Get test filename for page being run in popup so errors are more useful
+var testName = location.pathname.split("/").pop();
+
+// Wrap test functions and pass to parent window
+window.ok = function (a, msg) {
+ opener.ok(a, testName + ": " + msg);
+};
+
+window.is = function (a, b, msg) {
+ opener.is(a, b, testName + ": " + msg);
+};
+
+window.isnot = function (a, b, msg) {
+ opener.isnot(a, b, testName + ": " + msg);
+};
+
+window.todo = function (a, msg) {
+ opener.todo(a, testName + ": " + msg);
+};
+
+window.todo_is = function (a, b, msg) {
+ opener.todo_is(a, b, testName + ": " + msg);
+};
+
+window.todo_isnot = function (a, b, msg) {
+ opener.todo_isnot(a, b, testName + ": " + msg);
+};
+
+window.info = function (msg) {
+ opener.info(testName + ": " + msg);
+};
+
+// Override bits of SimpleTest so test files work stand-alone
+var SimpleTest = SimpleTest || {};
+
+SimpleTest.waitForExplicitFinish = function () {
+ dump("[POINTERLOCK] Starting " + testName + "\n");
+};
+
+SimpleTest.finish = function () {
+ dump("[POINTERLOCK] Finishing " + testName + "\n");
+ opener.nextTest();
+};
+
+// Keep track of how many fullscreenChange enters we've received, so that
+// we can balance them with the number of exits we receive. We reset this
+// to 0 when we load a test.
+var fullscreenChangeEnters = 0;
+
+addLoadEvent(function () {
+ info(`Resetting fullscreen enter count.`);
+ fullscreenChangeEnters = 0;
+ if (typeof start !== "undefined") {
+ // Delay one event loop to stabilize the initial state of the page.
+ SimpleTest.executeSoon(start);
+ }
+});
+
+// Returns true if the window believes it is in fullscreen. This may be true even
+// before an asynchronous fullscreen transition is complete.
+function inFullscreenMode(win) {
+ return win.document.fullscreenElement;
+}
+
+// Adds a listener that will be called once a fullscreen transition
+// is complete. When type==='enter', callback is called when we've
+// received a fullscreenchange event, and the fullscreen transition is
+// complete. When type==='exit', callback is called when we've
+// received a fullscreenchange event and the window is out of
+// fullscreen. inDoc is the document which the listeners are added on,
+// if absent, the listeners are added to the current document.
+function addFullscreenChangeContinuation(type, callback, inDoc) {
+ var doc = inDoc || document;
+ var topWin = doc.defaultView.top;
+ function checkCondition() {
+ if (type == "enter") {
+ fullscreenChangeEnters++;
+ return inFullscreenMode(topWin);
+ } else if (type == "exit") {
+ fullscreenChangeEnters--;
+ return fullscreenChangeEnters
+ ? inFullscreenMode(topWin)
+ : !inFullscreenMode(topWin);
+ } else {
+ throw "'type' must be either 'enter', or 'exit'.";
+ }
+ }
+ function invokeCallback(event) {
+ // Use async call after a paint to workaround unfinished fullscreen
+ // change even when the window size has changed on Linux.
+ requestAnimationFrame(() => setTimeout(() => callback(event), 0), 0);
+ }
+ function onFullscreenChange(event) {
+ doc.removeEventListener("fullscreenchange", onFullscreenChange);
+ ok(checkCondition(), `Should ${type} fullscreen.`);
+ invokeCallback(event);
+ }
+ doc.addEventListener("fullscreenchange", onFullscreenChange);
+}
diff --git a/dom/tests/mochitest/pointerlock/test_closewindow-with-pointerlock.html b/dom/tests/mochitest/pointerlock/test_closewindow-with-pointerlock.html
new file mode 100644
index 0000000000..797228c3e0
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/test_closewindow-with-pointerlock.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 1323983 - Auto-close window after holding pointerlock</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css">
+</head>
+<body style="width: 100vw; height: 100vh; margin: 0;">
+ <script>
+ if (!opener) {
+ SimpleTest.waitForExplicitFinish();
+ }
+
+ var newwin = null;
+ function finish() {
+ newwin.close()
+ setTimeout(function() {
+ SimpleTest.finish();
+ }, 0);
+ }
+
+ addLoadEvent(function() {
+ SimpleTest.waitForFocus(function() {
+ if (!opener) {
+ newwin = window.open(location);
+ } else {
+ document.addEventListener("pointerlockchange", function() {
+ opener.is(document.pointerLockElement, document.body,
+ "Check we have locked the pointer");
+ opener.finish();
+ }, {once: true});
+ document.addEventListener("pointerlockerror", function() {
+ opener.info("Fail to lock pointer");
+ opener.finish();
+ });
+ document.addEventListener("click", function() {
+ opener.info("Clicked");
+ document.body.requestPointerLock();
+ }, {once: true});
+ setTimeout(function() {
+ opener.info("Clicking");
+ synthesizeMouseAtCenter(document.body, {});
+ }, 0);
+ }
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/test_pointerlock-api.html b/dom/tests/mochitest/pointerlock/test_pointerlock-api.html
new file mode 100644
index 0000000000..201fdbcb9c
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/test_pointerlock-api.html
@@ -0,0 +1,113 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+ <head>
+ <title>Test for Bug 633602</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ </head>
+ <body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
+ Mozilla Bug 633602
+ </a>
+ <div id="content">
+ </div>
+ <pre id="test">
+ <script type="application/javascript">
+ const { AppConstants } = SpecialPowers.ChromeUtils.import(
+ "resource://gre/modules/AppConstants.jsm"
+ );
+
+ /**
+ * Pointer Lock tests for bug 633602. These depend on the fullscreen api
+ * which doesn't work when run in the mochitests' iframe, since the
+ * mochitests' iframe doesn't have an allowfullscreen attribute. To get
+ * around this, all tests are run in a child window, which can go fullscreen.
+ * This method is borrowed from dom/html/test/test_fullscreen-api.html.
+ **/
+
+ SimpleTest.waitForExplicitFinish();
+
+ SpecialPowers.pushPrefEnv({"set": [
+ ["full-screen-api.enabled", true],
+ ["full-screen-api.allow-trusted-requests-only", false],
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"]
+ ]}, nextTest);
+
+ // Run the tests which go full-screen in new window, as Mochitests
+ // normally run in an iframe, which by default will not have the
+ // allowfullscreen attribute set, so full-screen won't work.
+ var gTestFiles = [
+ "file_screenClientXYConst.html",
+ "file_childIframe.html",
+ "file_doubleLock.html",
+ "file_escapeKey.html",
+ "file_infiniteMovement.html",
+ "file_locksvgelement.html",
+ "file_movementXY.html",
+ "file_nestedFullScreen.html",
+ "file_pointerlock-api.html",
+ "file_pointerlock-api-with-shadow.html",
+ "file_pointerlockerror.html",
+ "file_pointerLockPref.html",
+ "file_removedFromDOM.html",
+ "file_retargetMouseEvents.html",
+ "file_suppressSomeMouseEvents.html",
+ "file_targetOutOfFocus.html",
+ "file_withoutDOM.html",
+ "file_allowPointerLockSandboxFlag.html",
+ "file_changeLockElement.html",
+ ];
+
+ var gDisableList = [
+ // Bug 1615802
+ { file: "file_screenClientXYConst.html", platform: "macosx" },
+ // Bug 1357082
+ { file: "file_retargetMouseEvents.html", platform: "all" },
+ ];
+
+ var gTestWindow = null;
+ var gTestIndex = 0;
+
+ function nextTest() {
+ if (gTestWindow) {
+ gTestWindow.close();
+ }
+
+ // Try to stabilize the state before running the next test.
+ SimpleTest.waitForFocus(
+ () => requestAnimationFrame(() => setTimeout(runNextTest)));
+ }
+
+ function runNextTest() {
+ if (gTestIndex < gTestFiles.length) {
+ var file = gTestFiles[gTestIndex];
+ gTestIndex++;
+
+ var skipTest = false;
+ for (var item of gDisableList) {
+ if (item.file == file &&
+ ("all" == item.platform || AppConstants.platform == item.platform)) {
+ skipTest = true;
+ break;
+ }
+ }
+ if (!skipTest) {
+ info(`Testing ${file}`);
+ gTestWindow = window.open(file, "", "width=500,height=500");
+ } else {
+ info(`Skip ${file}`);
+ nextTest();
+ }
+ } else {
+ SimpleTest.finish();
+ }
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/test_pointerlock_focus.html b/dom/tests/mochitest/pointerlock/test_pointerlock_focus.html
new file mode 100644
index 0000000000..4b414d3ba6
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/test_pointerlock_focus.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 1646493 - test_pointerlock_focus.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css">
+ <style>
+ #target {
+ width: 50px;
+ height: 50px;
+ background-color: green;
+ }
+
+ iframe {
+ width: 250px;
+ height: 50px;
+ }
+ </style>
+</head>
+<body style="width: 100vw; height: 100vh; margin: 0;">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1646493">Mozilla Bug 1646493</a><br>
+<div id="target"></div>
+<input id="input"><br>
+<iframe id="iframe" src="https://example.com/tests/dom/tests/mochitest/pointerlock/iframe_differentDOM.html"></iframe>
+<script>
+
+function waitForEventOnce(aTarget, aEvent) {
+ return new Promise(aResolve => {
+ aTarget.addEventListener(aEvent, aResolve, { once: true });
+ });
+}
+
+function unexpectedEvent(aEvent) {
+ ok(false, `Unexpected ${aEvent.type} event`);
+}
+
+async function requestPointerLock(aElement) {
+ let doc = aElement.ownerDocument;
+ doc.addEventListener("pointerlockerror", unexpectedEvent);
+
+ SpecialPowers.wrap(doc).notifyUserGestureActivation();
+ aElement.requestPointerLock();
+ await waitForEventOnce(doc, "pointerlockchange");
+
+ is(doc.pointerLockElement, aElement, "target pointer locked");
+ doc.removeEventListener("pointerlockerror", unexpectedEvent);
+}
+
+async function exitPointerLock(aDocument) {
+ if (aDocument.pointerLockElement) {
+ aDocument.exitPointerLock();
+ await waitForEventOnce(aDocument, "pointerlockchange");
+ }
+ is(aDocument.pointerLockElement, null, "pointer unlocked");
+}
+
+let target = document.getElementById("target");
+let input = document.getElementById("input");
+
+add_task(async function init() {
+ await SimpleTest.promiseFocus();
+});
+
+add_task(async function focusMovesIntoXoriginIframe() {
+ let iframe = document.getElementById("iframe");
+
+ input.focus();
+ is(document.activeElement, input, "focus input");
+
+ // Request pointer lock on parent window
+ await requestPointerLock(target);
+
+ // Move focus into child window with different origin
+ let win = iframe.contentWindow;
+ document.addEventListener("pointerlockchange", unexpectedEvent);
+ synthesizeKey("KEY_Tab");
+ await SpecialPowers.spawn(win, [], async () => {
+ if (!content.document.hasFocus()) {
+ await new Promise((resolve) => {
+ content.document.addEventListener('focus', resolve, { once: true });
+ });
+ }
+ });
+ is(document.pointerLockElement, target, "target pointer locked");
+ document.removeEventListener("pointerlockchange", unexpectedEvent);
+
+ // Exit pointer lock
+ await exitPointerLock(document);
+});
+
+add_task(async function focusMovesToAnotherTab() {
+ input.focus();
+ is(document.activeElement, input, "focus input");
+
+ // Request pointer lock on parent window
+ await requestPointerLock(target);
+
+ // Move focus to another tab
+ let promise = waitForEventOnce(document, "pointerlockchange");
+ let win = window.open('iframe_differentDOM.html');
+ await promise;
+ is(document.pointerLockElement, null, "pointer unlocked");
+
+ win.close();
+ await exitPointerLock(document);
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/test_pointerlock_target_not_in_active_document.html b/dom/tests/mochitest/pointerlock/test_pointerlock_target_not_in_active_document.html
new file mode 100644
index 0000000000..8629230b6b
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/test_pointerlock_target_not_in_active_document.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 1646493 - test_pointerlock_target_not_in_active_document.html</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css">
+</head>
+<body style="width: 100vw; height: 100vh; margin: 0;">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1646493">Mozilla Bug 1646493</a><br>
+<iframe></iframe>
+<script>
+if (!opener) {
+ SimpleTest.waitForExplicitFinish();
+}
+
+var newwin = null;
+function finish() {
+ newwin.close()
+ setTimeout(function() {
+ SimpleTest.finish();
+ }, 0);
+}
+
+function testUnfocusedDocument() {
+ opener.document.addEventListener("pointerlockchange", function() {
+ opener.ok(false, "Check we have locked the pointer");
+ opener.document.exitPointerLock();
+ opener.testInactiveTopLevelDocument();
+ }, {once: true});
+
+ opener.document.addEventListener("pointerlockerror", function() {
+ opener.ok(true, "Fail to lock pointer");
+ opener.testInactiveTopLevelDocument();
+ }, {once: true});
+
+ SpecialPowers.wrap(opener.document).notifyUserGestureActivation();
+ opener.document.body.requestPointerLock();
+}
+
+function testInactiveTopLevelDocument() {
+ let iframeWin = newwin.frames[0];
+ let iframeDoc = iframeWin.document;
+
+ iframeDoc.addEventListener("pointerlockchange", function() {
+ ok(false, "Check we have locked the pointer");
+ iframeDoc.exitPointerLock();
+ finish();
+ }, {once: true});
+
+ iframeDoc.addEventListener("pointerlockerror", function() {
+ ok(true, "Fail to lock pointer");
+ finish();
+ }, {once: true});
+
+ SpecialPowers.wrap(iframeDoc).notifyUserGestureActivation();
+
+ newwin.addEventListener("pagehide", function() {
+ iframeDoc.body.requestPointerLock();
+ }, {once: true});
+ newwin.location = "iframe_differentDOM.html";
+}
+
+addLoadEvent(async function() {
+ await SimpleTest.promiseFocus();
+
+ if (!opener) {
+ newwin = window.open(location);
+ return;
+ }
+
+ testUnfocusedDocument();
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/test_pointerlock_xorigin_iframe.html b/dom/tests/mochitest/pointerlock/test_pointerlock_xorigin_iframe.html
new file mode 100644
index 0000000000..fb4f84470e
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/test_pointerlock_xorigin_iframe.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1662587
+-->
+<head>
+<title>Test for Bug 1662587</title>
+<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1662587">Mozilla Bug 1662587</a>
+<div id="content"></div>
+<pre id="test">
+<script type="application/javascript">
+/**
+ * Pointer Lock tests for bug 1662587.
+ **/
+
+SimpleTest.waitForExplicitFinish();
+
+let gTestFiles = [
+ "file_pointerlock_xorigin_iframe.html",
+ "file_pointerlock_xorigin_iframe_no_user_gesture.html",
+ "file_pointerlock_xorigin_iframe_not_focused.html",
+];
+
+let gTestWindow = null;
+let gTestIndex = 0;
+
+SpecialPowers.pushPrefEnv({"set": [
+ // This will make dispatched event going through parent process.
+ ["test.events.async.enabled", true]
+]}, nextTest);
+
+function nextTest() {
+ if (gTestWindow) {
+ gTestWindow.close();
+ }
+ SimpleTest.waitForFocus(runNextTest);
+}
+
+function runNextTest() {
+ if (gTestIndex < gTestFiles.length) {
+ let file = gTestFiles[gTestIndex];
+ gTestIndex++;
+
+ info(`Testing ${file}`);
+ gTestWindow = window.open(file, "", "width=500,height=500");
+ info(`Test finish`);
+ } else {
+ SimpleTest.finish();
+ }
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/script/bug1656248_frame.html b/dom/tests/mochitest/script/bug1656248_frame.html
new file mode 100644
index 0000000000..9030b4cbcf
--- /dev/null
+++ b/dom/tests/mochitest/script/bug1656248_frame.html
@@ -0,0 +1,11 @@
+<html>
+ <head>
+ </head>
+ <body>
+ <script type="text/javascript">
+const script = document.createElement("script");
+script.setAttribute("src", "./subdir/bug1656248_script.js");
+document.body.appendChild(script);
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/script/file_blocked_script.sjs b/dom/tests/mochitest/script/file_blocked_script.sjs
new file mode 100644
index 0000000000..a5b375a23d
--- /dev/null
+++ b/dom/tests/mochitest/script/file_blocked_script.sjs
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+function setGlobalState(data, key) {
+ x = {
+ data,
+ QueryInterface(iid) {
+ return this;
+ },
+ };
+ x.wrappedJSObject = x;
+ setObjectState(key, x);
+}
+
+function getGlobalState(key) {
+ var data;
+ getObjectState(key, function (x) {
+ data = x && x.wrappedJSObject.data;
+ });
+ return data;
+}
+
+function finishBlockedRequest(request, response, query) {
+ response.setStatusLine(request.httpVersion, 200, "OK");
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "application/javascript", false);
+ response.write("scriptLoaded('" + query[1] + "');");
+ response.finish();
+
+ setGlobalState(undefined, query[1]);
+}
+
+function handleRequest(request, response) {
+ var query = request.queryString.split("&");
+ switch (query[0]) {
+ case "blocked":
+ var alreadyUnblocked = getGlobalState(query[1]);
+
+ response.processAsync();
+ if (alreadyUnblocked === true) {
+ // the unblock request came before the blocked request, just go on and finish synchronously
+ finishBlockedRequest(request, response, query);
+ } else {
+ setGlobalState(response, query[1]);
+ }
+ break;
+
+ case "unblock":
+ response.setStatusLine(request.httpVersion, 200, "OK");
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "image/png", false);
+ response.write("\x89PNG"); // just a broken image is enough for our purpose
+
+ var blockedResponse = getGlobalState(query[1]);
+ if (blockedResponse === undefined) {
+ // the unblock request came before the blocked request, remember to not block it
+ setGlobalState(true, query[1]);
+ } else if (typeof blockedResponse == "object") {
+ finishBlockedRequest(request, blockedResponse, query);
+ }
+ break;
+
+ default:
+ response.setStatusLine(request.httpVersion, 400, "Bad request");
+ break;
+ }
+}
diff --git a/dom/tests/mochitest/script/mochitest.ini b/dom/tests/mochitest/script/mochitest.ini
new file mode 100644
index 0000000000..d792777d41
--- /dev/null
+++ b/dom/tests/mochitest/script/mochitest.ini
@@ -0,0 +1,15 @@
+[DEFAULT]
+support-files =
+ file_blocked_script.sjs
+ bug1656248_frame.html
+ subdir/bug1656248_script.js
+ subdir/bug1656248_import.js
+ test_bug1788532_moduleA.mjs
+ test_bug1788532_moduleB.mjs
+ slow.sjs
+
+[test_bug1053321.html]
+[test_whitespace.html]
+[test_bug1656248.html]
+skip-if = verify
+[test_bug1788532.html]
diff --git a/dom/tests/mochitest/script/slow.sjs b/dom/tests/mochitest/script/slow.sjs
new file mode 100644
index 0000000000..7139eb91f3
--- /dev/null
+++ b/dom/tests/mochitest/script/slow.sjs
@@ -0,0 +1,15 @@
+function handleRequest(request, response) {
+ response.processAsync();
+
+ timer = Components.classes["@mozilla.org/timer;1"].createInstance(
+ Components.interfaces.nsITimer
+ );
+ timer.init(
+ function () {
+ response.write("Here the content. But slowly.");
+ response.finish();
+ },
+ 5000,
+ Components.interfaces.nsITimer.TYPE_ONE_SHOT
+ );
+}
diff --git a/dom/tests/mochitest/script/subdir/.eslintrc.js b/dom/tests/mochitest/script/subdir/.eslintrc.js
new file mode 100644
index 0000000000..c85129a731
--- /dev/null
+++ b/dom/tests/mochitest/script/subdir/.eslintrc.js
@@ -0,0 +1,11 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+module.exports = {
+ parserOptions: {
+ sourceType: "module",
+ },
+};
diff --git a/dom/tests/mochitest/script/subdir/bug1656248_import.js b/dom/tests/mochitest/script/subdir/bug1656248_import.js
new file mode 100644
index 0000000000..7a4e8a723a
--- /dev/null
+++ b/dom/tests/mochitest/script/subdir/bug1656248_import.js
@@ -0,0 +1 @@
+export default 42;
diff --git a/dom/tests/mochitest/script/subdir/bug1656248_script.js b/dom/tests/mochitest/script/subdir/bug1656248_script.js
new file mode 100644
index 0000000000..25cd8c241f
--- /dev/null
+++ b/dom/tests/mochitest/script/subdir/bug1656248_script.js
@@ -0,0 +1,18 @@
+// Import a module which should be resolved relative to this script's URL.
+import("./bug1656248_import.js")
+ .then(ns => window.parent.checkResult(ns.default))
+ .catch(e => window.parent.checkResult(`error: ${e}`));
+
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
+// To trigger the bytecode cache, this script needs to be at least 1KB.
diff --git a/dom/tests/mochitest/script/test_bug1053321.html b/dom/tests/mochitest/script/test_bug1053321.html
new file mode 100644
index 0000000000..bad2b4b4c4
--- /dev/null
+++ b/dom/tests/mochitest/script/test_bug1053321.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<!--
+This test confirms we don't block body referred sub-resources by head-referenced defer and async scripts.
+If this test times out, the two image requests, that unblock the two script requests, never happen, hence
+are unexpectedly blocked.
+-->
+
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+ <script>
+ // The two scripts below are expected to load and call scriptLoaded().
+ SimpleTest.waitForExplicitFinish();
+
+ window.expected_scripts = {
+ "defer": true,
+ "async": true,
+ };
+
+ function scriptLoaded(script)
+ {
+ ok(true, 'Script ' + script + ' executed');
+ delete window.expected_scripts[script];
+
+ let expecting = Object.keys(window.expected_scripts).length;
+ info("Expecting " + expecting + " more script(s) to execute");
+
+ if (expecting == 0) {
+ SimpleTest.finish();
+ }
+ }
+ </script>
+
+ <!-- this script is not loaded until file_blocked_script.sjs?unblock&defer request is made,
+ when this script is executed, it calls SimpleTest.finish().
+ -->
+ <script defer src="file_blocked_script.sjs?blocked&defer"></script>
+
+ <!-- this script is not loaded until file_blocked_script.sjs?unblock&async request is made,
+ when this script is executed, it calls SimpleTest.finish().
+ -->
+ <script async src="file_blocked_script.sjs?blocked&async"></script>
+</head>
+
+<body>
+ <img src="file_blocked_script.sjs?unblock&defer"/>
+ <img src="file_blocked_script.sjs?unblock&async"/>
+</body>
diff --git a/dom/tests/mochitest/script/test_bug1656248.html b/dom/tests/mochitest/script/test_bug1656248.html
new file mode 100644
index 0000000000..3b12fdaf80
--- /dev/null
+++ b/dom/tests/mochitest/script/test_bug1656248.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<!--
+Repeated reload an iframe. When iframe's script is loaded from the bytecode
+cache, dynamic module import should still resolve modules based on the
+script's URL.
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+ <script>
+ const iframeId = "test_iframe";
+
+ var checkResult = null;
+
+ async function startTest() {
+ SimpleTest.waitForExplicitFinish();
+
+ // Setting dom.expose_test_interfaces pref causes the
+ // nsScriptLoadRequest to fire event on script tags, with information
+ // about its internal state. The ScriptLoader source send events to
+ // trace these and resolve a promise with the path taken by the
+ // script loader.
+ //
+ // Setting dom.script_loader.bytecode_cache.strategy to -1 causes the
+ // nsScriptLoadRequest to force all the conditions necessary to make a
+ // script be saved as bytecode in the alternate data storage provided
+ // by the channel (necko cache).
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ['dom.script_loader.bytecode_cache.enabled', true],
+ ['dom.expose_test_interfaces', true],
+ ["dom.script_loader.bytecode_cache.strategy", -1]
+ ]});
+
+ for (let i = 0; i < 3; i++) {
+ let iframe = document.getElementById(iframeId);
+ if (iframe) {
+ document.body.removeChild(iframe);
+ }
+
+ iframe = document.createElement("iframe");
+ document.body.appendChild(iframe);
+ iframe.id = iframeId;
+
+ let iwin = iframe.contentWindow;
+
+ let eventPromise = new Promise(resolve => {
+ // Both regular script and imported module scripts are encoded/decoded
+ // Wait for 2 encode/load events to be fired.
+ let count = 0;
+ if (i == 0) {
+ iwin.addEventListener("scriptloader_bytecode_saved", event => {
+ count++;
+ ok(true, "Bytecode encoding succeeded");
+ if (count == 2) {
+ resolve();
+ }
+ });
+ } else {
+ iwin.addEventListener("scriptloader_load_bytecode", event => {
+ count++;
+ ok(true, "Script loaded from bytecode");
+ if (count == 2) {
+ resolve();
+ }
+ });
+ }
+
+ iwin.addEventListener("scriptloader_bytecode_failed", () => {
+ ok(false, "Bytecode encoding failed");
+ SimpleTest.finish();
+ });
+ });
+
+ let resultPromise = new Promise(resolve => {
+ checkResult = resolve;
+ });
+
+ iframe.src = "bug1656248_frame.html";
+
+ let [_, result] = await Promise.all([eventPromise, resultPromise]);
+
+ is(result, 42, `Module was loaded successfully (${i})`);
+ }
+
+ SimpleTest.finish();
+ }
+ </script>
+</head>
+
+<body onload="startTest()"></body>
diff --git a/dom/tests/mochitest/script/test_bug1788532.html b/dom/tests/mochitest/script/test_bug1788532.html
new file mode 100644
index 0000000000..8465c3a1fc
--- /dev/null
+++ b/dom/tests/mochitest/script/test_bug1788532.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<!--
+Test interaction of dynamic module loading and synchronous XHR.
+
+Load a module A that starts a dynamic import of module B which imports A, then
+run a sync XHR at top level. The dynamic import should complete successfully
+after the XHR has finished loading.
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+ <script>
+ SimpleTest.waitForExplicitFinish();
+ </script>
+
+ <script type="module" src="./test_bug1788532_moduleA.mjs"></script>
+</head>
+
+</html>
diff --git a/dom/tests/mochitest/script/test_bug1788532_moduleA.mjs b/dom/tests/mochitest/script/test_bug1788532_moduleA.mjs
new file mode 100644
index 0000000000..d667aac482
--- /dev/null
+++ b/dom/tests/mochitest/script/test_bug1788532_moduleA.mjs
@@ -0,0 +1,15 @@
+let xhrFinished = false;
+
+import("./test_bug1788532_moduleB.mjs")
+ .then(() => {
+ ok(xhrFinished, "Loaded after XHR finished");
+ SimpleTest.finish();
+ })
+ .catch(e => {
+ ok(false, "Caught exception: " + e);
+ });
+
+let request = new XMLHttpRequest();
+request.open("GET", "./slow.sjs", false);
+request.send(null);
+xhrFinished = true;
diff --git a/dom/tests/mochitest/script/test_bug1788532_moduleB.mjs b/dom/tests/mochitest/script/test_bug1788532_moduleB.mjs
new file mode 100644
index 0000000000..71e2e7009b
--- /dev/null
+++ b/dom/tests/mochitest/script/test_bug1788532_moduleB.mjs
@@ -0,0 +1,2 @@
+/* eslint-disable-next-line import/no-unassigned-import */
+import "./test_bug1788532_moduleA.mjs";
diff --git a/dom/tests/mochitest/script/test_whitespace.html b/dom/tests/mochitest/script/test_whitespace.html
new file mode 100644
index 0000000000..7ab14d9b67
--- /dev/null
+++ b/dom/tests/mochitest/script/test_whitespace.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for ScriptLoader and type with whitespaces</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="application/javascript">
+let passed = false;
+
+let tests = [
+ " application/javascript",
+ "\tapplication/javascript\n\r \t",
+];
+
+for (let i = 0; i < tests.length; ++i) {
+ passed = false;
+
+ let script = document.createElement('script');
+ script.setAttribute('type', tests[i]);
+ script.innerText = "passed = true;";
+ document.body.appendChild(script);
+
+ ok (passed, "Test " + tests[i] + " passed");
+}
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/chrome.ini b/dom/tests/mochitest/sessionstorage/chrome.ini
new file mode 100644
index 0000000000..65112f0f82
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/chrome.ini
@@ -0,0 +1,3 @@
+[DEFAULT]
+
+[test_sessionStorageFromChrome.xhtml]
diff --git a/dom/tests/mochitest/sessionstorage/file_http.html b/dom/tests/mochitest/sessionstorage/file_http.html
new file mode 100644
index 0000000000..7825f60c51
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/file_http.html
@@ -0,0 +1,40 @@
+<html>
+<head>
+<script>
+
+window.addEventListener("message", onMessageReceived);
+
+function postMsg(msg)
+{
+ parent.postMessage(msg, "http://mochi.test:8888");
+}
+
+function onMessageReceived(event)
+{
+ if (event.data == "check") {
+ postMsg(sessionStorage.getItem("foo"));
+
+ var gotValue = "threw";
+ try {
+ gotValue = sessionStorage.getItem("foo-https");
+ } catch (e) {
+ }
+
+ postMsg(gotValue);
+
+ postMsg("the end");
+ }
+}
+
+function start()
+{
+ sessionStorage.setItem("foo", "insecure");
+ postMsg(sessionStorage.getItem("foo"));
+}
+
+</script>
+</head>
+<body onload="start();">
+insecure
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/file_https.html b/dom/tests/mochitest/sessionstorage/file_https.html
new file mode 100644
index 0000000000..915c54950e
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/file_https.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+<script>
+function start()
+{
+ sessionStorage.setItem("foo-https", "secure");
+ parent.postMessage(sessionStorage.getItem("foo-https"),
+ "http://mochi.test:8888");
+}
+</script>
+</head>
+<body onload="start();">
+secure
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/frameEqual.html b/dom/tests/mochitest/sessionstorage/frameEqual.html
new file mode 100644
index 0000000000..787f3ee3eb
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/frameEqual.html
@@ -0,0 +1,47 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for sessionStorage test</title>
+
+<script type="text/javascript" src="interOriginSlave.js"></script>
+<script type="text/javascript">
+
+var currentStep = 2;
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 2:
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the slave");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the slave");
+ is(sessionStorage.length, 2, "Num of items is 2");
+
+ sessionStorage.setItem("C", "3");
+ is(sessionStorage.getItem("C"), "3", "C is 3 in the slave");
+ is(sessionStorage.length, 3, "Num of items is 3");
+ break;
+
+ case 4:
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the slave");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the slave");
+ is(sessionStorage.getItem("C"), "3", "C is 3 in the slave");
+ is(sessionStorage.length, 3, "Num of items is 3");
+ break;
+
+ case 6:
+ return finishTest();
+ }
+
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/frameNotEqual.html b/dom/tests/mochitest/sessionstorage/frameNotEqual.html
new file mode 100644
index 0000000000..bdda1baf70
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/frameNotEqual.html
@@ -0,0 +1,49 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for sessionStorage test</title>
+
+<script type="text/javascript" src="interOriginSlave.js"></script>
+<script type="text/javascript">
+
+var aps = document.location.hash.includes("aps");
+var xorigin = document.location.hash.includes("xorigin");
+var sameOrigin = document.location.origin === "http://mochi.test:8888";
+
+var currentStep = 2;
+
+function doStep()
+{
+ var expect = (!xorigin && aps && sameOrigin) ? 2 : 0;
+ switch (currentStep)
+ {
+ case 2:
+ is(sessionStorage.length, expect, `Num of items is ${expect}`);
+
+ sessionStorage.setItem("C", "3");
+
+ is(sessionStorage.getItem("C"), "3", "C is 3 in the slave");
+ is(sessionStorage.length, expect + 1, `Num of items is ${expect + 1}`);
+ break;
+
+ case 4:
+ is(sessionStorage.getItem("C"), "3", "C is 3 in the slave");
+ is(sessionStorage.length, expect + 1, `Num of items is ${expect + 1}`);
+ break;
+
+ case 6:
+ return finishTest();
+ }
+
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/frameReplace.html b/dom/tests/mochitest/sessionstorage/frameReplace.html
new file mode 100644
index 0000000000..bf5579c718
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/frameReplace.html
@@ -0,0 +1,75 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage replace frame</title>
+
+<script type="text/javascript">
+
+var shell;
+
+function ok(a, message)
+{
+ if (!a)
+ shell.postMessage("FAILURE: " + message, "http://mochi.test:8888");
+ else
+ shell.postMessage(message, "http://mochi.test:8888");
+}
+
+function is(a, b, message)
+{
+ if (a != b)
+ shell.postMessage("FAILURE: " + message + ", expected "+b+" got "+a, "http://mochi.test:8888");
+ else
+ shell.postMessage(message + ", expected "+b+" got "+a, "http://mochi.test:8888");
+}
+
+function doTest()
+{
+ var query = location.search.substring(1);
+ var queries = query.split("&");
+
+ var action = queries[0];
+ shell = queries[1];
+ switch (shell)
+ {
+ case "frame":
+ shell = parent;
+ break;
+ case "window":
+ shell = opener;
+ break;
+ }
+
+ switch (action)
+ {
+ case "init":
+ sessionStorage.setItem("A", "1");
+ sessionStorage.setItem("B", "2");
+ sessionStorage.setItem("C", "3");
+ is(sessionStorage.getItem("A"), "1", "'A' is '1'");
+ is(sessionStorage.getItem("B"), "2", "'A' is '2'");
+ is(sessionStorage.getItem("C"), "3", "'A' is '3'");
+ break;
+
+ case "check":
+ is(sessionStorage.getItem("A"), null, "'A' is null");
+ is(sessionStorage.getItem("B"), null, "'A' is null");
+ is(sessionStorage.getItem("C"), null, "'A' is null");
+ break;
+
+ case "clean":
+ is(sessionStorage.getItem("A"), "1", "'A' is '1'");
+ is(sessionStorage.getItem("B"), "2", "'A' is '2'");
+ is(sessionStorage.getItem("C"), "3", "'A' is '3'");
+ sessionStorage.clear();
+ break;
+ }
+
+ shell.postMessage(action + "_done", "http://mochi.test:8888");
+}
+
+</script>
+
+</head>
+<body onload="doTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/interOriginSlave.js b/dom/tests/mochitest/sessionstorage/interOriginSlave.js
new file mode 100644
index 0000000000..c4d4231542
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/interOriginSlave.js
@@ -0,0 +1,40 @@
+function postMsg(message) {
+ opener.postMessage(message, "http://mochi.test:8888");
+}
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event) {
+ //alert("slave got event: "+event.data);
+ if (event.data == "step") {
+ if (doStep()) {
+ postMsg("perf");
+ }
+
+ return;
+ }
+
+ postMsg("Invalid message");
+}
+
+function ok(a, message) {
+ if (!a) {
+ postMsg("FAILURE: " + message);
+ } else {
+ postMsg(message);
+ }
+}
+
+function is(a, b, message) {
+ if (a != b) {
+ postMsg("FAILURE: " + message + ", expected " + b + " got " + a);
+ } else {
+ postMsg(message + ", expected " + b + " got " + a);
+ }
+}
+
+function finishTest() {
+ sessionStorage.clear();
+ postMsg("done");
+ return false;
+}
diff --git a/dom/tests/mochitest/sessionstorage/interOriginTest.js b/dom/tests/mochitest/sessionstorage/interOriginTest.js
new file mode 100644
index 0000000000..4d2654e5dc
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/interOriginTest.js
@@ -0,0 +1,43 @@
+var slaveLoadsPending = 1;
+
+var slaveOrigin = "";
+var slave = null;
+
+var failureRegExp = new RegExp("^FAILURE");
+const slavePath = "/tests/dom/tests/mochitest/sessionstorage/";
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event) {
+ //alert("master got event: "+event.data);
+ switch (event.data) {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--slaveLoadsPending) {
+ break;
+ }
+
+ // Indication of successfully finished step of a test
+ // Just fall through...
+ case "perf":
+ // We called doStep before the frame was load
+ if (event.data == "perf") {
+ doStep();
+ }
+
+ slave.postMessage("step", slaveOrigin);
+ break;
+
+ // Indication of all test parts finish (from any of the frames)
+ case "done":
+ sessionStorage.clear();
+ slaveLoadsPending = 1;
+ doNextTest();
+ break;
+
+ // Any other message indicates error or succes message of a test
+ default:
+ SimpleTest.ok(!event.data.match(failureRegExp), event.data);
+ break;
+ }
+}
diff --git a/dom/tests/mochitest/sessionstorage/mochitest.ini b/dom/tests/mochitest/sessionstorage/mochitest.ini
new file mode 100644
index 0000000000..eff4562bb2
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/mochitest.ini
@@ -0,0 +1,28 @@
+[DEFAULT]
+support-files =
+ file_http.html
+ file_https.html
+ frameEqual.html
+ frameNotEqual.html
+ frameReplace.html
+ interOriginSlave.js
+ interOriginTest.js
+
+[test_sessionStorageBase.html]
+[test_sessionStorageBaseSessionOnly.html]
+[test_sessionStorageClone.html]
+skip-if =
+ http3
+[test_sessionStorageClone_alwaysPartitioned.html]
+skip-if =
+ http3
+[test_sessionStorageClone_alwaysPartitioned_exempted.html]
+skip-if =
+ http3
+[test_sessionStorageHttpHttps.html]
+skip-if =
+ http3
+[test_sessionStorageReplace.html]
+skip-if =
+ http3
+[test_sessionStorageUsage.html]
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageBase.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageBase.html
new file mode 100644
index 0000000000..e7538127fe
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageBase.html
@@ -0,0 +1,180 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage basic test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var expectedEvents = [
+ "empty,null,",
+ "empty,,null",
+ "key1,null,value1",
+ "key1,value1,null",
+ "key1,null,value1",
+ "key2,null,value2",
+ "key2,value2,value2-2",
+ "key1,value1,value1-2",
+ "key2,value2-2,null",
+ "null,null,null"
+];
+
+function setup() {
+ sessionStorage.clear();
+ SimpleTest.executeSoon(startTest);
+}
+
+function startTest()
+{
+ // Initially check the sessionStorage is empty
+ is(sessionStorage.length, 0, "The storage is empty [1]");
+ is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
+ is(sessionStorage.nonexisting, undefined, "Nonexisting item is undefined (array access)");
+ is(sessionStorage.nonexisting, undefined, "Nonexisting item is undefined (property access)");
+ sessionStorage.removeItem("nonexisting"); // Just check there is no exception
+
+ is(typeof sessionStorage.getItem("nonexisting"), "object", "getItem('nonexisting') is object");
+ is(typeof sessionStorage.nonexisting, "undefined", "['nonexisting'] is undefined");
+ is(typeof sessionStorage.nonexisting, "undefined", "nonexisting is undefined");
+ is(typeof sessionStorage.getItem("nonexisting2"), "object", "getItem('nonexisting2') is object");
+ is(typeof sessionStorage.nonexisting2, "undefined", "['nonexisting2'] is undefined");
+ is(typeof sessionStorage.nonexisting2, "undefined", "nonexisting2 is undefined");
+
+ var sessionStorageCopy = sessionStorage;
+
+ function onStorageChanged(e) {
+ if (e.storageArea == sessionStorageCopy) {
+ ok(expectedEvents.length, "Not more then expected events encountered");
+ var receivedEvent = e.key + "," + e.oldValue + "," + e.newValue;
+ is(receivedEvent, expectedEvents.shift(), "Expected event data: " + receivedEvent);
+ }
+ }
+
+ // Listen for MozSessionStorageChanged
+ SpecialPowers.addChromeEventListener("MozSessionStorageChanged", onStorageChanged, true);
+
+ // add an empty-value key
+ sessionStorage.setItem("empty", "");
+ is(sessionStorage.getItem("empty"), "", "Empty value (getItem())");
+ is(sessionStorage.empty, "", "Empty value (array access)");
+ is(sessionStorage.empty, "", "Empty value (property access)");
+ is(typeof sessionStorage.getItem("empty"), "string", "getItem('empty') is string");
+ is(typeof sessionStorage.empty, "string", "['empty'] is string");
+ is(typeof sessionStorage.empty, "string", "empty is string");
+ sessionStorage.removeItem("empty");
+ is(sessionStorage.length, 0, "The storage has no keys");
+ is(sessionStorage.getItem("empty"), null, "empty item is null (getItem())");
+ is(sessionStorage.empty, undefined, "empty item is undefined (array access)");
+ is(sessionStorage.empty, undefined, "empty item is undefined (property access)");
+ is(typeof sessionStorage.getItem("empty"), "object", "getItem('empty') is object");
+ is(typeof sessionStorage.empty, "undefined", "['empty'] is undefined");
+ is(typeof sessionStorage.empty, "undefined", "empty is undefined");
+
+ // add one key, check it is there
+ sessionStorage.setItem("key1", "value1");
+ is(sessionStorage.length, 1, "The storage has one key-value pair");
+ is(sessionStorage.key(0), "key1");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+
+ // check all access method give the correct result
+ // and are of the correct type
+ is(sessionStorage.getItem("key1"), "value1", "getItem('key1') == value1");
+ is(sessionStorage.key1, "value1", "['key1'] == value1");
+ is(sessionStorage.key1, "value1", "key1 == value1");
+
+ is(typeof sessionStorage.getItem("key1"), "string", "getItem('key1') is string");
+ is(typeof sessionStorage.key1, "string", "['key1'] is string");
+ is(typeof sessionStorage.key1, "string", "key1 is string");
+
+ // remove the previously added key and check the storage is empty
+ sessionStorage.removeItem("key1");
+ is(sessionStorage.length, 0, "The storage is empty [2]");
+ is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), null, "\'key1\' removed");
+
+ is(typeof sessionStorage.getItem("key1"), "object", "getItem('key1') is object");
+ is(typeof sessionStorage.key1, "undefined", "['key1'] is undefined");
+ is(typeof sessionStorage.key1, "undefined", "key1 is undefined");
+
+ // add one key, check it is there
+ sessionStorage.setItem("key1", "value1");
+ is(sessionStorage.length, 1, "The storage has one key-value pair");
+ is(sessionStorage.key(0), "key1");
+ is(sessionStorage.getItem("key1"), "value1");
+
+ // add a second key
+ sessionStorage.setItem("key2", "value2");
+ is(sessionStorage.length, 2, "The storage has two key-value pairs");
+ is(sessionStorage.getItem("key1"), "value1");
+ is(sessionStorage.getItem("key2"), "value2");
+ var firstKey = sessionStorage.key(0);
+ var secondKey = sessionStorage.key(1);
+ ok((firstKey == 'key1' && secondKey == 'key2') ||
+ (firstKey == 'key2' && secondKey == 'key1'),
+ 'key() API works.');
+
+ // change the second key
+ sessionStorage.setItem("key2", "value2-2");
+ is(sessionStorage.length, 2, "The storage has two key-value pairs");
+ is(sessionStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(sessionStorage.key(1), secondKey);
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), "value1");
+ is(sessionStorage.getItem("key2"), "value2-2");
+
+ // change the first key
+ sessionStorage.setItem("key1", "value1-2");
+ is(sessionStorage.length, 2, "The storage has two key-value pairs");
+ is(sessionStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(sessionStorage.key(1), secondKey);
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), "value1-2");
+ is(sessionStorage.getItem("key2"), "value2-2");
+
+ // remove the second key
+ sessionStorage.removeItem("key2");
+ is(sessionStorage.length, 1, "The storage has one key-value pair");
+ is(sessionStorage.key(0), "key1");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), "value1-2");
+
+ // Clear the storage
+ sessionStorage.clear();
+ is(sessionStorage.length, 0, "The storage is empty [3]");
+ is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("nonexisting"), null, "Nonexisting item is null");
+ is(sessionStorage.getItem("key1"), null, "key1 removed");
+ is(sessionStorage.getItem("key2"), null, "key2 removed");
+ sessionStorage.removeItem("nonexisting"); // Just check there is no exception
+ sessionStorage.removeItem("key1"); // Just check there is no exception
+ sessionStorage.removeItem("key2"); // Just check there is no exception
+
+ SimpleTest.executeSoon(function () {
+ SpecialPowers.removeChromeEventListener("MozSessionStorageChanged", onStorageChanged, true);
+ is(expectedEvents.length, 0, "received the correct number of events");
+
+ sessionStorage.clear();
+ SimpleTest.finish();
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="setup();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageBaseSessionOnly.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageBaseSessionOnly.html
new file mode 100644
index 0000000000..34169decc4
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageBaseSessionOnly.html
@@ -0,0 +1,231 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage basic test, while in sesison only mode</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var testframe;
+function iframeOnload(aValue) {
+ switch (aValue) {
+ case 1:
+ testframe.onload = test1;
+ break;
+ case 2:
+ testframe.onload = test2;
+ break;
+ default:
+ of(false, 'should not be reached');
+ SimpleTest.finish();
+ return;
+ }
+ /* After every permission change, an iframe has to be reloaded,
+ otherwise this test causes failures in b2g (oop) mochitest, because
+ the permission changes don't seem to be always picked up
+ by the code that excercises it */
+ testframe.contentWindow.location.reload();
+}
+
+function startTest() {
+ testframe = document.getElementById('testframe');
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, 'context': document}], function() { iframeOnload(1); });
+}
+
+function test1() {
+
+ // Initially check the sessionStorage is empty
+ is(sessionStorage.length, 0, "The storage is empty [1]");
+ is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
+ is(sessionStorage.nonexisting, undefined, "Nonexisting item is undefined (array access)");
+ is(sessionStorage.nonexisting, undefined, "Nonexisting item is undefined (property access)");
+ sessionStorage.removeItem("nonexisting"); // Just check there is no exception
+
+ is(typeof sessionStorage.getItem("nonexisting"), "object", "getItem('nonexisting') is object");
+ is(typeof sessionStorage.nonexisting, "undefined", "['nonexisting'] is undefined");
+ is(typeof sessionStorage.nonexisting, "undefined", "nonexisting is undefined");
+ is(typeof sessionStorage.getItem("nonexisting2"), "object", "getItem('nonexisting2') is object");
+ is(typeof sessionStorage.nonexisting2, "undefined", "['nonexisting2'] is undefined");
+ is(typeof sessionStorage.nonexisting2, "undefined", "nonexisting2 is undefined");
+
+ // add an empty-value key
+ sessionStorage.setItem("empty", "");
+ is(sessionStorage.getItem("empty"), "", "Empty value (getItem())");
+ is(sessionStorage.empty, "", "Empty value (array access)");
+ is(sessionStorage.empty, "", "Empty value (property access)");
+ is(typeof sessionStorage.getItem("empty"), "string", "getItem('empty') is string");
+ is(typeof sessionStorage.empty, "string", "['empty'] is string");
+ is(typeof sessionStorage.empty, "string", "empty is string");
+ sessionStorage.removeItem("empty");
+ is(sessionStorage.length, 0, "The storage has no keys");
+ is(sessionStorage.getItem("empty"), null, "empty item is null (getItem())");
+ is(sessionStorage.empty, undefined, "empty item is undefined (array access)");
+ is(sessionStorage.empty, undefined, "empty item is undefined (property access)");
+ is(typeof sessionStorage.getItem("empty"), "object", "getItem('empty') is object");
+ is(typeof sessionStorage.empty, "undefined", "['empty'] is undefined");
+ is(typeof sessionStorage.empty, "undefined", "empty is undefined");
+
+ // add one key, check it is there
+ sessionStorage.setItem("key1", "value1");
+ is(sessionStorage.length, 1, "The storage has one key-value pair");
+ is(sessionStorage.key(0), "key1");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+
+ // check all access method give the correct result
+ // and are of the correct type
+ is(sessionStorage.getItem("key1"), "value1", "getItem('key1') == value1");
+ is(sessionStorage.key1, "value1", "['key1'] == value1");
+ is(sessionStorage.key1, "value1", "key1 == value1");
+
+ is(typeof sessionStorage.getItem("key1"), "string", "getItem('key1') is string");
+ is(typeof sessionStorage.key1, "string", "['key1'] is string");
+ is(typeof sessionStorage.key1, "string", "key1 is string");
+
+ // remove the previously added key and check the storage is empty
+ sessionStorage.removeItem("key1");
+ is(sessionStorage.length, 0, "The storage is empty [2]");
+ is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), null, "\'key1\' removed");
+
+ is(typeof sessionStorage.getItem("key1"), "object", "getItem('key1') is object");
+ is(typeof sessionStorage.key1, "undefined", "['key1'] is undefined");
+ is(typeof sessionStorage.key1, "undefined", "key1 is undefined");
+
+ // add one key, check it is there
+ sessionStorage.setItem("key1", "value1");
+ is(sessionStorage.length, 1, "The storage has one key-value pair");
+ is(sessionStorage.key(0), "key1");
+ is(sessionStorage.getItem("key1"), "value1");
+
+ // add a second key
+ sessionStorage.setItem("key2", "value2");
+ is(sessionStorage.length, 2, "The storage has two key-value pairs");
+ is(sessionStorage.getItem("key1"), "value1");
+ is(sessionStorage.getItem("key2"), "value2");
+ var firstKey = sessionStorage.key(0);
+ var secondKey = sessionStorage.key(1);
+ ok((firstKey == 'key1' && secondKey == 'key2') ||
+ (firstKey == 'key2' && secondKey == 'key1'),
+ 'key() API works.');
+
+ // change the second key
+ sessionStorage.setItem("key2", "value2-2");
+ is(sessionStorage.length, 2, "The storage has two key-value pairs");
+ is(sessionStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(sessionStorage.key(1), secondKey);
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), "value1");
+ is(sessionStorage.getItem("key2"), "value2-2");
+
+ // change the first key
+ sessionStorage.setItem("key1", "value1-2");
+ is(sessionStorage.length, 2, "The storage has two key-value pairs");
+ is(sessionStorage.key(0), firstKey); // After key value changes the order must be preserved
+ is(sessionStorage.key(1), secondKey);
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(2), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), "value1-2");
+ is(sessionStorage.getItem("key2"), "value2-2");
+
+ // remove the second key
+ sessionStorage.removeItem("key2");
+ is(sessionStorage.length, 1, "The storage has one key-value pair");
+ is(sessionStorage.key(0), "key1");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("key1"), "value1-2");
+
+ // JS property test
+ sessionStorage.testA = "valueA";
+ is(sessionStorage.testA, "valueA");
+ is(sessionStorage.testA, "valueA");
+ is(sessionStorage.getItem("testA"), "valueA");
+
+ sessionStorage.testA = "valueA2";
+ is(sessionStorage.testA, "valueA2");
+ is(sessionStorage.testA, "valueA2");
+ is(sessionStorage.getItem("testA"), "valueA2");
+
+ sessionStorage.testB = "valueB";
+ is(sessionStorage.testB, "valueB");
+ is(sessionStorage.testB, "valueB");
+ is(sessionStorage.getItem("testB"), "valueB");
+
+ sessionStorage.testB = "valueB2";
+ is(sessionStorage.testB, "valueB2");
+ is(sessionStorage.testB, "valueB2");
+ is(sessionStorage.getItem("testB"), "valueB2");
+
+ sessionStorage.setItem("testC", "valueC");
+ is(sessionStorage.testC, "valueC");
+ is(sessionStorage.testC, "valueC");
+ is(sessionStorage.getItem("testC"), "valueC");
+
+ sessionStorage.setItem("testC", "valueC2");
+ is(sessionStorage.testC, "valueC2");
+ is(sessionStorage.testC, "valueC2");
+ is(sessionStorage.getItem("testC"), "valueC2");
+
+ sessionStorage.setItem("testC", null);
+ is("testC" in sessionStorage, true);
+ is(sessionStorage.getItem("testC"), "null");
+ is(sessionStorage.testC, "null");
+ is(sessionStorage.testC, "null");
+
+ sessionStorage.removeItem("testC");
+ sessionStorage.testC = null;
+ is("testC" in sessionStorage, true);
+ is(sessionStorage.getItem("testC"), "null");
+ is(sessionStorage.testC, "null");
+ is(sessionStorage.testC, "null");
+
+ sessionStorage.setItem(null, "test");
+ is("null" in sessionStorage, true);
+ is(sessionStorage.getItem("null"), "test");
+ is(sessionStorage.getItem(null), "test");
+ is(sessionStorage.null, "test");
+ sessionStorage.removeItem(null, "test");
+ is("null" in sessionStorage, false);
+
+ sessionStorage.setItem(null, "test");
+ is("null" in sessionStorage, true);
+ sessionStorage.removeItem("null", "test");
+ is("null" in sessionStorage, false);
+
+ // Clear the storage
+ sessionStorage.clear();
+ is(sessionStorage.length, 0, "The storage is empty [3]");
+ is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
+ is(sessionStorage.getItem("nonexisting"), null, "Nonexisting item is null");
+ is(sessionStorage.getItem("key1"), null, "key1 removed");
+ is(sessionStorage.getItem("key2"), null, "key2 removed");
+ sessionStorage.removeItem("nonexisting"); // Just check there is no exception
+ sessionStorage.removeItem("key1"); // Just check there is no exception
+ sessionStorage.removeItem("key2"); // Just check there is no exception
+
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT, 'context': document}], function() { iframeOnload(2); });
+}
+
+function test2() {
+ sessionStorage.clear();
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+<iframe id="testframe" srcdoc="<meta charset=utf-8>"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageClone.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageClone.html
new file mode 100644
index 0000000000..e0045480b2
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageClone.html
@@ -0,0 +1,112 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage clone equal origins</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var currentTest = 1;
+var currentStep = 1;
+
+/*
+window.addEventListener("storage", onStorageEvent, false);
+
+function onStorageEvent(event)
+{
+}
+*/
+
+async function doNextTest()
+{
+ // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
+ // Acquire storage access permission here so that the sessionStorage object is
+ // shared between this window and the slave in xorigin tests. Without this,
+ // our storage would be isolated as a xorigin iframe.
+ if (isXOrigin) {
+ SpecialPowers.wrap(document).notifyUserGestureActivation();
+ await SpecialPowers.addPermission(
+ "storageAccessAPI",
+ true,
+ window.location.href
+ );
+ await SpecialPowers.wrap(document).requestStorageAccess();
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
+ });
+
+ // We must perform the first step of the test
+ // to prepare the land.
+ currentStep = 1;
+ doStep();
+
+ switch (currentTest)
+ {
+ case 1:
+ // Open a window from the same origin and check data
+ // are copied but not further modified on our side
+ slaveOrigin = "http://mochi.test:8888";
+ slave = window.open(slaveOrigin + slavePath + "frameEqual.html");
+ break;
+
+ case 2:
+ slave.close();
+ // Open a window from a different origin and check data
+ // are NOT copied and not modified on our side
+ slaveOrigin = "https://example.com";
+ slave = window.open(slaveOrigin + slavePath + "frameNotEqual.html");
+ break;
+
+ case 3:
+ slave.close();
+ sessionStorage.clear();
+ SimpleTest.finish();
+ break;
+ }
+
+ ++currentTest;
+}
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ sessionStorage.setItem("A", "1");
+ sessionStorage.setItem("B", "2");
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the master");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the master");
+ is(sessionStorage.length, 2, "Num of items is 2");
+ break;
+
+ case 3:
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the master");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the master");
+ is(sessionStorage.getItem("C"), null, "C is null in the master");
+ is(sessionStorage.length, 2, "Num of items is 2");
+
+ sessionStorage.setItem("C", "4");
+ is(sessionStorage.getItem("C"), "4", "C is 4 in the master");
+ is(sessionStorage.length, 3, "Num of items is 3");
+ break;
+ }
+
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="doNextTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned.html
new file mode 100644
index 0000000000..384faf2044
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned.html
@@ -0,0 +1,110 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage clone equal origins</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var currentTest = 1;
+var currentStep = 1;
+
+async function doNextTest()
+{
+ // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
+ // Acquire storage access permission here so that the sessionStorage object is
+ // shared between this window and the slave in xorigin tests. Without this,
+ // our storage would be isolated as a xorigin iframe.
+ if (isXOrigin) {
+ SpecialPowers.wrap(document).notifyUserGestureActivation();
+ await SpecialPowers.addPermission(
+ "storageAccessAPI",
+ true,
+ window.location.href
+ );
+ await SpecialPowers.wrap(document).requestStorageAccess();
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["privacy.partition.always_partition_third_party_non_cookie_storage", true],
+ ["privacy.partition.always_partition_third_party_non_cookie_storage.exempt_sessionstorage", false]
+ ],
+ });
+
+ // We must perform the first step of the test
+ // to prepare the land.
+ currentStep = 1;
+ doStep();
+
+ let hash = "#aps";
+ if (isXOrigin) hash += "xorigin";
+
+ switch (currentTest)
+ {
+ case 1:
+ // Open a window from the same origin and check data
+ // are copied but not further modified on our side
+ slaveOrigin = "http://mochi.test:8888";
+ slave = window.open(slaveOrigin + slavePath + "frameNotEqual.html" + hash);
+ break;
+
+ case 2:
+ slave.close();
+ // Open a window from a different origin and check data
+ // are NOT copied and not modified on our side
+ slaveOrigin = "https://example.com";
+ slave = window.open(slaveOrigin + slavePath + "frameNotEqual.html" + hash);
+ break;
+
+ case 3:
+ slave.close();
+ sessionStorage.clear();
+ SimpleTest.finish();
+ break;
+ }
+
+ ++currentTest;
+}
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ sessionStorage.setItem("A", "1");
+ sessionStorage.setItem("B", "2");
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the master");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the master");
+ is(sessionStorage.length, 2, "Num of items is 2");
+ break;
+
+ case 3:
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the master");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the master");
+ is(sessionStorage.getItem("C"), null, "C is null in the master");
+ is(sessionStorage.length, 2, "Num of items is 2");
+
+ sessionStorage.setItem("C", "4");
+ is(sessionStorage.getItem("C"), "4", "C is 4 in the master");
+ is(sessionStorage.length, 3, "Num of items is 3");
+ break;
+ }
+
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="doNextTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned_exempted.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned_exempted.html
new file mode 100644
index 0000000000..3f9e3b331f
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageClone_alwaysPartitioned_exempted.html
@@ -0,0 +1,110 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage clone equal origins</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var currentTest = 1;
+var currentStep = 1;
+
+async function doNextTest()
+{
+ // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
+ // Acquire storage access permission here so that the sessionStorage object is
+ // shared between this window and the slave in xorigin tests. Without this,
+ // our storage would be isolated as a xorigin iframe.
+ if (isXOrigin) {
+ SpecialPowers.wrap(document).notifyUserGestureActivation();
+ await SpecialPowers.addPermission(
+ "storageAccessAPI",
+ true,
+ window.location.href
+ );
+ await SpecialPowers.wrap(document).requestStorageAccess();
+ }
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["privacy.partition.always_partition_third_party_non_cookie_storage", true],
+ ["privacy.partition.always_partition_third_party_non_cookie_storage.exempt_sessionstorage", true]
+ ],
+ });
+
+ // We must perform the first step of the test
+ // to prepare the land.
+ currentStep = 1;
+ doStep();
+
+ let hash = "#";
+ if (isXOrigin) hash += "xorigin";
+
+ switch (currentTest)
+ {
+ case 1:
+ // Open a window from the same origin and check data
+ // are copied but not further modified on our side
+ slaveOrigin = "http://mochi.test:8888";
+ slave = window.open(slaveOrigin + slavePath + "frameEqual.html" + hash);
+ break;
+
+ case 2:
+ slave.close();
+ // Open a window from a different origin and check data
+ // are NOT copied and not modified on our side
+ slaveOrigin = "https://example.com";
+ slave = window.open(slaveOrigin + slavePath + "frameNotEqual.html" + hash);
+ break;
+
+ case 3:
+ slave.close();
+ sessionStorage.clear();
+ SimpleTest.finish();
+ break;
+ }
+
+ ++currentTest;
+}
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ sessionStorage.setItem("A", "1");
+ sessionStorage.setItem("B", "2");
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the master");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the master");
+ is(sessionStorage.length, 2, "Num of items is 2");
+ break;
+
+ case 3:
+ is(sessionStorage.getItem("A"), "1", "A is 1 in the master");
+ is(sessionStorage.getItem("B"), "2", "B is 2 in the master");
+ is(sessionStorage.getItem("C"), null, "C is null in the master");
+ is(sessionStorage.length, 2, "Num of items is 2");
+
+ sessionStorage.setItem("C", "4");
+ is(sessionStorage.getItem("C"), "4", "C is 4 in the master");
+ is(sessionStorage.length, 3, "Num of items is 3");
+ break;
+ }
+
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="doNextTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageFromChrome.xhtml b/dom/tests/mochitest/sessionstorage/test_sessionStorageFromChrome.xhtml
new file mode 100644
index 0000000000..b149ec0095
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageFromChrome.xhtml
@@ -0,0 +1,34 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage basic test</title>
+
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ // Check that we do not crash when we access the sessionStorage object from
+ // chrome and that we throw. See bug 404453.
+ var exceptionCaught = false;
+ try {
+ sessionStorage;
+ }
+ catch (e) {
+ is(e.result, Components.results.NS_ERROR_NOT_AVAILABLE,
+ "Testing that we get the expected exception.");
+ exceptionCaught = true;
+ }
+ is(exceptionCaught, true, "Testing that an exception was thrown.");
+
+ SimpleTest.finish();
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageHttpHttps.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageHttpHttps.html
new file mode 100644
index 0000000000..e8fbfcca03
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageHttpHttps.html
@@ -0,0 +1,59 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage replace test</title>
+
+<!--
+ This test checks that sessionStorage values set in an https page
+ are not readable from a non-https page from the same domain.
+-->
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+window.addEventListener("message", onMessageReceived);
+
+var messages = [];
+
+function onMessageReceived(event)
+{
+ if (event.data == "the end") {
+ is(messages.length, 4, "Wrong number of messages.");
+ is(messages[0], "insecure", "Wrong message from insecure page");
+ is(messages[1], "secure", "Wrong message from secure page");
+ is(messages[2], "insecure", "Wrong second message from insecure page");
+ is(messages[3], null, "Insecure page got secure message?");
+
+ SimpleTest.finish();
+
+ return;
+ }
+
+ messages.push(event.data);
+
+ if (event.data == "insecure" && messages.length == 1) {
+ window.httpsframe.location = "https://test1.example.com/tests/dom/tests/mochitest/sessionstorage/file_https.html";
+ }
+
+ if (event.data == "secure") {
+ window.httpframe.postMessage("check", "http://test1.example.com");
+ }
+}
+
+function startTest()
+{
+ window.httpframe.location = "http://test1.example.com/tests/dom/tests/mochitest/sessionstorage/file_http.html";
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="httpframe"></iframe>
+ <iframe src="" name="httpsframe"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageReplace.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageReplace.html
new file mode 100644
index 0000000000..9993d8f789
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageReplace.html
@@ -0,0 +1,78 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage replace test</title>
+
+<!--
+ This test checks that sessionStorage object doesn't leak
+ in a window that changes its location. We do this by switching
+ frame location inside of this window and then by changing location
+ of a top level window.
+-->
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var shell;
+var shellType;
+var failureRegExp = new RegExp("^FAILURE");
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event)
+{
+ //alert("onMessageReceived "+event.data);
+ switch (event.data)
+ {
+ case "init_done":
+ // This is frame with different origin in the same browsing context
+ // as the first frame adding data to sessionStorage of the first origin.
+ shell.location = "http://example.com/tests/dom/tests/mochitest/sessionstorage/frameReplace.html?check&" + shellType;
+ break;
+
+ case "check_done":
+ // Recheck and clean the sessionStorage of the first origin.
+ shell.location = "http://example.org:80/tests/dom/tests/mochitest/sessionstorage/frameReplace.html?clean&" + shellType;
+ break;
+
+ case "clean_done":
+ switch (shellType)
+ {
+ case "frame":
+ // We finished testing in a frame
+ // proceed with test in a separate window
+ shellType = "window";
+ shell = window.open("http://example.org/tests/dom/tests/mochitest/sessionstorage/frameReplace.html?init&" + shellType);
+ break;
+
+ case "window":
+ shell.close();
+ window.setTimeout(function() {SimpleTest.finish();}, 0);
+ break;
+ }
+ break;
+
+ default:
+ SimpleTest.ok(!event.data.match(failureRegExp), event.data);
+ break;
+ }
+}
+
+function startTest()
+{
+ shellType = "frame";
+ shell = frame;
+ shell.location = "http://example.org/tests/dom/tests/mochitest/sessionstorage/frameReplace.html?init&" + shellType;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="frame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageUsage.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageUsage.html
new file mode 100644
index 0000000000..db894c9780
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageUsage.html
@@ -0,0 +1,53 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage basic test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function setup() {
+ sessionStorage.clear();
+ SimpleTest.executeSoon(startTest);
+}
+
+function startTest()
+{
+ var util = SpecialPowers.getDOMWindowUtils(window);
+
+ // Check initial state.
+ is(sessionStorage.length, 0, "storage is empty");
+ is(util.getStorageUsage(sessionStorage), 0, "usage is zero");
+
+ // Add some data.
+ sessionStorage.setItem("one", "data");
+ var usage = util.getStorageUsage(sessionStorage);
+ ok(usage > 0, "storage contains data");
+
+ // Add some more data.
+ sessionStorage.setItem("two", "data");
+ ok(usage < util.getStorageUsage(sessionStorage), "storage size grew");
+
+ // Remove data.
+ sessionStorage.removeItem("two");
+ is(util.getStorageUsage(sessionStorage), usage, "storage size shrunk");
+
+ // Cleanup.
+ sessionStorage.clear();
+ is(sessionStorage.length, 0, "storage is empty");
+ is(util.getStorageUsage(sessionStorage), 0, "usage is zero");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="setup();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html b/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html
new file mode 100644
index 0000000000..55cbad1d28
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html
@@ -0,0 +1,63 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>master frame for event storage propagation</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 1;
+var gotEvent = false;
+
+window.addEventListener("storage", function(event)
+{
+ gotEvent = true;
+});
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ // Must not fire (storage must be clear!)
+ localStorage.clear();
+ // Must fire X:null->'1'
+ localStorage.setItem("X", "1");
+ // Must fire X:'1'->'2'
+ localStorage.setItem("X", "2");
+ // Must not fire
+ localStorage.setItem("X", "2");
+ // Must fire X:'2'->null
+ localStorage.removeItem("X");
+ // Must not fire
+ localStorage.removeItem("X");
+ // Must not fire
+ localStorage.removeItem("Y");
+ // Must fire X:null->'2' (we need something in the storage)
+ localStorage.setItem("X", "2");
+ // Must fire null:null->null (one item has been erased)
+ localStorage.clear();
+ // Must not fire
+ localStorage.clear();
+ break;
+
+ // Wait some time to let the async event be propagated
+ case 11:
+ is(gotEvent, false, "Expected no events");
+ return finishTest();
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html
new file mode 100644
index 0000000000..ad3738bed2
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html
@@ -0,0 +1,55 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for storage event propagation</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 2;
+
+var events = [];
+
+window.addEventListener("storage", function(event)
+{
+ events.push(event);
+});
+
+function doStep()
+{
+ function checkEvent(expectedKey, expectedOldValue, expectedNewValue)
+ {
+ var event = events.shift();
+ is(event.key, expectedKey, "key name check");
+ is(event.oldValue, expectedOldValue, "old value check");
+ is(event.newValue, expectedNewValue, "new value check");
+ is(event.url, "http://example.com/tests/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html");
+ ok(event.storageArea);
+ }
+
+ switch (currentStep)
+ {
+ case 10:
+ is(events.length, 5, "Expected 5 events");
+ checkEvent("X", null, "1");
+ checkEvent("X", "1", "2");
+ checkEvent("X", "2", null);
+ checkEvent("X", null, "2");
+ checkEvent(null, null, null);
+ break;
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html
new file mode 100644
index 0000000000..248604b400
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html
@@ -0,0 +1,39 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for storage event propagation</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 2;
+var gotEvent = false;
+
+window.addEventListener("storage", function(event)
+{
+ gotEvent = true;
+});
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 10:
+ is(gotEvent, false, "Expected no events");
+ break;
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html b/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html
new file mode 100644
index 0000000000..595e21351b
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html
@@ -0,0 +1,67 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>master frame for event storage propagation</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 1;
+var gotEvent = false;
+
+window.addEventListener("storage", function(event)
+{
+ gotEvent = true;
+});
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ // In step 2 we instantiate sessionStorage in the other frame
+ case 1:
+ // Must not fire (storage must be clear!)
+ sessionStorage.clear();
+ // Must fire X:null->'1'
+ sessionStorage.setItem("X", "1");
+ // Must fire X:'1'->'2'
+ sessionStorage.setItem("X", "2");
+ // Must not fire
+ sessionStorage.setItem("X", "2");
+ // Must fire X:'2'->null
+ sessionStorage.removeItem("X");
+ // Must not fire
+ sessionStorage.removeItem("X");
+ // Must not fire
+ sessionStorage.removeItem("Y");
+ // Must fire X:null->'2' (we need something in the storage)
+ sessionStorage.setItem("X", "2");
+ // Must fire null:null->null (one item has been erased)
+ sessionStorage.clear();
+ // Must not fire
+ sessionStorage.clear();
+ break;
+
+ // Wait some time to let the async event be propagated
+ case 11:
+ is(gotEvent, false, "Expected no events");
+ return finishTest();
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
+ <iframe src="http://example.com:80/tests/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html"
+ name="slaveFrame">
+ </iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html b/dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html
new file mode 100644
index 0000000000..6c66e085e0
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html
@@ -0,0 +1,70 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>master frame for event storage propagation</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 1;
+var gotEvent = false;
+
+window.addEventListener("storage", function(event)
+{
+ gotEvent = true;
+});
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 1:
+ // Must not fire (storage must be clear!)
+ sessionStorage.clear();
+ // Must fire X:null->'1'
+ sessionStorage.setItem("X", "1");
+ // Must fire X:'1'->'2'
+ sessionStorage.setItem("X", "2");
+ // Must not fire
+ sessionStorage.setItem("X", "2");
+ // Must fire X:'2'->null
+ sessionStorage.removeItem("X");
+ // Must not fire
+ sessionStorage.removeItem("X");
+ // Must not fire
+ sessionStorage.removeItem("Y");
+ // Must fire X:null->'2' (we need something in the storage)
+ sessionStorage.setItem("X", "2");
+ // Must fire null:null->null (one item has been erased)
+ sessionStorage.clear();
+ // Must not fire
+ sessionStorage.clear();
+ break;
+
+ // Wait some time to let the async event be propagated
+ case 11:
+ is(gotEvent, false, "Expected no events");
+ return finishTest();
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+function startTest() {
+ postMsg('frame loaded', 'http://mochi.test:8888');
+ slaveFrame.location =
+ "http://example.com:80/tests/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html";
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html
new file mode 100644
index 0000000000..c7326e9a89
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html
@@ -0,0 +1,59 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for storage event propagation</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 2;
+
+var events = [];
+
+window.addEventListener("storage", function(event)
+{
+ events.push(event);
+});
+
+function doStep()
+{
+ function checkEvent(expectedKey, expectedOldValue, expectedNewValue)
+ {
+ var event = events.shift();
+ ok(event, "Event is present");
+ if (!event)
+ return;
+
+ is(event.key, expectedKey, "key name check");
+ is(event.oldValue, expectedOldValue, "old value check");
+ is(event.newValue, expectedNewValue, "new value check");
+ is(event.url, "http://example.com/tests/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html");
+ ok(event.storageArea);
+ }
+
+ switch (currentStep)
+ {
+ case 10:
+ is(events.length, 5, "Expected 5 events");
+ checkEvent("X", null, "1");
+ checkEvent("X", "1", "2");
+ checkEvent("X", "2", null);
+ checkEvent("X", null, "2");
+ checkEvent(null, null, null);
+ break;
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded', 'http://example.com:80');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html
new file mode 100644
index 0000000000..b86b3c02cc
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html
@@ -0,0 +1,39 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for storage event propagation</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+var currentStep = 2;
+var gotEvent = false;
+
+window.addEventListener("storage", function(event)
+{
+ gotEvent = true;
+});
+
+function doStep()
+{
+ switch (currentStep)
+ {
+ case 10:
+ is(gotEvent, false, "Expected no events");
+ break;
+ }
+
+ // Increase by two to distinguish each test step order
+ // in both master doStep and slave doStep functions.
+ ++currentStep;
+ ++currentStep;
+
+ return true;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded', 'http://example.org');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/interOriginFrame.js b/dom/tests/mochitest/storageevent/interOriginFrame.js
new file mode 100644
index 0000000000..f4b3d6c9ab
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/interOriginFrame.js
@@ -0,0 +1,63 @@
+let parentLocation = "";
+
+// The first time this gets called in a page, the location of the parent
+// should be passed in. This will be used as the target origin argument
+// for the postMessage call for all subsequent calls to postMsg().
+function postMsg(message, newParentLocation) {
+ if (newParentLocation) {
+ parentLocation = newParentLocation;
+ } else if (parentLocation == "") {
+ throw new Error("Failed to pass in newParentLocation");
+ }
+
+ parent.postMessage(message, parentLocation);
+}
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event) {
+ if (event.data == "step") {
+ var performed = false;
+ try {
+ performed = doStep();
+ } catch (ex) {
+ postMsg("FAILURE: exception threw at " + location + ":\n" + ex);
+ finishTest();
+ }
+
+ if (performed) {
+ postMsg("perf");
+ }
+
+ return;
+ }
+
+ if (parent) {
+ postMsg(event.data);
+ }
+}
+
+function ok(a, message) {
+ if (!a) {
+ postMsg("FAILURE: " + message);
+ } else {
+ postMsg(message);
+ }
+}
+
+function is(a, b, message) {
+ if (a != b) {
+ postMsg("FAILURE: " + message + ", expected " + b + " got " + a);
+ } else {
+ postMsg(message + ", expected " + b + " got " + a);
+ }
+}
+
+function todo(a, b, message) {
+ postMsg("TODO: " + message + ", expected " + b + " got " + a);
+}
+
+function finishTest() {
+ postMsg("done");
+ return false;
+}
diff --git a/dom/tests/mochitest/storageevent/interOriginTest2.js b/dom/tests/mochitest/storageevent/interOriginTest2.js
new file mode 100644
index 0000000000..733f88a32d
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/interOriginTest2.js
@@ -0,0 +1,60 @@
+var frameLoadsPending = 2;
+
+var callMasterFrame = true;
+var testDone = false;
+
+var masterFrameOrigin = "";
+var slaveFrameOrigin = "";
+
+var failureRegExp = new RegExp("^FAILURE");
+var todoRegExp = new RegExp("^TODO");
+
+const framePath = "/tests/dom/tests/mochitest/storageevent/";
+
+window.addEventListener("message", onMessageReceived);
+
+function onMessageReceived(event) {
+ switch (event.data) {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--frameLoadsPending) {
+ break;
+ }
+
+ // Indication of successfully finished step of a test
+ // Just fall through...
+ case "perf":
+ if (callMasterFrame) {
+ masterFrame.postMessage("step", "*");
+ } else if (slaveFrame) {
+ slaveFrame.postMessage("step", "*");
+ } else if (masterFrame.slaveFrame) {
+ masterFrame.slaveFrame.postMessage("step", "*");
+ }
+ callMasterFrame = !callMasterFrame;
+ break;
+
+ // Indication of all test parts finish (from any of the frames)
+ case "done":
+ if (testDone) {
+ break;
+ }
+
+ testDone = true;
+ SimpleTest.finish();
+ break;
+
+ // Any other message indicates error, succes or todo message of a test
+ default:
+ if (typeof event.data == "undefined") {
+ break;
+ } // XXXkhuey this receives undefined values
+ // (which used to become empty strings) on occasion ...
+ if (event.data.match(todoRegExp)) {
+ SimpleTest.todo(false, event.data);
+ } else {
+ SimpleTest.ok(!event.data.match(failureRegExp), event.data);
+ }
+ break;
+ }
+}
diff --git a/dom/tests/mochitest/storageevent/mochitest.ini b/dom/tests/mochitest/storageevent/mochitest.ini
new file mode 100644
index 0000000000..49b2fb1e2d
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/mochitest.ini
@@ -0,0 +1,25 @@
+[DEFAULT]
+support-files =
+ frameLocalStorageMaster.html
+ frameLocalStorageSlaveEqual.html
+ frameLocalStorageSlaveNotEqual.html
+ frameSessionStorageMasterEqual.html
+ frameSessionStorageMasterNotEqual.html
+ frameSessionStorageSlaveEqual.html
+ frameSessionStorageSlaveNotEqual.html
+ interOriginFrame.js
+ interOriginTest2.js
+
+[test_storageLocalStorageEventCheckNoPropagation.html]
+skip-if =
+ http3
+[test_storageLocalStorageEventCheckPropagation.html]
+skip-if =
+ http3
+[test_storageNotifications.html]
+[test_storageSessionStorageEventCheckNoPropagation.html]
+skip-if =
+ http3
+[test_storageSessionStorageEventCheckPropagation.html]
+skip-if =
+ http3
diff --git a/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckNoPropagation.html b/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckNoPropagation.html
new file mode 100644
index 0000000000..ee48abedba
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckNoPropagation.html
@@ -0,0 +1,43 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>storage event propagation test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest2.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.com:80";
+ slaveFrameOrigin = "http://example.org:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameLocalStorageMaster.html";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameLocalStorageSlaveNotEqual.html";
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckPropagation.html b/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckPropagation.html
new file mode 100644
index 0000000000..a6d291e147
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckPropagation.html
@@ -0,0 +1,43 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>storage event propagation test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest2.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.com:80";
+ slaveFrameOrigin = "http://example.com:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameLocalStorageMaster.html";
+ slaveFrame.location = slaveFrameOrigin + framePath + "frameLocalStorageSlaveEqual.html";
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+ <iframe src="" name="slaveFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/test_storageNotifications.html b/dom/tests/mochitest/storageevent/test_storageNotifications.html
new file mode 100644
index 0000000000..255de171de
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/test_storageNotifications.html
@@ -0,0 +1,130 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage basic test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="application/javascript">
+
+var expectedTypes = [
+ "localStorage",
+ "localStorage",
+ "sessionStorage",
+ "localStorage",
+ "sessionStorage",
+ "sessionStorage",
+ "localStorage",
+ "sessionStorage",
+ "localStorage",
+ "sessionStorage",
+ "localStorage",
+ "sessionStorage",
+ "sessionStorage",
+ "localStorage",
+ "sessionStorage",
+ "localStorage",
+];
+
+var tests = Tests();
+function setup() {
+ sessionStorage.clear();
+ SimpleTest.executeSoon(function() {
+ tests.next();
+ });
+}
+
+function* Tests()
+{
+ // Initially check the both storages are empty
+ is(sessionStorage.length, 0, "Session storage is empty [1]");
+ is(localStorage.length, 0, "Local storage is empty [1]");
+
+ function onSessionStorageChanged(e) {
+ ok(expectedTypes.length, "Not more then expected events encountered");
+ is("sessionStorage", expectedTypes.shift(), "Expected session type of the storage notification");
+ tests.next();
+ }
+
+ function onLocalStorageChanged(e) {
+ ok(expectedTypes.length, "Not more then expected events encountered");
+ is("localStorage", expectedTypes.shift(), "Expected session type of the storage notification");
+ tests.next();
+ }
+
+ // Listen for storage notifications
+ SpecialPowers.addChromeEventListener("MozSessionStorageChanged", onSessionStorageChanged, true);
+ SpecialPowers.addChromeEventListener("MozLocalStorageChanged", onLocalStorageChanged, true);
+
+ // add an empty-value key
+ localStorage.setItem("empty", "");
+ yield undefined;
+
+ localStorage.setItem("empty", "value-1");
+ yield undefined;
+
+ sessionStorage.setItem("empty", "");
+ yield undefined;
+
+ localStorage.removeItem("empty");
+ yield undefined;
+
+ sessionStorage.setItem("empty", "value-1");
+ yield undefined;
+
+ sessionStorage.removeItem("empty");
+ yield undefined;
+
+ localStorage.setItem("key1", "value-1");
+ yield undefined;
+
+ sessionStorage.setItem("key2", "value-2");
+ yield undefined;
+
+ localStorage.setItem("key1", "value-1-2");
+ yield undefined;
+
+ sessionStorage.setItem("key2", "value-2-2");
+ yield undefined;
+
+ localStorage.setItem("key3", "value-3");
+ yield undefined;
+
+ sessionStorage.setItem("key4", "value-4");
+ yield undefined;
+
+ sessionStorage.removeItem("key4");
+ yield undefined;
+
+ localStorage.setItem("key4", "value-4");
+ yield undefined;
+
+ sessionStorage.clear();
+ yield undefined;
+
+ localStorage.clear();
+ yield undefined;
+
+ SimpleTest.executeSoon(function () {
+ SpecialPowers.removeChromeEventListener("MozSessionStorageChanged", onSessionStorageChanged, true);
+ SpecialPowers.removeChromeEventListener("MozLocalStorageChanged", onLocalStorageChanged, true);
+
+ is(expectedTypes.length, 0, "received the correct number of events");
+
+ sessionStorage.clear();
+ localStorage.clear();
+ tests = null;
+ SimpleTest.finish();
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="setup();">
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckNoPropagation.html b/dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckNoPropagation.html
new file mode 100644
index 0000000000..7ffa70dbf6
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckNoPropagation.html
@@ -0,0 +1,43 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>storage event propagation test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest2.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+var slaveFrame = null;
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.org:80";
+ slaveFrameOrigin = "http://example.com:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameSessionStorageMasterNotEqual.html";
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckPropagation.html b/dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckPropagation.html
new file mode 100644
index 0000000000..4f3402b6bb
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/test_storageSessionStorageEventCheckPropagation.html
@@ -0,0 +1,43 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>storage event propagation test</title>
+
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest2.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<!--
+ This test loads two frames from different
+ origins and checks that entries of localStorage
+ objects don't leak each between other.
+
+ The subsystem is based on postMessage and addEventListener
+ to send messages among different origins. The subsystem waits
+ for both frames be loaded and then alternately calls each frames'
+ doStep() function that on each call proceeds with a single step
+ of the test on its side. This way the subsystem alternate between
+ both frames until both sequences completely finish.
+-->
+
+<script type="text/javascript">
+
+var slaveFrame = null;
+
+function startTest()
+{
+ masterFrameOrigin = "http://example.com:80";
+ slaveFrameOrigin = "http://example.com:80";
+
+ masterFrame.location = masterFrameOrigin + framePath + "frameSessionStorageMasterEqual.html";
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="masterFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/chrome.ini b/dom/tests/mochitest/webcomponents/chrome.ini
new file mode 100644
index 0000000000..8f54af95e3
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/chrome.ini
@@ -0,0 +1,17 @@
+[DEFAULT]
+support-files =
+ dummy_page.html
+
+[test_custom_element_ensure_custom_element.html]
+[test_custom_element_htmlconstructor_chrome.html]
+support-files =
+ htmlconstructor_autonomous_tests.js
+ htmlconstructor_builtin_tests.js
+[test_custom_element_namespace.html]
+[test_custom_element_namespace.xhtml]
+[test_custom_element_upgrade_chrome.html]
+support-files =
+ test_upgrade_page.html
+ upgrade_tests.js
+[test_xul_custom_element.xhtml]
+[test_xul_shadowdom_accesskey.xhtml]
diff --git a/dom/tests/mochitest/webcomponents/dummy_page.html b/dom/tests/mochitest/webcomponents/dummy_page.html
new file mode 100644
index 0000000000..fd238954c6
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/dummy_page.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<title>Dummy test page</title>
+<meta charset="utf-8"/>
+</head>
+<body>
+<p>Dummy test page</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/head.js b/dom/tests/mochitest/webcomponents/head.js
new file mode 100644
index 0000000000..23c91d63be
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/head.js
@@ -0,0 +1,26 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+/**
+ * Loads an iframe.
+ *
+ * @return {Promise} promise that resolves when iframe is loaded.
+ */
+function createIframe(aSrcDoc) {
+ return new Promise(function (aResolve, aReject) {
+ let iframe = document.createElement("iframe");
+ iframe.onload = function () {
+ aResolve(iframe.contentDocument);
+ };
+ iframe.onerror = function () {
+ aReject("Failed to load iframe");
+ };
+ if (aSrcDoc) {
+ iframe.srcdoc = aSrcDoc;
+ }
+ document.body.appendChild(iframe);
+ });
+}
diff --git a/dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js b/dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js
new file mode 100644
index 0000000000..75b42389cc
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js
@@ -0,0 +1,107 @@
+promises.push(
+ test_with_new_window(testWindow => {
+ // Test calling the HTMLElement constructor.
+ (() => {
+ SimpleTest.doesThrow(() => {
+ testWindow.HTMLElement();
+ }, "calling the HTMLElement constructor should throw a TypeError");
+ })();
+
+ // Test constructing a HTMLELement.
+ (() => {
+ SimpleTest.doesThrow(() => {
+ new testWindow.HTMLElement();
+ }, "constructing a HTMLElement should throw a TypeError");
+ })();
+
+ // Test constructing a custom element with defining HTMLElement as entry.
+ (() => {
+ testWindow.customElements.define(
+ "x-defining-html-element",
+ testWindow.HTMLElement
+ );
+ SimpleTest.doesThrow(() => {
+ new testWindow.HTMLElement();
+ }, "constructing a custom element with defining HTMLElement as registry " + "entry should throw a TypeError");
+ })();
+
+ // Test calling a custom element constructor and constructing an autonomous
+ // custom element.
+ (() => {
+ let num_constructor_invocations = 0;
+ class X extends testWindow.HTMLElement {
+ constructor() {
+ super();
+ num_constructor_invocations++;
+ }
+ }
+ testWindow.customElements.define("x-element", X);
+ SimpleTest.doesThrow(() => {
+ X();
+ }, "calling an autonomous custom element constructor should throw a TypeError");
+
+ let element = new X();
+ SimpleTest.is(
+ Object.getPrototypeOf(Cu.waiveXrays(element)),
+ X.prototype,
+ "constructing an autonomous custom element; " +
+ "the element should be a registered constructor"
+ );
+ SimpleTest.is(
+ element.localName,
+ "x-element",
+ "constructing an autonomous custom element; " +
+ 'the element tag name should be "x-element"'
+ );
+ SimpleTest.is(
+ element.namespaceURI,
+ "http://www.w3.org/1999/xhtml",
+ "constructing an autonomous custom element; " +
+ "the element should be in the HTML namespace"
+ );
+ SimpleTest.is(
+ element.prefix,
+ null,
+ "constructing an autonomous custom element; " +
+ "the element name should not have a prefix"
+ );
+ SimpleTest.is(
+ element.ownerDocument,
+ testWindow.document,
+ "constructing an autonomous custom element; " +
+ "the element should be owned by the registry's associated " +
+ "document"
+ );
+ SimpleTest.is(
+ num_constructor_invocations,
+ 1,
+ "constructing an autonomous custom element; " +
+ "the constructor should have been invoked once"
+ );
+ })();
+
+ // Test if prototype is no an object.
+ (() => {
+ function ElementWithNonObjectPrototype() {
+ let o = Reflect.construct(testWindow.HTMLElement, [], new.target);
+ SimpleTest.is(
+ Object.getPrototypeOf(Cu.waiveXrays(o)),
+ window.HTMLElement.prototype,
+ "constructing an autonomous custom element; " +
+ "if prototype is not object, fallback from NewTarget's realm"
+ );
+ }
+
+ // Prototype have to be an object during define(), otherwise define will
+ // throw an TypeError exception.
+ ElementWithNonObjectPrototype.prototype = {};
+ testWindow.customElements.define(
+ "x-non-object-prototype",
+ ElementWithNonObjectPrototype
+ );
+
+ ElementWithNonObjectPrototype.prototype = "string";
+ new ElementWithNonObjectPrototype();
+ })();
+ })
+);
diff --git a/dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js b/dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js
new file mode 100644
index 0000000000..0b72ca3f7a
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js
@@ -0,0 +1,282 @@
+[
+ // [TagName, InterfaceName]
+ ["a", "Anchor"],
+ ["abbr", ""],
+ ["acronym", ""],
+ ["address", ""],
+ ["area", "Area"],
+ ["article", ""],
+ ["aside", ""],
+ ["audio", "Audio"],
+ ["b", ""],
+ ["base", "Base"],
+ ["basefont", ""],
+ ["bdo", ""],
+ ["big", ""],
+ ["blockquote", "Quote"],
+ ["body", "Body"],
+ ["br", "BR"],
+ ["button", "Button"],
+ ["canvas", "Canvas"],
+ ["caption", "TableCaption"],
+ ["center", ""],
+ ["cite", ""],
+ ["code", ""],
+ ["col", "TableCol"],
+ ["colgroup", "TableCol"],
+ ["data", "Data"],
+ ["datalist", "DataList"],
+ ["dd", ""],
+ ["del", "Mod"],
+ ["details", "Details"],
+ ["dfn", ""],
+ ["dir", "Directory"],
+ ["div", "Div"],
+ ["dl", "DList"],
+ ["dt", ""],
+ ["em", ""],
+ ["embed", "Embed"],
+ ["fieldset", "FieldSet"],
+ ["figcaption", ""],
+ ["figure", ""],
+ ["font", "Font"],
+ ["footer", ""],
+ ["form", "Form"],
+ ["frame", "Frame"],
+ ["frameset", "FrameSet"],
+ ["h1", "Heading"],
+ ["h2", "Heading"],
+ ["h3", "Heading"],
+ ["h4", "Heading"],
+ ["h5", "Heading"],
+ ["h6", "Heading"],
+ ["head", "Head"],
+ ["header", ""],
+ ["hgroup", ""],
+ ["hr", "HR"],
+ ["html", "Html"],
+ ["i", ""],
+ ["iframe", "IFrame"],
+ ["image", ""],
+ ["img", "Image"],
+ ["input", "Input"],
+ ["ins", "Mod"],
+ ["kbd", ""],
+ ["label", "Label"],
+ ["legend", "Legend"],
+ ["li", "LI"],
+ ["link", "Link"],
+ ["listing", "Pre"],
+ ["main", ""],
+ ["map", "Map"],
+ ["mark", ""],
+ ["marquee", "Marquee"],
+ ["menu", "Menu"],
+ ["meta", "Meta"],
+ ["meter", "Meter"],
+ ["nav", ""],
+ ["nobr", ""],
+ ["noembed", ""],
+ ["noframes", ""],
+ ["noscript", ""],
+ ["object", "Object"],
+ ["ol", "OList"],
+ ["optgroup", "OptGroup"],
+ ["option", "Option"],
+ ["output", "Output"],
+ ["p", "Paragraph"],
+ ["param", "Param"],
+ ["picture", "Picture"],
+ ["plaintext", ""],
+ ["pre", "Pre"],
+ ["progress", "Progress"],
+ ["q", "Quote"],
+ ["rb", ""],
+ ["rp", ""],
+ ["rt", ""],
+ ["rtc", ""],
+ ["ruby", ""],
+ ["s", ""],
+ ["samp", ""],
+ ["script", "Script"],
+ ["section", ""],
+ ["select", "Select"],
+ ["small", ""],
+ ["source", "Source"],
+ ["span", "Span"],
+ ["strike", ""],
+ ["strong", ""],
+ ["style", "Style"],
+ ["sub", ""],
+ ["summary", ""],
+ ["sup", ""],
+ ["table", "Table"],
+ ["tbody", "TableSection"],
+ ["td", "TableCell"],
+ ["textarea", "TextArea"],
+ ["tfoot", "TableSection"],
+ ["th", "TableCell"],
+ ["thead", "TableSection"],
+ ["template", "Template"],
+ ["time", "Time"],
+ ["title", "Title"],
+ ["tr", "TableRow"],
+ ["track", "Track"],
+ ["tt", ""],
+ ["u", ""],
+ ["ul", "UList"],
+ ["var", ""],
+ ["video", "Video"],
+ ["wbr", ""],
+ ["xmp", "Pre"],
+].forEach(e => {
+ let tagName = e[0];
+ let interfaceName = "HTML" + e[1] + "Element";
+ promises.push(
+ test_with_new_window(testWindow => {
+ // Use window from iframe to isolate the test.
+ // Test calling the HTML*Element constructor.
+ (() => {
+ SimpleTest.doesThrow(() => {
+ testWindow[interfaceName]();
+ }, "calling the " + interfaceName + " constructor should throw a TypeError");
+ })();
+
+ // Test constructing a HTML*ELement.
+ (() => {
+ SimpleTest.doesThrow(() => {
+ new testWindow[interfaceName]();
+ }, "constructing a " + interfaceName + " should throw a TypeError");
+ })();
+
+ // Test constructing a custom element with defining HTML*Element as entry.
+ (() => {
+ testWindow.customElements.define(
+ "x-defining-" + tagName,
+ testWindow[interfaceName]
+ );
+ SimpleTest.doesThrow(() => {
+ new testWindow[interfaceName]();
+ }, "constructing a custom element with defining " + interfaceName + " as registry entry should throw a TypeError");
+ })();
+
+ // Since HTMLElement can be registered without specifying "extends", skip
+ // testing HTMLElement tags.
+ if (interfaceName !== "HTMLElement") {
+ // Test constructing a customized HTML*Element with defining a registry entry
+ // without specifying "extends".
+ (() => {
+ class X extends testWindow[interfaceName] {}
+ testWindow.customElements.define("x-defining-invalid-" + tagName, X);
+ SimpleTest.doesThrow(() => {
+ new X();
+ }, "constructing a customized " + interfaceName + " with defining a " + 'registry entry without specifying "extends" should throw a TypeError');
+ })();
+ }
+
+ // Test constructing a built-in custom element with defining a registry entry
+ // with incorrect "extends" information.
+ (() => {
+ class X extends testWindow[interfaceName] {}
+ testWindow.customElements.define("x-defining-incorrect-" + tagName, X, {
+ extends: tagName === "img" ? "p" : "img",
+ });
+ SimpleTest.doesThrow(() => {
+ new X();
+ }, "constructing a customized " + interfaceName + " with defining a " + 'registry entry with incorrect "extends" should throw a TypeError');
+ })();
+
+ // Test calling a custom element constructor and constructing a built-in
+ // custom element.
+ (() => {
+ let num_constructor_invocations = 0;
+ class X extends testWindow[interfaceName] {
+ constructor() {
+ super();
+ num_constructor_invocations++;
+ }
+ }
+ testWindow.customElements.define("x-" + tagName, X, {
+ extends: tagName,
+ });
+ SimpleTest.doesThrow(() => {
+ X();
+ }, "calling a customized " + interfaceName + " constructor should throw a TypeError");
+
+ let element = new X();
+
+ SimpleTest.is(
+ Object.getPrototypeOf(Cu.waiveXrays(element)),
+ X.prototype,
+ "constructing a customized " +
+ interfaceName +
+ "; the element should be a registered constructor"
+ );
+ SimpleTest.is(
+ element.localName,
+ tagName,
+ "constructing a customized " +
+ interfaceName +
+ '; the element tag name should be "' +
+ tagName +
+ '"'
+ );
+ SimpleTest.is(
+ element.namespaceURI,
+ "http://www.w3.org/1999/xhtml",
+ "constructing a customized " +
+ interfaceName +
+ "; the element should be in the HTML namespace"
+ );
+ SimpleTest.is(
+ element.prefix,
+ null,
+ "constructing a customized " +
+ interfaceName +
+ "; the element name should not have a prefix"
+ );
+ SimpleTest.is(
+ element.ownerDocument,
+ testWindow.document,
+ "constructing a customized " +
+ interfaceName +
+ "; the element should be owned by the registry's associated " +
+ "document"
+ );
+ SimpleTest.is(
+ num_constructor_invocations,
+ 1,
+ "constructing a customized " +
+ interfaceName +
+ "; the constructor should have been invoked once"
+ );
+ })();
+
+ // Test if prototype is no an object.
+ (() => {
+ function ElementWithNonObjectPrototype() {
+ let o = Reflect.construct(testWindow[interfaceName], [], new.target);
+ SimpleTest.is(
+ Object.getPrototypeOf(Cu.waiveXrays(o)),
+ window[interfaceName].prototype,
+ "constructing a customized " +
+ interfaceName +
+ "; if prototype is not object, fallback from NewTarget's realm"
+ );
+ }
+
+ // Prototype have to be an object during define(), otherwise define will
+ // throw an TypeError exception.
+ ElementWithNonObjectPrototype.prototype = {};
+ testWindow.customElements.define(
+ "x-non-object-prototype-" + tagName,
+ ElementWithNonObjectPrototype,
+ { extends: tagName }
+ );
+
+ ElementWithNonObjectPrototype.prototype = "string";
+ new ElementWithNonObjectPrototype();
+ })();
+ })
+ );
+});
diff --git a/dom/tests/mochitest/webcomponents/inert_style.css b/dom/tests/mochitest/webcomponents/inert_style.css
new file mode 100644
index 0000000000..3b005ede8c
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/inert_style.css
@@ -0,0 +1,10 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* This style is linked in test_shadowroot_inert_link to ensure
+ that link element in ShadowRoot is inert. */
+span {
+ padding-top: 10px;
+}
+
diff --git a/dom/tests/mochitest/webcomponents/mochitest.ini b/dom/tests/mochitest/webcomponents/mochitest.ini
new file mode 100644
index 0000000000..a268de66dc
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/mochitest.ini
@@ -0,0 +1,50 @@
+[DEFAULT]
+support-files =
+ inert_style.css
+ dummy_page.html
+ head.js
+
+[test_bug900724.html]
+[test_bug1017896.html]
+[test_bug1276240.html]
+[test_custom_element_callback_innerhtml.html]
+[test_custom_element_htmlconstructor.html]
+support-files =
+ htmlconstructor_autonomous_tests.js
+ htmlconstructor_builtin_tests.js
+[test_custom_element_in_shadow.html]
+[test_custom_element_throw_on_dynamic_markup_insertion.html]
+[test_custom_element_get.html]
+[test_custom_element_when_defined.html]
+[test_custom_element_uncatchable_exception.html]
+skip-if = !debug # TestFunctions only applied in debug builds
+[test_custom_element_upgrade.html]
+support-files =
+ test_upgrade_page.html
+ upgrade_tests.js
+[test_custom_element_lifecycle.html]
+[test_custom_element_stack.html]
+[test_custom_element_define.html]
+[test_custom_element_define_parser.html]
+[test_custom_element_set_element_creation_callback.html]
+[test_custom_element_template.html]
+[test_detached_style.html]
+[test_document_adoptnode.html]
+[test_document_importnode.html]
+[test_event_composed.html]
+[test_event_retarget.html]
+[test_event_stopping.html]
+[test_template.html]
+[test_template_xhtml.html]
+[test_shadowdom_active_pseudo_class.html]
+support-files =
+ !/gfx/layers/apz/test/mochitest/apz_test_utils.js
+[test_shadowdom_ime.html]
+[test_shadowroot.html]
+[test_shadowroot_clonenode.html]
+[test_shadowroot_inert_element.html]
+[test_shadowroot_style.html]
+[test_shadowroot_style_order.html]
+[test_style_fallback_content.html]
+[test_link_prefetch.html]
+[test_bug1269155.html]
diff --git a/dom/tests/mochitest/webcomponents/test_bug1017896.html b/dom/tests/mochitest/webcomponents/test_bug1017896.html
new file mode 100644
index 0000000000..53562e9251
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_bug1017896.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1017896
+-->
+<head>
+ <title>Test template element in stale document.</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1017896">Bug 1017896</a>
+<div id="container"></div>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var frame = document.createElement("iframe");
+document.getElementById("container").appendChild(frame);
+
+var staleFrameDoc = frame.contentDocument;
+
+setTimeout(function() {
+ var v = staleFrameDoc.createElement("div");
+ v.innerHTML = "<template>Content</template>";
+ is(v.firstChild.content.childNodes.length, 1, "Template should have one child in template content.");
+ SimpleTest.finish();
+}, 0);
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_bug1269155.html b/dom/tests/mochitest/webcomponents/test_bug1269155.html
new file mode 100644
index 0000000000..6464ca92e7
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_bug1269155.html
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1269155
+-->
+<head>
+ <title>Test for Bug 1269155</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1269155">Mozilla Bug 1269155</a>
+<p id="display"></p>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 1269155 **/
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div id="content" style="display: none"> </div>';
+createIframe(content)
+ .then((aDocument) => {
+ var host = aDocument.querySelector('#content');
+ var root = host.attachShadow({mode: "open"});
+
+ var header1 = aDocument.createElement('h1');
+ header1.textContent = 'Shadow Header1';
+
+ var paragraph1 = aDocument.createElement('p');
+ paragraph1.textContent = 'shadow text paragraph1';
+
+ root.appendChild(header1);
+ root.appendChild(paragraph1);
+
+ var root2 = paragraph1.attachShadow({mode: "open"});
+ var header2 = aDocument.createElement('h2');
+ header2.textContent = 'Shadow Header2';
+
+ var paragraph2 = aDocument.createElement('p');
+ paragraph2.textContent = 'shadow text paragraph2';
+ root2.appendChild(header2);
+ root2.appendChild(paragraph2);
+
+
+ var frag = aDocument.createDocumentFragment();
+ var paragraph3 = aDocument.createElement('p');
+ paragraph3.textContent = 'fragment paragraph3';
+ frag.appendChild(paragraph3);
+
+ var root3 = paragraph3.attachShadow({mode: "open"});
+ var header4 = aDocument.createElement('h2');
+ header4.textContent = 'Shadow Header3';
+
+ var paragraph4 = aDocument.createElement('p');
+ paragraph4.textContent = 'shadow text paragraph4';
+
+ root3.appendChild(header4);
+ root3.appendChild(paragraph4);
+
+ //shadow dom without compose
+ is(root.getRootNode(), root, "root.getRootNode() should be root.");
+ is(root2.getRootNode(), root2, "root2.getRootNode() should be root.");
+ is(root3.getRootNode(), root3, "root3.getRootNode() should be root.");
+ is(header1.getRootNode(), root, "header1.getRootNode() should be root.");
+ is(header2.getRootNode(), root2, "header1.getRootNode() should be root2.");
+ is(header4.getRootNode(), root3, "header1.getRootNode() should be root3.");
+ //shadow dom with compose
+ is(root.getRootNode({ composed: true }), aDocument, "root.getRootNode() with composed flag should be document.");
+ is(root2.getRootNode({ composed: true }), aDocument, "root2.getRootNode() with composed flag should be document.");
+ is(root3.getRootNode({ composed: true }), frag, "root3.getRootNode() with composed flag should be frag.");
+ is(header1.getRootNode({ composed: true }) , aDocument, "header1.getRootNode() with composed flag should be document.");
+ is(header2.getRootNode({ composed: true }) , aDocument, "header2.getRootNode() with composed flag should be document.");
+ is(header4.getRootNode({ composed: true }) , frag, "head4.getRootNode() with composed flag should be frag.");
+ //dom without compose
+ is(host.getRootNode(), aDocument, "host.getRootNode() should be document.");
+ is(header1.getRootNode(), root, "header1.getRootNode() should be root.");
+ is(paragraph1.getRootNode(), root, "paragraph1.getRootNode() should be root.");
+ is(frag.getRootNode(), frag, "frag.getRootNode() should be frag.");
+ //dom with compose
+ is(host.getRootNode({ composed: true }) , aDocument, "host.getRootNode() with composed flag should be document.");
+ is(header1.getRootNode({ composed: true }) , aDocument, "header1.getRootNode() with composed flag should be document.");
+ is(paragraph1.getRootNode({ composed: true }) , aDocument, "paragraph1.getRootNode() with composed flag should be document.");
+ is(frag.getRootNode({ composed: true }) , frag, "frag.getRootNode() with composed flag should be frag.");
+
+ SimpleTest.finish();
+ });
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/webcomponents/test_bug1276240.html b/dom/tests/mochitest/webcomponents/test_bug1276240.html
new file mode 100644
index 0000000000..220f005138
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_bug1276240.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
+-->
+<head>
+ <title>Test for Bug 1276240</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1276240">Mozilla Bug 1276240</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 1276240 **/
+// when passing null for the second argument, it would be ignored
+
+function test() {
+ var e = document.createElement("p", null);
+ is(e.getAttribute("is"), null);
+
+ e = document.createElement("p", undefined);
+ is(e.getAttribute("is"), null);
+
+ e = document.createElementNS("http://www.w3.org/1999/xhtml", "p", null);
+ is(e.getAttribute("is"), null);
+
+ e = document.createElementNS("http://www.w3.org/1999/xhtml", "p", undefined);
+ is(e.getAttribute("is"), null);
+}
+
+test();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_bug900724.html b/dom/tests/mochitest/webcomponents/test_bug900724.html
new file mode 100644
index 0000000000..19abc37ac8
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_bug900724.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=900724
+-->
+<head>
+ <title>Test for form-association in template contents.</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=900724">Bug 900724</a>
+<form id="formone"><template id="templateone"><input></template></form>
+<form id="formthree"><template id="templatethree"></template></form>
+<form id="formfive"><template id="templatefive"></template></form>
+<script>
+is($("formone").elements.length, 0, "Forms should have no association with controls in template contents.");
+
+var templateOneInput = $("templateone").content.firstChild;
+is(templateOneInput.form, null, "Form controls inside template contents should not associate with forms.");
+
+// Try dynamically adding form/form controls using innerHTML.
+$("templatethree").innerHTML = '<input>';
+is($("formthree").elements.length, 0, "Form controls inside template contents should not associate with forms.");
+
+// Append a form control as a child of the template (not template contents) and make sure form is associated.
+var formFiveInput = document.createElement("input");
+$("templatefive").appendChild(formFiveInput);
+is($("formfive").elements.length, 1, "Form control should associate with form control not in template contents.");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html b/dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html
new file mode 100644
index 0000000000..c8a8d872ed
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1102502
+-->
+<head>
+ <title>Test for connected callback for element created in the document by the parser</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1102502">Bug 1102502</a>
+<div id="container"></div>
+
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var connectedCallbackCount = 0;
+
+class Foo extends HTMLElement {
+ connectedCallback() {
+ ok(true, "connectedCallback should be called when the parser creates an element in the document.");
+ connectedCallbackCount++;
+ // connectedCallback should be called twice, once for the element created for innerHTML and
+ // once for the element created in this document.
+ if (connectedCallbackCount == 2) {
+ SimpleTest.finish();
+ }
+ }
+};
+
+customElements.define("x-foo", Foo);
+
+var container = document.getElementById("container");
+container.innerHTML = '<x-foo></x-foo>';
+
+</script>
+
+<x-foo></x-foo>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_define.html b/dom/tests/mochitest/webcomponents/test_custom_element_define.html
new file mode 100644
index 0000000000..7ab5ed44aa
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_define.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for customElements.define</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
+<div>
+<x-unresolved id="unresolved"></x-unresolved>
+</div>
+
+<script>
+
+function testDefineExtend(tag, extend, definition, expectException) {
+ try {
+ customElements.define(tag, definition, { extends: extend });
+ ok(!expectException, "Defined " + tag + " extending " + extend + ".");
+ } catch (ex) {
+ ok(expectException, "Did not define " + tag + " extending " + extend + ".");
+ }
+}
+
+function testDefineSimple(tag, definition, expectException) {
+ try {
+ customElements.define(tag, definition);
+ ok(!expectException, "Defined " + tag + " extending HTMLElement.");
+ } catch (ex) {
+ ok(expectException, "Did not define " + tag + " extending HTMLElement.");
+ }
+}
+
+function startTest() {
+ // Test defining some simple definition.
+ testDefineSimple("x-html-obj-elem", class extends HTMLElement {}, false);
+ testDefineSimple("x-html-obj-p", class extends HTMLParagraphElement {}, false);
+
+ // Make sure the prototype on unresolved elements is HTMLElement not HTMLUnknownElement.
+ var unresolved = document.getElementById("unresolved");
+ is(unresolved.__proto__, HTMLElement.prototype, "Unresolved custom elements should have HTMLElement as prototype.");
+
+ var anotherUnresolved = document.createElement("maybe-custom-element");
+ is(anotherUnresolved.__proto__, HTMLElement.prototype, "Unresolved custom elements should have HTMLElement as prototype.");
+
+ // Test defining some invalid definition.
+ testDefineSimple("x-invalid-number", 42, true);
+ testDefineSimple("x-invalid-boolean", false, true);
+ testDefineSimple("x-invalid-float", 1.0, true);
+
+ // Test invalid custom element names.
+ testDefineSimple("invalid", class extends HTMLElement {}, true);
+ testDefineSimple("annotation-xml", class extends HTMLElement {}, true);
+ testDefineSimple("color-profile", class extends HTMLElement {}, true);
+ testDefineSimple("font-face", class extends HTMLElement {}, true);
+ testDefineSimple("font-face-src", class extends HTMLElement {}, true);
+ testDefineSimple("font-face-uri", class extends HTMLElement {}, true);
+ testDefineSimple("font-face-format", class extends HTMLElement {}, true);
+ testDefineSimple("font-face-name", class extends HTMLElement {}, true);
+ testDefineSimple("missing-glyph", class extends HTMLElement {}, true);
+
+ // Test defining elements that extend from an existing element.
+ testDefineExtend("x-extend-span", "span", class extends HTMLElement {}, false);
+ testDefineExtend("x-extend-span-caps", "SPAN", class extends HTMLElement {}, true);
+
+ // Test defining elements that extend from a non-existing element.
+ testDefineExtend("x-extend-span-nonexist", "nonexisting", class extends HTMLElement {}, true);
+
+ // Test registration with duplicate type.
+ testDefineSimple("x-dupe-me", class extends HTMLElement {}, false);
+ testDefineSimple("x-dupe-me", class extends HTMLElement {}, true);
+ testDefineSimple("X-DUPE-ME", class extends HTMLElement {}, true);
+ testDefineExtend("x-dupe-me", "span", class extends HTMLElement {}, true);
+
+ // customElements.define with extended type.
+ class ExtendButton extends HTMLButtonElement {};
+ customElements.define("x-extended-button", ExtendButton, { extends: "button" });
+ var extendedButton = document.createElement("button", {is: "x-extended-button"});
+ is(extendedButton.tagName, "BUTTON", "Created element should have local name of BUTTON");
+ is(extendedButton.__proto__, ExtendButton.prototype, "Created element should have the prototype of the extended type.");
+ is(extendedButton.getAttribute("is"), null, "The |is| attribute of the created element should not be the extended type.");
+ is(extendedButton.type, "submit", "Created element should be a button with type of \"submit\"");
+
+ // Custom element constructor.
+ var constructedButton = new ExtendButton();
+ is(constructedButton.tagName, "BUTTON", "Created element should have local name of BUTTON");
+ is(constructedButton.__proto__, ExtendButton.prototype, "Created element should have the prototype of the extended type.");
+
+ // Try creating an element with a custom element name, but not in the html namespace.
+ class XInHTMLNamespace extends HTMLElement {};
+ customElements.define("x-in-html-namespace", XInHTMLNamespace);
+ var wrongNamespaceElem = document.createElementNS("http://www.w3.org/2000/svg", "x-in-html-namespace");
+ isnot(wrongNamespaceElem.__proto__, XInHTMLNamespace.prototype, "Definition for element in html namespace should not apply to SVG elements.");
+
+ var div = document.createElement("div");
+ div.appendChild(extendedButton);
+ is(div.innerHTML, '<button is="x-extended-button"></button>', "'is value' should be serialized.");
+
+ const de = SpecialPowers.Ci.nsIDocumentEncoder;
+ var htmlencoder = SpecialPowers.Cu.createDocumentEncoder("text/html");
+ htmlencoder.init(document, "text/html", de.OutputLFLineBreak);
+ htmlencoder.setCharset("UTF-8");
+ htmlencoder.setContainerNode(div);
+ is(htmlencoder.encodeToString(), '<button is="x-extended-button"></button>',
+ "'is value' should be serialized (html).");
+
+ var xhtmlencoder = SpecialPowers.Cu.createDocumentEncoder("application/xhtml+xml");
+ xhtmlencoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak);
+ xhtmlencoder.setCharset("UTF-8");
+ xhtmlencoder.setContainerNode(div);
+ is(xhtmlencoder.encodeToString(), '<button is="x-extended-button" xmlns="http://www.w3.org/1999/xhtml"></button>',
+ "'is value' should be serialized (xhtml).");
+
+ var xmlencoder = SpecialPowers.Cu.createDocumentEncoder("text/xml");
+ xmlencoder.init(document, "text/xml", de.OutputLFLineBreak);
+ xmlencoder.setCharset("UTF-8");
+ xmlencoder.setContainerNode(div);
+ is(xmlencoder.encodeToString(), '<button is="x-extended-button" xmlns="http://www.w3.org/1999/xhtml"></button>',
+ "'is value' should be serialized (xml).");
+}
+
+startTest();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html b/dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html
new file mode 100644
index 0000000000..dc247220d4
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for customElements.define for elements created by the parser</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script>
+
+var uncaughtError;
+window.onerror = function(message, url, lineNumber, columnNumber, error) {
+ uncaughtError = error;
+};
+
+var isConnectedCallbackCalled = false;
+class XButton extends HTMLButtonElement {
+ connectedCallback() {
+ ok(!isConnectedCallbackCalled, "ConnectedCallback should only be called once.");
+ is(this.tagName, "BUTTON", "Only the <button> element should be upgraded.");
+ isConnectedCallbackCalled = true;
+ }
+};
+
+customElements.define("x-button", XButton, { extends: "button" });
+
+class XDiv extends HTMLDivElement {
+ constructor() {
+ // Queue a task to check error and callbacks.
+ setTimeout(() => {
+ ok(isConnectedCallbackCalled, "ConnectedCallback should be called.");
+ ok(uncaughtError instanceof TypeError,
+ "TypeError should be filed for upgrading <x-div> element.");
+ SimpleTest.finish();
+ }, 0);
+ super();
+ }
+
+ connectedCallback() {
+ ok(false, "Connected callback for x-div should not be called.");
+ }
+};
+
+customElements.define("x-div", XDiv);
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
+<button is="x-button"></button><!-- should be upgraded -->
+<x-button></x-button><!-- should not be upgraded -->
+<span is="x-button"></span><!-- should not be upgraded -->
+<div is="x-div"></div><!-- should not be upgraded -->
+<x-div></x-div><!-- should be upgraded, but failed -->
+<script>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html b/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html
new file mode 100644
index 0000000000..03ed2e3815
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html lang="en">
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=1813077
+ -->
+<head>
+ <meta charset="utf-8">
+ <title>Test for customElements.ensureCustomElement</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+ <script>
+ /*
+ Note: once you import one of these custom elements, they stay on the window
+ outside of the task that imported them. This can create issues if writing
+ another test in this file.
+ */
+ add_task(async function test_ensure_custom_elements() {
+ let registry = SpecialPowers.wrap(customElements);
+ ok(window.ensureCustomElements, "should be defined");
+
+ // Ensure the custom elements from ESModules are not defined.
+ is(registry.get("moz-button-group"), undefined, "moz-button-group should be undefined since we have not yet imported it");
+ is(registry.get("moz-support-link"), undefined, "moz-support-link should be undefined since we have not yet imported it");
+ is(registry.get("moz-toggle"), undefined, "moz-toggle should be undefined since we have not yet imported it");
+
+ // Import a single custom element and assert it exists in the custom
+ // element registry
+ let modules = await window.ensureCustomElements("moz-support-link");
+ ok(registry.get("moz-support-link"), "moz-support-link should be defined after importing it");
+ is(modules, null, "There should not be a return value when using ensureCustomElements");
+
+ // Import multiple custom elements and assert they exist in the registry
+ modules = undefined;
+ is(registry.get("moz-button-group"), undefined, "moz-button-group should be undefined since we have not yet imported it");
+ is(registry.get("moz-toggle"), undefined, "moz-toggle should be undefined since we have not yet imported it")
+ modules = await window.ensureCustomElements("moz-toggle", "moz-button-group");
+ is(modules, null, "There should not be a return value when using ensureCustomElements");
+ ok(registry.get("moz-toggle"), "moz-toggle should be defined after importing it");
+ ok(registry.get("moz-button-group"), "moz-button-group should be defined after importing it");
+
+ // Ensure there are no errors if the imported elements are imported
+ // again
+ modules = undefined;
+ modules = await window.ensureCustomElements("moz-support-link", "moz-toggle", "moz-button-group");
+ ok(true, "The custom elements should not throw an error if imported again");
+ is(modules, null, "There should not be a return value when using ensureCustomElements");
+ })
+ </script>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_get.html b/dom/tests/mochitest/webcomponents/test_custom_element_get.html
new file mode 100644
index 0000000000..0688d21aaa
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_get.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1275838
+-->
+<head>
+ <title>Test custom elements get function.</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<iframe id="iframe"></iframe>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1275838">Bug 1275838</a>
+<script>
+const testWindow = iframe.contentDocument.defaultView;
+const customElements = testWindow.customElements;
+
+ok('customElements' in testWindow, '"window.customElements" exists');
+ok('define' in customElements, '"window.customElements.define" exists');
+ok('get' in customElements, '"window.customElements.get" exists');
+
+const name = 'test-get-existing';
+class C extends HTMLElement {};
+customElements.define(name, C);
+is(customElements.get(name), C, 'get() returns the constructor');
+is(customElements.get('test-get-not-defined'), undefined,
+ 'get() returns undefined for not-defined name');
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html
new file mode 100644
index 0000000000..c295a15038
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1274159
+-->
+<head>
+ <title>Test HTMLConstructor for custom elements.</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1274159">Bug 1274159</a>
+<script type="text/javascript">
+function test_with_new_window(f) {
+ return new Promise((aResolve) => {
+ let iframe = document.createElement('iframe');
+ iframe.setAttribute('type', 'content');
+ iframe.setAttribute('src', 'dummy_page.html');
+ iframe.onload = function() {
+ f(iframe.contentWindow);
+ aResolve();
+ };
+ document.body.appendChild(iframe);
+ });
+}
+
+// Fake the Cu.waiveXrays, so that we can share the tests with mochitest chrome.
+var Cu = { waiveXrays: (obj) => obj };
+var promises = [];
+SimpleTest.waitForExplicitFinish();
+</script>
+<!-- Test cases for autonomous element -->
+<script type="text/javascript" src="htmlconstructor_autonomous_tests.js"></script>
+<!-- Test cases for customized built-in element -->
+<script type="text/javascript" src="htmlconstructor_builtin_tests.js"></script>
+<script type="text/javascript">
+Promise.all(promises).then(() => {
+ SimpleTest.finish();
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html
new file mode 100644
index 0000000000..2adb0aac28
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1274159
+-->
+<head>
+ <title>Test HTMLConstructor for custom elements.</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1274159">Bug 1274159</a>
+<script type="text/javascript">
+function test_with_new_window(f) {
+ return new Promise((aResolve) => {
+ let iframe = document.createElement('iframe');
+ iframe.setAttribute('type', 'content');
+ iframe.setAttribute('src', 'http://example.org/tests/dom/tests/mochitest/webcomponents/dummy_page.html');
+ iframe.onload = function() {
+ f(iframe.contentWindow);
+ aResolve();
+ };
+ document.body.appendChild(iframe);
+ });
+}
+
+var promises = [];
+SimpleTest.waitForExplicitFinish();
+</script>
+<!-- Test cases for autonomous element -->
+<script type="text/javascript" src="htmlconstructor_autonomous_tests.js"></script>
+<!-- Test cases for customized built-in element -->
+<script type="text/javascript" src="htmlconstructor_builtin_tests.js"></script>
+<script type="text/javascript">
+Promise.all(promises).then(() => {
+ SimpleTest.finish();
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html b/dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html
new file mode 100644
index 0000000000..4371d296ce
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1087460
+-->
+<head>
+ <title>Test for custom element callbacks in shadow DOM.</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1087460">Bug 1087460</a>
+
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div id="container"></div>';
+createIframe(content)
+ .then((aDocument) => {
+
+ // Test callback for custom element when used after registration.
+
+ var iframeWin = aDocument.defaultView;
+ var connectedCallbackCount = 0;
+ var disconnectedCallbackCount = 0;
+ var attributeChangedCallbackCount = 0;
+
+ class Foo extends iframeWin.HTMLElement
+ {
+ connectedCallback() {
+ connectedCallbackCount++;
+ }
+
+ disconnectedCallback() {
+ disconnectedCallbackCount++;
+ }
+
+ attributeChangedCallback(aName, aOldValue, aNewValue) {
+ attributeChangedCallbackCount++;
+ }
+
+ static get observedAttributes() {
+ return ["data-foo"];
+ }
+ }
+
+ iframeWin.customElements.define("x-foo", Foo);
+
+ var container = aDocument.getElementById("container");
+ var shadow = container.attachShadow({mode: "open"});
+ var customElem = aDocument.createElement("x-foo");
+
+ is(attributeChangedCallbackCount, 0, "attributeChangedCallback should not be called after just creating an element.");
+ customElem.setAttribute("data-foo", "bar");
+ is(attributeChangedCallbackCount, 1, "attributeChangedCallback should be called after setting an attribute.");
+
+ is(connectedCallbackCount, 0, "connectedCallback should not be called on an element that is not in a document/composed document.");
+ shadow.appendChild(customElem);
+ is(connectedCallbackCount, 1, "connectedCallback should be called after attaching custom element to the composed document.");
+
+ is(disconnectedCallbackCount, 0, "disconnectedCallback should not be called without detaching custom element.");
+ shadow.removeChild(customElem);
+ is(disconnectedCallbackCount, 1, "disconnectedCallback should be called after detaching custom element from the composed document.");
+
+ // Test callback for custom element already in the composed doc when created.
+
+ connectedCallbackCount = 0;
+ disconnectedCallbackCount = 0;
+ attributeChangedCallbackCount = 0;
+
+ shadow.innerHTML = "<x-foo></x-foo>";
+ is(connectedCallbackCount, 1, "connectedCallback should be called after creating an element in the composed document.");
+
+ shadow.innerHTML = "";
+ is(disconnectedCallbackCount, 1, "disconnectedCallback should be called after detaching custom element from the composed document.");
+
+ // Test callback for custom element in shadow DOM when host attached/detached to/from document.
+
+ connectedCallbackCount = 0;
+ disconnectedCallbackCount = 0;
+ attributeChangedCallbackCount = 0;
+
+ var host = aDocument.createElement("div");
+ shadow = host.attachShadow({mode: "open"});
+ customElem = aDocument.createElement("x-foo");
+
+ is(connectedCallbackCount, 0, "connectedCallback should not be called on newly created element.");
+ shadow.appendChild(customElem);
+ is(connectedCallbackCount, 0, "connectedCallback should not be called on attaching to a tree that is not in the composed document.");
+
+ is(disconnectedCallbackCount, 0, "disconnectedCallback should not be called.");
+ shadow.removeChild(customElem);
+ is(disconnectedCallbackCount, 0, "disconnectedCallback should not be called when detaching from a tree that is not in the composed document.");
+
+ shadow.appendChild(customElem);
+ is(connectedCallbackCount, 0, "connectedCallback should still not be called after reattaching to a shadow tree that is not in the composed document.");
+
+ container.appendChild(host);
+ is(connectedCallbackCount, 1, "connectedCallback should be called after host is inserted into document.");
+
+ container.removeChild(host);
+ is(disconnectedCallbackCount, 1, "disconnectedCallback should be called after host is removed from document.");
+
+ // Test callback for custom element for upgraded element.
+
+ connectedCallbackCount = 0;
+ disconnectedCallbackCount = 0;
+ attributeChangedCallbackCount = 0;
+
+ shadow = container.shadowRoot;
+ shadow.innerHTML = "<x-bar></x-bar>";
+
+ class Bar extends iframeWin.HTMLElement {
+ connectedCallback() {
+ connectedCallbackCount++;
+ }
+ };
+
+ iframeWin.customElements.define("x-bar", Bar);
+ is(connectedCallbackCount, 1, "connectedCallback should be called after upgrading element in composed document.");
+
+ SimpleTest.finish();
+ });
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html b/dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html
new file mode 100644
index 0000000000..a02d0b297b
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html
@@ -0,0 +1,432 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for custom elements lifecycle callback</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
+<div id="container">
+ <x-hello id="hello"></x-hello>
+ <button id="extbutton" is="x-button"></button>
+</div>
+<script>
+
+var container = document.getElementById("container");
+
+// Tests callbacks after defining element type that is already in the document.
+// create element in document -> define -> remove from document
+function testRegisterUnresolved() {
+ var helloElem = document.getElementById("hello");
+
+ var connectedCallbackCalled = false;
+ var disconnectedCallbackCalled = false;
+
+ class Hello extends HTMLElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called once in this test.");
+ is(this, helloElem, "The 'this' value should be the custom element.");
+ connectedCallbackCalled = true;
+ }
+
+ disconnectedCallback() {
+ is(connectedCallbackCalled, true, "Connected callback should be called before detached");
+ is(disconnectedCallbackCalled, false, "Disconnected callback should only be called once in this test.");
+ disconnectedCallbackCalled = true;
+ is(this, helloElem, "The 'this' value should be the custom element.");
+ runNextTest();
+ }
+
+ attributeChangedCallback(name, oldValue, newValue) {
+ ok(false, "attributeChanged callback should never be called in this test.");
+ }
+ };
+
+ customElements.define("x-hello", Hello);
+
+ // Remove element from document to trigger disconnected callback.
+ container.removeChild(helloElem);
+}
+
+// Tests callbacks after defining an extended element type that is already in the document.
+// create element in document -> define -> remove from document
+function testRegisterUnresolvedExtended() {
+ var buttonElem = document.getElementById("extbutton");
+
+ var connectedCallbackCalled = false;
+ var disconnectedCallbackCalled = false;
+
+ class XButton extends HTMLButtonElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called once in this test.");
+ is(this, buttonElem, "The 'this' value should be the custom element.");
+ connectedCallbackCalled = true;
+ }
+
+ disconnectedCallback() {
+ is(connectedCallbackCalled, true, "Connected callback should be called before detached");
+ is(disconnectedCallbackCalled, false, "Disconnected callback should only be called once in this test.");
+ disconnectedCallbackCalled = true;
+ is(this, buttonElem, "The 'this' value should be the custom element.");
+ runNextTest();
+ }
+
+ attributeChangedCallback(name, oldValue, newValue) {
+ ok(false, "attributeChanged callback should never be called in this test.");
+ }
+ };
+
+ customElements.define("x-button", XButton, { extends: "button" });
+
+ // Remove element from document to trigger disconnected callback.
+ container.removeChild(buttonElem);
+}
+
+function testInnerHTML() {
+ var connectedCallbackCalled = false;
+
+ class XInnerHTML extends HTMLElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called once in this test.");
+ connectedCallbackCalled = true;
+ }
+ };
+
+ customElements.define("x-inner-html", XInnerHTML);
+ var div = document.createElement(div);
+ document.documentElement.appendChild(div);
+ div.innerHTML = '<x-inner-html></x-inner-html>';
+ is(connectedCallbackCalled, true, "Connected callback should be called after setting innerHTML.");
+ runNextTest();
+}
+
+function testInnerHTMLExtended() {
+ var connectedCallbackCalled = false;
+
+ class XInnerHTMLExtend extends HTMLButtonElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called once in this test.");
+ connectedCallbackCalled = true;
+ }
+ };
+
+ customElements.define("x-inner-html-extended", XInnerHTMLExtend, { extends: "button" });
+ var div = document.createElement(div);
+ document.documentElement.appendChild(div);
+ div.innerHTML = '<button is="x-inner-html-extended"></button>';
+ is(connectedCallbackCalled, true, "Connected callback should be called after setting innerHTML.");
+ runNextTest();
+}
+
+function testInnerHTMLUpgrade() {
+ var connectedCallbackCalled = false;
+
+ var div = document.createElement(div);
+ document.documentElement.appendChild(div);
+ div.innerHTML = '<x-inner-html-upgrade></x-inner-html-upgrade>';
+
+ class XInnerHTMLUpgrade extends HTMLElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called once in this test.");
+ connectedCallbackCalled = true;
+ }
+ };
+
+ customElements.define("x-inner-html-upgrade", XInnerHTMLUpgrade);
+ is(connectedCallbackCalled, true, "Connected callback should be called after registering.");
+ runNextTest();
+}
+
+function testInnerHTMLExtendedUpgrade() {
+ var connectedCallbackCalled = false;
+
+ var div = document.createElement(div);
+ document.documentElement.appendChild(div);
+ div.innerHTML = '<button is="x-inner-html-extended-upgrade"></button>';
+
+ class XInnerHTMLExtnedUpgrade extends HTMLButtonElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called once in this test.");
+ connectedCallbackCalled = true;
+ }
+ };
+
+ customElements.define("x-inner-html-extended-upgrade", XInnerHTMLExtnedUpgrade, { extends: "button" });
+ is(connectedCallbackCalled, true, "Connected callback should be called after registering.");
+ runNextTest();
+}
+
+// Test callback when creating element after defining an element type.
+// define -> create element -> insert into document -> remove from document
+function testRegisterResolved() {
+ var connectedCallbackCalled = false;
+ var disconnectedCallbackCalled = false;
+
+ class Resolved extends HTMLElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called on in this test.");
+ is(this, createdElement, "The 'this' value should be the custom element.");
+ connectedCallbackCalled = true;
+ }
+
+ disconnectedCallback() {
+ is(connectedCallbackCalled, true, "Connected callback should be called before detached");
+ is(disconnectedCallbackCalled, false, "Disconnected callback should only be called once in this test.");
+ is(this, createdElement, "The 'this' value should be the custom element.");
+ disconnectedCallbackCalled = true;
+ runNextTest();
+ }
+
+ attributeChangedCallback() {
+ ok(false, "attributeChanged callback should never be called in this test.");
+ }
+ };
+
+ customElements.define("x-resolved", Resolved);
+
+ var createdElement = document.createElement("x-resolved");
+ is(createdElement.__proto__, Resolved.prototype, "Prototype of custom element should be the defined prototype.");
+
+ // Insert element into document to trigger attached callback.
+ container.appendChild(createdElement);
+
+ // Remove element from document to trigger detached callback.
+ container.removeChild(createdElement);
+}
+
+// Callbacks should always be the same ones when registered.
+function testChangingCallback() {
+ var callbackCalled = false;
+
+ class TestCallback extends HTMLElement
+ {
+ attributeChangedCallback(aName, aOldValue, aNewValue) {
+ is(callbackCalled, false, "Callback should only be called once in this test.");
+ callbackCalled = true;
+ runNextTest();
+ }
+
+ static get observedAttributes() {
+ return ["data-foo"];
+ }
+ }
+
+ customElements.define("x-test-callback", TestCallback);
+
+ TestCallback.prototype.attributeChangedCallback = function(name, oldValue, newValue) {
+ ok(false, "Only callbacks at registration should be called.");
+ };
+
+ var elem = document.createElement("x-test-callback");
+ elem.setAttribute("data-foo", "bar");
+}
+
+function testAttributeChanged() {
+ var createdElement;
+ // Sequence of callback arguments that we expect from attribute changed callback
+ // after changing attributes values in a specific order.
+ var expectedCallbackArguments = [
+ // [oldValue, newValue]
+ [null, "newvalue"], // Setting the attribute value to "newvalue"
+ ["newvalue", "nextvalue"], // Changing the attribute value from "newvalue" to "nextvalue"
+ ["nextvalue", ""], // Changing the attribute value from "nextvalue" to empty string
+ ["", null], // Removing the attribute.
+ ];
+
+ class AttrChange extends HTMLElement
+ {
+ attributeChangedCallback(name, oldValue, newValue) {
+ is(this, createdElement, "The 'this' value should be the custom element.");
+ ok(expectedCallbackArguments.length, "Attribute changed callback should not be called more than expected.");
+
+ is(name, "changeme", "name arugment in attribute changed callback should be the name of the changed attribute.");
+
+ var expectedArgs = expectedCallbackArguments.shift();
+ is(oldValue, expectedArgs[0], "The old value argument should match the expected value.");
+ is(newValue, expectedArgs[1], "The new value argument should match the expected value.");
+
+ if (expectedCallbackArguments.length === 0) {
+ // Done with the attribute changed callback test.
+ runNextTest();
+ }
+ }
+
+ static get observedAttributes() {
+ return ["changeme"];
+ }
+ }
+
+ customElements.define("x-attrchange", AttrChange);
+
+ createdElement = document.createElement("x-attrchange");
+ createdElement.setAttribute("changeme", "newvalue");
+ createdElement.setAttribute("changeme", "nextvalue");
+ createdElement.setAttribute("changeme", "");
+ createdElement.removeAttribute("changeme");
+}
+
+function testAttributeChangedExtended() {
+ var callbackCalled = false;
+
+ class ExtnededAttributeChange extends HTMLButtonElement
+ {
+ attributeChangedCallback(name, oldValue, newValue) {
+ is(callbackCalled, false, "Callback should only be called once in this test.");
+ callbackCalled = true;
+ runNextTest();
+ }
+
+ static get observedAttributes() {
+ return ["foo"];
+ }
+ }
+
+ customElements.define("x-extended-attribute-change", ExtnededAttributeChange,
+ { extends: "button" });
+
+ var elem = document.createElement("button", {is: "x-extended-attribute-change"});
+ elem.setAttribute("foo", "bar");
+}
+
+function testStyleAttributeChange() {
+ var expectedCallbackArguments = [
+ // [name, oldValue, newValue]
+ ["style", null, "font-size: 10px;"],
+ ["style", "font-size: 10px;", "font-size: 20px;"],
+ ["style", "font-size: 20px;", "font-size: 30px;"],
+ ];
+
+ customElements.define("x-style-attribute-change", class extends HTMLElement {
+ attributeChangedCallback(name, oldValue, newValue) {
+ if (expectedCallbackArguments.length === 0) {
+ ok(false, "Got unexpected attributeChangedCallback?");
+ return;
+ }
+
+ let expectedArgument = expectedCallbackArguments.shift();
+ is(name, expectedArgument[0],
+ "The name argument should match the expected value.");
+ is(oldValue, expectedArgument[1],
+ "The old value argument should match the expected value.");
+ is(newValue, expectedArgument[2],
+ "The new value argument should match the expected value.");
+ }
+
+ static get observedAttributes() {
+ return ["style"];
+ }
+ });
+
+ var elem = document.createElement("x-style-attribute-change");
+ elem.style.fontSize = "10px";
+ elem.style.fontSize = "20px";
+ elem.style.fontSize = "30px";
+
+ ok(expectedCallbackArguments.length === 0,
+ "The attributeChangedCallback should be fired synchronously.");
+ runNextTest();
+}
+
+// Creates a custom element that is an upgrade candidate (no registration)
+// and mutate the element in ways that would call callbacks for registered
+// elements.
+function testUpgradeCandidate() {
+ var createdElement = document.createElement("x-upgrade-candidate");
+ container.appendChild(createdElement);
+ createdElement.setAttribute("foo", "bar");
+ container.removeChild(createdElement);
+ ok(true, "Nothing bad should happen when trying to mutating upgrade candidates.");
+ runNextTest();
+}
+
+function testNotInDocEnterLeave() {
+ class DestinedForFragment extends HTMLElement {
+ connectedCallback() {
+ ok(false, "Connected callback should not be called.");
+ }
+
+ disconnectedCallback() {
+ ok(false, "Disconnected callback should not be called.");
+ }
+ };
+
+ var createdElement = document.createElement("x-destined-for-fragment");
+
+ customElements.define("x-destined-for-fragment", DestinedForFragment);
+
+ var fragment = new DocumentFragment();
+ fragment.appendChild(createdElement);
+ fragment.removeChild(createdElement);
+
+ var divNotInDoc = document.createElement("div");
+ divNotInDoc.appendChild(createdElement);
+ divNotInDoc.removeChild(createdElement);
+
+ runNextTest();
+}
+
+function testEnterLeaveView() {
+ var connectedCallbackCalled = false;
+ var disconnectedCallbackCalled = false;
+
+ class ElementInDiv extends HTMLElement {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should only be called on in this test.");
+ connectedCallbackCalled = true;
+ }
+
+ disconnectedCallback() {
+ is(connectedCallbackCalled, true, "Connected callback should be called before detached");
+ is(disconnectedCallbackCalled, false, "Disconnected callback should only be called once in this test.");
+ disconnectedCallbackCalled = true;
+ runNextTest();
+ }
+ };
+
+ var div = document.createElement("div");
+ customElements.define("x-element-in-div", ElementInDiv);
+ var customElement = document.createElement("x-element-in-div");
+ div.appendChild(customElement);
+ is(connectedCallbackCalled, false, "Appending a custom element to a node that is not in the document should not call the connected callback.");
+
+ container.appendChild(div);
+ container.removeChild(div);
+}
+
+var testFunctions = [
+ testRegisterUnresolved,
+ testRegisterUnresolvedExtended,
+ testInnerHTML,
+ testInnerHTMLExtended,
+ testInnerHTMLUpgrade,
+ testInnerHTMLExtendedUpgrade,
+ testRegisterResolved,
+ testAttributeChanged,
+ testAttributeChangedExtended,
+ testStyleAttributeChange,
+ testUpgradeCandidate,
+ testChangingCallback,
+ testNotInDocEnterLeave,
+ testEnterLeaveView,
+ SimpleTest.finish
+];
+
+function runNextTest() {
+ if (testFunctions.length) {
+ var nextTestFunction = testFunctions.shift();
+ info(`Start ${nextTestFunction.name} ...`);
+ nextTestFunction();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+runNextTest();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_namespace.html b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.html
new file mode 100644
index 0000000000..a4dc4c40cc
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.html
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Custom Elements in an HTML document</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+ <script>
+ SimpleTest.waitForExplicitFinish();
+
+ const HTML_NS = "http://www.w3.org/1999/xhtml";
+ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ class TestXULCustomElement extends XULElement {
+ constructor() {
+ super();
+ }
+
+ get connected() {
+ return true;
+ }
+ }
+
+ customElements.define("test-xul-element", TestXULCustomElement);
+
+ class TestHTMLCustomElement extends HTMLElement {
+ constructor() {
+ super();
+ }
+
+ get connected() {
+ return true;
+ }
+ }
+
+ customElements.define("test-html-element", TestHTMLCustomElement);
+
+ function checkElement(element, ns, connected, type) {
+ is(element.namespaceURI, ns, `${type} should have the correct namespace`);
+ if (connected) {
+ ok(element.connected, `${type} should have applied the class`);
+ } else {
+ is(element.connected, undefined, `${type} should not have applied the class`);
+ }
+ }
+
+ function runTest() {
+ let element = new TestXULCustomElement();
+ checkElement(element, XUL_NS, true, "instantiated XUL");
+
+ element = document.getElementById("xul2");
+ checkElement(element, HTML_NS, false, "parsed XUL as HTML");
+
+ element = document.createElement("test-xul-element");
+ checkElement(element, HTML_NS, false, "document.createElement(XUL)");
+
+ element = document.createXULElement("test-xul-element");
+ checkElement(element, XUL_NS, true, "document.createXULElement(XUL)");
+
+ element = document.createElementNS(XUL_NS, "test-xul-element");
+ checkElement(element, XUL_NS, true, "document.createElementNS(XUL, XUL)");
+
+ element = document.createElementNS(HTML_NS, "test-xul-element");
+ checkElement(element, HTML_NS, false, "document.createElementNS(HTML, XUL)");
+
+ element = new TestHTMLCustomElement();
+ checkElement(element, HTML_NS, true, "instantiated HTML");
+
+ element = document.getElementById("html2");
+ checkElement(element, HTML_NS, true, "parsed HTML as HTML");
+
+ element = document.createElement("test-html-element");
+ checkElement(element, HTML_NS, true, "document.createElement(HTML)");
+
+ element = document.createXULElement("test-html-element");
+ checkElement(element, XUL_NS, false, "document.createXULElement(HTML)");
+
+ element = document.createElementNS(XUL_NS, "test-html-element");
+ checkElement(element, XUL_NS, false, "document.createElementNS(XUL, HTML)");
+
+ element = document.createElementNS(HTML_NS, "test-html-element");
+ checkElement(element, HTML_NS, true, "document.createElementNS(HTML, HTML)");
+
+ SimpleTest.finish();
+ }
+ </script>
+</head>
+<body onload="runTest();">
+ <p id="display"></p>
+ <div id="content">
+ <test-xul-element id="xul2"/>
+ <test-html-element id="html2"/>
+ </div>
+ <pre id="test"></pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml
new file mode 100644
index 0000000000..5bfdd779ad
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Custom Elements in an XHTML document</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+ <script>
+ SimpleTest.waitForExplicitFinish();
+
+ const HTML_NS = "http://www.w3.org/1999/xhtml";
+ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ class TestXULCustomElement extends XULElement {
+ constructor() {
+ super();
+ }
+
+ get connected() {
+ return true;
+ }
+ }
+
+ customElements.define("test-xul-element", TestXULCustomElement);
+
+ class TestHTMLCustomElement extends HTMLElement {
+ constructor() {
+ super();
+ }
+
+ get connected() {
+ return true;
+ }
+ }
+
+ customElements.define("test-html-element", TestHTMLCustomElement);
+
+ function checkElement(element, ns, connected, type) {
+ is(element.namespaceURI, ns, `${type} should have the correct namespace`);
+ if (connected) {
+ ok(element.connected, `${type} should have applied the class`);
+ } else {
+ is(element.connected, undefined, `${type} should not have applied the class`);
+ }
+ }
+
+ function runTest() {
+ let element = new TestXULCustomElement();
+ checkElement(element, XUL_NS, true, "instantiated XUL");
+
+ element = document.getElementById("xul1");
+ checkElement(element, XUL_NS, true, "parsed XUL as XUL");
+
+ element = document.getElementById("xul2");
+ checkElement(element, HTML_NS, false, "parsed XUL as HTML");
+
+ element = document.createElement("test-xul-element");
+ checkElement(element, HTML_NS, false, "document.createElement(XUL)");
+
+ element = document.createXULElement("test-xul-element");
+ checkElement(element, XUL_NS, true, "document.createXULElement(XUL)");
+
+ element = document.createElementNS(XUL_NS, "test-xul-element");
+ checkElement(element, XUL_NS, true, "document.createElementNS(XUL, XUL)");
+
+ element = document.createElementNS(HTML_NS, "test-xul-element");
+ checkElement(element, HTML_NS, false, "document.createElementNS(HTML, XUL)");
+
+ element = new TestHTMLCustomElement();
+ checkElement(element, HTML_NS, true, "instantiated HTML");
+
+ element = document.getElementById("html1");
+ checkElement(element, XUL_NS, false, "parsed HTML as XUL");
+
+ element = document.getElementById("html2");
+ checkElement(element, HTML_NS, true, "parsed HTML as HTML");
+
+ element = document.createElement("test-html-element");
+ checkElement(element, HTML_NS, true, "document.createElement(HTML)");
+
+ element = document.createXULElement("test-html-element");
+ checkElement(element, XUL_NS, false, "document.createXULElement(HTML)");
+
+ element = document.createElementNS(XUL_NS, "test-html-element");
+ checkElement(element, XUL_NS, false, "document.createElementNS(XUL, HTML)");
+
+ element = document.createElementNS(HTML_NS, "test-html-element");
+ checkElement(element, HTML_NS, true, "document.createElementNS(HTML, HTML)");
+
+ SimpleTest.finish();
+ }
+ </script>
+</head>
+<body onload="runTest();">
+ <p id="display"></p>
+ <div id="content">
+ <test-xul-element xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="xul1"/>
+ <test-html-element xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="html1"/>
+ <test-xul-element id="xul2"/>
+ <test-html-element id="html2"/>
+ </div>
+ <pre id="test"></pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html b/dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html
new file mode 100644
index 0000000000..6a8f127d93
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1460815
+-->
+<head>
+ <title>Test for customElements.setElementCreationCallback</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1460815">Bug 1460815</a>
+<div>
+</div>
+
+<script>
+
+let registry = SpecialPowers.wrap(customElements);
+
+function simpleTest() {
+ let callbackCalled = false;
+ class XObjElement extends HTMLElement {};
+ registry.setElementCreationCallback("x-html-obj-elem", (type) => {
+ if (callbackCalled) {
+ ok(false, "Callback should not be invoked more than once.");
+ }
+ callbackCalled = true;
+ is(type, "x-html-obj-elem", "Type is passed to the callback.");
+ customElements.define("x-html-obj-elem", XObjElement);
+ });
+ ok(!callbackCalled, "Callback should not be called.");
+ let el = document.createElement("x-html-obj-elem");
+ ok(callbackCalled, "Callback should be called.");
+ is(Object.getPrototypeOf(el), XObjElement.prototype, "Created element should have the prototype of the custom type.");
+}
+
+function multipleDefinitionTest() {
+ let callbackCalled = false;
+ class XObjElement1 extends HTMLElement {};
+ class XObjElement2 extends HTMLElement {};
+ let callback = (type) => {
+ if (callbackCalled) {
+ ok(false, "Callback should not be invoked more than once.");
+ }
+ callbackCalled = true;
+ is(type, "x-html-obj-elem1", "Type is passed to the callback.");
+ customElements.define("x-html-obj-elem1", XObjElement1);
+ customElements.define("x-html-obj-elem2", XObjElement2);
+ };
+ registry.setElementCreationCallback("x-html-obj-elem1", callback);
+ registry.setElementCreationCallback("x-html-obj-elem2", callback);
+ ok(!callbackCalled, "Callback should not be called.");
+ let el1 = document.createElement("x-html-obj-elem1");
+ ok(callbackCalled, "Callback should be called.");
+ is(Object.getPrototypeOf(el1), XObjElement1.prototype, "Created element should have the prototype of the custom type.");
+ let el2 = document.createElement("x-html-obj-elem2");
+ is(Object.getPrototypeOf(el2), XObjElement2.prototype, "Created element should have the prototype of the custom type.");
+}
+
+function throwIfDefined() {
+ let callbackCalled = false;
+ class XObjElement3 extends HTMLElement {};
+ customElements.define("x-html-obj-elem3", XObjElement3);
+ try {
+ registry.setElementCreationCallback(
+ "x-html-obj-elem3", () => callbackCalled = true);
+ } catch (e) {
+ ok(true, "Set a callback on defined type should throw.");
+ }
+ ok(!callbackCalled, "Callback should not be called.");
+}
+
+function throwIfSetTwice() {
+ let callbackCalled = false;
+ registry.setElementCreationCallback(
+ "x-html-obj-elem4", () => callbackCalled = true);
+ try {
+ registry.setElementCreationCallback(
+ "x-html-obj-elem4", () => callbackCalled = true);
+ } catch (e) {
+ ok(true, "Callack shouldn't be set twice on the same type.");
+ }
+ ok(!callbackCalled, "Callback should not be called.");
+}
+
+function simpleExtendedTest() {
+ let callbackCalled = false;
+ class ExtendButton extends HTMLButtonElement {};
+ registry.setElementCreationCallback("x-extended-button", (type) => {
+ if (callbackCalled) {
+ ok(false, "Callback should not be invoked more than once.");
+ }
+ callbackCalled = true;
+ customElements.define("x-extended-button", ExtendButton, { extends: "button" });
+ is(type, "x-extended-button", "Type is passed to the callback.");
+ });
+ ok(!callbackCalled, "Callback should not be called.");
+ let el = document.createElement("button", { is: "x-extended-button"});
+ ok(callbackCalled, "Callback should be called.");
+ is(Object.getPrototypeOf(el), ExtendButton.prototype, "Created element should have the prototype of the extended type.");
+ is(el.getAttribute("is"), null, "The |is| attribute of the created element should not be the extended type.");
+}
+
+function simpleInnerHTMLTest() {
+ let callbackCalled = false;
+ class XObjElement4 extends HTMLElement {};
+ registry.setElementCreationCallback("x-html-obj-elem5", (type) => {
+ if (callbackCalled) {
+ ok(false, "Callback should not be invoked more than once.");
+ }
+ callbackCalled = true;
+ is(type, "x-html-obj-elem5", "Type is passed to the callback.");
+ customElements.define("x-html-obj-elem5", XObjElement4);
+ });
+ ok(!callbackCalled, "Callback should not be called.");
+ let p = document.createElement("p");
+ p.innerHTML = "<x-html-obj-elem5></x-html-obj-elem5>";
+ let el = p.firstChild;
+ ok(callbackCalled, "Callback should be called.");
+ is(Object.getPrototypeOf(el), XObjElement4.prototype, "Created element should have the prototype of the custom type.");
+}
+
+function twoElementInnerHTMLTest() {
+ let callbackCalled = false;
+ class XObjElement5 extends HTMLElement {};
+ registry.setElementCreationCallback("x-html-obj-elem6", (type) => {
+ if (callbackCalled) {
+ ok(false, "Callback should not be invoked more than once.");
+ }
+ callbackCalled = true;
+ is(type, "x-html-obj-elem6", "Type is passed to the callback.");
+ customElements.define("x-html-obj-elem6", XObjElement5);
+ });
+ ok(!callbackCalled, "Callback should not be called.");
+ let p = document.createElement("p");
+ p.innerHTML =
+ "<x-html-obj-elem6></x-html-obj-elem6><x-html-obj-elem6></x-html-obj-elem6>";
+ let el1 = p.firstChild;
+ let el2 = p.lastChild;
+ ok(callbackCalled, "Callback should be called.");
+ is(Object.getPrototypeOf(el1), XObjElement5.prototype, "Created element should have the prototype of the custom type.");
+ is(Object.getPrototypeOf(el2), XObjElement5.prototype, "Created element should have the prototype of the custom type.");
+}
+
+function startTest() {
+ simpleTest();
+ multipleDefinitionTest();
+ throwIfDefined();
+ throwIfSetTwice();
+ simpleExtendedTest();
+ simpleInnerHTMLTest();
+ twoElementInnerHTMLTest();
+}
+
+startTest();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_stack.html b/dom/tests/mochitest/webcomponents/test_custom_element_stack.html
new file mode 100644
index 0000000000..1b20103eb7
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_stack.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for custom elements lifecycle callback</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
+<div id="container">
+</div>
+<script>
+
+var container = document.getElementById("container");
+
+function testChangeAttributeInEnteredViewCallback() {
+ var attributeChangedCallbackCalled = false;
+ var connectedCallbackCalled = false;
+
+ class Two extends HTMLElement
+ {
+ connectedCallback() {
+ is(connectedCallbackCalled, false, "Connected callback should be called only once in this test.");
+ connectedCallbackCalled = true;
+ is(attributeChangedCallbackCalled, false, "Attribute changed callback should not be called before changing attribute.");
+ this.setAttribute("foo", "bar");
+ is(attributeChangedCallbackCalled, true, "Transition from user-agent implementation to script should result in attribute changed callback being called.");
+ runNextTest();
+ }
+
+ attributeChangedCallback() {
+ is(connectedCallbackCalled, true, "Connected callback should have been called prior to attribute changed callback.");
+ is(attributeChangedCallbackCalled, false, "Attribute changed callback should only be called once in this tests.");
+ attributeChangedCallbackCalled = true;
+ }
+
+ static get observedAttributes() {
+ return ["foo"];
+ }
+ }
+
+ customElements.define("x-two", Two);
+ var elem = document.createElement("x-two");
+
+ var container = document.getElementById("container");
+ container.appendChild(elem);
+}
+
+function testLeaveViewInEnteredViewCallback() {
+ var connectedCallbackCalled = false;
+ var disconnectedCallbackCalled = false;
+ var container = document.getElementById("container");
+
+ class Three extends HTMLElement {
+ connectedCallback() {
+ is(this.parentNode, container, "Parent node should the container in which the node was appended.");
+ is(connectedCallbackCalled, false, "Connected callback should be called only once in this test.");
+ connectedCallbackCalled = true;
+ is(disconnectedCallbackCalled, false, "Disconnected callback should not be called prior to removing element from document.");
+ container.removeChild(this);
+ is(disconnectedCallbackCalled, true, "Transition from user-agent implementation to script should run left view callback.");
+ runNextTest();
+ }
+
+ disconnectedCallback() {
+ is(disconnectedCallbackCalled, false, "The disconnected callback should only be called once in this test.");
+ is(connectedCallbackCalled, true, "The connected callback should be called prior to disconnected callback.");
+ disconnectedCallbackCalled = true;
+ }
+ };
+
+ customElements.define("x-three", Three);
+ var elem = document.createElement("x-three");
+
+ container.appendChild(elem);
+}
+
+function testStackedAttributeChangedCallback() {
+ var attributeChangedCallbackCount = 0;
+
+ var attributeSequence = ["foo", "bar", "baz"];
+
+ class Four extends HTMLElement
+ {
+ attributeChangedCallback(attrName, oldValue, newValue) {
+ if (newValue == "baz") {
+ return;
+ }
+
+ var nextAttribute = attributeSequence.shift();
+ ok(true, nextAttribute);
+ // Setting this attribute will call this function again, when
+ // control returns to the script, the last attribute in the sequence should
+ // be set on the element.
+ this.setAttribute("foo", nextAttribute);
+ is(this.getAttribute("foo"), "baz", "The last value in the sequence should be the value of the attribute.");
+
+ attributeChangedCallbackCount++;
+ if (attributeChangedCallbackCount == 3) {
+ runNextTest();
+ }
+ }
+
+ static get observedAttributes() {
+ return ["foo"];
+ }
+ }
+
+ customElements.define("x-four", Four);
+ var elem = document.createElement("x-four");
+ elem.setAttribute("foo", "changeme");
+}
+
+var testFunctions = [
+ testChangeAttributeInEnteredViewCallback,
+ testLeaveViewInEnteredViewCallback,
+ testStackedAttributeChangedCallback,
+ SimpleTest.finish
+];
+
+function runNextTest() {
+ if (testFunctions.length) {
+ var nextTestFunction = testFunctions.shift();
+ info(`Start ${nextTestFunction.name} ...`);
+ nextTestFunction();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+runNextTest();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_template.html b/dom/tests/mochitest/webcomponents/test_custom_element_template.html
new file mode 100644
index 0000000000..f077f84ebe
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_template.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1091425
+-->
+<head>
+ <title>Test for custom elements in template</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<template>
+ <x-foo></x-foo>
+</template>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1091425">Bug 1091425</a>
+<script>
+
+class XFoo extends HTMLElement {
+ connectedCallback() {
+ ok(false, "Connected callback should not be called for custom elements in templates.");
+ }
+};
+
+customElements.define("x-foo", XFoo);
+
+ok(true, "Connected callback should not be called for custom elements in templates.");
+
+</script>
+<template>
+ <x-foo></x-foo>
+</template>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html b/dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html
new file mode 100644
index 0000000000..6c8c5e032c
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1378079
+-->
+<head>
+ <title>Test throw on dynamic markup insertion when creating element synchronously from parser</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1378079">Bug 1378079</a>
+<div id="container"></div>
+
+<script>
+
+class DoDocumentOpenInCtor extends HTMLElement {
+ constructor() {
+ super();
+ document.open();
+ }
+};
+customElements.define('x-document-open-in-ctor', DoDocumentOpenInCtor);
+
+class DoDocumentWriteInCtor extends HTMLElement {
+ constructor() {
+ super();
+ document.write('<div>This should not be shown</div>');
+ }
+};
+customElements.define('x-document-write-in-ctor', DoDocumentWriteInCtor);
+
+class DoDocumentCloseInCtor extends HTMLElement {
+ constructor() {
+ super();
+ document.close();
+ }
+};
+customElements.define('x-document-close-in-ctor', DoDocumentCloseInCtor);
+
+window.errors = [];
+window.onerror = function(message, url, lineNumber, columnNumber, error) {
+ errors.push(error.name);
+ return true;
+}
+var expectedErrorCount = 0;
+
+document.write("<x-document-open-in-ctor></x-document-open-in-ctor>");
+expectedErrorCount++;
+is(window.errors.length, expectedErrorCount, "expectedErrorCount should be " + expectedErrorCount);
+is(window.errors[expectedErrorCount - 1], 'InvalidStateError', "Error name should be 'InvalidStateError'");
+
+document.write("<x-document-write-in-ctor></x-document-write-in-ctor>");
+expectedErrorCount++;
+is(window.errors.length, expectedErrorCount, "expectedErrorCount should be " + expectedErrorCount);
+is(window.errors[expectedErrorCount - 1], 'InvalidStateError', "Error name should be 'InvalidStateError'");
+
+document.write("<x-document-close-in-ctor></x-document-close-in-ctor>");
+expectedErrorCount++;
+is(window.errors.length, expectedErrorCount, "expectedErrorCount should be " + expectedErrorCount);
+is(window.errors[expectedErrorCount - 1], 'InvalidStateError', "Error name should be 'InvalidStateError'");
+
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html b/dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html
new file mode 100644
index 0000000000..96c2add0dd
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1407669
+-->
+<head>
+ <title>Test custom elements runtime exception</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1407669">Bug 1407669</a>
+<script type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, function() {
+ window.onerror = function (e) {
+ ok(false, "How did we get here!?");
+ }
+
+ class Foo extends HTMLElement {
+ constructor() {
+ super()
+ TestFunctions.throwUncatchableException();
+ }
+ }
+
+ customElements.define("test-custom-element", Foo);
+ let element = document.createElement("test-custom-element");
+ is(element instanceof HTMLUnknownElement, true, "It should be a HTMLUnknownElement when uncatchable exception throws in constructor");
+ ok(true, "Uncatchable exception should not report");
+ SimpleTest.finish();
+});
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html
new file mode 100644
index 0000000000..5759925cfa
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1299363
+-->
+<head>
+ <title>Test upgrade steps for custom elements.</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1299363">Bug 1299363</a>
+<script type="text/javascript">
+// Fake the Cu.waiveXrays, so that we can share the tests with mochitest chrome.
+var Cu = { waiveXrays: (obj) => obj };
+SimpleTest.waitForExplicitFinish();
+
+var promises = [];
+function test_with_new_window(f, msg) {
+ promises.push(new Promise((aResolve) => {
+ let iframe = document.createElement('iframe');
+ iframe.setAttribute('type', 'content');
+ iframe.setAttribute('src', 'test_upgrade_page.html');
+ iframe.onload = function() {
+ // Use window from iframe to isolate the test.
+ f(iframe.contentWindow, msg);
+ aResolve();
+ };
+ document.body.appendChild(iframe);
+ }));
+}
+</script>
+<!-- Test cases for autonomous element -->
+<script type="text/javascript" src="upgrade_tests.js"></script>
+<script>
+Promise.all(promises).then(() => {
+ SimpleTest.finish();
+});
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html
new file mode 100644
index 0000000000..5913fc8601
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1299363
+-->
+<head>
+ <title>Test upgrade steps for custom elements.</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1299363">Bug 1299363</a>
+<script type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+
+var promises = [];
+function test_with_new_window(f, msg) {
+ promises.push(new Promise((aResolve) => {
+ let iframe = document.createElement('iframe');
+ iframe.setAttribute('type', 'content');
+ iframe.setAttribute('src', 'http://example.org/chrome/dom/tests/mochitest/webcomponents/test_upgrade_page.html');
+ iframe.onload = function() {
+ try {
+ // Use window from iframe to isolate the test.
+ f(iframe.contentWindow, msg);
+ } catch (e) {
+ SimpleTest.ok(false, e);
+ }
+ aResolve();
+ };
+ document.body.appendChild(iframe);
+ }));
+}
+</script>
+<!-- Test cases for autonomous element -->
+<script type="text/javascript" src="upgrade_tests.js"></script>
+<script>
+Promise.all(promises).then(() => {
+ SimpleTest.finish();
+});
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html b/dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html
new file mode 100644
index 0000000000..04cca31581
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1275839
+-->
+<head>
+ <title>Test custom elements whenDefined function.</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1275839">Bug 1275839</a>
+<iframe id="iframe"></iframe>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+const testWindow = iframe.contentDocument.defaultView;
+const customElements = testWindow.customElements;
+const expectSyntaxError = 'SyntaxError';
+
+function testCustomElementsAvailable() {
+ ok('customElements' in testWindow, '"window.customElements" exists');
+ ok('define' in customElements, '"window.customElements.define" exists');
+ ok('whenDefined' in customElements, '"window.customElements.get" exists');
+}
+
+function testCustomElementsPromiseEqually() {
+ // 4. If map does not contain an entry with key name, create an entry in
+ // map with key name and whose value is a new promise.
+ let promiseElement1 = customElements.whenDefined('x-element1');
+ let promiseElement2 = customElements.whenDefined('x-element2');
+
+ ok(promiseElement1 instanceof testWindow.Promise &&
+ promiseElement2 instanceof testWindow.Promise,
+ "promiseElement1 and promiseElement2 should return promises.");
+
+ // 5. Let promise be the value of the entry in map with key name.
+ // 6. Return promise
+ let sameAsPromiseElement1 = customElements.whenDefined('x-element1');
+
+ ok(sameAsPromiseElement1 instanceof testWindow.Promise,
+ "sameAsPromiseElement1 should return promise.");
+ is(promiseElement1, sameAsPromiseElement1,
+ "Same name should return same promise.");
+ isnot(promiseElement1, promiseElement2,
+ "whenDefined() returns different promises for different names.");
+}
+
+function testCustomElementsNameDefined() {
+ let name = 'x-foo';
+ let beforeDefinedPromise = customElements.whenDefined(name);
+
+ customElements.define(name, class {});
+
+ // 2. If this CustomElementRegistry contains an entry with name name,
+ // then return a new promise resolved with undefined and abort these
+ // steps.
+ return beforeDefinedPromise.then(() => {
+ let afterDefinedPromise = customElements.whenDefined(name);
+ isnot(beforeDefinedPromise, afterDefinedPromise,
+ "When name is defined, we should have a new promise.");
+
+ let newPromise = customElements.whenDefined(name);
+ isnot(afterDefinedPromise, newPromise,
+ "Once name is defined, whenDefined() always returns a new promise.");
+ return Promise.all([newPromise, afterDefinedPromise]);
+ });
+}
+
+function testCustomElementsNameNotDefined() {
+ let isResolved = false;
+ customElements.whenDefined('x-name-not-defined').then(() => {
+ isResolved = true;
+ });
+
+ return new Promise((aResolve, aReject) => {
+ setTimeout(
+ function() {
+ ok(!isResolved, "Promise for not defined name should not be resolved.");
+ aResolve();
+ }, 0);
+ });
+}
+
+function testCustomElementsInvalidName() {
+ let invalidCustomElementNames = [
+ undefined,
+ null,
+ '',
+ '-',
+ 'a',
+ 'input',
+ 'mycustomelement',
+ 'A',
+ 'A-',
+ '0-',
+ 'a-A',
+ 'a-Z',
+ 'A-a',
+ 'a-a\u00D7',
+ 'a-a\u3000',
+ 'a-a\uDB80\uDC00', // Surrogate pair U+F0000
+ // name must not be any of the hyphen-containing element names.
+ 'annotation-xml',
+ 'color-profile',
+ 'font-face',
+ 'font-face-src',
+ 'font-face-uri',
+ 'font-face-format',
+ 'font-face-name',
+ 'missing-glyph',
+ ];
+
+ let promises = [];
+ invalidCustomElementNames.forEach(name => {
+ const expectSyntaxErrorPromise = customElements.whenDefined(name);
+
+ promises.push(expectSyntaxErrorPromise.then(() => {
+ ok(false, "CustomElements with invalid name should throw SyntaxError.");
+ }, (ex) => {
+ is(ex.name, expectSyntaxError,
+ "CustomElements with invalid name should throw SyntaxError.");
+ }));
+ });
+
+ return Promise.all(promises);
+}
+
+Promise.resolve()
+ .then(() => testCustomElementsAvailable())
+ .then(() => testCustomElementsPromiseEqually())
+ .then(() => testCustomElementsNameDefined())
+ .then(() => testCustomElementsNameNotDefined())
+ .then(() => testCustomElementsInvalidName())
+ .then(() => SimpleTest.finish());
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_detached_style.html b/dom/tests/mochitest/webcomponents/test_detached_style.html
new file mode 100644
index 0000000000..4fc32d6650
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_detached_style.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1062578
+-->
+<head>
+ <title>Test for creating style in shadow root of host not in document.</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1062578">Bug 1062578</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div id="grabme"></div>';
+createIframe(content)
+ .then((aDocument) => {
+ var host = aDocument.createElement("div");
+ var shadow = host.attachShadow({mode: "open"});
+ shadow.innerHTML = '<style> #inner { height: 200px; } </style><div id="inner">Hello</div>';
+
+ var iframeWin = aDocument.defaultView;
+ iframeWin.grabme.appendChild(host);
+
+ var inner = shadow.getElementById("inner");
+ is(iframeWin.getComputedStyle(inner).getPropertyValue("height"), "200px", "Style in shadow root should take effect.");
+
+ SimpleTest.finish();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_adoptnode.html b/dom/tests/mochitest/webcomponents/test_document_adoptnode.html
new file mode 100644
index 0000000000..50f35a55df
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_adoptnode.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1177991
+-->
+<head>
+ <title>Test for Bug 1177991</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1177991">Mozilla Bug 1177991</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+createIframe()
+ .then((aDocument) => {
+ var thrownException = false;
+ var shadowRoot = aDocument.createElement('div').attachShadow({mode: "open"});
+
+ try {
+ aDocument.adoptNode(shadowRoot);
+ } catch(err) {
+ thrownException = err;
+ }
+
+ ok(thrownException !== false, "A HierarchyRequestError");
+ is(thrownException.name, "HierarchyRequestError", "A HierarchyRequestError should've been thrown");
+
+ SimpleTest.finish();
+ });
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_importnode.html b/dom/tests/mochitest/webcomponents/test_document_importnode.html
new file mode 100644
index 0000000000..e56fcacf27
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_importnode.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1177914
+-->
+<head>
+ <title>Test for Bug 1177914</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1177914">Mozilla Bug 1177914</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+createIframe()
+ .then((aDocument) => {
+ var thrownException = false;
+ var shadowRoot = aDocument.createElement('div').attachShadow({mode: "open"});
+
+ try {
+ aDocument.importNode(shadowRoot);
+ } catch(err) {
+ thrownException = err;
+ }
+
+ ok(thrownException !== false, "A HierarchyRequestError");
+ is(thrownException.name, "NotSupportedError", "A NotSupportedError exception should've been thrown");
+
+ SimpleTest.finish();
+ });
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_event_composed.html b/dom/tests/mochitest/webcomponents/test_event_composed.html
new file mode 100644
index 0000000000..b96cd5f9dc
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_event_composed.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for composed event in web components</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="host">
+<script>
+
+let host = document.getElementById("host");
+let root = host.attachShadow({ mode: "open" });
+
+function waitForEvent(element, eventName) {
+ let promises = [];
+ promises.push(new Promise((resolve) => {
+ element.addEventListener(eventName, (event) => {
+ is(event.composed, true, "check composed");
+ resolve();
+ }, { once: true });
+ }));
+ promises.push(new Promise((resolve) => {
+ root.addEventListener(eventName, (event) => {
+ is(event.composed, true, "check composed");
+ resolve();
+ }, { once: true });
+ }));
+ promises.push(new Promise((resolve) => {
+ host.addEventListener(eventName, (event) => {
+ is(event.composed, true, "check composed");
+ resolve();
+ }, { once: true });
+ }));
+ return Promise.all(promises);
+}
+
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1554965
+add_task(async function input_type_date() {
+ let date = document.createElement("input");
+ date.type = "date";
+ date.value = "2020-01-01";
+ root.appendChild(date);
+
+ let promise = waitForEvent(date, "input");
+ date.focus();
+ synthesizeKey("KEY_ArrowDown");
+
+ await promise;
+
+ date.remove();
+});
+
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1554965
+add_task(function input_type_time() {
+ let time = document.createElement("input");
+ time.type = "time";
+ time.value = "10:30";
+ root.appendChild(time);
+
+ let promise = waitForEvent(time, "input");
+ time.focus();
+ synthesizeKey("KEY_ArrowDown");
+
+ time.remove();
+});
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_event_retarget.html b/dom/tests/mochitest/webcomponents/test_event_retarget.html
new file mode 100644
index 0000000000..05b4fa3ebe
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_event_retarget.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=887541
+-->
+<head>
+ <title>Test for event retargeting in web components</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887541">Bug 887541</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+createIframe()
+ .then((aDocument) => {
+ /*
+ * Creates an event listener with an expected event target.
+ */
+ function createEventListener(expectedTarget, msg) {
+ return function(e) {
+ is(e.target, expectedTarget, msg);
+ };
+ }
+
+ /*
+ * Test of event retargeting through a basic ShadowRoot with a content insertion point.
+ *
+ * <div elemThree> ---- <shadow-root shadowOne>
+ * | |
+ * <div elemOne> <content elemTwo>
+ *
+ * Dispatch event on elemOne
+ */
+
+ var elemOne = aDocument.createElement("div");
+ var elemTwo = aDocument.createElement("content");
+ var elemThree = aDocument.createElement("div");
+ var shadowOne = elemThree.attachShadow({mode: "open"});
+
+ elemThree.appendChild(elemOne);
+ shadowOne.appendChild(elemTwo);
+
+ elemOne.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemOne."));
+ elemTwo.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemTwo."));
+ elemThree.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemThree."));
+ shadowOne.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of shadowOne."));
+
+ var customEvent = new CustomEvent("custom", { "bubbles" : true });
+ elemOne.dispatchEvent(customEvent);
+
+ /*
+ * Test of event retargeting through a basic ShadowRoot with a content insertion point.
+ *
+ * <div elemThree> ---- <shadow-root shadowOne>
+ * | |
+ * <div elemOne> <content elemTwo>
+ *
+ * Dispatch event on elemTwo
+ */
+
+ elemOne = aDocument.createElement("div");
+ elemTwo = aDocument.createElement("content");
+ elemThree = aDocument.createElement("div");
+ shadowOne = elemThree.attachShadow({mode: "open"});
+
+ elemThree.appendChild(elemOne);
+ shadowOne.appendChild(elemTwo);
+
+ elemTwo.addEventListener("custom", createEventListener(elemTwo, "elemTwo is in common ancestor tree of elemTwo."));
+ elemThree.addEventListener("custom", createEventListener(elemThree, "elemThree is in common ancestor tree of elemThree."));
+ shadowOne.addEventListener("custom", createEventListener(elemTwo, "elemTwo is in common ancestor tree of shadowOne."));
+
+ customEvent = new CustomEvent("custom", { "bubbles" : true });
+ elemTwo.dispatchEvent(customEvent);
+
+ /*
+ * Test of event retargeting through a nested ShadowRoots with content insertion points.
+ *
+ * <div elemFive> --- <shadow-root shadowTwo>
+ * | |
+ * <div elemOne> <div elemFour> ----- <shadow-root shadowOne>
+ * | |
+ * <content elemTwo> <content elemThree>
+ *
+ * Dispatch custom event on elemOne.
+ */
+
+ elemOne = aDocument.createElement("div");
+ elemTwo = aDocument.createElement("content");
+ elemThree = aDocument.createElement("content");
+ var elemFour = aDocument.createElement("div");
+ var elemFive = aDocument.createElement("div");
+ var shadowTwo = elemFive.attachShadow({mode: "open"});
+ shadowOne = elemFour.attachShadow({mode: "open"});
+
+ elemFive.appendChild(elemOne);
+ shadowTwo.appendChild(elemFour);
+ elemFour.appendChild(elemTwo);
+ shadowOne.appendChild(elemThree);
+
+ elemOne.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemOne."));
+ elemTwo.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemTwo."));
+ elemThree.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemThree."));
+ elemFour.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemFour."));
+ elemFive.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of elemFive."));
+ shadowOne.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of shadowOne."));
+ shadowTwo.addEventListener("custom", createEventListener(elemOne, "elemOne is in common ancestor tree of shadowTwo."));
+
+ customEvent = new CustomEvent("custom", { "bubbles" : true });
+ elemOne.dispatchEvent(customEvent);
+
+ /*
+ * Test of event retargeting through a nested ShadowRoots with content insertion points.
+ *
+ * <div elemFive> --- <shadow-root shadowTwo>
+ * | |
+ * <div elemOne> <div elemFour> ----- <shadow-root shadowOne>
+ * | |
+ * <content elemTwo> <content elemThree>
+ *
+ * Dispatch custom event on elemThree.
+ */
+
+ elemOne = aDocument.createElement("div");
+ elemTwo = aDocument.createElement("content");
+ elemThree = aDocument.createElement("content");
+ elemFour = aDocument.createElement("div");
+ elemFive = aDocument.createElement("div");
+ shadowTwo = elemFive.attachShadow({mode: "open"});
+ shadowOne = elemFour.attachShadow({mode: "open"});
+
+ elemFive.appendChild(elemOne);
+ shadowTwo.appendChild(elemFour);
+ elemFour.appendChild(elemTwo);
+ shadowOne.appendChild(elemThree);
+
+ elemThree.addEventListener("custom", createEventListener(elemThree, "elemThree is in common ancestor tree of elemThree."));
+ elemFour.addEventListener("custom", createEventListener(elemFour, "elemFour is in common ancestor tree of elemFour."));
+ elemFive.addEventListener("custom", createEventListener(elemFive, "elemFive is in common ancestor tree of elemFive."));
+ shadowOne.addEventListener("custom", createEventListener(elemThree, "elemThree is in common ancestor tree of shadowOne."));
+ shadowTwo.addEventListener("custom", createEventListener(elemFour, "elemFour is in common ancestor tree of shadowTwo."));
+
+ customEvent = new CustomEvent("custom", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+
+ SimpleTest.finish();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_event_stopping.html b/dom/tests/mochitest/webcomponents/test_event_stopping.html
new file mode 100644
index 0000000000..c90988d869
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_event_stopping.html
@@ -0,0 +1,174 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=887541
+-->
+<head>
+ <title>Test for event model in web components</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887541">Bug 887541</a>
+<script>
+
+var els = SpecialPowers.Cc["@mozilla.org/eventlistenerservice;1"]
+ .getService(SpecialPowers.Ci.nsIEventListenerService);
+
+SimpleTest.waitForExplicitFinish();
+createIframe()
+ .then((aDocument) => {
+ function eventListener(e) {
+ eventChain.push(this);
+ }
+
+ function isEventChain(actual, expected, msg) {
+ is(actual.length, expected.length, msg);
+ for (var i = 0; i < expected.length; i++) {
+ is(actual[i], expected[i], msg + " at " + i);
+ }
+
+ if (actual.length) {
+ var chain = els.getEventTargetChainFor(actual[0], false); // Events should be dispatched on actual[0].
+ ok(expected.length < chain.length, "There should be additional chrome event targets.");
+ }
+ }
+
+ /*
+ * <div elemOne> ------ <shadow-root shadowOne>
+ * |
+ * <span elemTwo>
+ * |
+ * <span elemThree>
+ */
+
+ var elemOne = aDocument.createElement("div");
+ var elemTwo = aDocument.createElement("span");
+ var elemThree = aDocument.createElement("span");
+ var shadowOne = elemOne.attachShadow({mode: "open"});
+
+ shadowOne.appendChild(elemTwo);
+ elemTwo.appendChild(elemThree);
+
+ // Test stopping "abort" event.
+
+ elemOne.addEventListener("abort", eventListener);
+ elemTwo.addEventListener("abort", eventListener);
+ elemThree.addEventListener("abort", eventListener);
+ shadowOne.addEventListener("abort", eventListener);
+
+ var eventChain = [];
+
+ var customEvent = new CustomEvent("abort", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that abort event is stopped at shadow root.");
+
+ // Test stopping "error" event.
+
+ elemOne.addEventListener("error", eventListener);
+ elemTwo.addEventListener("error", eventListener);
+ elemThree.addEventListener("error", eventListener);
+ shadowOne.addEventListener("error", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("error", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that error event is stopped at shadow root.");
+
+ // Test stopping "select" event.
+
+ elemOne.addEventListener("select", eventListener);
+ elemTwo.addEventListener("select", eventListener);
+ elemThree.addEventListener("select", eventListener);
+ shadowOne.addEventListener("select", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("select", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that select event is stopped at shadow root.");
+
+ // Test stopping "change" event.
+
+ elemOne.addEventListener("change", eventListener);
+ elemTwo.addEventListener("change", eventListener);
+ elemThree.addEventListener("change", eventListener);
+ shadowOne.addEventListener("change", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("change", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+
+ // Test stopping "reset" event.
+
+ elemOne.addEventListener("reset", eventListener);
+ elemTwo.addEventListener("reset", eventListener);
+ elemThree.addEventListener("reset", eventListener);
+ shadowOne.addEventListener("reset", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("reset", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that reset event is stopped at shadow root.");
+
+ // Test stopping "load" event.
+
+ elemOne.addEventListener("load", eventListener);
+ elemTwo.addEventListener("load", eventListener);
+ elemThree.addEventListener("load", eventListener);
+ shadowOne.addEventListener("load", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("load", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that load event is stopped at shadow root.");
+
+ // Test stopping "resize" event.
+
+ elemOne.addEventListener("resize", eventListener);
+ elemTwo.addEventListener("resize", eventListener);
+ elemThree.addEventListener("resize", eventListener);
+ shadowOne.addEventListener("resize", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("resize", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that resize event is stopped at shadow root.");
+
+ // Test stopping "scroll" event.
+
+ elemOne.addEventListener("scroll", eventListener);
+ elemTwo.addEventListener("scroll", eventListener);
+ elemThree.addEventListener("scroll", eventListener);
+ shadowOne.addEventListener("scroll", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("scroll", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that scroll event is stopped at shadow root.");
+
+ // Test stopping "selectstart" event.
+
+ elemOne.addEventListener("selectstart", eventListener);
+ elemTwo.addEventListener("selectstart", eventListener);
+ elemThree.addEventListener("selectstart", eventListener);
+ shadowOne.addEventListener("selectstart", eventListener);
+
+ eventChain = [];
+
+ customEvent = new CustomEvent("selectstart", { "bubbles" : true });
+ elemThree.dispatchEvent(customEvent);
+ isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that selectstart event is stopped at shadow root.");
+
+ SimpleTest.finish();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_link_prefetch.html b/dom/tests/mochitest/webcomponents/test_link_prefetch.html
new file mode 100644
index 0000000000..c376ec1981
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_link_prefetch.html
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=580313
+-->
+<head>
+ <title>Test Prefetch (bug 580313)</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=580313">Mozilla Bug 580313</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+ SimpleTest.waitForExplicitFinish();
+
+ var prefetch = SpecialPowers.Cc["@mozilla.org/prefetch-service;1"].
+ getService(SpecialPowers.Ci.nsIPrefetchService);
+ var ios = SpecialPowers.Cc["@mozilla.org/network/io-service;1"].
+ getService(SpecialPowers.Ci.nsIIOService);
+
+ is(prefetch.hasMoreElements(), false, "No prefetches at the test start.");
+
+ var linkElem = document.createElement('link');
+ linkElem.rel = "prefetch";
+
+ // Href is empty.
+ document.head.appendChild(linkElem);
+ is(prefetch.hasMoreElements(), false,
+ "If href is not a valid uri, a prefetch has not been started.");
+
+ // Change uri of an existing link. Now it is a valid uri and
+ // a prefetch should start.
+ linkElem.href = "https://example.com/1";
+ is(prefetch.hasMoreElements(), true,
+ "Setting the href to a valid uri has started a new prefetch.");
+
+ // Removing a link, removes its prefetch.
+ document.head.removeChild(linkElem);
+ is(prefetch.hasMoreElements(), false,
+ "Removing the link has canceled the prefetch.");
+
+ // Add link again.
+ document.head.appendChild(linkElem);
+ is(prefetch.hasMoreElements(), true,
+ "Adding link again, has started the prefetch again.");
+
+ // Changing the href should cancel the current prefetch.
+ linkElem.href = "https://example.com/2";
+ is(prefetch.hasMoreElements(), true,
+ "Changing href, a new prefetch has been started.");
+ // To check if "https://example.com/1" prefetch has been canceled, we try to
+ // cancel it using PrefetService. Since the prefetch for
+ // "https://example.com/1" does not exist, the cancel will throw.
+ var cancelError = 0;
+ try {
+ var uri = ios.newURI("https://example.com/1");
+ prefetch.cancelPrefetchPreloadURI(uri, linkElem);
+ } catch(e) {
+ cancelError = 1;
+ }
+ is(cancelError, 1, "This prefetch has aleady been canceled");
+
+ // Now cancel the right uri.
+ cancelError = 0;
+ try {
+ var uri = ios.newURI("https://example.com/2");
+ prefetch.cancelPrefetchPreloadURI(uri, linkElem);
+ } catch(e) {
+ cancelError = 1;
+ }
+ is(cancelError, 0, "This prefetch has been canceled successfully");
+
+ is(prefetch.hasMoreElements(), false, "The prefetch has already been canceled.");
+
+ // Removing the link will do nothing regarding prefetch service.
+ document.head.removeChild(linkElem);
+
+ // Adding two links to the same uri and removing one will not remove the other.
+ document.head.appendChild(linkElem);
+ is(prefetch.hasMoreElements(), true,
+ "Added one prefetch for 'https://example.com/2'.");
+
+ var linkElem2 = document.createElement('link');
+ linkElem2.rel = "prefetch";
+ linkElem2.href = "https://example.com/2";
+ document.head.appendChild(linkElem2);
+ is(prefetch.hasMoreElements(), true,
+ "Added second prefetch for 'https://example.com/2'.");
+
+ // Remove first link element. This should not remove the prefetch.
+ document.head.removeChild(linkElem);
+ is(prefetch.hasMoreElements(), true,
+ "The prefetch for 'https://example.com/2' is still present.");
+
+ // Remove the second link element. This should remove the prefetch.
+ document.head.removeChild(linkElem2);
+ is(prefetch.hasMoreElements(), false,
+ "There is no prefetch.");
+
+ SimpleTest.finish();
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html b/dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html
new file mode 100644
index 0000000000..88f69190eb
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1782142
+-->
+<title>Test :active pseudo-class in shadow DOM</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1062578">Bug 1782142</a>
+<div id="host"></div>
+<script>
+let { ContentTaskUtils } = SpecialPowers.ChromeUtils.import(
+ "resource://testing-common/ContentTaskUtils.jsm"
+);
+
+// Setup shadow DOM
+const host = document.querySelector("#host");
+const sr = host.attachShadow({mode: "closed"});
+const button = document.createElement("button");
+button.innerText = "button";
+sr.appendChild(button);
+
+add_task(async function init() {
+ await SpecialPowers.pushPrefEnv({set: [["test.events.async.enabled", true]]});
+ await waitUntilApzStable();
+});
+
+add_task(async function mouse_input() {
+ ok(!button.matches(":active"), "Button should not be active initially");
+
+ synthesizeMouseAtCenter(button, { type: "mousedown" });
+ await ContentTaskUtils.waitForCondition(() => {
+ return button.matches(":active");
+ }, "Button should be active");
+
+ synthesizeMouseAtCenter(button, { type: "mouseup" });
+ await ContentTaskUtils.waitForCondition(() => {
+ return !button.matches(":active");
+ }, "Button should not be active");
+});
+
+add_task(async function touch_input() {
+ // To avoid contextmenu showing up during test.
+ document.addEventListener("contextmenu", (e) => {
+ e.preventDefault();
+ }, { once: true });
+
+ ok(!button.matches(":active"), "Button should not be active initially");
+
+ synthesizeTouchAtCenter(button, { type: "touchstart" });
+ await ContentTaskUtils.waitForCondition(() => {
+ return button.matches(":active");
+ }, "Button should be active");
+
+ synthesizeTouchAtCenter(button, { type: "touchend" });
+ await ContentTaskUtils.waitForCondition(() => {
+ return !button.matches(":active");
+ }, "Button should not be active");
+});
+</script>
diff --git a/dom/tests/mochitest/webcomponents/test_shadowdom_ime.html b/dom/tests/mochitest/webcomponents/test_shadowdom_ime.html
new file mode 100644
index 0000000000..e023ff04a2
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowdom_ime.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1553852
+-->
+<head>
+ <title>Test for Bug 1429982</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1553852">Mozilla Bug 1553852</a>
+<p id="display"></p>
+<div id="content">
+ <div id="host"></div>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 1553852 **/
+SimpleTest.waitForExplicitFinish()
+SimpleTest.waitForFocus(function() {
+ let div = document.createElement('div');
+ div.setAttribute('contenteditable', 'true');
+
+ let shadow = document.getElementById('host').attachShadow({mode: 'open'});
+ shadow.appendChild(div);
+ div.focus();
+
+ let testString = '\uD842\uDFB7\u91CE\u5BB6';
+ synthesizeCompositionChange(
+ { "composition":
+ { "string": testString,
+ "clauses":
+ [
+ { "length": testString.length, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
+ ],
+ },
+ "caret": { "start": testString.length, "length": 0 },
+ });
+ is(div.innerText, testString,
+ "The value of contenteditable div should be " + testString +
+ " during composition");
+
+ synthesizeComposition({ type: "compositioncommitasis" });
+ is(div.innerText, testString,
+ "The value of contenteditable div should be " + testString +
+ " after compositionend");
+
+ SimpleTest.finish();
+});
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot.html b/dom/tests/mochitest/webcomponents/test_shadowroot.html
new file mode 100644
index 0000000000..07bc8b3fcd
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for ShadowRoot</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div id="movedtoshadow" class="testclass"></div>' +
+ '<svg id="svgmovedtoshadow"></svg>';
+createIframe(content)
+ .then((aDocument) => {
+ // Create ShadowRoot.
+ var element = aDocument.createElement("div");
+ ok(!element.shadowRoot, "div element should not have a shadow root.");
+ var shadow = element.attachShadow({mode: "open"});
+ is(element.shadowRoot, shadow, "shadowRoot property should return the same shadow root that was just created.");
+
+ // Move an element from the document to the ShadowRoot.
+ var inShadowEl = aDocument.getElementById("movedtoshadow");
+ var inShadowSVGEl = aDocument.getElementById("svgmovedtoshadow");
+
+ // Test getElementById
+ ok(!shadow.getElementById("movedtoshadow"), "Element not in ShadowRoot should not be accessible from ShadowRoot API.");
+ ok(!shadow.getElementById("svgmovedtoshadow"), "SVG element not in ShadowRoot should not be accessible from ShadowRoot API.");
+ shadow.appendChild(inShadowEl);
+ shadow.appendChild(inShadowSVGEl);
+ is(shadow.getElementById("movedtoshadow"), inShadowEl, "Element appended to a ShadowRoot should be accessible from ShadowRoot API.");
+ ok(!aDocument.getElementById("movedtoshadow"), "Element appended to a ShadowRoot should not be accessible from document.");
+ is(shadow.getElementById("svgmovedtoshadow"), inShadowSVGEl, "SVG element appended to a ShadowRoot should be accessible from ShadowRoot API.");
+ ok(!aDocument.getElementById("svgmovedtoshadow"), "SVG element appended to a ShadowRoot should not be accessible from document.");
+
+ // Remove elements from ShadowRoot and make sure that they are no longer accessible via the ShadowRoot API.
+ shadow.removeChild(inShadowEl);
+ shadow.removeChild(inShadowSVGEl);
+ ok(!shadow.getElementById("movedtoshadow"), "ShadowRoot API should not be able to access elements removed from ShadowRoot.");
+ ok(!shadow.getElementById("svgmovedtoshadow"), "ShadowRoot API should not be able to access elements removed from ShadowRoot.");
+
+ // Test querySelector on element in a ShadowRoot.
+ element = aDocument.createElement("div");
+ shadow = element.attachShadow({mode: "open"});
+ var parentDiv = aDocument.createElement("div");
+ var childSpan = aDocument.createElement("span");
+ childSpan.id = "innerdiv";
+ parentDiv.appendChild(childSpan);
+ is(parentDiv.querySelector("#innerdiv"), childSpan, "ID query selector should work on element in ShadowRoot.");
+ is(parentDiv.querySelector("span"), childSpan, "Tag query selector should work on element in ShadowRoot.");
+
+ // Test that exception is thrown when trying to create a cycle with host node.
+ element = aDocument.createElement("div");
+ shadow = element.attachShadow({mode: "open"});
+ try {
+ shadow.appendChild(element);
+ ok(false, "Excpetion should be thrown when creating a cycle with host content.");
+ } catch (ex) {
+ ok(true, "Excpetion should be thrown when creating a cycle with host content.");
+ }
+
+ // Basic innerHTML tests.
+ shadow.innerHTML = '<span id="first"></span><div id="second"></div>';
+ is(shadow.childNodes.length, 2, "There should be two children in the ShadowRoot.");
+ is(shadow.getElementById("second").tagName, "DIV", "Elements created by innerHTML should be accessible by ShadowRoot API.");
+
+ SimpleTest.finish();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html b/dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html
new file mode 100644
index 0000000000..e344615596
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1429982
+-->
+<head>
+ <title>Test for Bug 1429982</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1429982">Mozilla Bug 1429982</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 1429982 **/
+SimpleTest.waitForExplicitFinish();
+createIframe()
+ .then((aDocument) => {
+ var element = aDocument.createElement("div");
+ var shadowRoot = element.attachShadow({mode: "open"});
+ var thrownException = false;
+
+ try {
+ shadowRoot.cloneNode();
+ } catch(err) {
+ thrownException = err;
+ }
+
+ ok(thrownException !== false, "An exception should've been thrown");
+ is(thrownException.name, "NotSupportedError", "A NotSupportedError exception should've been thrown");
+
+ SimpleTest.finish();
+ });
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html b/dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html
new file mode 100644
index 0000000000..7fd5f78122
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for inert elements in ShadowRoot</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div id="grabme"></div>';
+createIframe(content).then(aDocument => {
+ var element = aDocument.getElementById("grabme");
+ var shadow = element.attachShadow({mode: "open"});
+
+ // Check that <base> is inert.
+ shadow.innerHTML = '<base href="http://www.example.org/" />';
+ isnot(aDocument.baseURI, "http://www.example.org/", "Base element should be inert in ShadowRoot.");
+ SimpleTest.finish();
+});
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_style.html b/dom/tests/mochitest/webcomponents/test_shadowroot_style.html
new file mode 100644
index 0000000000..824a8decea
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_style.html
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for ShadowRoot styling</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div class="tall" id="bodydiv"></div>' +
+ '<div id="container"></div>';
+createIframe(content)
+ .then((aDocument) => {
+ var iframeWin = aDocument.defaultView;
+
+ // Create ShadowRoot.
+ var container = aDocument.getElementById("container");
+ var elem = aDocument.createElement("div");
+ container.appendChild(elem); // Put ShadowRoot host in document.
+ var root = elem.attachShadow({mode: "open"});
+
+ // A style element that will be appended into the ShadowRoot.
+ var shadowStyle = aDocument.createElement("style");
+ shadowStyle.innerHTML = ".tall { height: 100px; } .fat { padding-left: inherit; }";
+
+ root.innerHTML = '<div id="divtostyle" class="tall fat"></div>';
+ var divToStyle = root.getElementById("divtostyle");
+
+ // Make sure styleSheet counts are correct after appending a style to the ShadowRoot.
+ is(aDocument.styleSheets.length, 0, "There shouldn't be any style sheet in the test frame document.");
+ is(root.styleSheets.length, 0, "The ShadowRoot should have no style sheets.");
+ root.appendChild(shadowStyle);
+ is(aDocument.styleSheets.length, 0, "Styles in the ShadowRoot element should not be accessible from the document.");
+ is(root.styleSheets.length, 1, "ShadowRoot should have one style sheet from the appened style.");
+ is(root.styleSheets[0].ownerNode, shadowStyle, "First style in ShadowRoot should match the style that was just appended.");
+
+ var dummyStyle = aDocument.createElement("style");
+ root.appendChild(dummyStyle);
+ is(root.styleSheets.length, 2, "ShadowRoot should have an additional style from appending dummyStyle.");
+ is(root.styleSheets[1].ownerNode, dummyStyle, "Second style in ShadowRoot should be the dummyStyle.");
+ root.removeChild(dummyStyle);
+ is(root.styleSheets.length, 1, "Removing dummyStyle should remove it from the ShadowRoot style sheets.");
+ is(root.styleSheets[0].ownerNode, shadowStyle, "The style sheet remaining in the ShadowRoot should be shadowStyle.");
+
+ // Make sure that elements outside of the ShadowRoot are not affected by the ShadowRoot style.
+ isnot(iframeWin.getComputedStyle(aDocument.getElementById("bodydiv")).getPropertyValue("height"), "100px", "Style sheets in ShadowRoot should not apply to elements no in the ShadowRoot.");
+
+ // Make sure that elements in the ShadowRoot are styled according to the ShadowRoot style.
+ is(iframeWin.getComputedStyle(divToStyle).getPropertyValue("height"), "100px", "ShadowRoot style sheets should apply to elements in ShadowRoot.");
+
+ // Tests for author styles not applying in a ShadowRoot.
+ var authorStyle = aDocument.createElement("style");
+ authorStyle.innerHTML = ".fat { padding-right: 20px; padding-left: 30px; }";
+ aDocument.body.appendChild(authorStyle);
+ isnot(iframeWin.getComputedStyle(divToStyle).getPropertyValue("padding-right"), "20px", "Author styles should not apply to ShadowRoot.");
+
+ // Test dynamic changes to style in ShadowRoot.
+ root.innerHTML = '<div id="divtostyle" class="dummy"></div>';
+ divToStyle = root.getElementById("divtostyle");
+ var dummyShadowStyle = aDocument.createElement("style");
+ dummyShadowStyle.innerHTML = ".dummy { height: 300px; }";
+ root.appendChild(dummyShadowStyle);
+ is(iframeWin.getComputedStyle(divToStyle).getPropertyValue("height"), "300px", "Dummy element in ShadowRoot should be styled by style in ShadowRoot.");
+ dummyShadowStyle.innerHTML = ".dummy { height: 200px; }";
+ is(iframeWin.getComputedStyle(divToStyle).getPropertyValue("height"), "200px", "Dynamic changes to styles in ShadowRoot should change style of affected elements.");
+
+ // Test id selector in ShadowRoot style.
+ root.innerHTML = '<style>#divtostyle { padding-top: 10px; }</style><div id="divtostyle"></div>';
+ divToStyle = root.getElementById("divtostyle");
+ is(iframeWin.getComputedStyle(divToStyle).getPropertyValue("padding-top"), "10px", "ID selector in style selector should match element.");
+
+ SimpleTest.finish();
+ });
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html b/dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html
new file mode 100644
index 0000000000..05976a934a
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for ShadowRoot style order</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div id="container"></div>';
+createIframe(content)
+ .then((aDocument) => {
+ var iframeWin = aDocument.defaultView;
+
+ // Create ShadowRoot.
+ var container = aDocument.getElementById("container");
+ var elem = aDocument.createElement("div");
+ container.appendChild(elem); // Put ShadowRoot host in document.
+ var root = elem.attachShadow({mode: "open"});
+
+ // Style elements that will be appended into the ShadowRoot.
+ var tallShadowStyle = aDocument.createElement("style");
+ tallShadowStyle.innerHTML = ".tall { height: 100px; }";
+
+ var veryTallShadowStyle = aDocument.createElement("style");
+ veryTallShadowStyle.innerHTML = ".tall { height: 200px; }";
+
+ var divToStyle = aDocument.createElement("div");
+ divToStyle.setAttribute("class", "tall");
+ root.appendChild(divToStyle);
+
+ // Make sure the styles are applied in tree order.
+ root.appendChild(tallShadowStyle);
+ is(root.styleSheets.length, 1, "ShadowRoot should have one style sheet.");
+ is(iframeWin.getComputedStyle(divToStyle).getPropertyValue("height"), "100px", "Style in ShadowRoot should apply to elements in ShadowRoot.");
+ root.appendChild(veryTallShadowStyle);
+ is(root.styleSheets.length, 2, "ShadowRoot should have two style sheets.");
+ is(iframeWin.getComputedStyle(divToStyle).getPropertyValue("height"), "200px", "Style in ShadowRoot should apply to elements in ShadowRoot in tree order.");
+
+ SimpleTest.finish();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_style_fallback_content.html b/dom/tests/mochitest/webcomponents/test_style_fallback_content.html
new file mode 100644
index 0000000000..33aef21322
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_style_fallback_content.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for styling fallback content</title>
+ <script type="text/javascript" src="head.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var content = '<div id="grabme"></div>';
+createIframe(content)
+ .then((aDocument) => {
+ var iframeWin = aDocument.defaultView;
+
+ var host = aDocument.getElementById("grabme");
+ var shadow = host.attachShadow({mode: "open"});
+ shadow.innerHTML = '<style id="innerstyle"></style><span id="container"><slot><span id="innerspan">Hello</span></slot></span>';
+ var innerStyle = shadow.getElementById("innerstyle");
+
+ innerStyle.innerHTML = '#innerspan { margin-top: 10px; }';
+ var innerSpan = shadow.getElementById("innerspan");
+ is(iframeWin.getComputedStyle(innerSpan).getPropertyValue("margin-top"), "10px", "Default content should be style by id selector.");
+
+ innerStyle.innerHTML = '#container > slot > #innerspan { margin-top: 30px; }';
+ is(iframeWin.getComputedStyle(innerSpan).getPropertyValue("margin-top"), "30px", "Default content should be style by child combinators.");
+
+ SimpleTest.finish();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_template.html b/dom/tests/mochitest/webcomponents/test_template.html
new file mode 100644
index 0000000000..8e663b2c93
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_template.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=818976
+-->
+<head>
+ <title>Test for template element</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script>
+ function shouldNotCall() {
+ ok(false, "Template contents should be inert.");
+ }
+ </script>
+ <template>
+ <script>
+ shouldNotCall();
+ </script>
+ </template>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=818976">Bug 818976</a>
+<template id="grabme"><div id="insidetemplate"></div></template>
+<template id="justtemplate"></template>
+<template id="first">Hi<template>Bye</template></template>
+<div><template id="second"><span></span></template></div>
+<template id="cloneme"><span>I want a clone</span><span>me too</span></template>
+<template id="cycleone"></template>
+<template id="cycletwo"><template></template></template>
+<template id="cyclethree"></template>
+<template id="cyclefour"><template></template></template>
+<template id="appendtome"></template>
+<template id="insertinme"></template>
+<template>
+ <script>
+ shouldNotCall();
+ </script>
+</template>
+<div id="fillme"></div>
+<script>
+var templateEl = document.getElementById("grabme");
+ok(templateEl, "template element should be in document.");
+is(window.getComputedStyle(templateEl).display, "none", "Template element should not be visible.");
+ok(!document.getElementById("insidetemplate"), "Template content should not be in document.");
+is(templateEl.childNodes.length, 0, "Template element should have no children.");
+is(templateEl.content.childNodes.length, 1, "Template content should have 1 child <div>.");
+
+// Make sure that template is owned by different document.
+ok(templateEl.content.ownerDocument != templateEl.ownerDocument, "Template should be in a different document because the current document has a browsing context.");
+var otherTemplateEl = document.getElementById("first");
+is(templateEl.content.ownerDocument, otherTemplateEl.content.ownerDocument, "Template contents within the same document should be owned by the same template contents owner.");
+
+var htmlDoc = document.implementation.createHTMLDocument();
+var otherDocTemplateEl = htmlDoc.createElement("template");
+isnot(otherDocTemplateEl.content.ownerDocument, htmlDoc, "Template content owner should be a new document.");
+
+var templateOwnerDoc = otherDocTemplateEl.content.ownerDocument;
+var docCreatedTemplateEl = templateOwnerDoc.createElement("template");
+is(docCreatedTemplateEl.content.ownerDocument, templateOwnerDoc, "Template content owner of template elements created by a template document should be the template document.");
+
+// Tests for XMLSerializer
+templateEl = document.getElementById("justtemplate");
+var serializer = new XMLSerializer();
+is(serializer.serializeToString(templateEl), '<template xmlns="http://www.w3.org/1999/xhtml" id="justtemplate"></template>', "XMLSerializer should serialize template element.");
+
+templateEl = document.getElementById("first");
+is(serializer.serializeToString(templateEl), '<template xmlns="http://www.w3.org/1999/xhtml" id="first">Hi<template>Bye</template></template>', "XMLSerializer should serialize template content.");
+
+// Tests for innerHTML.
+is(templateEl.innerHTML, 'Hi<template>Bye</template>', "innerHTML should serialize content.");
+// Tests for outerHTML, not specified but should do something reasonable.
+is(templateEl.outerHTML, '<template id="first">Hi<template>Bye</template></template>', "outerHTML should serialize content.");
+
+templateEl.innerHTML = "Hello";
+is(templateEl.innerHTML, "Hello", "innerHTML of template should be set to 'Hello'");
+is(templateEl.childNodes.length, 0, "Template element should have no children.");
+is(templateEl.content.childNodes.length, 1, "Template content should have 'Hello' as child.");
+
+// Test for innerHTML on parent of template element.
+var templateParent = document.getElementById("second").parentNode;
+is(templateParent.innerHTML, '<template id="second"><span></span></template>', "InnerHTML on parent of template element should serialize template and template content.");
+
+templateEl.innerHTML = '<template id="inner">Hello</template>';
+ok(templateEl.content.childNodes[0] instanceof HTMLTemplateElement, "Template content should have <template> as child.");
+is(templateEl.content.childNodes[0].childNodes.length, 0, "Parsed temlate element should have no children.");
+is(templateEl.content.childNodes[0].content.childNodes.length, 1, "Parsed temlate element should have 'Hello' in content.");
+
+// Test cloning.
+templateEl = document.getElementById("cloneme");
+var nonDeepClone = templateEl.cloneNode(false);
+is(nonDeepClone.childNodes.length, 0, "There should be no children on the clone.");
+is(nonDeepClone.content.childNodes.length, 0, "Content should not be cloned.");
+var deepClone = templateEl.cloneNode(true);
+is(deepClone.childNodes.length, 0, "There should be no children on the clone.");
+is(deepClone.content.childNodes.length, 2, "The content should be cloned.");
+
+// Append content into a node.
+var parentEl = document.getElementById("fillme");
+parentEl.appendChild(templateEl.content);
+is(parentEl.childNodes.length, 2, "Parent should be appended with cloned content.");
+
+// Test exceptions thrown for cycles.
+templateEl = document.getElementById("cycleone");
+try {
+ templateEl.content.appendChild(templateEl);
+ ok(false, "Exception should be thrown when creating cycles in template content.");
+} catch (ex) {
+ ok(true, "Exception should be thrown when creating cycles in template content.");
+}
+
+templateEl = document.getElementById("cycletwo");
+try {
+ // Append template to template content within the template content.
+ templateEl.content.childNodes[0].content.appendChild(templateEl);
+ ok(false, "Exception should be thrown when creating cycles in template content.");
+} catch (ex) {
+ ok(true, "Exception should be thrown when creating cycles in template content.");
+}
+
+templateEl = document.getElementById("cyclethree");
+try {
+ templateEl.appendChild(templateEl);
+ ok(false, "Exception should be thrown when creating cycles in hierarchy.");
+} catch (ex) {
+ ok(true, "Exception should be thrown when creating cycles in hierarchy.");
+}
+
+templateEl = document.getElementById("cyclefour");
+try {
+ templateEl.content.childNodes[0].appendChild(templateEl);
+ ok(false, "Exception should be thrown when creating cycles in hierarchy.");
+} catch (ex) {
+ ok(true, "Exception should be thrown when creating cycles in hierarchy.");
+}
+
+templateEl = document.getElementById("insertinme");
+var sentinel = document.createElement("div");
+try {
+ templateEl.content.appendChild(sentinel);
+ templateEl.content.insertBefore(templateEl, sentinel);
+ ok(false, "Exception should be thrown when creating cycles in hierarchy.");
+} catch (ex) {
+ ok(true, "Exception should be thrown when creating cycles in hierarchy.");
+}
+
+// Appending normal stuff into content should work.
+templateEl = document.getElementById("appendtome");
+templateEl.content.appendChild(document.createElement("div"));
+is(templateEl.content.childNodes.length, 1, "Template should have div element appended as child");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_template_xhtml.html b/dom/tests/mochitest/webcomponents/test_template_xhtml.html
new file mode 100644
index 0000000000..b14e5c365a
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_template_xhtml.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1011831
+-->
+<head>
+ <title>Test for template element</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011831">Bug 1011831</a>
+<script>
+var docSrc =
+ '<!DOCTYPE html>' +
+ '<html xmlns="http://www.w3.org/1999/xhtml">' +
+ '<body>' +
+ '<template id="t">Content<span>Content</span></template>' +
+ '<div id="container"><template>One</template><div>Two</div></div>' +
+ '<template id="t2"></template>' +
+ '</body>' +
+ '</html>';
+
+var doc = (new DOMParser()).parseFromString(docSrc, 'application/xhtml+xml');
+
+var t = doc.getElementById("t");
+is(t.childNodes.length, 0, "Template should have no children.");
+is(t.content.childNodes.length, 2, "Template content should have two children, text node and a span.");
+
+// Test serialization of template element.
+is(t.innerHTML, 'Content<span xmlns="http://www.w3.org/1999/xhtml">Content</span>', "Template contents should be serialized.");
+is(t.outerHTML, '<template xmlns="http://www.w3.org/1999/xhtml" id="t">Content<span>Content</span></template>', "Template contents should be serialized.");
+
+var c = doc.getElementById("container");
+is(c.innerHTML, '<template xmlns="http://www.w3.org/1999/xhtml">One</template><div xmlns="http://www.w3.org/1999/xhtml">Two</div>', "Template contents should be serialized.");
+is(c.outerHTML, '<div xmlns="http://www.w3.org/1999/xhtml" id="container"><template>One</template><div>Two</div></div>', "Template contents should be serialized.");
+
+// Test setting innerHTML on template element.
+var t2 = doc.getElementById("t2");
+t2.innerHTML = 'Three<span>Four</span>';
+is(t2.childNodes.length, 0, "Setting innerHTML should append children into template content.");
+is(t2.content.childNodes.length, 2, "Setting innerHTML should append children into template content.");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_upgrade_page.html b/dom/tests/mochitest/webcomponents/test_upgrade_page.html
new file mode 100644
index 0000000000..d1822b715e
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_upgrade_page.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<title>Upgrade test page</title>
+<meta charset="utf-8"/>
+</head>
+<body>
+<p>Upgrade test page</p>
+<unresolved-element></unresolved-element>
+</body>
+</html> \ No newline at end of file
diff --git a/dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml b/dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml
new file mode 100644
index 0000000000..f2c50f7bde
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml
@@ -0,0 +1,386 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="XUL Custom Elements"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="runTest();">
+ <title>XUL Custom Elements</title>
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <script type="application/javascript">
+ <![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ var gXULDOMParser = new DOMParser();
+ gXULDOMParser.forceEnableXULXBL();
+
+ function parseXULToFragment(str) {
+ let doc = gXULDOMParser.parseFromSafeString(`
+ <box xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">${str}</box>`,
+ "application/xml");
+ // We use a range here so that we don't access the inner DOM elements from
+ // JavaScript before they are imported and inserted into a document.
+ let range = doc.createRange();
+ range.selectNodeContents(doc.firstChild);
+ return range.extractContents();
+ }
+
+ class TestCustomElement extends XULElement {
+ constructor() {
+ super();
+
+ this.attachShadow({mode: "open"});
+ }
+
+ connectedCallback() {
+ this.textContent = "foo";
+ }
+ }
+
+ customElements.define("test-custom-element", TestCustomElement);
+
+ class TestWithoutDash extends XULElement { }
+ customElements.define("testwithoutdash", TestWithoutDash);
+
+ class TestWithoutDashExtended extends TestWithoutDash {
+ constructor() {
+ super();
+ }
+
+ connectedCallback() {
+ this.textContent = "quux";
+ }
+ }
+ customElements.define("testwithoutdash-extended", TestWithoutDashExtended, { extends: "testwithoutdash" });
+
+ class TestCustomBuiltInElement extends XULElement {
+ constructor() {
+ super();
+ }
+
+ connectedCallback() {
+ this.textContent = "baz";
+ }
+ }
+ customElements.define("test-built-in-element",
+ TestCustomBuiltInElement, { extends: "axulelement" });
+
+ class TestPopupExtendElement extends XULPopupElement {
+ constructor() {
+ super();
+ }
+
+ connectedCallback() {
+ this.textContent = "quuz";
+ }
+ }
+ customElements.define("test-popup-extend",
+ TestPopupExtendElement, { extends: "popup" });
+
+ class TestCustomElement3 extends XULElement { }
+
+ customElements.setElementCreationCallback(
+ "test-custom-element-3", () => customElements.define("test-custom-element-3", TestCustomElement3));
+
+ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ function basicCustomElementCreate() {
+ let element = document.createElementNS(XUL_NS, "test-custom-element");
+ ok(element.shadowRoot, "Shadow DOM works even with pref off");
+ document.querySelector("#content").appendChild(element);
+ is(element.textContent, "foo", "Should have set the textContent");
+ ok(element instanceof TestCustomElement, "Should be an instance of TestCustomElement");
+
+ let element2 = element.cloneNode(false);
+ is(element2.textContent, "", "Shouldn't have cloned the textContent");
+ document.querySelector("#content").appendChild(element2);
+ is(element2.textContent, "foo", "Should have set the textContent");
+ ok(element2 instanceof TestCustomElement, "Should be an instance of TestCustomElement");
+
+ let element3 = new TestCustomElement();
+ is(element3.localName, "test-custom-element", "Should see the right tag");
+ is(element3.textContent, "", "Shouldn't have been inserted yet");
+ is(element3.namespaceURI, XUL_NS, "Should have set the right namespace");
+ document.querySelector("#content").appendChild(element3);
+ is(element3.textContent, "foo", "Should have set the textContent");
+ ok(element3 instanceof TestCustomElement, "Should be an instance of TestCustomElement");
+
+ document.querySelector("#content").appendChild(parseXULToFragment(`<test-custom-element />`));
+ let element4 = document.querySelector("#content").lastChild;
+ is(element4.localName, "test-custom-element", "Should see the right tag");
+ is(element4.namespaceURI, XUL_NS, "Should have set the right namespace");
+ is(element4.textContent, "foo", "Should have set the textContent");
+ ok(element4 instanceof TestCustomElement, "Should be an instance of TestCustomElement");
+ }
+
+ function parserBasicElementUpgrade() {
+ let element = document.getElementById("element4");
+ is(element.textContent, "foo",
+ "Parser should have instantiated the custom element.");
+ ok(element instanceof TestCustomElement, "Should be an instance of TestCustomElement");
+ }
+
+ function tagNameWithoutDash() {
+ let element = document.getElementById("element5");
+ ok(element instanceof TestWithoutDash, "Should be an instance of TestWithoutDash");
+ }
+
+ function upgradeAfterDefine() {
+ class TestCustomElement1 extends XULElement {
+ constructor() {
+ super();
+ }
+
+ connectedCallback() {
+ this.textContent = "bar";
+ }
+ }
+
+ let element = document.createElementNS(XUL_NS, "test-custom-element-1");
+ ok(!(element instanceof TestCustomElement1), "Should not be an instance of TestCustomElement1");
+ customElements.define("test-custom-element-1", TestCustomElement1);
+ ok(!(element instanceof TestCustomElement1), "Should not be an instance of TestCustomElement1");
+ document.querySelector("#content").appendChild(element);
+ ok(element instanceof TestCustomElement1, "Should be upgraded to an instance of TestCustomElement1");
+ is(element.textContent, "bar", "Should have set the textContent");
+ }
+
+ function basicElementCreateBuiltIn() {
+ let element = document.createElementNS(XUL_NS, "axulelement", { is: "test-built-in-element" });
+ ok(element instanceof TestCustomBuiltInElement, "Should be an instance of TestCustomBuiltInElement");
+ is(element.getAttribute("is"), "", "The |is| attribute of the created element should not be the extended type.");
+ document.querySelector("#content").appendChild(element);
+ is(element.textContent, "baz", "Should have set the textContent");
+
+ let element2 = element.cloneNode(false);
+ is(element2.localName, "axulelement", "Should see the right tag");
+ is(element2.getAttribute("is"), "", "The |is| attribute of the created element should not be the extended type.");
+ is(element2.textContent, "", "Shouldn't have cloned the textContent");
+ document.querySelector("#content").appendChild(element2);
+ is(element2.textContent, "baz", "Should have set the textContent");
+ ok(element2 instanceof TestCustomBuiltInElement, "Should be an instance of TestCustomBuiltInElement");
+
+ let element3 = new TestCustomBuiltInElement();
+ is(element3.localName, "axulelement", "Should see the right tag");
+ is(element3.textContent, "", "Shouldn't have been inserted yet");
+ is(element3.namespaceURI, XUL_NS, "Should have set the right namespace");
+ document.querySelector("#content").appendChild(element3);
+ is(element3.textContent, "baz", "Should have set the textContent");
+ ok(element3 instanceof TestCustomBuiltInElement, "Should be an instance of TestCustomBuiltInElement");
+
+ document.querySelector("#content").appendChild(parseXULToFragment(`<axulelement is="test-built-in-element" />`))
+ let element4 = document.querySelector("#content").lastChild;
+ is(element4.localName, "axulelement", "Should see the right tag");
+ is(element4.namespaceURI, XUL_NS, "Should have set the right namespace");
+ is(element4.textContent, "baz", "Should have set the textContent");
+ ok(element4 instanceof TestCustomBuiltInElement, "Should be an instance of TestCustomBuiltInElement");
+ }
+
+ function parserBasicElementUpgradeBuiltIn() {
+ let element = document.getElementById("element6");
+ is(element.textContent, "baz",
+ "Parser should have instantiated the custom element.");
+ ok(element instanceof TestCustomBuiltInElement, "Should be an instance of TestCustomBuiltInElement");
+ }
+
+ function subclassElementCreateBuiltIn() {
+ let element = document.createElementNS(XUL_NS, "popup", { is: "test-popup-extend" });
+ ok(element instanceof TestPopupExtendElement, "Should be an instance of TestPopupExtendElement");
+ is(element.getAttribute("is"), "", "The |is| attribute of the created element should not be the extended type.");
+ document.querySelector("#content").appendChild(element);
+ is(element.textContent, "quuz", "Should have set the textContent");
+
+ let element2 = element.cloneNode(false);
+ is(element2.localName, "popup", "Should see the right tag");
+ is(element2.getAttribute("is"), "", "The |is| attribute of the created element should not be the extended type.");
+ is(element2.textContent, "", "Shouldn't have cloned the textContent");
+ document.querySelector("#content").appendChild(element2);
+ is(element2.textContent, "quuz", "Should have set the textContent");
+ ok(element2 instanceof TestPopupExtendElement, "Should be an instance of TestPopupExtendElement");
+
+ let element3 = new TestPopupExtendElement();
+ is(element3.localName, "popup", "Should see the right tag");
+ is(element3.textContent, "", "Shouldn't have been inserted yet");
+ is(element3.namespaceURI, XUL_NS, "Should have set the right namespace");
+ document.querySelector("#content").appendChild(element3);
+ is(element3.textContent, "quuz", "Should have set the textContent");
+ ok(element3 instanceof TestPopupExtendElement, "Should be an instance of TestPopupExtendElement");
+
+ document.querySelector("#content").appendChild(parseXULToFragment(`<popup is="test-popup-extend" />`))
+ let element4 = document.querySelector("#content").lastChild;
+ is(element4.localName, "popup", "Should see the right tag");
+ is(element4.namespaceURI, XUL_NS, "Should have set the right namespace");
+ is(element4.textContent, "quuz", "Should have set the textContent");
+ ok(element4 instanceof TestPopupExtendElement, "Should be an instance of TestPopupExtendElement");
+ }
+
+ function parserSubclassElementUpgradeBuiltIn() {
+ let element = document.getElementById("element7");
+ is(element.textContent, "quuz",
+ "Parser should have instantiated the custom element.");
+ ok(element instanceof TestPopupExtendElement, "Should be an instance of TestPopupExtendElement");
+ }
+
+ function upgradeAfterDefineBuiltIn() {
+ class TestCustomBuiltInElement1 extends XULElement {
+ constructor() {
+ super();
+ }
+
+ connectedCallback() {
+ this.textContent = "qux";
+ }
+ }
+ let element = document.createElementNS(XUL_NS, "axulelement", { is: "test-built-in-element-1" });
+ ok(!(element instanceof TestCustomBuiltInElement1), "Should not be an instance of TestCustomBuiltInElement1");
+ customElements.define("test-built-in-element-1",
+ TestCustomBuiltInElement1, { extends: "axulelement" });
+ ok(!(element instanceof TestCustomBuiltInElement1), "Should not be an instance of TestCustomBuiltInElement1");
+ document.querySelector("#content").appendChild(element);
+ ok(element instanceof TestCustomBuiltInElement1, "Should be upgraded to an instance of TestCustomBuiltInElement1");
+ is(element.textContent, "qux", "Should have set the textContent");
+ }
+
+ function throwForInvalidBuiltInName() {
+ try {
+ // <axulelement is="testwithoutdashbuiltin" /> is not allowed;
+ // built-in type names need dashes.
+ customElements.define(
+ "testwithoutdashbuiltin", class extends XULElement {}, { extends: "axulelement" });
+ ok(false, "Built-in type name without dash should be rejected.");
+ } catch (e) {
+ ok(true, "Built-in type name without dash is rejected.");
+ }
+ try {
+ // <test-built-in-element-2 is="test-custom-element-2" /> is not allowed;
+ // built-in type tag names forbid dashes
+ customElements.define(
+ "test-built-in-element-2", class extends XULElement {}, { extends: "test-custom-element-2" });
+ ok(false, "Extending from a name with dash should be rejected.");
+ } catch (e) {
+ ok(true, "Extending from a name with dash is rejected.");
+ }
+ }
+
+ function extendingWithoutDashCustomElement() {
+ let element = document.createElementNS(XUL_NS, "testwithoutdash", { is: "testwithoutdash-extended" });
+ ok(element instanceof TestWithoutDashExtended, "Should be an instance of TestWithoutDashExtended");
+ ok(element instanceof TestWithoutDash, "Should be an instance of TestWithoutDash");
+ is(element.getAttribute("is"), "", "The |is| attribute of the created element should not be the extended type.");
+ document.querySelector("#content").appendChild(element);
+ is(element.textContent, "quux", "Should have set the textContent");
+
+ let element2 = element.cloneNode(false);
+ is(element2.localName, "testwithoutdash", "Should see the right tag");
+ is(element2.getAttribute("is"), "", "The |is| attribute of the created element should not be the extended type.");
+ is(element2.textContent, "", "Shouldn't have cloned the textContent");
+ document.querySelector("#content").appendChild(element2);
+ is(element2.textContent, "quux", "Should have set the textContent");
+ ok(element2 instanceof TestWithoutDashExtended, "Should be an instance of TestWithoutDashExtended");
+ ok(element2 instanceof TestWithoutDash, "Should be an instance of TestWithoutDash");
+
+ let element3 = new TestWithoutDashExtended();
+ is(element3.localName, "testwithoutdash", "Should see the right tag");
+ is(element3.textContent, "", "Shouldn't have been inserted yet");
+ is(element3.namespaceURI, XUL_NS, "Should have set the right namespace");
+ document.querySelector("#content").appendChild(element3);
+ is(element3.textContent, "quux", "Should have set the textContent");
+ ok(element3 instanceof TestWithoutDashExtended, "Should be an instance of TestWithoutDashExtended");
+ ok(element3 instanceof TestWithoutDash, "Should be an instance of TestWithoutDash");
+
+ document.querySelector("#content").appendChild(parseXULToFragment(`<testwithoutdash is="testwithoutdash-extended" />`))
+ let element4 = document.querySelector("#content").lastChild;
+ is(element4.localName, "testwithoutdash", "Should see the right tag");
+ is(element4.namespaceURI, XUL_NS, "Should have set the right namespace");
+ is(element4.textContent, "quux", "Should have set the textContent");
+ ok(element4 instanceof TestWithoutDashExtended, "Should be an instance of TestWithoutDashExtended");
+ ok(element4 instanceof TestWithoutDash, "Should be an instance of TestWithoutDash");
+ }
+
+ function nonCustomElementCreate() {
+ // All of these should be created as plain XUL elements without hitting
+ // any assertions.
+ let elements = [
+ document.createElementNS(XUL_NS, "axulelement", { is: "test-custom-element" }),
+ document.createElementNS(XUL_NS, "axulelement", { is: "testwithoutdash" }),
+ document.createElementNS(XUL_NS, "axulelement", { is: "test-custom-element-1" }),
+ document.createElementNS(XUL_NS, "name-with-dash", { is: "name-with-dash" }),
+ document.createElementNS(XUL_NS, "name-with-dash", { is: "another-name-with-dash" }),
+ document.createElementNS(XUL_NS, "testwithoutdash-extended"),
+ document.createElementNS(XUL_NS, "test-built-in-element"),
+ document.createElementNS(XUL_NS, "test-popup-extend"),
+ document.createElementNS(XUL_NS, "test-built-in-element-1")];
+
+ for (let element of elements) {
+ is(Object.getPrototypeOf(element), XULElement.prototype,
+ `<${element.localName} is="${element.getAttribute("is")}" /> should not be a custom element.`);
+ }
+ }
+
+ function testSetElementCreationballbackInDocument() {
+ let element = document.getElementById("element8");
+ ok(element instanceof TestCustomElement3, "Should be an instance of TestCustomElement3");
+ }
+
+ function setElementCreationCallbackCreate() {
+ class TestCustomElement4 extends XULElement {}
+ customElements.setElementCreationCallback(
+ "test-custom-element-4", () => customElements.define("test-custom-element-4", TestCustomElement4));
+
+ let element = document.createElementNS(XUL_NS, "test-custom-element-4");
+ ok(element instanceof TestCustomElement4, "Should be an instance of TestCustomElement4");
+
+ class TestCustomElement5 extends XULElement {}
+ customElements.setElementCreationCallback(
+ "test-custom-element-5", () => {
+ ok(true, "test-custom-element-5 callback called");
+ customElements.define("test-custom-element-5", TestCustomElement5);
+ });
+
+ document.querySelector("#content").appendChild(parseXULToFragment(`<test-custom-element-5 />`));
+ let element1 = document.querySelector("#content").lastChild;
+ ok(element1 instanceof TestCustomElement5, "Should be an instance of TestCustomElement5");
+ }
+
+ function runTest() {
+ basicCustomElementCreate();
+ parserBasicElementUpgrade();
+
+ tagNameWithoutDash();
+ upgradeAfterDefine();
+
+ basicElementCreateBuiltIn();
+ parserBasicElementUpgradeBuiltIn();
+
+ subclassElementCreateBuiltIn();
+ parserSubclassElementUpgradeBuiltIn();
+
+ upgradeAfterDefineBuiltIn();
+
+ throwForInvalidBuiltInName();
+ extendingWithoutDashCustomElement();
+
+ nonCustomElementCreate();
+
+ testSetElementCreationballbackInDocument();
+ setElementCreationCallbackCreate();
+
+ SimpleTest.finish();
+ }
+ ]]>
+ </script>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ <test-custom-element id="element4" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
+ <testwithoutdash id="element5" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
+ <axulelement id="element6" is="test-built-in-element" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
+ <popup id="element7" is="test-popup-extend" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
+ <test-custom-element-3 id="element8" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"></test-custom-element-3>
+ </div>
+ <pre id="test"></pre>
+ </body>
+</window>
diff --git a/dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml b/dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml
new file mode 100644
index 0000000000..79fb167276
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="XUL ShadowDOM accesskey"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+<body xmlns="http://www.w3.org/1999/xhtml">
+<a target="_blank" rel="opener"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=1037709"
+ title="XUL ShadowDOM accesskey">
+Mozilla Bug 1037709
+</a>
+<div id="container" style="position: relative"></div>
+</body>
+<!-- Tests code -->
+<script type="application/javascript">
+<![CDATA[
+
+const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+const container = document.getElementById("container");
+
+function pressAccessKey(accessKey){
+ synthesizeKey(accessKey, navigator.platform.includes("Mac") ? { altKey: true, ctrlKey: true }
+ : { altKey: true, shiftKey: true });
+}
+
+function testAccesskeyInShadowTree(mode) {
+ add_task(async () => {
+ const host = document.createXULElement("div");
+ container.appendChild(host);
+
+ const shadowRoot = host.attachShadow({mode})
+ const button = document.createXULElement("button");
+ button.innerText = "Click Me";
+ button.setAttribute("accesskey", "g");
+ shadowRoot.appendChild(button);
+
+ // Trigger frame construction which is constructed lazily on XUL Element.
+ button.getBoundingClientRect();
+
+ let isClickFired = false;
+ button.addEventListener("click", function(e) {
+ isClickFired = true;
+ }, { once: true });
+
+ pressAccessKey("g");
+ ok(isClickFired, `button element with accesskey in the shadow tree of ${mode} mode`);
+
+ host.remove();
+ });
+}
+
+testAccesskeyInShadowTree("open");
+testAccesskeyInShadowTree("closed");
+
+]]>
+</script>
+</window>
diff --git a/dom/tests/mochitest/webcomponents/upgrade_tests.js b/dom/tests/mochitest/webcomponents/upgrade_tests.js
new file mode 100644
index 0000000000..85cff984f0
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/upgrade_tests.js
@@ -0,0 +1,128 @@
+function test_upgrade(f, msg) {
+ // Run upgrading test on an element created by HTML parser.
+ test_with_new_window(function (testWindow, testMsg) {
+ let elementParser = testWindow.document.querySelector("unresolved-element");
+ f(testWindow, elementParser, testMsg);
+ }, msg + " (HTML parser)");
+
+ // Run upgrading test on an element created by document.createElement.
+ test_with_new_window(function (testWindow, testMsg) {
+ let element = testWindow.document.createElement("unresolved-element");
+ testWindow.document.documentElement.appendChild(element);
+ f(testWindow, element, testMsg);
+ }, msg + " (document.createElement)");
+}
+
+// Test cases
+
+test_upgrade(function (testWindow, testElement, msg) {
+ class MyCustomElement extends testWindow.HTMLElement {}
+ testWindow.customElements.define("unresolved-element", MyCustomElement);
+ SimpleTest.is(
+ Object.getPrototypeOf(Cu.waiveXrays(testElement)),
+ MyCustomElement.prototype,
+ msg
+ );
+}, "Custom element must be upgraded if there is a matching definition");
+
+test_upgrade(function (testWindow, testElement, msg) {
+ testElement.remove();
+ class MyCustomElement extends testWindow.HTMLElement {}
+ testWindow.customElements.define("unresolved-element", MyCustomElement);
+ SimpleTest.is(
+ Object.getPrototypeOf(testElement),
+ testWindow.HTMLElement.prototype,
+ msg
+ );
+}, "Custom element must not be upgraded if it has been removed from tree");
+
+test_upgrade(function (testWindow, testElement, msg) {
+ let exceptionToThrow = { name: "exception thrown by a custom constructor" };
+ class ThrowCustomElement extends testWindow.HTMLElement {
+ constructor() {
+ super();
+ if (exceptionToThrow) {
+ throw exceptionToThrow;
+ }
+ }
+ }
+
+ let uncaughtError;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) {
+ uncaughtError = error;
+ return true;
+ };
+ testWindow.customElements.define("unresolved-element", ThrowCustomElement);
+
+ SimpleTest.is(uncaughtError.name, exceptionToThrow.name, msg);
+}, "Upgrading must report an exception thrown by a custom element constructor");
+
+test_upgrade(function (testWindow, testElement, msg) {
+ class InstantiatesItselfAfterSuper extends testWindow.HTMLElement {
+ constructor(doNotCreateItself) {
+ super();
+ if (!doNotCreateItself) {
+ new InstantiatesItselfAfterSuper(true);
+ }
+ }
+ }
+
+ let uncaughtError;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) {
+ uncaughtError = error;
+ return true;
+ };
+ testWindow.customElements.define(
+ "unresolved-element",
+ InstantiatesItselfAfterSuper
+ );
+
+ SimpleTest.is(uncaughtError.name, "TypeError", msg);
+}, "Upgrading must report an TypeError when the top of the " +
+ "construction stack is marked AlreadyConstructed");
+
+test_upgrade(function (testWindow, testElement, msg) {
+ class InstantiatesItselfBeforeSuper extends testWindow.HTMLElement {
+ constructor(doNotCreateItself) {
+ if (!doNotCreateItself) {
+ new InstantiatesItselfBeforeSuper(true);
+ }
+ super();
+ }
+ }
+
+ let uncaughtError;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) {
+ uncaughtError = error;
+ return true;
+ };
+ testWindow.customElements.define(
+ "unresolved-element",
+ InstantiatesItselfBeforeSuper
+ );
+
+ SimpleTest.is(uncaughtError.name, "TypeError", msg);
+}, "Upgrading must report an TypeError when the top of the " +
+ "construction stack is marked AlreadyConstructed due to a custom element " +
+ "constructor constructing itself before super() call");
+
+test_upgrade(function (testWindow, testElement, msg) {
+ class MyOtherElement extends testWindow.HTMLElement {
+ constructor() {
+ super();
+ if (this == testElement) {
+ return testWindow.document.createElement("other-element");
+ }
+ }
+ }
+
+ let uncaughtError;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) {
+ uncaughtError = error;
+ return true;
+ };
+ testWindow.customElements.define("unresolved-element", MyOtherElement);
+
+ SimpleTest.is(uncaughtError.name, "TypeError", msg);
+}, "Upgrading must report an TypeError when the returned element is " +
+ "not SameValue as the upgraded element");
diff --git a/dom/tests/mochitest/whatwg/chrome.ini b/dom/tests/mochitest/whatwg/chrome.ini
new file mode 100644
index 0000000000..6d6bfc36c6
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/chrome.ini
@@ -0,0 +1,3 @@
+[DEFAULT]
+
+[test_postMessage_chrome.html]
diff --git a/dom/tests/mochitest/whatwg/file_bug500328_1.html b/dom/tests/mochitest/whatwg/file_bug500328_1.html
new file mode 100644
index 0000000000..941cb47c55
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/file_bug500328_1.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Inner frame for testing bug 500328.
+https://bugzilla.mozilla.org/show_bug.cgi?id=500328
+-->
+<head>
+<title>test 1</title>
+ <style>
+ a { fill:blue; }
+ a:visited { fill:purple; }
+ </style>
+</head>
+<body onload="load(event);" onpopstate="popstate(event);" onpageshow="pageshow(event);">
+<script type="application/javascript">
+ if (parent && parent.onChildScript)
+ parent.onChildScript(history.state);
+ if (opener && opener.onChildScript)
+ opener.onChildScript(history.state);
+
+ function load(e) {
+ if(parent && parent.onChildLoad)
+ parent.onChildLoad(e);
+ if(opener && opener.onChildLoad)
+ opener.onChildLoad(e);
+ }
+
+ function pageshow(e) {
+ if(parent && parent.onChildPageShow)
+ parent.onChildPageShow(e);
+ if(opener && opener.onChildPageShow)
+ opener.onChildPageShow(e);
+ }
+
+ function popstate(e) {
+ if(parent && parent.onChildLoad)
+ parent.onChildPopState(e);
+ if(opener && opener.onChildLoad)
+ opener.onChildPopState(e);
+ }
+
+ function navigateTo(loc) {
+ location = loc;
+ }
+
+</script>
+
+<a id="link-anchor1", href="#1">Link Anchor1</a>
+<a id="link-self" href="file_bug500328_1.html">Self</a>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/file_bug500328_2.html b/dom/tests/mochitest/whatwg/file_bug500328_2.html
new file mode 100644
index 0000000000..3ce66493dd
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/file_bug500328_2.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Inner frame for testing bug 500328.
+https://bugzilla.mozilla.org/show_bug.cgi?id=500328
+-->
+<head>
+</head>
+<body>
+<!--
+ Yes, this page is basically blank. But no, about:blank wouldn't do as a
+ replacement, because we use this page to test that pushstate has correct
+ same-origin checks.
+-->
+file_bug500328_2.html
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/mochitest.ini b/dom/tests/mochitest/whatwg/mochitest.ini
new file mode 100644
index 0000000000..a29ee29809
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/mochitest.ini
@@ -0,0 +1,68 @@
+[DEFAULT]
+support-files =
+ postMessage_chrome_helper.html
+ postMessage_closed_helper.html
+ postMessage_hash.html
+ postMessage_helper.html
+ postMessage_idn_helper.html
+ postMessage_joined_helper2.html
+ postMessage_joined_helper.html
+ postMessage_onOther.html
+ postMessage_origin_helper.xhtml
+ postMessage_override_helper.html
+ postMessage_structured_clone_helper.html
+ postMessage_structured_clone_helper.js
+ postMessage_throw_helper.html
+ postMessage_transfer_helper.html
+ postMessage_userpass_helper.html
+
+[test_bug477323.html]
+[test_document_scripts.html]
+[test_MessageEvent_dispatchToOther.html]
+skip-if =
+ http3
+[test_MessageEvent.html]
+[test_postMessage_basehref.html]
+skip-if =
+ http3
+[test_postMessage_closed.html]
+skip-if =
+ toolkit == 'android' #bug 894914 - wrong data - got FAIL, expected message
+ http3
+[test_postMessage_hash.html]
+skip-if =
+ http3
+[test_postMessage.html]
+skip-if =
+ http3
+[test_postMessage_idn.xhtml]
+skip-if =
+ http3
+[test_postMessage_joined.html]
+skip-if =
+ http3
+[test_postMessage_onOther.html]
+skip-if =
+ http3
+[test_postMessage_origin.xhtml]
+skip-if =
+ http3
+[test_postMessage_override.html]
+skip-if =
+ http3
+[test_postMessage_special.xhtml]
+skip-if =
+ http3
+[test_postMessage_structured_clone.html]
+skip-if =
+ http3
+[test_postMessage_throw.html]
+[test_postMessage_transfer.html]
+skip-if =
+ http3
+[test_postMessage_userpass.html]
+skip-if =
+ http3
+[test_bug500328.html]
+skip-if = true # bug 696306
+support-files = file_bug500328_1.html file_bug500328_2.html
diff --git a/dom/tests/mochitest/whatwg/postMessage_chrome_helper.html b/dom/tests/mochitest/whatwg/postMessage_chrome_helper.html
new file mode 100644
index 0000000000..eea07f538c
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_chrome_helper.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage chrome message receiver</title>
+ <script type="application/javascript">
+ var gPrePath = "";
+
+ function receiveMessage(evt)
+ {
+ if (evt.data.substring(0,9) == "chrome://") {
+ gPrePath = evt.data;
+ respond("path-is-set");
+ } else {
+ // Content cannot post to chrome without privileges
+ try {
+ window.parent.postMessage("SHOULD NOT GET THIS!", "*");
+ }
+ catch (ex) {
+ }
+
+ var msg = "post-to-content-response";
+
+ if (evt.source !== null)
+ msg += " wrong-source(" + evt.source + ")";
+ if (!evt.isTrusted)
+ msg += " unexpected-untrusted-event";
+ if (evt.type !== "message")
+ msg += " wrong-type(" + evt.type + ")";
+ if (evt.origin !== gPrePath)
+ msg += " wrong-origin(" + evt.origin + ")";
+ if (evt.data !== "post-to-content")
+ msg += " wrong-message(" + evt.data + ")";
+
+ respond(msg);
+ }
+ }
+
+ function respond(msg)
+ {
+ SpecialPowers.wrap(window).parent.postMessage(msg, "*");
+ }
+
+ window.addEventListener("message", receiveMessage);
+ </script>
+</head>
+<body>
+<h1 id="domain">example.org</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_closed_helper.html b/dom/tests/mochitest/whatwg/postMessage_closed_helper.html
new file mode 100644
index 0000000000..984ed08e71
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_closed_helper.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>postMessage closed page</title>
+ <script type="application/javascript">
+function receiveMessage(evt)
+{
+ evt.source.postMessage("FAIL", "*");
+}
+
+window.addEventListener("message", receiveMessage);
+
+function setup()
+{
+ var query = location.search.substring(1);
+
+ if (query == "opener")
+ window.opener.postMessage("message", "http://mochi.test:8888");
+}
+
+window.addEventListener("load", setup);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_hash.html b/dom/tests/mochitest/whatwg/postMessage_hash.html
new file mode 100644
index 0000000000..a7225153be
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_hash.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Hashed kid for test_postMessage_hash.html</title>
+ <script type="application/javascript">
+function receiveMessage(evt)
+{
+ var response = "response-message";
+
+ if (window.location.href !== "http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_hash.html#hash")
+ response += " kid-at-wrong-uri(" + window.location.href + ")";
+
+ if (evt.origin !== "http://mochi.test:8888")
+ response += " wrong-origin(" + evt.origin + ")";
+ if (evt.source !== window.parent)
+ response += " wrong-source";
+ if (evt.data !== "from-parent")
+ response += " wrong-data(" + evt.data + ")";
+ if (evt.lastEventId !== "")
+ response += " wrong-lastEventId(" + evt.lastEventId + ")";
+
+ window.parent.postMessage(response, "http://mochi.test:8888");
+}
+
+window.addEventListener("message", receiveMessage);
+ </script>
+</head>
+<body>
+<p>Kid iframe</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_helper.html b/dom/tests/mochitest/whatwg/postMessage_helper.html
new file mode 100644
index 0000000000..352edb5ca7
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_helper.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage message receiver</title>
+ <script type="application/javascript">
+ function $(id) { return document.getElementById(id); }
+
+ function setup()
+ {
+ var target = $("domain");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+ }
+
+ function receiveMessage(evt)
+ {
+ var response = evt.data + "-response";
+
+ if (evt.lastEventId !== "")
+ response += " wrong-lastEventId(" + evt.lastEventId + ")";
+
+ if (evt.source !== window.parent)
+ {
+ response += " unexpected-source(" + evt.source + ")";
+ response += " window-parent-is(" + window.parent + ")";
+ response += " location(" + window.location.href + ")";
+ }
+
+ if (evt.type != "message")
+ response += " wrong-type(" + evt.type + ")";
+
+ var data = evt.data;
+ if (data == "post-to-other-same-domain")
+ {
+ receiveSame(evt, response);
+ }
+ else if (data == "post-to-other-cross-domain")
+ {
+ receiveCross(evt, response);
+ }
+ else
+ {
+ response += " unexpected-message-to(" + window.location.href + ")";
+ window.parent.postMessage(response, "http://mochi.test:8888");
+ return;
+ }
+ }
+
+ function receiveSame(evt, response)
+ {
+ var source = evt.source;
+ try
+ {
+ if (evt.origin != "http://mochi.test:8888")
+ response += " unexpected-origin(" + evt.origin + ")";
+
+ try
+ {
+ var threw = false;
+ var privateVariable = source.privateVariable;
+ }
+ catch (e)
+ {
+ threw = true;
+ }
+ if (threw || privateVariable !== window.parent.privateVariable)
+ response += " accessed-source!!!";
+
+ }
+ finally
+ {
+ source.postMessage(response, evt.origin);
+ }
+ }
+
+ function receiveCross(evt, response)
+ {
+ var source = evt.source;
+ if (evt.origin != "http://mochi.test:8888")
+ response += " unexpected-origin(" + evt.origin + ")";
+
+ try
+ {
+ var threw = false;
+ var privateVariable = source.privateVariable;
+ }
+ catch (e)
+ {
+ threw = true;
+ }
+ if (!threw || privateVariable !== undefined)
+ response += " accessed-source!!!";
+
+ source.postMessage(response, evt.origin);
+ }
+
+ window.addEventListener("load", setup);
+ window.addEventListener("message", receiveMessage);
+ </script>
+</head>
+<body>
+<h1 id="domain"></h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_idn_helper.html b/dom/tests/mochitest/whatwg/postMessage_idn_helper.html
new file mode 100644
index 0000000000..b401fd9933
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_idn_helper.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage IDN test page</title>
+ <script type="application/javascript">
+ function receiveMessage(evt)
+ {
+ var response = "idn-response";
+
+ if (!(evt instanceof MessageEvent))
+ response += " not-a-MessageEvent";
+ if (evt.origin !== "http://mochi.test:8888")
+ response += " wrong-sender-origin(" + evt.origin + ")";
+ if (evt.data !== "idn-message")
+ response += " wrong-data(" + evt.data + ")";
+ if (evt.lastEventId !== "")
+ response += " wrong-lastEventId(" + evt.lastEventId + ")";
+ if (evt.source !== window.parent)
+ response += " wrong-source";
+ if (evt.target !== window)
+ response += " wrong-target";
+ if (evt.type !== "message")
+ response += " wrong-type(" + evt.type + ")";
+
+ evt.source.postMessage(response, evt.origin);
+ }
+ window.addEventListener("message", receiveMessage);
+
+ function setup()
+ {
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+ }
+
+ window.addEventListener("load", setup);
+ </script>
+</head>
+<body>
+<h1 id="location">No location!</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_joined_helper.html b/dom/tests/mochitest/whatwg/postMessage_joined_helper.html
new file mode 100644
index 0000000000..aa40909017
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_joined_helper.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<!--
+http://sub1.test1.example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper.html
+-->
+<head>
+ <title>postMessage joined domains, inner frame</title>
+ <script type="application/javascript">
+ function receiveMessage(evt)
+ {
+ var response, target, providedOrigin;
+ var data = evt.data;
+ if (data === "subframe-test-finished")
+ {
+ target = window.parent;
+ providedOrigin = "http://mochi.test:8888";
+ response = "test-passed";
+ }
+ else if (data === "start-test")
+ {
+ target = window.frames.innermost;
+ providedOrigin = "http://example.org";
+ response = "start-test";
+ }
+ else
+ {
+ target = window.parent;
+ providedOrigin = "http://mochi.test:8888";
+ response = "not reached";
+ }
+
+ if (evt.lastEventId !== "")
+ response += " wrong-lastEventId(" + evt.lastEventId + ")";
+
+ if (evt.type !== "message")
+ response += " wrong-type(" + evt.type + ")";
+
+ if (evt.target !== window)
+ {
+ response += " wrong-target(" + evt.target + ")";
+ response += " location(" + window.location.href + ")";
+ }
+
+ var origin;
+ if (data == "subframe-test-finished")
+ origin = "http://example.org";
+ else if (data === "start-test")
+ origin = "http://mochi.test:8888";
+ else
+ origin = "unreached";
+
+ if (evt.origin !== origin)
+ {
+ response += " wrong-origin(" + evt.origin + ")";
+ response += " location(" + window.location.href + ")";
+ }
+
+ target.postMessage(response, providedOrigin);
+ }
+
+ function setup()
+ {
+ var oldDomain = document.domain;
+ var newDomain = "example.org";
+
+ document.domain = newDomain;
+
+ var target = document.getElementById("location");
+ target.textContent = "Location: " + oldDomain +
+ ", effective domain: " + newDomain;
+
+ window.addEventListener("message", receiveMessage);
+ }
+
+ window.addEventListener("load", setup);
+ </script>
+</head>
+<body>
+<p id="location">No location!</p>
+
+<iframe src="http://example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html"
+ name="innermost"></iframe>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html b/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html
new file mode 100644
index 0000000000..0f6c063cc4
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<!--
+http://example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html
+-->
+<head>
+ <title>postMessage joined domains, innermost frame</title>
+ <script type="application/javascript">
+ function receiveMessage(evt)
+ {
+ var response = "subframe-test-finished";
+
+ if (evt.origin !== "http://sub1.test1.example.org")
+ {
+ response += " wrong-origin(" + evt.origin + ")";
+ response += " location(" + window.location.href + ")";
+ }
+
+ if (evt.data !== "start-test")
+ response += " incorrect-subframe-data(" + evt.data + ")";
+ if (evt.type !== "message")
+ response += " wrong-type(" + evt.type + ")";
+ if (evt.target !== window)
+ {
+ response += " wrong-target(" + evt.target + ")";
+ response += " location(" + window.location.href + ")";
+ }
+
+ if (evt.source !== window.parent)
+ {
+ response += " unexpected-source(" + evt.source + ")";
+ response += " window-parent-is(" + window.parent + ")";
+ response += " location(" + window.location.href + ")";
+ }
+
+ // verify that document.domain was actually joined with this domain
+ try
+ {
+ var passed = evt.source.document.domain === document.domain;
+ }
+ catch (e)
+ {
+ }
+
+ if (!passed)
+ response += " expected-joined-domains";
+
+ window.parent.postMessage(response, "http://sub1.test1.example.org");
+ }
+
+ function setup()
+ {
+ var oldDomain = document.domain;
+ var newDomain = "example.org"; // join with parent
+
+ document.domain = newDomain;
+
+ var target = document.getElementById("location");
+ target.textContent = "Location: " + oldDomain +
+ ", effective domain: " + newDomain;
+
+ window.addEventListener("message", receiveMessage);
+ }
+
+ window.addEventListener("load", setup);
+ </script>
+</head>
+<body>
+<p id="location">No location!</p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_onOther.html b/dom/tests/mochitest/whatwg/postMessage_onOther.html
new file mode 100644
index 0000000000..9d60d9ef24
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_onOther.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage called through another frame</title>
+ <script type="application/javascript">
+ var PATH = "/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html";
+
+ function receiveMessage(evt)
+ {
+ if (evt.lastEventId !== "")
+ {
+ fail("unexpected non-empty lastEventId");
+ return;
+ }
+
+ switch (window.location.href)
+ {
+ case "http://example.com" + PATH:
+ receiveTopDomain(evt);
+ break;
+
+ case "http://test1.example.com" + PATH:
+ receiveSubDomain(evt);
+ break;
+
+ default:
+ fail("unexpected location");
+ }
+ }
+
+ function fail(msg)
+ {
+ window.parent.postMessage("FAIL " + msg, "*");
+ }
+
+ // The parent frame sends "start-test" to the subdomain frame to start.
+ // The subdomain frame then sets document.domain to the top domain so that
+ // the top domain frame can access it. It then sends a message to the top
+ // domain frame to tell it to do likewise; once that happens, the top domain
+ // frame can then call a method on the subdomain frame window, which will
+ // call a method *on the top domain window* to send a message to the parent
+ // window. We thus expect to see an event whose source is the subdomain
+ // window -- *not* the top domain window. Therefore, its .origin should be:
+ //
+ // http://test1.example.com
+ //
+ // and not
+ //
+ // http://example.com
+
+ function receiveSubDomain(evt)
+ {
+ if (evt.origin !== "http://mochi.test:8888")
+ {
+ fail("wrong top-domain origin: " + evt.origin);
+ return;
+ }
+ if (evt.data !== "start-test")
+ {
+ fail("wrong top-domain message: " + evt.origin);
+ return;
+ }
+
+ document.domain = "example.com";
+ window.parent.topDomainFrame.postMessage("domain-switch",
+ "http://example.com");
+ }
+
+ function receiveTopDomain(evt)
+ {
+ if (evt.origin !== "http://test1.example.com")
+ {
+ fail("wrong subdomain origin: " + evt.origin);
+ return;
+ }
+ if (evt.data !== "domain-switch")
+ {
+ fail("wrong subdomain message: " + evt.origin);
+ return;
+ }
+ if (evt.source !== window.parent.subDomainFrame)
+ {
+ fail("wrong source on message from subdomain");
+ return;
+ }
+
+ document.domain = "example.com";
+ window.parent.subDomainFrame.testSiblingPostMessage();
+ }
+
+ function testSiblingPostMessage()
+ {
+ window.parent.postMessage("test-finished", "http://mochi.test:8888");
+ }
+
+ function setup()
+ {
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+ }
+
+ window.addEventListener("message", receiveMessage);
+ window.addEventListener("load", setup);
+ </script>
+</head>
+<body>
+<h1 id="location">No location!</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml b/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml
new file mode 100644
index 0000000000..955b2de83f
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>postMessage origin-testing helper page</title>
+ <script type="application/javascript"><![CDATA[
+function receiveMessage(evt)
+{
+ if (event.data === "PING") {
+ window.parent.postMessage("PONG", "*");
+ return;
+ }
+
+ var response = "PASS";
+
+ if (evt.origin !== "http://mochi.test:8888")
+ response += " wrong-origin(" + evt.origin + ")";
+ if (evt.source !== window.parent)
+ response += " wrong-source";
+ if (evt.data !== "PASS")
+ response += " wrong-data(" + evt.data + ")";
+
+ window.parent.postMessage(response, "http://mochi.test:8888");
+}
+
+window.addEventListener("message", receiveMessage);
+
+
+// Aids for identifying origins
+
+function setup()
+{
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+}
+
+window.addEventListener("load", setup);
+ ]]></script>
+</head>
+<body>
+<h1 id="location">No location!</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_override_helper.html b/dom/tests/mochitest/whatwg/postMessage_override_helper.html
new file mode 100644
index 0000000000..901e3af7bb
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_override_helper.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Overriding postMessage and dispatchEvent bindings</title>
+ <script type="application/javascript">
+ window.postMessage = function (evt) {
+ window.parent.postMessage("FAIL overridden postMessage called", "*");
+ };
+
+ var count = 0;
+
+ function receiveMessage(evt) {
+ count++;
+ if (count == 2) {
+ window.dispatchEvent = function(evt) {
+ window.parent.postMessage("FAIL", "*");
+ throw "dispatchEvent threw";
+ };
+ }
+
+ window.parent.postMessage(evt.data, "http://mochi.test:8888");
+ }
+
+ function setup() {
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+ }
+
+ window.addEventListener("message", receiveMessage);
+
+ window.addEventListener("load", setup);
+ </script>
+</head>
+<body>
+<h1 id="location">No location!</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html b/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html
new file mode 100644
index 0000000000..2b6e9d1f46
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage structured clone page</title>
+ <script type="application/javascript"
+ src="postMessage_structured_clone_helper.js"></script>
+ <script type="application/javascript">
+ var generator = getTestContent()
+
+ function isClone(a, b) {
+ window.dump("Object a: " + a + "\n");
+ window.dump("Object b: " + b + "\n");
+ var stack = [[a, b]];
+ var memory = new WeakMap();
+ var rmemory = new WeakMap();
+
+ while (stack.length) {
+ var pair = stack.pop();
+ var x = pair[0], y = pair[1];
+ if (typeof x !== "object" || x === null) {
+ // x is primitive.
+ if (x !== y) {
+ window.dump("Primitives not equal!\n");
+ return false;
+ }
+ } else if (x instanceof Date) {
+ if (x.getTime() == y.getTime())
+ return true;
+ window.dump("Dates not equal!\n");
+ return false;
+ } else if (memory.has(x)) {
+ // x is an object we have seen before in a.
+ if (y !== memory.get(x)) {
+ window.dump("Already seen!?\n");
+ return false;
+ }
+ if (!(rmemory.get(y) == x)) {
+ window.dump("Not equal??\n");
+ return false;
+ }
+ } else {
+ // x is an object we have not seen before.
+ // Check that we have not seen y before either.
+ if (rmemory.has(y)) {
+ // If we have seen y before, the only possible outcome
+ // is that x and y are literally the same object.
+ if (y == x)
+ continue;
+ window.dump("Already seen y!?\n");
+ window.dump(y.toString() + "\n");
+ return false;
+ }
+
+ // x and y must be of the same [[Class]].
+ var xcls = Object.prototype.toString.call(x);
+ var ycls = Object.prototype.toString.call(y);
+ if (xcls !== ycls) {
+ window.dump("Failing on proto\n");
+ return false;
+ }
+
+ // This function is only designed to check Objects and Arrays.
+ if (!(xcls === "[object Object]" || xcls === "[object Array]")) {
+ window.dump("Not an object!\n");
+ window.dump(xcls + "\n");
+ return false;
+ }
+
+ // Compare objects.
+ var xk = Object.keys(x), yk = Object.keys(y);
+ if (xk.length !== yk.length) {
+ window.dump("Length mismatch!\n");
+ return false;
+ }
+ for (var i = 0; i < xk.length; i++) {
+ // We must see the same property names in the same order.
+ if (xk[i] !== yk[i]) {
+ window.dump("wrong order\n");
+ return false;
+ }
+
+ // Put the property values on the stack to compare later.
+ stack.push([x[xk[i]], y[yk[i]]]);
+ }
+
+ // Record that we have seen this pair of objects.
+ memory.set(x, y);
+ rmemory.set(y, x);
+ }
+ }
+ return true;
+ }
+
+ function receiveMessage(evt)
+ {
+ if (isClone(evt.data, generator.next().value))
+ window.parent.postMessage("TEST-PASS", "*");
+ else
+ window.parent.postMessage("TEST-FAIL", "*");
+ }
+ window.addEventListener("message", receiveMessage);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.js b/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.js
new file mode 100644
index 0000000000..b457fd2d2f
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.js
@@ -0,0 +1,62 @@
+function* getTestContent() {
+ yield "hello";
+ yield 2 + 3;
+ yield 12;
+ yield null;
+ yield "complex" + "string";
+ yield new Object();
+ yield new Date(1306113544);
+ yield [1, 2, 3, 4, 5];
+ let obj = new Object();
+ obj.foo = 3;
+ obj.bar = "hi";
+ obj.baz = new Date(1306113544);
+ obj.boo = obj;
+ yield obj;
+
+ let recursiveobj = new Object();
+ recursiveobj.a = recursiveobj;
+ recursiveobj.foo = new Object();
+ recursiveobj.foo.bar = "bar";
+ recursiveobj.foo.backref = recursiveobj;
+ recursiveobj.foo.baz = 84;
+ recursiveobj.foo.backref2 = recursiveobj;
+ recursiveobj.bar = new Object();
+ recursiveobj.bar.foo = "foo";
+ recursiveobj.bar.backref = recursiveobj;
+ recursiveobj.bar.baz = new Date(1306113544);
+ recursiveobj.bar.backref2 = recursiveobj;
+ recursiveobj.expando = recursiveobj;
+ yield recursiveobj;
+
+ obj = new Object();
+ obj.expando1 = 1;
+ obj.foo = new Object();
+ obj.foo.bar = 2;
+ obj.bar = new Object();
+ obj.bar.foo = obj.foo;
+ obj.expando = new Object();
+ obj.expando.expando = new Object();
+ obj.expando.expando.obj = obj;
+ obj.expando2 = 4;
+ obj.baz = obj.expando.expando;
+ obj.blah = obj.bar;
+ obj.foo.baz = obj.blah;
+ obj.foo.blah = obj.blah;
+ yield obj;
+
+ let diamond = new Object();
+ obj = new Object();
+ obj.foo = "foo";
+ obj.bar = 92;
+ obj.backref = diamond;
+ diamond.ref1 = obj;
+ diamond.ref2 = obj;
+ yield diamond;
+
+ let doubleref = new Object();
+ obj = new Object();
+ doubleref.ref1 = obj;
+ doubleref.ref2 = obj;
+ yield doubleref;
+}
diff --git a/dom/tests/mochitest/whatwg/postMessage_throw_helper.html b/dom/tests/mochitest/whatwg/postMessage_throw_helper.html
new file mode 100644
index 0000000000..b1d3ddce7d
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_throw_helper.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage throwing page</title>
+ <script type="application/javascript">
+ function receiveMessage(evt)
+ {
+ throw 17;
+ }
+ window.addEventListener("message", receiveMessage);
+
+ function setup()
+ {
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+ }
+
+ window.addEventListener("load", setup);
+ </script>
+</head>
+<body>
+<h1 id="location">No location!</h1>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_transfer_helper.html b/dom/tests/mochitest/whatwg/postMessage_transfer_helper.html
new file mode 100644
index 0000000000..03c4c1030b
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_transfer_helper.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head><meta charset=utf-8>
+ <title>postMessage transferable tests helper</title>
+</head>
+<body>
+<script>
+
+onmessage = function(e) {
+ parent.postMessage(e.data, "*");
+};
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html b/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html
new file mode 100644
index 0000000000..762cf52f9f
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Username/password page for postMessage tests</title>
+ <script type="application/javascript">
+
+function sendMessage(evt)
+{
+ var msg = "child-message";
+
+ if (evt.origin !== "http://mochi.test:8888")
+ msg += " wrong-origin(" + evt.origin + ")";
+ if (evt.data !== "parent-message")
+ msg += " wrong-data(" + evt.data + ")";
+ if (evt.lastEventId !== "")
+ msg += " wrong-lastEventId(" + evt.lastEventId + ")";
+ if (evt.source !== window.parent)
+ msg += " wrong-source";
+
+ // It would be good to guarantee that we've been opened with a userinfo of
+ // "bobhope:password", but Gecko elides that from the content-visible URL,
+ // and I can't find another way to actually detect this programmatically.
+
+ window.parent.postMessage(msg, "http://mochi.test:8888");
+}
+
+window.addEventListener("message", sendMessage);
+ </script>
+</head>
+<body>
+<p>Kid iframe</p>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/whatwg/test_MessageEvent.html b/dom/tests/mochitest/whatwg/test_MessageEvent.html
new file mode 100644
index 0000000000..41e1a7bcb4
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_MessageEvent.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>MessageEvent tests</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+
+<button id="target">target</button>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var data = "foobar";
+var origin = "http://cool.example.com";
+var bubbles = true, cancelable = true;
+var lastEventId = "lastEventId";
+
+var target;
+
+var count = 0;
+
+function sendMsg()
+{
+ try
+ {
+ var evt = new MessageEvent('message', {
+ bubbles, cancelable, data,
+ origin, lastEventId, source: window});
+ ok(evt instanceof MessageEvent, "I ordered a MessageEvent!");
+
+ is(evt.data, data, "unexpected data");
+ is(evt.origin, origin, "unexpected origin");
+ is(evt.lastEventId, lastEventId, "unexpected lastEventId");
+
+ is(evt.cancelable, cancelable, "wrong cancelable property");
+ is(evt.bubbles, bubbles, "wrong bubbling property");
+ is(evt.source, window, "wrong source");
+
+ return target.dispatchEvent(evt);
+ }
+ catch (e)
+ {
+ ok(false, "exception thrown: " + e);
+ return false;
+ }
+}
+
+function recvMsg(evt)
+{
+ is(evt.data, data, "unexpected data");
+ is(evt.origin, origin, "unexpected origin");
+ is(evt.lastEventId, lastEventId, "unexpected lastEventId");
+
+ is(evt.cancelable, cancelable, "wrong cancelable property");
+ is(evt.bubbles, bubbles, "wrong bubbling property");
+ is(evt.source, window, "wrong source");
+
+ is(evt.target, target, "wrong target");
+
+ if (target == evt.currentTarget)
+ {
+ is(Event.AT_TARGET, evt.eventPhase, "this listener was on the target");
+ }
+ else
+ {
+ is(evt.currentTarget, document, "should have gotten this at the window");
+ is(Event.BUBBLING_PHASE, evt.eventPhase, "wrong phase");
+ }
+
+ count++;
+}
+
+function setup()
+{
+ target = $("target");
+ target.addEventListener("message", recvMsg);
+ document.addEventListener("message", recvMsg);
+ var res = sendMsg();
+ ok(res === true, "nothing canceled this");
+ is(count, 2, "listener not called twice");
+ SimpleTest.finish();
+}
+
+addLoadEvent(setup);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_MessageEvent_dispatchToOther.html b/dom/tests/mochitest/whatwg/test_MessageEvent_dispatchToOther.html
new file mode 100644
index 0000000000..d5d2f4c454
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_MessageEvent_dispatchToOther.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>Dispatching MessageEvent across origins</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://example.com/" name="otherDomain"></iframe>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function run()
+{
+ try
+ {
+ var msg = new MessageEvent('message', { bubbles: true, cancelable: true,
+ data: "foo", origin: "http://evil.com",
+ source: window });
+
+ try
+ {
+ var ex;
+ window.frames.otherDomain.dispatchEvent(msg);
+ ok(false, "should have thrown a security exception per HTML5");
+ }
+ catch (e)
+ {
+ ok(true, "correctly threw an exception (security exception, but " +
+ "what that entails isn't yet defined in the spec)");
+ }
+ }
+ catch (e)
+ {
+ ok(false, "threw exception during execution: " + e);
+ }
+ finally
+ {
+ SimpleTest.finish();
+ }
+}
+
+addLoadEvent(run);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_bug477323.html b/dom/tests/mochitest/whatwg/test_bug477323.html
new file mode 100644
index 0000000000..66bad6288c
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_bug477323.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Dynamically assigned drag and drop handlers</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="start()">
+<script class="testbody" type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function start()
+{
+ var element = document.getElementById("draggable_img");
+
+ var gotdragstart = false, gotdrag = false,
+ gotdragenter = false, gotdragover = false, gotdragleave = false,
+ gotdrop = false, gotdragend = false;
+
+ element.ondragstart = function(event) {gotdragstart = true;}
+ element.ondrag = function(event) {gotdrag = true;}
+ element.ondragenter = function(event) {gotdragenter = true;}
+ element.ondragover = function(event) {gotdragover = true;}
+ element.ondragleave = function(event) {gotdragleave = true;}
+ element.ondrop = function(event) {gotdrop = true;}
+ element.ondragend = function(event) {gotdragend = true;}
+
+ function dispatch(eventName)
+ {
+ var event = document.createEvent("DragEvent");
+ event.initDragEvent(eventName, true, true, window, 0, 5, 5, 5, 5,
+ false, false, false, false, 0, null, null);
+ element.dispatchEvent(event);
+ }
+
+ dispatch("dragstart");
+ dispatch("drag");
+ dispatch("dragenter");
+ dispatch("dragover");
+ dispatch("dragleave");
+ dispatch("drop");
+ dispatch("dragend");
+
+ ok(gotdragstart, "Got ondragstart event");
+ ok(gotdrag, "Got ondrag event");
+ ok(gotdragenter, "Got ondragenter event");
+ ok(gotdragover, "Got ondragover event");
+ ok(gotdragleave, "Got ondragleave event");
+ ok(gotdrop, "Got ondrop event");
+ ok(gotdragend, "Got ondragend event");
+
+ SimpleTest.finish();
+}
+
+</script>
+
+<img src="data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%18%00%00%00%18%02%03%00%00%00%9D%19%D5k%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%0CPLTE%FF%FF%FF%FF%FF%FF%F7%DC%13%00%00%00%03%80%01X%00%00%00%01tRNS%08N%3DPT%00%00%00%01bKGD%00%88%05%1DH%00%00%00%09pHYs%00%00%0B%11%00%00%0B%11%01%7Fd_%91%00%00%00%07tIME%07%D2%05%0C%14%0C%0D%D8%3F%1FQ%00%00%00%5CIDATx%9C%7D%8E%CB%09%C0%20%10D%07r%B7%20%2F%E9wV0%15h%EA%D9%12D4%BB%C1x%CC%5C%1E%0C%CC%07%C0%9C0%9Dd7()%C0A%D3%8D%E0%B8%10%1DiCHM%D0%AC%D2d%C3M%F1%B4%E7%FF%10%0BY%AC%25%93%CD%CBF%B5%B2%C0%3Alh%CD%AE%13%DF%A5%F7%E0%03byW%09A%B4%F3%E2%00%00%00%00IEND%AEB%60%82"
+ draggable="true" id="draggable_img"/>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_bug500328.html b/dom/tests/mochitest/whatwg/test_bug500328.html
new file mode 100644
index 0000000000..20b2c36761
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_bug500328.html
@@ -0,0 +1,769 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=500328
+-->
+<head>
+ <title>Test for Bug 500328</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500328">Mozilla Bug 500328</a>
+<p id="display"></p>
+<div id="status"></div>
+<div id="content">
+ <iframe id="iframe"></iframe>
+ <iframe id="iframe2"></iframe>
+ <a id="link">link</a>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 500328 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var iframe = document.getElementById("iframe");
+var iframeCw = iframe.contentWindow;
+
+var iframe2 = document.getElementById("iframe2");
+var iframe2Cw = iframe2.contentWindow;
+
+const unvisitedColor = "rgb(0, 0, 238)";
+const visitedColor = "rgb(85, 26, 139)";
+
+var gCallbackOnIframeLoad = false;
+var gCallbackOnIframePageShow = false;
+var gCallbackOnPopState = false;
+var gNumPopStates = 0;
+var gLastPopStateEvent;
+var gLastScriptHistoryState;
+
+var gGen;
+
+function statusMsg(msg) {
+ var msgElem = document.createElement("p");
+ msgElem.appendChild(document.createTextNode(msg));
+
+ document.getElementById("status").appendChild(msgElem);
+}
+
+function longWait() {
+ function hitEventLoop(times, func) {
+ if (times > 0) {
+ setTimeout(hitEventLoop, 0, times - 1, func);
+ } else {
+ setTimeout(func, 0);
+ }
+ }
+ hitEventLoop(100, function() { gGen.next(); });
+}
+
+function shortWait() {
+ setTimeout(function() { gGen.next(); }, 0);
+}
+
+function onChildPopState(e) {
+ gNumPopStates++;
+ gLastPopStateEvent = e;
+ if (gCallbackOnPopState) {
+ statusMsg("Popstate(" + JSON.stringify(e.state) + "). Calling gGen.next().");
+ gCallbackOnPopState = false;
+ gGen.next();
+ }
+ else {
+ statusMsg("Popstate(" + JSON.stringify(e.state) + "). NOT calling gGen.next().");
+ }
+}
+
+function onChildScript(state) {
+ gLastScriptHistoryState = state;
+}
+
+function getURLFromEvent(e) {
+ try {
+ var target = e.target;
+ if ("contentWindow" in target) {
+ return target.contentWindow.location.toString();
+ }
+ if ("ownerDocument" in target && target.ownerDocument) {
+ return target.ownerDocument.location.toString();
+ }
+ if ("location" in target) {
+ return target.location.toString();
+ }
+ return target.toString();
+ }
+ catch(ex) {
+ return "<cross-site object>";
+ }
+}
+
+function onChildLoad(e) {
+ if(gCallbackOnIframeLoad) {
+ statusMsg("Got load for " + getURLFromEvent(e) + ". About to call gGen.next().");
+ gCallbackOnIframeLoad = false;
+ gGen.next();
+ }
+ else {
+ statusMsg("Got load for " + getURLFromEvent(e) + ", but not calling gGen.next() because gCallbackOnIframeLoad was false.");
+ }
+}
+
+function onChildPageShow(e) {
+ if(gCallbackOnIframePageShow) {
+ statusMsg("Got pageshow for " + getURLFromEvent(e) + ". About to call gGen.next().");
+ gCallbackOnIframePageShow = false;
+ SimpleTest.executeSoon(function() { gGen.next(); });
+ }
+ else {
+ statusMsg("Got pageshow for " + getURLFromEvent(e) + ", but not calling gGen.next() because gCallbackOnIframePageShow was false.");
+ }
+}
+
+function enableChildLoadCallback() {
+ gCallbackOnIframeLoad = true;
+}
+
+function enableChildPageShowCallback() {
+ gCallbackOnIframePageShow = true;
+}
+
+function enableChildPopStateCallback() {
+ gCallbackOnPopState = true;
+}
+
+function clearPopStateCounter() {
+ gNumPopStates = 0;
+}
+
+function noPopStateExpected(msg) {
+ is(gNumPopStates, 0, msg);
+
+ // Even if there's an error, set gNumPopStates to 0 so other tests don't
+ // fail.
+ gNumPopStates = 0;
+}
+
+function popstateExpected(msg) {
+ is(gNumPopStates, 1, msg);
+ gNumPopStates = 0;
+}
+
+function getColor(elem) {
+ var utils = SpecialPowers.getDOMWindowUtils(document.defaultView);
+ return utils.getVisitedDependentComputedStyle(elem, "", "color");
+}
+
+function getSHistory(theWindow)
+{
+ const Ci = SpecialPowers.Ci;
+ var sh = SpecialPowers.wrap(theWindow).docShell
+ .QueryInterface(Ci.nsIWebNavigation)
+ .sessionHistory;
+ if (!sh || sh == null)
+ throw("Couldn't get shistory for window!");
+
+ return sh;
+}
+
+function getSHTitle(sh, offset)
+{
+ if (!offset)
+ offset = 0;
+
+ // False instructs the SHistory not to modify its current index.
+ return sh.legacySHistory.getEntryAtIndex(sh.index + offset).title;
+}
+
+// Tests that win's location ends with str
+function locationEndsWith(win, str) {
+ var exp = new RegExp(str + "$");
+ ok(win.location.toString().match(exp),
+ "Wrong window location. Expected it to end with " +
+ str + ", but actuall was " + win.location);
+}
+
+function expectException(func, msg) {
+ var failed = false;
+ try {
+ func();
+ } catch(ex) {
+ failed = true;
+ }
+
+ ok(failed, msg + " succeeded, but should have failed.");
+}
+
+function* runTest() {
+ // We can't enable universal XPConnect privleges in this function, because
+ // test 5 needs to be running at normal privleges in order to test the
+ // same-origin policy.
+
+ /**
+ * PRELIMINARY:
+ * 1. Clear the popstate counter
+ */
+
+ clearPopStateCounter();
+
+ // The URL of file_bug500328_1.html on http://localhost:8888
+ var innerLoc;
+
+ // Now we can start the tests
+
+ /**
+ * TEST 1 tests basic pushState functionality
+ */
+ enableChildLoadCallback();
+ iframeCw.location = "file_bug500328_1.html";
+ yield undefined;
+ innerLoc = iframeCw.location.toString();
+ // No popstate during initial load.
+ shortWait();
+ yield undefined;
+ noPopStateExpected("No initial popstate.");
+ is(JSON.stringify(gLastScriptHistoryState), "null", "null initial state.");
+ statusMsg("Awake after first load.");
+
+ // Make sure that the pushstate below doesn't trigger a hashchange.
+ iframeCw.onhashchange = function() {
+ ok(false, "Pushstate shouldn't trigger a hashchange.");
+ };
+
+ var testObj1 = 42;
+ var testObj2 = { x: 4.2 };
+ iframeCw.history.pushState(testObj1, "test 1");
+ is(JSON.stringify(iframeCw.history.state), JSON.stringify(testObj1),
+ "correct state after pushState");
+ is(iframeCw.location.search, "",
+ "First pushstate should leave us where we were.");
+
+ iframeCw.history.pushState(testObj2, "test 1#foo", "?test1#foo");
+ is(JSON.stringify(iframeCw.history.state), JSON.stringify(testObj2),
+ "correct state after pushState");
+ isnot(iframeCw.history.state, testObj2,
+ "correct state object identity after pushState");
+ is(iframeCw.location.search, "?test1",
+ "Second pushstate should push us to '?test1'.");
+ is(iframeCw.location.hash, "#foo",
+ "Second pushstate should push us to '#foo'");
+ shortWait();
+ yield undefined;
+
+ // Let the hashchange event fire, if it's going to.
+ longWait();
+ yield undefined;
+ iframeCw.onhashchange = null;
+
+ statusMsg("About to go back to page 1.");
+ // We don't have to yield here because this back() and the resulting popstate
+ // are completely synchronous. In fact, if we did yield, JS would throw an
+ // error because we'd be calling gGen.next from within gGen.next.
+ iframeCw.history.back();
+
+ statusMsg("Awake after going back to page 1.");
+ popstateExpected("Going back to page 1 should trigger a popstate.");
+ is(gLastPopStateEvent.isTrusted, true, 'Popstate event should be trusted.');
+ is(JSON.stringify(gLastPopStateEvent.state), JSON.stringify(testObj1),
+ "Wrong state object popped after going back to page 1.");
+ ok(gLastPopStateEvent.state === iframeCw.history.state,
+ "Wrong state object in document after going back to page 1.");
+ ok(iframeCw.location.toString().match(/file_bug500328_1.html$/),
+ "Going back to page 1 hould take us to original page.");
+
+ iframeCw.history.back();
+ popstateExpected("Going back to page 0 should trigger a popstate.");
+ is(gLastPopStateEvent.state, null,
+ "Going back to page 0 should pop a null state.");
+ is(iframeCw.history.state, null,
+ "Going back to page 0 should pop a null state.");
+ is(iframeCw.location.search, "",
+ "Going back to page 0 should clear the querystring.");
+
+ iframeCw.history.forward();
+ popstateExpected("Going forward to page 1 should trigger a popstate.");
+ is(JSON.stringify(gLastPopStateEvent.state), JSON.stringify(testObj1),
+ "Wrong state object popped after going forward to page 1.");
+ is(gLastPopStateEvent.state, iframeCw.history.state,
+ "Wrong state object in document after going forward to page 1.");
+ ok(iframeCw.location.toString().match(/file_bug500328_1.html$/),
+ "Going forward to page 1 should leave us at original page.");
+
+ statusMsg("About to go forward to page 2.");
+ iframeCw.history.forward();
+ statusMsg("Awake after going forward to page 2.");
+ popstateExpected("Going forward to page 2 should trigger a popstate.");
+ is(JSON.stringify(gLastPopStateEvent.state), JSON.stringify(testObj2),
+ "Wrong state object popped after going forward to page 2.");
+ is(iframeCw.history.state, gLastPopStateEvent.state,
+ "Wrong state object in document after going forward to page 2.");
+ ok(iframeCw.location.toString().match(/file_bug500328_1.html\?test1#foo$/),
+ "Going forward to page 2 took us to " + iframeCw.location.toString());
+
+ statusMsg("About to reload page 2.");
+ iframeCw.location.reload();
+ enableChildLoadCallback();
+ yield undefined;
+ statusMsg("Awake after reloading page 2.");
+ noPopStateExpected("Reloading page 2 should not trigger popstate.");
+ is(JSON.stringify(iframeCw.history.state), JSON.stringify(testObj2),
+ "Wrong state object after reloading page 2.");
+ is(JSON.stringify(gLastScriptHistoryState), JSON.stringify(testObj2),
+ "Wrong state object while reloading page 2.");
+ ok(iframeCw.location.toString().match(/file_bug500328_1.html\?test1#foo$/),
+ "Reloading page 2 took us to " + iframeCw.location.toString());
+
+ // The iframe's current location is file_bug500328_1.html?test1#foo.
+ // Clicking link1 should take us to file_bug500328_1.html?test1#1.
+
+ enableChildPopStateCallback();
+ sendMouseEvent({type:'click'}, 'link-anchor1', iframeCw);
+ yield undefined;
+ popstateExpected("Clicking on link-anchor1 should trigger a popstate.");
+ is(iframeCw.location.search, "?test1",
+ "search should be ?test1 after clicking link.");
+ is(iframeCw.location.hash, "#1",
+ "hash should be #1 after clicking link.");
+ is(iframeCw.history.state, null,
+ "Wrong state object in document after clicking link to hash '#1'.");
+
+ /*
+ * Reload file_bug500328_1.html; we're now going to test that link hrefs
+ * and colors are updated correctly on push/popstates.
+ */
+
+ iframe.onload = onChildLoad;
+ enableChildLoadCallback();
+ iframeCw.location = "about:blank";
+ yield undefined;
+ enableChildLoadCallback();
+ iframeCw.location = "file_bug500328_1.html";
+ yield undefined;
+ noPopStateExpected("No popstate after re-loading file_bug500328_1.html");
+ statusMsg("Done loading file_bug500328_1.html for the second time.");
+
+ var ifLink = iframeCw.document.getElementById("link-anchor1");
+ var rand = Date.now() + "-" + Math.random();
+ ifLink.href = rand;
+
+ // Poll the document until the link has the correct color, or this test times
+ // out. Unfortunately I can't come up with a more elegant way to do this.
+ // We could listen to MozAfterPaint, but that doesn't guarantee that we'll
+ // observe the new color.
+ while (getColor(ifLink) != unvisitedColor) {
+ // Dump so something shows up in the mochitest logs if we spin here.
+ dump("ifLink has wrong initial color. Spinning...\n");
+ setTimeout(function() { gGen.next(); }, 0);
+ yield undefined;
+ }
+
+ // Navigate iframe2 to dir/${rand}
+ iframe2.onload = onChildLoad;
+ enableChildLoadCallback();
+ iframe2Cw.location = "mytestdir/" + rand;
+ yield undefined;
+
+ // PushState the iframe into the mytestdir directory. This should cause
+ // ifLink to turn purple, since we just visited mytestdir/${rand} in iframe2.
+ iframeCw.history.pushState(null, "foo", "mytestdir/foo");
+
+ // Check that the link's color is now visitedColor
+ while (getColor(ifLink) != visitedColor) {
+ dump("ifLink has wrong color after pushstate. Spinning...\n");
+ setTimeout(function() { gGen.next(); }, 0);
+ yield undefined;
+ }
+
+ ok(ifLink.href.match("mytestdir\\/" + rand + "$"),
+ "inner frame's link should end with 'mytestdir/${rand}'");
+
+ // Navigate out of the mytestdir directory. This should cause ifLink to turn
+ // blue again.
+ iframeCw.history.pushState(null, "bar", "../file_bug500328_1.html");
+
+ // Check that the link's color is back to the unvisited color.
+ while (getColor(ifLink) != unvisitedColor) {
+ dump("ifLink has wrong color after pushstating out of dir. Spinning...\n");
+ setTimeout(function() { gGen.next(); }, 0);
+ yield undefined;
+ }
+
+ ok(!ifLink.href.match("mytestdir"),
+ "inner frame's link shouldn't contain 'mytestdir'.");
+
+ /*
+ * TEST 2 tests that pushstate's same-origin checks are correct.
+ */
+ var filename = 'file_bug500328_2.html';
+ var dirname = document.location.pathname.replace(/[^\/]*$/, '');
+ statusMsg("Dirname is: " + dirname);
+ iframeCw.location = filename;
+ iframe.onload = onChildLoad;
+ enableChildLoadCallback();
+ yield undefined;
+
+ // This function tries to pushstate and replacestate to the given URL and
+ // fails the test if the calls succeed.
+ var tryBadPushAndReplaceState = function(url) {
+ // XXX ex should be a SECURITY_ERR, not a plain Error.
+
+ var hist = iframeCw.history;
+ var url2 = url + dirname + filename;
+
+ expectException(function() { hist.pushState({}, "foo", url); },
+ 'pushState to ' + url);
+
+ expectException(function() { hist.pushState({}, "foo", url2); },
+ 'pushState to ' + url2);
+
+ expectException(function() { hist.replaceState({}, "foo", url); },
+ 'replaceState to ' + url);
+
+ expectException(function() { hist.replaceState({}, "foo", url2); },
+ 'replaceState to ' + url2);
+ }
+
+ // We're currently at http://example.com/[dirname]/[filename]
+ tryBadPushAndReplaceState("https://mochi.test:8888");
+ tryBadPushAndReplaceState("http://foo.mochitest:8888");
+ tryBadPushAndReplaceState("http://mochi.test:1234");
+ tryBadPushAndReplaceState("http://mochi.test.a:8888");
+ tryBadPushAndReplaceState("http://mochi.tes:8888");
+ tryBadPushAndReplaceState("http://mmochi.test:8888");
+ tryBadPushAndReplaceState("http://me@mochi.test:8888");
+
+ /**
+ * TEST 3 tests that the session history entries' titles are properly sync'ed
+ * after push/pop states.
+ *
+ * We have to run this test in a popup rather than an iframe because only the
+ * root docshell has a session history object.
+ */
+ statusMsg("About to open popup.");
+ var popup = window.open("file_bug500328_1.html", "popup0",
+ "height=200,width=200,location=yes," +
+ "menubar=yes,status=yes,toolbar=yes,dependent=yes");
+
+ enableChildLoadCallback();
+ var shistory = getSHistory(popup);
+ yield undefined;
+ shortWait();
+ yield undefined;
+ noPopStateExpected("Shouldn't get popstate after opening window.");
+
+ popup.history.pushState(null, "title 0");
+ ok(SpecialPowers.isBackButtonEnabled(popup),
+ "Back button was not enabled after initial pushstate.");
+
+ popup.document.title = "title 1";
+
+ // Yield to the event loop so listeners will be notified of the title change
+ // and so that the hash change we trigger below generates a new session
+ // history entry.
+ shortWait();
+ yield undefined;
+
+ // Check that the current session history entry's title has been updated to
+ // reflect the new document title.
+ is(getSHTitle(shistory), "title 1", "SHEntry title test 1");
+
+ // Change the page's hash to #1, which will trigger a popstate event.
+ // We don't have to wait, because this happens synchronously.
+ popup.location.hash = "#1";
+ popstateExpected("Didn't get popstate after changing hash.");
+
+ popup.document.title = "title 2";
+
+ // Yield so listeners will be notified of the title change we just performed.
+ shortWait();
+ yield undefined;
+
+ is(getSHTitle(shistory), "title 2", "SHEntry title test 2");
+
+ // Go back. Happens synchronously. We should get a popstate.
+ statusMsg("About to go back.");
+ popup.history.go(-1);
+ popstateExpected("Didn't get a popstate after going back.");
+
+ // Even though we went back, we expect the SHEntry title to remain the same
+ // because the document didn't change.
+ is(getSHTitle(shistory), "title 2", "SHEntry title test 3");
+
+ popup.document.title = "Changed 1";
+ shortWait();
+ yield undefined;
+
+ // This check is really a test of bug 509055.
+ is(getSHTitle(shistory), "Changed 1", "SHEntry title test 4");
+
+ popup.close();
+
+ /**
+ * TEST 4 tests replaceState and that we don't get double popstates on
+ * window.open. It also stress-tests the system and its interaction with
+ * bfcache by making many push/replace state calls.
+ */
+ popup = window.open("file_bug500328_1.html", "popup1",
+ "height=200,width=200,location=yes," +
+ "menubar=yes,status=yes,toolbar=yes,dependent=yes");
+
+ // The initial about:blank load into the new window shouldn't result in us
+ // seeing a popstate. Once file_bug500328_1.html is loaded, it'll overwrite
+ // popup.onpopstate, and this assertion won't fire for that popstate and
+ // others after.
+ //
+ // If we fired the popstate event asynchronously, we'd expect this assert to
+ // fire.
+ popup.onpopstate = function() {
+ ok(false, "Initial load of popup shouldn't give us a popstate.");
+ };
+
+ shistory = getSHistory(popup);
+
+ enableChildLoadCallback();
+ yield undefined;
+ statusMsg("Awake after loading content into popup.");
+
+ popup.history.replaceState({n:1, ok:true}, "state 1", "good1.html");
+ locationEndsWith(popup, "good1.html");
+
+ // Even though we replaceState with title "state 1", the title should remain
+ // "test 1" because we ignore the title argument in push/replaceState.
+ // See bug 544535.
+ is(getSHTitle(shistory), "test 1", "SHEntry title 'state 1'");
+
+ // Flush the event loop so our next load creates a new session history entry.
+ shortWait();
+ yield undefined;
+
+ enableChildLoadCallback();
+ popup.location = "file_bug500328_1.html";
+ yield undefined;
+
+ // Flush the event loop so nsDocShell::OnNewURI runs and our load is recorded
+ // properly.
+ shortWait();
+ yield undefined;
+
+ // Now go back and make sure everything is as it should be.
+ enableChildPageShowCallback();
+ popup.history.back();
+ yield undefined;
+ // Flush the event loop so the document's location is updated and any
+ // popstates fire.
+ shortWait();
+ yield undefined;
+ noPopStateExpected("no popstate during initial load");
+
+ locationEndsWith(popup, "good1.html");
+ is(JSON.stringify(popup.history.state), '{"n":1,"ok":true}',
+ "Wrong state popped after going back to initial state.");
+
+ // We're back at state 0, which was replaceState-ed to state1.html. Let's do
+ // some push/pop/replaces to make sure everything works OK when we involve
+ // large numbers of SHEntries.
+ for(var i = 2; i <= 30; i++) {
+ if (i % 3 == 0) {
+ popup.history.pushState({n:i, ok:true}, "state " + i, "good" + i + ".html");
+ }
+ else {
+ popup.history.pushState({n:i}, "state " + i, "state" + i + ".html");
+ for(var j = 0; j < i % 4; j++) {
+ popup.history.replaceState({n:i, nn:j}, "state " + i + ", " + j);
+ }
+ popup.history.replaceState({n:i, ok:true}, "state " + i, "good" + i + ".html");
+ }
+ }
+
+ for(var i = 29; i >= 1; i--) {
+ popup.history.back();
+ popstateExpected("Didn't get a popstate on iteration " + i);
+ locationEndsWith(popup, "good" + i + ".html");
+ is(gLastPopStateEvent.state.n, i, "Bad counter on last popstate event.");
+ ok(gLastPopStateEvent.state.ok,
+ "Last popstate event should have 'ok' set to true.");
+ }
+
+ popup.close();
+
+ /**
+ * TEST 5 tests misc security features and implementation details of
+ * Push/ReplaceState
+ */
+
+ /*
+ * Test that we can't push/replace an object with a large (over 640k
+ * characters) JSON representation.
+ */
+
+ // (In case you're curious, this loop generates an object which serializes to
+ // 694581 characters.)
+ var bigObject = new Object();
+ for(var i = 0; i < 51200; i++) {
+ bigObject[i] = i;
+ }
+ // statusMsg("Big object has size " + JSON.stringify(bigObject).length);
+
+ // We shouldn't be able to pushstate this large object, due to space
+ // constraints.
+ expectException(
+ function() { iframeCw.history.pushState(bigObject, "foo"); },
+ "pushState-ing large object");
+
+ expectException(
+ function() { iframeCw.history.replaceState(bigObject, "foo"); },
+ "replaceState-ing large object");
+
+ /*
+ * Make sure we can't push/replace state on an iframe of a different origin.
+ * This will work if this function has requested Universal XPConnect
+ * privileges, so any code which needs those privileges can't be in this
+ * function.
+ */
+ enableChildLoadCallback();
+ iframeCw.location = "http://example.com";
+ iframe.onload = onChildLoad;
+ yield undefined;
+ iframe.onload = null;
+
+ expectException(
+ function() { iframeCw.history.pushState({}, "foo"); },
+ "pushState-ing in a different origin");
+
+ expectException(
+ function() { iframeCw.history.replaceState({}, "foo"); },
+ "replaceState-ing in a different origin");
+
+ /*
+ * If we do the following:
+ * * Start at page A.
+ * * PushState to page B.
+ * * Refresh. The server responds with a 404
+ * * Go back.
+ * Then at the end, page A should be displayed, not the 404 page.
+ */
+ enableChildLoadCallback();
+ iframe.onload = onChildLoad;
+ iframeCw.location = "about:blank";
+ yield undefined;
+ iframe.onload = null;
+
+ enableChildLoadCallback();
+ // navigate to http://mochi.test:8888/[...]/file_bug500328_1.html
+ iframeCw.location = innerLoc;
+ yield undefined;
+
+ // PushState to a URL which doesn't exist
+ iframeCw.history.pushState({}, "", rand);
+
+ // Refresh. We'll end up a 404 page.
+ iframe.onload = onChildLoad;
+ enableChildLoadCallback();
+ iframeCw.location.reload(true);
+ yield undefined;
+ iframe.onload = null;
+
+ // Since the last page was a 404, going back should actually show the
+ // contents of the old page, instead of persisting the contents of the 404
+ // page.
+ enableChildPageShowCallback();
+ iframeCw.history.back();
+ yield undefined;
+
+ // Make sure that we're actually showing the contents of
+ // file_bug500328_1.html, as opposed to the 404 page.
+ var identifierElem = iframeCw.document.getElementById("link-anchor1");
+ ok(identifierElem != undefined && identifierElem != null,
+ "iframe didn't contain file_bug500328_1.html's contents.");
+
+ /**
+ * TEST 6 tests that the referrer is set properly after push/replace states.
+ */
+
+ /*
+ * First, a simple test:
+ * * Load file_bug500328_1.html into iframe
+ * * PushState to newpage1.html#foo
+ * * Instruct the iframe to load file_bug500328_1.html into itself.
+ * The referer should be newpage1.html, without the hash.
+ *
+ * This also tests that we can call pushState from within the onload handler.
+ */
+ enableChildLoadCallback();
+ iframeCw.location = "file_bug500328_1.html";
+ yield undefined;
+
+ // Run within the onload handler. This should work without issue.
+ iframeCw.history.pushState(null, "", "newpage1.html");
+
+ // iframeCw.navigateTo() causes the iframe to set its location on our
+ // behalf. We can't just set its location ourselves, because then *we*
+ // become the referrer.
+ enableChildLoadCallback();
+ iframeCw.navigateTo("file_bug500328_1.html");
+ yield undefined;
+
+ ok(iframeCw.document.referrer.toString().match(/newpage1.html$/),
+ "Wrong referrer after pushState. Expected newpage1.html, but was " +
+ iframeCw.document.referrer);
+
+ /*
+ * We're back at file_bug500328_1.html. Now do the following:
+ * * replaceState to newpage2.html#foo
+ * * Click a link back to file_bug500328_1.html
+ * The referrer should be newpage2.html, without the hash.
+ */
+ iframeCw.history.replaceState(null, null, "newpage2.html#foo");
+ enableChildLoadCallback();
+ sendMouseEvent({type:'click'}, 'link-self', iframeCw);
+ yield undefined;
+
+ ok(iframeCw.document.referrer.toString().match(/newpage2.html$/),
+ "Wrong referrer after replaceState. Expected newpage2.html, but was " +
+ iframeCw.document.referrer);
+
+ /*
+ * Set up a cycle with the popstate event to make sure it's properly
+ * collected.
+ */
+ var evt = document.createEvent("popstateevent");
+ evt.initEvent("foo", false, false, evt);
+
+ /* */
+ SimpleTest.finish();
+ statusMsg("********** Finished tests ***********");
+ while(true)
+ {
+ yield undefined;
+
+ // I don't think this will actually make the mochitest fail, but there's
+ // not much we can do about this. Realistically, though, regressions are
+ // not likely to fire extra events -- this trap is here mostly to catch
+ // errors made while wriring tests.
+ ok(false, "Got extra event!");
+ }
+
+ /*
+ statusMsg("XXXXXXXXXXXXXX");
+ while(true) {
+ yield undefined;
+ statusMsg("Woken up.");
+ }
+ */
+}
+
+// Important: Wait to start the tests until the page has loaded. Otherwise,
+// the test will occasionally fail when it begins running before the iframes
+// have finished their initial load of about:blank.
+window.addEventListener('load', function() {
+ gGen = runTest();
+ gGen.next();
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_document_scripts.html b/dom/tests/mochitest/whatwg/test_document_scripts.html
new file mode 100644
index 0000000000..f0d8d27449
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_document_scripts.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=685774
+-->
+<head>
+ <title>Test for document.scripts (Bug 685774)</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685774">Mozilla Bug 685774</a>
+<script type="application/javascript">
+
+/** Test for Bug 685774 **/
+
+function testSameCollection(a, b, c) {
+ is(a.length, c, "unexpected count of script elements");
+ is(b.length, c, "unexpected count of script elements");
+ for (var i = 0; i < a.length; i++) {
+ is(a[i], b[i], "document.scripts is not supported");
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+testSameCollection(document.scripts, document.getElementsByTagName("script"), 3);
+
+</script>
+<script type="application/javascript">
+
+testSameCollection(document.scripts, document.getElementsByTagName("script"), 4);
+
+function start() {
+ testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
+
+ var e = document.createElement("script");
+ testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
+ document.body.appendChild(e);
+ testSameCollection(document.scripts, document.getElementsByTagName("script"), 6);
+
+ SimpleTest.finish();
+}
+
+addLoadEvent(start);
+
+</script>
+<script type="application/javascript">
+
+testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage.html b/dom/tests/mochitest/whatwg/test_postMessage.html
new file mode 100644
index 0000000000..a21abb9a00
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage.html
@@ -0,0 +1,161 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>Basic postMessage tests</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_helper.html"
+ name="otherSameDomain"></iframe>
+<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_helper.html"
+ name="otherCrossDomain"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+/** Variable for receivers to attempt to get. */
+window.privateVariable = 17;
+
+/** For sentinel finish, if necessary in deficient browsers. */
+var finished = false;
+
+/** Ends testing if it isn't already done. */
+function finish()
+{
+ if (!finished)
+ {
+ finished = true;
+ SimpleTest.finish();
+ }
+}
+
+/** Receives MessageEvents. */
+function messageReceiver(evt)
+{
+ try
+ {
+ ok(evt instanceof MessageEvent, "umm, how did we get this?");
+ is(evt.lastEventId, "",
+ "postMessage creates events with empty lastEventId");
+ is(evt.type, "message", "expected events of type 'message'");
+ ok(evt.isTrusted === true, "should have been a trusted event");
+
+ var data = evt.data;
+
+ // Check for the message we send to ourselves; it can't be
+ // counted as a test, and it's conceptually distinct from
+ // the other cases, so just return after handling it.
+ if (data === "post-to-self")
+ {
+ respondToSelf(evt);
+ return;
+ }
+
+ switch (evt.data)
+ {
+ case "post-to-self-response":
+ receiveSelf(evt);
+ break;
+
+ case "post-to-other-same-domain-response":
+ receiveOtherSameDomain(evt);
+ break;
+
+ case "post-to-other-cross-domain-response":
+ receiveOtherCrossDomain(evt);
+
+ // All the tests have executed, so we're done.
+ finish();
+ break;
+
+ default:
+ ok(false, "unexpected message: " + evt.data);
+ finish();
+ break;
+ }
+ }
+ catch (e)
+ {
+ ok(false, "error processing event with data '" + evt.data + "': " + e);
+ finish();
+ }
+}
+
+
+/******************
+ * SELF-RESPONDER *
+ ******************/
+
+function respondToSelf(evt)
+{
+ is(evt.origin, "http://mochi.test:8888", "event has wrong origin");
+ is(evt.source, window, "we posted this message!");
+
+ evt.source.postMessage("post-to-self-response", evt.origin);
+}
+
+
+/*************
+ * RECEIVERS *
+ *************/
+
+function receiveSelf(evt)
+{
+ is(evt.origin, "http://mochi.test:8888", "event has wrong origin");
+ is(evt.source, window, "we posted this message!");
+
+ window.frames.otherSameDomain.postMessage("post-to-other-same-domain",
+ "http://mochi.test:8888");
+}
+
+function receiveOtherSameDomain(evt)
+{
+ is(evt.origin, "http://mochi.test:8888",
+ "same-domain response event has wrong origin");
+ is(evt.source, window.frames.otherSameDomain,
+ "wrong source for same-domain message!");
+
+ window.frames.otherCrossDomain.postMessage("post-to-other-cross-domain",
+ "http://example.org:8000");
+}
+
+function receiveOtherCrossDomain(evt)
+{
+ is(evt.origin, "http://example.org:8000",
+ "same-domain response event has wrong origin");
+
+ // can't use |is| here, because ok tries to get properties on its arguments
+ // for creating a formatted logging message
+ ok(evt.source === window.frames.otherCrossDomain,
+ "wrong source for cross-domain message!");
+}
+
+
+/**************
+ * TEST SETUP *
+ **************/
+
+function start()
+{
+ window.postMessage("post-to-self", "http://mochi.test:8888");
+}
+
+window.addEventListener("load", start);
+window.addEventListener("message", messageReceiver);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_basehref.html b/dom/tests/mochitest/whatwg/test_postMessage_basehref.html
new file mode 100644
index 0000000000..4a0a167d9f
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_basehref.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=414815
+-->
+<head>
+ <title>postMessage's interaction with a &lt;base&gt; tag</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <base href="http://example.com/" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414815">Mozilla Bug 414815</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 414815 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveMessage(evt)
+{
+ is(evt.origin, "http://mochi.test:8888", "wrong sender");
+ ok(evt.source === window, "wrong source");
+
+ is(evt.data, "generate-event", "wrong data");
+ is(evt.lastEventId, "", "wrong lastEventId");
+
+ SimpleTest.finish();
+}
+
+window.addEventListener("message", receiveMessage);
+
+function run()
+{
+ window.postMessage("generate-event", "http://mochi.test:8888");
+}
+
+window.addEventListener("load", run);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_chrome.html b/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
new file mode 100644
index 0000000000..ceb19fc552
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage chrome tests</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="chrome://mochikit/content/chrome-harness.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://example.org/tests/dom/tests/mochitest/whatwg/postMessage_chrome_helper.html"
+ name="contentDomain"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var finished = false;
+function finish()
+{
+ if (!finished)
+ {
+ finished = true;
+ SimpleTest.finish();
+ }
+}
+
+/** Receives MessageEvents to this window. */
+function messageReceiver(evt)
+{
+ ok(evt instanceof MessageEvent, "umm, how did we get this?");
+ is(evt.type, "message", "expected events of type 'message'");
+ is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+
+ switch (evt.data)
+ {
+ case "path-is-set":
+ chromePathIsSet(evt);
+ break;
+
+ case "post-to-self":
+ checkSelf(evt);
+ break;
+
+ case "post-to-content-response":
+ receiveContent(evt);
+ break;
+
+ default:
+ ok(false, "unexpected message: " + evt.data);
+ finish();
+ break;
+ }
+}
+
+
+/******************
+ * SELF-RESPONDER *
+ ******************/
+
+function checkSelf(evt)
+{
+ var prepath = getChromePrePath(window.location.href);
+
+ is(evt.isTrusted, true, "should have sent a trusted event");
+ is(evt.origin, prepath, "wrong origin for chrome: URL");
+ is(evt.source, null, "chrome posters get a null source, for security");
+
+ window.frames.contentDomain.postMessage(prepath, "*");
+}
+
+
+function chromePathIsSet(evt)
+{
+ window.frames.contentDomain.postMessage("post-to-content",
+ "http://example.org");
+}
+
+/*************
+ * RECEIVERS *
+ *************/
+
+function receiveContent(evt)
+{
+ is(evt.isTrusted, true, "should have sent a trusted event");
+ finish();
+}
+
+
+/**************
+ * TEST SETUP *
+ **************/
+
+function run()
+{
+ window.addEventListener("message", messageReceiver);
+ window.postMessage("post-to-self", "*");
+}
+
+window.addEventListener("load", run);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_closed.html b/dom/tests/mochitest/whatwg/test_postMessage_closed.html
new file mode 100644
index 0000000000..01fc1294a3
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_closed.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage's interaction with closed windows</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=417075">Bug 417075</a></p>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<div id="holder"></div>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveMessage(evt)
+{
+ is(evt.origin, "http://mochi.test:8888", "wrong origin");
+ ok(evt.source === openedWindow, "wrong source");
+ is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+
+ is(evt.data, "message", "wrong data");
+ if (evt.data !== "message")
+ return; // prevent recursion if bugs
+
+ evt.source.close();
+
+ function afterClose()
+ {
+ document.removeEventListener("message", receiveMessage);
+ evt.source.postMessage("NOT-RECEIVED", "*");
+
+ var iframe = document.createElement("iframe");
+ iframe.id = "insertedIframe";
+ $("holder").appendChild(iframe);
+ iframe.addEventListener("load", iframeLoaded);
+ iframe.src = "postMessage_closed_helper.html?parent";
+ }
+
+ setTimeout(afterClose, 0);
+}
+
+window.addEventListener("message", receiveMessage);
+
+function iframeLoaded(evt)
+{
+ var iframe = $("insertedIframe");
+ iframe.removeEventListener("load", iframeLoaded);
+
+ var iframeWindow = iframe.contentWindow;
+ $("holder").removeChild($("insertedIframe"));
+ iframeWindow.postMessage("NOT-RECEIVED", "*");
+
+ SimpleTest.finish();
+}
+
+var openedWindow;
+
+function run()
+{
+ openedWindow = window.open("postMessage_closed_helper.html?opener", "foobar");
+ if (!openedWindow)
+ {
+ ok(false, "this test must be run with popup blocking disabled");
+ SimpleTest.finish();
+ }
+}
+
+window.addEventListener("load", run);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_hash.html b/dom/tests/mochitest/whatwg/test_postMessage_hash.html
new file mode 100644
index 0000000000..5942a200ca
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_hash.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage's interaction with hash URIs</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <base href="http://example.com/" />
+</head>
+<body>
+<p>(no bug; this is a preemptive test)</p>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_hash.html#hash"
+ name="kid"></iframe>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveMessage(evt)
+{
+ is(evt.origin, "http://mochi.test:8888", "wrong origin");
+ ok(evt.source === window.frames.kid, "wrong source");
+ is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+
+ is(evt.data, "response-message", "wrong data");
+
+ SimpleTest.finish();
+}
+
+window.addEventListener("message", receiveMessage);
+
+function run()
+{
+ window.frames.kid.postMessage("from-parent", "http://mochi.test:8888");
+}
+
+window.addEventListener("load", run);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml b/dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml
new file mode 100644
index 0000000000..79a6ede714
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage uri/domain values and IDN encoding</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://sub1.ält.example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_idn_helper.html"></iframe>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var responseReceived = false;
+var idnWindow = null;
+
+function receiveMessage(evt)
+{
+ ok(evt instanceof MessageEvent, "umm, how did we get this?");
+ is(evt.type, "message", "expected events of type 'message'");
+ ok(evt.isTrusted === true, "should have been a trusted event");
+
+ is(evt.origin, "http://sub1.xn--lt-uia.example.org:8000",
+ "wrong origin -- IDN issue, perhaps?");
+
+ is(evt.data, "idn-response", "unexpected test result");
+ is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+ ok(evt.source === idnWindow, "wrong source");
+
+ SimpleTest.finish();
+}
+window.addEventListener("message", receiveMessage);
+
+var xhtmlns = "http://www.w3.org/1999/xhtml";
+
+function setup()
+{
+ var idnFrame = document.getElementsByTagNameNS(xhtmlns, "iframe")[0];
+ idnWindow = idnFrame.contentWindow;
+ try
+ {
+ idnWindow.postMessage("idn-message", "http://sub1.ält.example.org:8000");
+ }
+ catch (e)
+ {
+ ok(false, "failed to post message: " + e);
+ SimpleTest.finish();
+ }
+}
+
+addLoadEvent(setup);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_joined.html b/dom/tests/mochitest/whatwg/test_postMessage_joined.html
new file mode 100644
index 0000000000..560fbb2911
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_joined.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage with document.domain setting to join origins</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://sub1.test1.example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper.html"
+ name="container"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveTestResult(evt)
+{
+ ok(evt instanceof MessageEvent, "umm, how did we get this?");
+ is(evt.type, "message", "expected events of type 'message'");
+ ok(evt.isTrusted === true, "should have been a trusted event");
+
+ is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+
+ // Either we passed the test or we failed it. The message's
+ // contents should help to diagnose the failure. Either way,
+ // consider this the end of the test.
+ is(evt.data, "test-passed", "unexpected test result");
+ SimpleTest.finish();
+}
+
+function setup()
+{
+ window.addEventListener("message", receiveTestResult);
+ window.frames.container.postMessage("start-test",
+ "http://sub1.test1.example.org");
+}
+
+addLoadEvent(setup);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_onOther.html b/dom/tests/mochitest/whatwg/test_postMessage_onOther.html
new file mode 100644
index 0000000000..502ebca36c
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_onOther.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage called through a different same-origin page</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://example.com/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
+ name="topDomainFrame"></iframe>
+<iframe src="http://test1.example.com/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
+ name="subDomainFrame"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+/** Receives MessageEvents to this window. */
+function messageReceiver(evt)
+{
+ ok(evt instanceof MessageEvent, "wrong event type");
+ is(evt.origin, "http://test1.example.com", "unexpected origin");
+ is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+ is(evt.data, "test-finished",
+ "unexpected data in message");
+
+ SimpleTest.finish();
+}
+
+function run()
+{
+ window.frames.subDomainFrame.postMessage("start-test",
+ "http://test1.example.com");
+}
+
+window.addEventListener("message", messageReceiver);
+window.addEventListener("load", run);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml b/dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml
new file mode 100644
index 0000000000..dd027c09ff
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml
@@ -0,0 +1,465 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=417075
+-->
+<head>
+ <title>postMessage from about:blank, data URLs</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417075">Mozilla Bug 417075</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml"
+ id="sameDomain"></iframe>
+<iframe src="http://example.com/tests/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml"
+ id="otherDomain"></iframe>
+<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml"
+ id="otherDomainPort"></iframe>
+<iframe src="ftp://mochi.test:27534/tests/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml"
+ id="localNoExist"></iframe>
+
+<iframe src="http://sub1.παράδειγμα.δοκιμή/tests/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml"
+ id="idnKidWhitelist"></iframe>
+
+<iframe src="http://sub1.exaмple.test/tests/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml"
+ id="idnKidNoWhitelist"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript"><![CDATA[
+/** Test for Bug 417075 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function errorCheck(i, called, error, actual) {
+ ok(!called, "receiver should not have been called for test #" + i);
+ is(actual, error, "wrong error thrown in test #" + i);
+}
+
+// Sends a "PING" message to the given child frame content window and returns
+// a promise which resolves when we receive a corresponding "PONG" message back.
+function ping(win) {
+ if (win.parent !== window) {
+ throw new Error("Can only ping windows which are child frames of this window");
+ }
+ return new Promise(resolve => {
+ window.addEventListener("message", function callback(event) {
+ if (event.source === win && event.data === "PONG") {
+ window.removeEventListener("message", callback);
+ resolve();
+ }
+ });
+ win.postMessage("PING", "*");
+ });
+}
+
+var tests =
+ [
+ // 0
+ {
+ args: ["NOT-RECEIVED", ""],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["NOT-RECEIVED", "null"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["NOT-RECEIVED", "a"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["NOT-RECEIVED", "http :"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["NOT-RECEIVED", "http: //"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR,
+
+ hasThrowsNoExceptionBug: true
+ },
+ // 5
+ {
+ args: ["NOT-RECEIVED", "http ://"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["TODO", " http://localhost:8888"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR,
+
+ returnOrigin: "http://mochi.test:8888",
+ hasThrowsNoExceptionBug: true
+ },
+ {
+ args: ["NOT-RECEIVED", "hä"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["NOT-RECEIVED", "http://lo\0k.com"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["NOT-RECEIVED", "http: //localhost:8888"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR,
+
+ hasThrowsNoExceptionBug: true
+ },
+ // 10
+ {
+ args: ["NOT-RECEIVED", "http://localhost :8888"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ {
+ args: ["NOT-RECEIVED", "http:// localhost:8888"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR,
+
+ hasThrowsNoExceptionBug: true
+ },
+ {
+ args: ["TODO", "http://\nlocalhost:8888"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR,
+
+ returnOrigin: "http://mochi.test:8888",
+ hasThrowsNoExceptionBug: true
+ },
+ {
+ args: ["TODO", "http://localhost:8888\0"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR,
+
+ returnOrigin: "http://mochi.test:8888",
+ hasThrowsNoExceptionBug: true
+ },
+ {
+ args: ["TODO", "http://localhost:8888\n"],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR,
+
+ returnOrigin: "http://mochi.test:8888",
+ hasThrowsNoExceptionBug: true
+ },
+ // 15
+ {
+ args: ["PASS", "*"],
+ source: "sameDomain",
+ returnOrigin: "http://mochi.test:8888"
+ },
+ {
+ args: ["PASS", "http://mochi.test:8888"],
+ source: "sameDomain",
+ returnOrigin: "http://mochi.test:8888"
+ },
+ {
+ args: ["PASS", "http://example.com"],
+ source: "otherDomain",
+ returnOrigin: "http://example.com"
+ },
+ {
+ args: ["PASS", "http://example.com/"],
+ source: "otherDomain",
+ returnOrigin: "http://example.com"
+ },
+ {
+ args: ["PASS", "http://example.com:80"],
+ source: "otherDomain",
+ returnOrigin: "http://example.com"
+ },
+ // 20
+ {
+ args: ["PASS", "http://example.com:80/"],
+ source: "otherDomain",
+ returnOrigin: "http://example.com"
+ },
+ {
+ args: ["PASS", "http://example.com:80/foobar"],
+ source: "otherDomain",
+ returnOrigin: "http://example.com"
+ },
+ {
+ args: ["PASS", "http://example.com/foobar"],
+ source: "otherDomain",
+ returnOrigin: "http://example.com"
+ },
+ {
+ args: ["PASS", "http://example.com:8000"],
+ source: "otherDomain",
+ expectNoCallback: true
+ },
+ {
+ args: ["PASS", "http://example.com:8000/"],
+ source: "otherDomain",
+ expectNoCallback: true
+ },
+ // 25
+ {
+ args: ["PASS", "http://example.org:8000"],
+ source: "otherDomainPort",
+ returnOrigin: "http://example.org:8000"
+ },
+ {
+ args: ["PASS", "http://example.org:8000/"],
+ source: "otherDomainPort",
+ returnOrigin: "http://example.org:8000"
+ },
+ {
+ args: ["PASS", "http://example.org:8000/tests/dom/test/mochitest/whatwg/postMessage_origin_helper.xhtml"],
+ source: "otherDomainPort",
+ returnOrigin: "http://example.org:8000"
+ },
+ {
+ args: ["PASS", "http://example.org:8000/tests/dom/test/mochitest/whatwg/this_file_does_not_exist.xhtml"],
+ source: "otherDomainPort",
+ returnOrigin: "http://example.org:8000"
+ },
+ {
+ args: ["PASS", "http://example.org"],
+ source: "otherDomainPort",
+ expectNoCallback: true
+ },
+ // 30
+ {
+ args: ["PASS", "http://example.org:80"],
+ source: "otherDomainPort",
+ expectNoCallback: true
+ },
+ {
+ args: ["PASS", "http://example.org/"],
+ source: "otherDomainPort",
+ expectNoCallback: true
+ },
+ {
+ args: ["PASS", "http://example.org"],
+ source: "otherDomain",
+ expectNoCallback: true
+ },
+ {
+ args: ["PASS", "ftp://mochi.test:8888"],
+ source: "sameDomain",
+ expectNoCallback: true
+ },
+ {
+ args: ["PASS", "http://mochi.test:8888"],
+ source: "sameDomain",
+ returnOrigin: "http://mochi.test:8888"
+ },
+ // 35
+ {
+ args: ["PASS", "http://mochi.test:27534"],
+ source: "sameDomain",
+ expectNoCallback: true
+ },
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή:80"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή:80/"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή:80/foobar"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ // 40
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή/foobar"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp:80"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp:80/"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp:80/foo"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"
+ },
+ // 45
+ {
+ args: ["PASS", "http://sub1.exaмple.test"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test:80"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test:80/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test/foobar"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ // 50
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test:80"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test:80/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test/foobar"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.xn--exaple-kqf.test",
+ },
+ ];
+
+async function allTests() {
+ let target, called, test, i;
+
+ let listener = evt => {
+ // Ignore "PONG" messages, which are used to ensure synchronization
+ // between scripts in parent and child frames.
+ if (evt.data === "PONG") {
+ return;
+ }
+
+ is(test, tests[i],
+ "i and test are out of sync! async is hard, let's go shopping");
+
+ var originCheck = test.hasWrongReturnOriginBug ? todo_is : is;
+ originCheck(evt.origin, test.returnOrigin, "wrong origin for #" + i);
+ if (test.args[0] == "TODO")
+ todo_is(evt.data, "PASS", "wrong data");
+ else
+ is(evt.data, "PASS", "wrong data");
+ is(evt.lastEventId, "",
+ "postMessage creates events with empty lastEventId");
+ ok(evt.source === target, "wrong source");
+ called = true;
+ };
+ window.addEventListener("message", listener);
+
+ for ([i, test] of tests.entries()) {
+ called = false;
+ target = $(test.source).contentWindow;
+ try {
+ target.postMessage.apply(target, test.args);
+ } catch (e) {
+ // Since an exception was thrown, we know at this point that we're not
+ // waiting on anything else in the queue of script to run, and we can just
+ // continue immediately.
+ errorCheck(i, called, e.name, test.name);
+ errorCheck(i, called, e.code, test.code);
+ continue;
+ }
+
+ // Perform a postMessage round-trip to ensure the target frame has
+ // processed our message and we've had time to receive its reply.
+ await ping(target);
+
+ if (test.hasThrowsNoExceptionBug) {
+ todo(false, `should throw on test #${i}`);
+ } else {
+ is(!test.expectNoCallback, called, `should have been called #${i}`);
+ }
+ }
+
+ window.removeEventListener("message", listener);
+}
+
+async function oddballTests() {
+ for (let i = 0; i < 2; i++) {
+ let evt = await new Promise(resolve => {
+ window.addEventListener("message", function listener(evt) {
+ resolve(evt);
+ window.removeEventListener("message", listener);
+ });
+ window.postMessage("PASS", "http://mochi.test:8888");
+ });
+
+ is(evt.origin, "http://mochi.test:8888", "wrong sender");
+ is(evt.data, "PASS", "wrong data");
+ is(evt.lastEventId, "",
+ "postMessage creates events with empty lastEventId");
+ ok(evt.source === window, "wrong source");
+ }
+}
+
+async function run() {
+ await oddballTests();
+ await allTests();
+ SimpleTest.finish();
+}
+
+window.addEventListener("load", run);
+]]></script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_override.html b/dom/tests/mochitest/whatwg/test_postMessage_override.html
new file mode 100644
index 0000000000..8414344f8d
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_override.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage override test</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_override_helper.html"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+async function run() {
+ function ping(win, msg) {
+ return new Promise(resolve => {
+ window.addEventListener("message", evt => {
+ is(evt.source, win, "Response should come from the correct window");
+ is(evt.data, msg, "Should get the correct response");
+ resolve();
+ }, { once: true });
+
+ win.postMessage(msg, "http://example.org:8000");
+ });
+ }
+
+ await ping(frames[0], "PASS 1");
+ await ping(frames[0], "PASS 2");
+ SimpleTest.finish();
+}
+
+window.addEventListener("load", run);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml b/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml
new file mode 100644
index 0000000000..deb3930550
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml
@@ -0,0 +1,304 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage from about:blank, data URLs</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<pre id="test">
+<script class="testbody" type="application/javascript"><![CDATA[
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var B64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/**
+ * Encodes an array of bytes into a string using the base 64 encoding scheme.
+ *
+ * @param bytes
+ * An array of bytes to encode.
+ */
+function b64(str)
+{
+ var byteArray = new Array(str.length);
+ for (var i = 0, sz = str.length; i < sz; i++)
+ byteArray[i] = str.charCodeAt(i);
+
+ var index = 0;
+ function get3Bytes()
+ {
+ if (byteArray.length - index < 3)
+ return null; // Less than three bytes remaining
+
+ // Return the next three bytes in the array, and increment index for our
+ // next invocation
+ return byteArray.slice(index, index += 3);
+ }
+
+ var out = "";
+ var bytes = null;
+ while ((bytes = get3Bytes()))
+ {
+ var bits = 0;
+ for (var i = 0; i < 3; i++)
+ bits = (bits << 8) | bytes[i];
+ for (var j = 18; j >= 0; j -= 6)
+ out += B64_CHARS[(bits>>j) & 0x3F];
+ }
+
+ // Get the remaining bytes
+ bytes = byteArray.slice(index);
+
+ switch (bytes.length)
+ {
+ case 2:
+ out += B64_CHARS[(bytes[0]>>2) & 0x3F] +
+ B64_CHARS[((bytes[0] & 0x03) << 4) | ((bytes[1] >> 4) & 0x0F)] +
+ B64_CHARS[((bytes[1] & 0x0F) << 2)] +
+ "=";
+ break;
+ case 1:
+ out += B64_CHARS[(bytes[0]>>2) & 0x3F] +
+ B64_CHARS[(bytes[0] & 0x03) << 4] +
+ "==";
+ break;
+ }
+
+ return out;
+}
+
+
+var aboutBlankWindow = null;
+var aboutBlank2Window = null;
+var dataWindow = null;
+
+/** Convert a nullable string to a pretty representation */
+function sourceify(v)
+{
+ if (typeof v == "string")
+ return "'" + v + "'";
+ return String(v);
+}
+
+/** Receives MessageEvents to this window. */
+function messageReceiver(evt)
+{
+ // It's not clear what the security model is for data: URLs and whether they
+ // can access their parents; WebKit denies access, while Gecko currently
+ // allows it. We work around this problem by using postMessage (surprise!)
+ // to start the round of tests when each iframe loads.
+ if (evt.data === "next-test")
+ {
+ setTimeout(nextTest, 0);
+ return;
+ }
+
+
+ try
+ {
+ ok(evt instanceof MessageEvent, "umm, how did we get this?");
+ is(evt.type, "message", "expected events of type 'message'");
+ ok(evt.isTrusted === true, "should have been a trusted event");
+
+ if (evt.data === "about:blank-response")
+ {
+ // This isn't clarified in HTML5 yet, but the origin for a document which
+ // has been open()ed is the origin of the calling code, somewhat loosely
+ // speaking. For the specific case of about:blank it's also possible
+ // that the origin is determined by the code that opens the window. It's
+ // not codified yet which of these two causes the identifier tokens on
+ // the event generated by the new window to be those of this window, but
+ // in either case this is what they should be.
+ is(evt.origin, "http://mochi.test:8888",
+ "wrong origin for event from about:blank");
+ is(evt.source, aboutBlankWindow, "wrong source");
+
+ // ...and onto the next test
+ setupBlank2();
+ }
+ else if (evt.data === "about:blank2-response")
+ {
+ is(evt.origin, "http://mochi.test:8888",
+ "wrong origin for event from about:blank #2");
+ is(evt.source, aboutBlank2Window, "wrong source");
+
+ setupData();
+ }
+ else if (evt.data === "data-response")
+ {
+ is(evt.origin, "null",
+ "wrong origin for event from data URL (should be the origin of the " +
+ "window/script that opened the URL, in this case the origin of this " +
+ "file)");
+ is(evt.source, dataWindow, "wrong source");
+
+ finish();
+ }
+ else
+ {
+ ok(false, "unexpected message: " + evt.data);
+ }
+ }
+ catch (e)
+ {
+ ok(false, "error processing event with data '" + evt.data + "': " + e);
+ }
+}
+
+function getContents(description, responseText)
+{
+ var contents =
+ "<!DOCTYPE html>\n" +
+ "<html>\n" +
+ "<head>\n" +
+ " <title>about:blank</title>\n" +
+ " <script type='application/javascript'>\n" +
+ "function receive(evt)\n" +
+ "{\n" +
+ " var response = '" + responseText + "';\n" +
+ "\n" +
+ " if (evt.source !== window.parent)\n" +
+ " response += ' wrong-source';\n" +
+ " if (evt.origin !== 'http://mochi.test:8888')\n" +
+ " response += ' wrong-origin(' + evt.origin + ')';\n" +
+ " if (evt.data !== 'from-opener')\n" +
+ " response += ' wrong-data(' + evt.data + ')';\n" +
+ "\n" +
+ " window.parent.postMessage(response, 'http://mochi.test:8888');\n" +
+ "}\n" +
+ "\n" +
+ "function ready()\n" +
+ "{\n" +
+ " window.parent.postMessage('next-test', 'http://mochi.test:8888');\n" +
+ "}\n" +
+ "\n" +
+ "window.addEventListener('load', ready, false);\n" +
+ "window.addEventListener('message', receive, false);\n" +
+ " </script>\n" +
+ "</head>\n" +
+ "<body><p>" + description + "</p></body>\n" +
+ "</html>";
+
+ return contents;
+}
+
+function finish()
+{
+ SimpleTest.finish();
+}
+
+var xhtmlns = "http://www.w3.org/1999/xhtml";
+
+function insert(el)
+{
+ var content = $("content");
+ content.parentNode.insertBefore(el, content);
+}
+
+function setupBlank()
+{
+ var aboutBlankFrame = document.createElementNS(xhtmlns, "iframe");
+ aboutBlankFrame.setAttribute("src", "about:blank");
+ insert(aboutBlankFrame);
+
+ aboutBlankWindow = aboutBlankFrame.contentWindow;
+ var doc = aboutBlankWindow.document;
+ doc.open();
+ doc.write(getContents("This was about:blank #1", "about:blank-response"));
+ doc.close();
+
+ // I don't believe anything guarantees sync parsing, so we have to wait for
+ // the new window to poke us to actually do the test. :-\
+}
+
+function setupBlank2()
+{
+ var aboutBlank2Frame = document.createElementNS(xhtmlns, "iframe");
+ aboutBlank2Frame.addEventListener("load", nextTest);
+ aboutBlank2Frame.setAttribute("src", "about:blank");
+
+ insert(aboutBlank2Frame);
+}
+
+// Could use window.btoa here, but that's not standardized, and we want to be
+// able to run these tests against browsers that don't support it.
+var dataURI = "data:text/html;base64," +
+ b64(getContents("A data: URL", "data-response"));
+
+function setupData()
+{
+ var dataFrame = document.createElementNS(xhtmlns, "iframe");
+ dataFrame.setAttribute("src", dataURI);
+ insert(dataFrame);
+
+ dataWindow = dataFrame.contentWindow;
+
+ // ...and wait again for the window to load...
+}
+
+var count = 0;
+function nextTest()
+{
+ switch (count++)
+ {
+ case 0:
+ testBlank();
+ break;
+
+ case 1:
+ testBlank2();
+ break;
+
+ case 2:
+ testData();
+ break;
+
+ default:
+ ok(false, "unreached");
+ break;
+ }
+}
+
+function testBlank()
+{
+ aboutBlankWindow.postMessage("from-opener", "http://mochi.test:8888");
+}
+
+function testBlank2()
+{
+ // For some reason we can't access this across browsers prior to the iframe
+ // loading, so set its value here.
+ aboutBlank2Window = window.frames[1];
+
+ var doc = aboutBlank2Window.document;
+
+ doc.body.textContent = "This was about:blank #2";
+
+ var script = doc.createElement("script");
+ script.textContent =
+ "window.parent.postMessage('about:blank2-response', " +
+ " 'http://mochi.test:8888');";
+ doc.body.appendChild(script);
+}
+
+function testData()
+{
+ dataWindow.postMessage("from-opener", "*");
+}
+
+window.addEventListener("message", messageReceiver);
+
+addLoadEvent(setupBlank);
+]]></script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html b/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html
new file mode 100644
index 0000000000..9574dcacd4
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=553125
+-->
+<head>
+ <title>postMessage uses structured clone</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ src="postMessage_structured_clone_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553125">Mozilla Bug 553125</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html"
+ name="sameDomain"></iframe>
+<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html"
+ name="crossDomain"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 553125 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var lastMessage = null;
+var crossOrigin = false;
+var generator = getTestContent();
+
+function runNextSameOrigin() {
+ let {done, value} = generator.next();
+ if (done) {
+ generator = getTestContent();
+ crossOrigin = true;
+ runNextCrossOrigin();
+ return;
+ }
+ lastMessage = value;
+ window.frames.sameDomain.postMessage(lastMessage, "http://mochi.test:8888");
+}
+
+function runNextCrossOrigin() {
+ let {done, value} = generator.next();
+ if (done) {
+ SimpleTest.finish();
+ return;
+ }
+ lastMessage = value;
+ window.frames.crossDomain.postMessage(lastMessage, "http://example.org:8000");
+}
+
+function receiveMessage(evt) {
+ if (evt.data == "TEST-PASS")
+ SimpleTest.ok(true, "structured clone of | " + lastMessage + " | succeeded");
+ else
+ SimpleTest.ok(false, "structured clone of | " + lastMessage + " | failed");
+ setTimeout(crossOrigin ? runNextCrossOrigin : runNextSameOrigin, 0);
+}
+
+window.addEventListener("message", receiveMessage);
+window.addEventListener("load", runNextSameOrigin);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_throw.html b/dom/tests/mochitest/whatwg/test_postMessage_throw.html
new file mode 100644
index 0000000000..8d71ea38cf
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_throw.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage with a thrown exception</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_throw_helper.html"
+ name="sameDomain"></iframe>
+<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_throw_helper.html"
+ name="crossDomain"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 387706 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function atLoad()
+{
+ try
+ {
+ sameDomain.postMessage("foo", "http://mochi.test:8888");
+ ok(true, "should not have thrown for same-domain exception");
+ }
+ catch (e)
+ {
+ ok(false, "uh-oh, threw a same-domain exception: " + e);
+ }
+
+ setTimeout(next, 0);
+}
+
+function next()
+{
+ ok(true, "no pending-exception wackiness for same-domain");
+ setTimeout(next2, 0);
+}
+
+function next2()
+{
+ try
+ {
+ crossDomain.postMessage("foo", "http://example.org:8000");
+ ok(true, "should not have thrown for cross-domain exception");
+ }
+ catch (e)
+ {
+ ok(false, "uh-oh, threw a cross-domain exception: " + e);
+ }
+
+ setTimeout(next3, 0);
+}
+
+function next3()
+{
+ ok(true, "no pending-exception wackiness for cross-domain");
+ SimpleTest.finish();
+}
+
+addLoadEvent(atLoad);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_transfer.html b/dom/tests/mochitest/whatwg/test_postMessage_transfer.html
new file mode 100644
index 0000000000..e7d8758bd6
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_transfer.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=822094
+-->
+<head><meta charset=utf-8>
+ <title>postMessage transferable tests</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822094">Mozilla Bug 822094</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+<iframe src="postMessage_transfer_helper.html"
+ name="sameDomain"></iframe>
+<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_transfer_helper.html"
+ name="crossDomain"></iframe>
+
+</div>
+<pre id="test">
+<script class="testbody" type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var tests = [
+ function() { testFunc(window, "http://mochi.test:8888"); },
+ function() { testFunc(frames.sameDomain, "http://mochi.test:8888"); },
+ function() { testFunc(frames.crossDomain, "http://example.org:8000"); },
+ function() { SimpleTest.finish(); },
+];
+
+function testFunc(target, origin) {
+ var ab = new ArrayBuffer(1);
+ var cd = new ArrayBuffer(1);
+
+ target.postMessage([ab, cd], origin, [ab]);
+ is(ab.byteLength, 0, "ab should be detached");
+ is(cd.byteLength, 1, "cd should not be detached");
+
+ onmessage = function(e) {
+ is(e.data[0].byteLength, 1, "ab should be transfered");
+ is(e.data[1].byteLength, 1, "cd should be cloned");
+ nextTest();
+ };
+}
+
+function nextTest() {
+ var t = tests.shift();
+ t();
+};
+
+onload = function() {
+ nextTest();
+};
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_userpass.html b/dom/tests/mochitest/whatwg/test_postMessage_userpass.html
new file mode 100644
index 0000000000..b47266fc45
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_userpass.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=417075
+-->
+<head>
+ <title>postMessage from a page with username/password in its URI</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417075">Mozilla Bug 417075</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://bobhope:password@example.org/tests/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html"
+ name="userPassKid"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 417075 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveMessage(evt)
+{
+ is(evt.origin, "http://example.org", "wrong origin");
+ is(evt.data, "child-message", "wrong data");
+ is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+ ok(evt.source === window.frames.userPassKid, "wrong source");
+ SimpleTest.finish();
+}
+
+window.addEventListener("message", receiveMessage);
+
+function sendMessage(evt)
+{
+ window.frames.userPassKid.postMessage("parent-message", "http://example.org");
+}
+
+window.addEventListener("load", sendMessage);
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/moz.build b/dom/tests/moz.build
new file mode 100644
index 0000000000..bc86736c26
--- /dev/null
+++ b/dom/tests/moz.build
@@ -0,0 +1,235 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+with Files("browser/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("browser/*onsole*"):
+ BUG_COMPONENT = ("DevTools", "General")
+
+with Files("browser/*autofocus*"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("browser/*unload*"):
+ BUG_COMPONENT = ("Core", "DOM: Events")
+
+with Files("browser/*1238427*"):
+ BUG_COMPONENT = ("Core", "DOM: Geolocation")
+
+with Files("browser/*Geolocation*"):
+ BUG_COMPONENT = ("Core", "DOM: Geolocation")
+
+with Files("browser/*geo_*"):
+ BUG_COMPONENT = ("Core", "DOM: Geolocation")
+
+with Files("browser/browser_cancel_keydown_keypress_event.js"):
+ BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling")
+
+with Files("browser/*local*"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("browser/browser_test_focus_after_modal_state.js"):
+ BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling")
+
+with Files("mochitest/ajax/**"):
+ BUG_COMPONENT = ("Testing", "Mochitest")
+
+with Files("mochitest/beacon/**"):
+ BUG_COMPONENT = ("Core", "DOM: Networking")
+
+# big mix of components here
+with Files("mochitest/bugs/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+# TODO: big mix of components here
+with Files("mochitest/chrome/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/crypto/**"):
+ BUG_COMPONENT = ("Core", "DOM: Security")
+
+with Files("mochitest/dom-level0/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/dom-level1-core/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/dom-level2-core/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/dom-level2-html/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/fetch/**"):
+ BUG_COMPONENT = ("Core", "DOM: Networking")
+
+with Files("mochitest/fetch/*sw_*"):
+ BUG_COMPONENT = ("Core", "DOM: Service Workers")
+
+with Files("mochitest/gamepad/**"):
+ BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
+
+# TODO: big mix of components here
+with Files("mochitest/general/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/geolocation/**"):
+ BUG_COMPONENT = ("Core", "DOM: Geolocation")
+
+with Files("mochitest/localstorage/**"):
+ BUG_COMPONENT = ("Core", "Storage: localStorage & sessionStorage")
+
+with Files("mochitest/orientation/**"):
+ BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
+
+with Files("mochitest/orientation/*507902*"):
+ BUG_COMPONENT = ("Core", "Layout: Images, Video, and HTML Frames")
+
+with Files("mochitest/pointerlock/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/script/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/sessionstorage/**"):
+ BUG_COMPONENT = ("Core", "Storage: localStorage & sessionStorage")
+
+with Files("mochitest/storageevent/**"):
+ BUG_COMPONENT = ("Core", "Storage: localStorage & sessionStorage")
+
+with Files("mochitest/webcomponents/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("mochitest/whatwg/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("reftest/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("reftest/*456008*"):
+ BUG_COMPONENT = ("Core", "XML")
+
+with Files("reftest/*439965*"):
+ BUG_COMPONENT = ("Core", "DOM: Editor")
+
+with Files("reftest/*427779*"):
+ BUG_COMPONENT = ("Core", "XML")
+
+with Files("reftest/*559996*"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("reftest/*591981*"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("reftest/*592366*"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("reftest/*798068*"):
+ BUG_COMPONENT = ("Core", "Layout")
+
+with Files("reftest/xml-stylesheet/**"):
+ BUG_COMPONENT = ("Core", "XSLT")
+
+with Files("unit/**"):
+ BUG_COMPONENT = ("Core", "DOM: Core & HTML")
+
+with Files("unit/*geolocation*"):
+ BUG_COMPONENT = ("Core", "DOM: Geolocation")
+
+with Files("unit/test_bug465752.js"):
+ BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
+
+with Files("unit/test_PromiseDebugging.js"):
+ BUG_COMPONENT = ("Core", "XPConnect")
+
+MOCHITEST_MANIFESTS += [
+ "mochitest/ajax/jquery/mochitest.ini",
+ "mochitest/ajax/mochikit/mochitest.ini",
+ "mochitest/ajax/prototype/mochitest.ini",
+ "mochitest/ajax/scriptaculous/mochitest.ini",
+ "mochitest/beacon/mochitest.ini",
+ "mochitest/bugs/mochitest.ini",
+ "mochitest/crypto/mochitest.ini",
+ "mochitest/dom-level0/mochitest.ini",
+ "mochitest/dom-level1-core/mochitest.ini",
+ "mochitest/dom-level2-core/mochitest.ini",
+ "mochitest/dom-level2-html/mochitest.ini",
+ "mochitest/fetch/mochitest.ini",
+ "mochitest/gamepad/mochitest.ini",
+ "mochitest/general/mochitest.ini",
+ "mochitest/geolocation/mochitest.ini",
+ "mochitest/integer-gemm/mochitest.ini",
+ "mochitest/keyhandling/mochitest.ini",
+ "mochitest/localstorage/mochitest.ini",
+ "mochitest/orientation/mochitest.ini",
+ "mochitest/pointerlock/mochitest.ini",
+ "mochitest/script/mochitest.ini",
+ "mochitest/sessionstorage/mochitest.ini",
+ "mochitest/storageevent/mochitest.ini",
+ "mochitest/webcomponents/mochitest.ini",
+ "mochitest/whatwg/mochitest.ini",
+]
+
+MOCHITEST_CHROME_MANIFESTS += [
+ "mochitest/beacon/chrome.ini",
+ "mochitest/chrome/chrome.ini",
+ "mochitest/fs/chrome.ini",
+ "mochitest/general/chrome.ini",
+ "mochitest/geolocation/chrome.ini",
+ "mochitest/keyhandling/chrome.ini",
+ "mochitest/localstorage/chrome.ini",
+ "mochitest/sessionstorage/chrome.ini",
+ "mochitest/webcomponents/chrome.ini",
+ "mochitest/whatwg/chrome.ini",
+]
+
+XPCSHELL_TESTS_MANIFESTS += ["unit/xpcshell.ini"]
+BROWSER_CHROME_MANIFESTS += [
+ "browser/browser.ini",
+ "browser/perfmetrics/browser.ini",
+]
+
+TEST_HARNESS_FILES.testing.mochitest.tests.dom.tests.mochitest.ajax.lib += [
+ "mochitest/ajax/lib/AJAX_setup.js",
+ "mochitest/ajax/lib/test.css",
+]
+
+TEST_HARNESS_FILES.testing.mochitest.tests.dom.tests.mochitest.ajax.mochikit.tests += [
+ "mochitest/ajax/mochikit/tests/cli.js",
+ "mochitest/ajax/mochikit/tests/FakeJSAN.js",
+ "mochitest/ajax/mochikit/tests/index.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Async.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Base.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Color.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-DateTime.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-DOM.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-DragAndDrop.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Format.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Iter.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-JSAN.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Logging.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-MochiKit.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Selector.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Signal.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Style.html",
+ "mochitest/ajax/mochikit/tests/MochiKit-Visual.html",
+ "mochitest/ajax/mochikit/tests/standalone.js",
+ "mochitest/ajax/mochikit/tests/test_Base.js",
+ "mochitest/ajax/mochikit/tests/test_Color.js",
+ "mochitest/ajax/mochikit/tests/test_DateTime.js",
+ "mochitest/ajax/mochikit/tests/test_DragAndDrop.js",
+ "mochitest/ajax/mochikit/tests/test_Format.js",
+ "mochitest/ajax/mochikit/tests/test_Iter.js",
+ "mochitest/ajax/mochikit/tests/test_Logging.js",
+ "mochitest/ajax/mochikit/tests/test_MochiKit-Async.json",
+ "mochitest/ajax/mochikit/tests/test_Signal.js",
+]
+
+TEST_HARNESS_FILES.testing.mochitest.tests.dom.tests.mochitest.ajax.mochikit.tests.SimpleTest += [
+ "mochitest/ajax/mochikit/tests/SimpleTest/SimpleTest.js",
+ "mochitest/ajax/mochikit/tests/SimpleTest/test.css",
+ "mochitest/ajax/mochikit/tests/SimpleTest/TestRunner.js",
+]
diff --git a/dom/tests/reftest/bug1389406-01.xsl b/dom/tests/reftest/bug1389406-01.xsl
new file mode 100644
index 0000000000..856a6a711e
--- /dev/null
+++ b/dom/tests/reftest/bug1389406-01.xsl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.1"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:import href="bug1389406-02.xsl"/>
+
+<xsl:template mode="title" match="*">
+ <xsl:value-of select="."/>
+ <xsl:apply-imports />
+</xsl:template>
+
+<xsl:template match="text()|@*"></xsl:template>
+
+</xsl:stylesheet>
diff --git a/dom/tests/reftest/bug1389406-02.xsl b/dom/tests/reftest/bug1389406-02.xsl
new file mode 100644
index 0000000000..60ab6936fa
--- /dev/null
+++ b/dom/tests/reftest/bug1389406-02.xsl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:template mode="title" match="*">
+ <xsl:text> — TEST CASE</xsl:text>
+ <xsl:apply-imports/>
+</xsl:template>
+
+<xsl:template match="/">
+ <h3 xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates select="title" mode="title"/></h3>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/dom/tests/reftest/bug1389406-ref.xml b/dom/tests/reftest/bug1389406-ref.xml
new file mode 100644
index 0000000000..8bfccb9c11
--- /dev/null
+++ b/dom/tests/reftest/bug1389406-ref.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<h3 xmlns="http://www.w3.org/1999/xhtml">Firefox bug — TEST CASEFirefox bug</h3>
diff --git a/dom/tests/reftest/bug1389406.xml b/dom/tests/reftest/bug1389406.xml
new file mode 100644
index 0000000000..58b00a56ac
--- /dev/null
+++ b/dom/tests/reftest/bug1389406.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="bug1389406-01.xsl"?>
+<title>Firefox bug</title>
diff --git a/dom/tests/reftest/bug427779-ref.xml b/dom/tests/reftest/bug427779-ref.xml
new file mode 100644
index 0000000000..b3631c0d14
--- /dev/null
+++ b/dom/tests/reftest/bug427779-ref.xml
@@ -0,0 +1,3 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body>This is a test</body>
+</html>
diff --git a/dom/tests/reftest/bug427779.xml b/dom/tests/reftest/bug427779.xml
new file mode 100644
index 0000000000..59e7a36ebf
--- /dev/null
+++ b/dom/tests/reftest/bug427779.xml
@@ -0,0 +1,4 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><base href="." /></head>
+<body>This is a test</body>
+</html>
diff --git a/dom/tests/reftest/bug439965-ref.html b/dom/tests/reftest/bug439965-ref.html
new file mode 100644
index 0000000000..c3465c3911
--- /dev/null
+++ b/dom/tests/reftest/bug439965-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+function doe(aEl) {
+var doc = aEl.contentDocument;
+doc.designMode = 'on';
+
+try {
+doc.execCommand("insertHTML",false,'some text');
+} catch(e) {
+ document.getElementById('result').innerHTML = e;
+}
+}
+</script>
+
+<iframe onload="doe(this)"></iframe><br>
+<pre id="result" style="background-color: red; width: 300px; white-space: -moz-pre-wrap;"></pre>
+</body>
+</html>
diff --git a/dom/tests/reftest/bug439965.html b/dom/tests/reftest/bug439965.html
new file mode 100644
index 0000000000..da3f90ebe2
--- /dev/null
+++ b/dom/tests/reftest/bug439965.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+function doe(aEl) {
+aEl.style.display = '';
+var doc = aEl.contentDocument;
+doc.designMode = 'on';
+
+try {
+doc.execCommand("insertHTML",false,'some text');
+} catch(e) {
+ document.getElementById('result').innerHTML = e;
+}
+}
+</script>
+
+<iframe onload="doe(this)" style="display:none"></iframe><br>
+<pre id="result" style="background-color: red; width: 300px; white-space: -moz-pre-wrap;"></pre>
+</body>
+</html>
diff --git a/dom/tests/reftest/bug453105-ref.html b/dom/tests/reftest/bug453105-ref.html
new file mode 100644
index 0000000000..cc10953858
--- /dev/null
+++ b/dom/tests/reftest/bug453105-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<body>
+<form name="f">
+<select name="s">
+</select>
+</form>
+</body>
diff --git a/dom/tests/reftest/bug453105.html b/dom/tests/reftest/bug453105.html
new file mode 100644
index 0000000000..0ace6d5a0d
--- /dev/null
+++ b/dom/tests/reftest/bug453105.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<body onload="document.forms.f.s.options.length = 0;">
+<form name="f">
+<select name="s">
+<option name="o1">option 1</option>
+<option name="o2">option 2</option>
+</select>
+</form>
+</body>
diff --git a/dom/tests/reftest/bug456008-ref.html b/dom/tests/reftest/bug456008-ref.html
new file mode 100644
index 0000000000..e605de5314
--- /dev/null
+++ b/dom/tests/reftest/bug456008-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <div id="target"></div>
+ <script>
+ document.getElementById("target").innerHTML =
+ "<object type='text/html' data='data:text/html,&lt;body bgcolor=&quot;green&quot;&gt;' width='300' height='200'></object>";
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/reftest/bug456008.xhtml b/dom/tests/reftest/bug456008.xhtml
new file mode 100644
index 0000000000..43027343cb
--- /dev/null
+++ b/dom/tests/reftest/bug456008.xhtml
@@ -0,0 +1,11 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <body>
+ <div id="target"></div>
+ <script>
+ <![CDATA[
+ document.getElementById("target").innerHTML =
+ "<object type='text/html' data='data:text/html,&lt;body bgcolor=&quot;green&quot;&gt;' width='300' height='200'></object>";
+ ]]>
+ </script>
+ </body>
+</html>
diff --git a/dom/tests/reftest/bug559996-iframe.html b/dom/tests/reftest/bug559996-iframe.html
new file mode 100644
index 0000000000..b576d1d223
--- /dev/null
+++ b/dom/tests/reftest/bug559996-iframe.html
@@ -0,0 +1,7 @@
+<html>
+<!-- This page is loaded in a 200px-square iframe scrolled to #down. -->
+<body>
+<div id="first" style="height: 150px; background: lightblue;">first</div>
+<div id="down" style="height: 250px; background: lightgreen;">second</div>
+</body>
+</html>
diff --git a/dom/tests/reftest/bug559996-ref-iframe.html b/dom/tests/reftest/bug559996-ref-iframe.html
new file mode 100644
index 0000000000..2b13b8b343
--- /dev/null
+++ b/dom/tests/reftest/bug559996-ref-iframe.html
@@ -0,0 +1,8 @@
+<html>
+<!-- This page is loaded in a 200px-square iframe scrolled to #down. -->
+<body>
+<div id="first" style="height: 150px; background: lightblue;">first</div>
+<div id="down" style="height: 250px; background: lightgreen;">second</div>
+<script>document.documentElement.offsetWidth;</script>
+</body>
+</html>
diff --git a/dom/tests/reftest/bug559996-ref.html b/dom/tests/reftest/bug559996-ref.html
new file mode 100644
index 0000000000..f7124e8698
--- /dev/null
+++ b/dom/tests/reftest/bug559996-ref.html
@@ -0,0 +1,16 @@
+<html class="reftest-wait">
+<body>
+
+<iframe src="bug559996-ref-iframe.html#down" style="height: 200px; width: 200px"></iframe>
+<script>
+function endTest() {
+ document.documentElement.removeAttribute("class");
+}
+function waitForInactivity() {
+ setTimeout(endTest, 1000);
+}
+document.addEventListener("MozReftestInvalidate", waitForInactivity);
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/reftest/bug559996.html b/dom/tests/reftest/bug559996.html
new file mode 100644
index 0000000000..1ade11db22
--- /dev/null
+++ b/dom/tests/reftest/bug559996.html
@@ -0,0 +1,16 @@
+<html class="reftest-wait">
+<body>
+
+<iframe src="bug559996-iframe.html#down" style="height: 200px; width: 200px"></iframe>
+<script>
+function endTest() {
+ document.documentElement.removeAttribute("class");
+}
+function waitForInactivity() {
+ setTimeout(endTest, 1000);
+}
+document.addEventListener("MozReftestInvalidate", waitForInactivity);
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/reftest/bug591981-1.html b/dom/tests/reftest/bug591981-1.html
new file mode 100644
index 0000000000..5c48ca8123
--- /dev/null
+++ b/dom/tests/reftest/bug591981-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Script-inserted script</title>
+</head>
+<body>
+<div></div>
+<script>
+function log(text) {
+ var p = document.createElement("p");
+ p.appendChild(document.createTextNode(text));
+ document.getElementsByTagName("div")[0].appendChild(p);
+}
+
+var head = document.getElementsByTagName("head")[0];
+
+var external = document.createElement("script");
+external.src = "bug591981-script.js";
+head.insertBefore(external, head.firstChild); // what jQuery does
+
+var internal = document.createElement("script");
+var data = "log('internal')";
+try {
+ internal.text = data;
+} catch(e) {
+ internal.appendChild(document.createTextNode(data));
+}
+head.insertBefore(internal, head.firstChild); // what jQuery does
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/reftest/bug591981-2.html b/dom/tests/reftest/bug591981-2.html
new file mode 100644
index 0000000000..7d05d5179a
--- /dev/null
+++ b/dom/tests/reftest/bug591981-2.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Script trying to execute parser-inserted non-executed scripts</title>
+</head>
+<body>
+<div></div>
+<script></script>
+<script></script>
+<script>
+function log(text) {
+ var p = document.createElement("p");
+ p.appendChild(document.createTextNode(text));
+ document.getElementsByTagName("div")[0].appendChild(p);
+}
+
+var head = document.getElementsByTagName("head")[0];
+
+var external = document.getElementsByTagName("script")[0];
+external.src = "bug591981-script.js";
+
+var internal = document.getElementsByTagName("script")[1];
+var data = "log('internal')";
+try {
+ internal.text = data;
+} catch(e) {
+ internal.appendChild(document.createTextNode(data));
+}
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/reftest/bug591981-ref.html b/dom/tests/reftest/bug591981-ref.html
new file mode 100644
index 0000000000..8a19a40b9d
--- /dev/null
+++ b/dom/tests/reftest/bug591981-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Script-inserted script</title>
+</head>
+<body>
+<div><p>internal</p><p>external</p></div>
+</body>
+</html>
diff --git a/dom/tests/reftest/bug591981-script.js b/dom/tests/reftest/bug591981-script.js
new file mode 100644
index 0000000000..818596af3c
--- /dev/null
+++ b/dom/tests/reftest/bug591981-script.js
@@ -0,0 +1 @@
+log("external");
diff --git a/dom/tests/reftest/bug592366-1.html b/dom/tests/reftest/bug592366-1.html
new file mode 100644
index 0000000000..42e2971542
--- /dev/null
+++ b/dom/tests/reftest/bug592366-1.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html><head>
+<title>Move node during parse</title>
+</head>
+<body>
+<iframe src=child592366-1.html></iframe>After iframe
+</body></html>
diff --git a/dom/tests/reftest/bug592366-1.xhtml b/dom/tests/reftest/bug592366-1.xhtml
new file mode 100644
index 0000000000..7f9f57b273
--- /dev/null
+++ b/dom/tests/reftest/bug592366-1.xhtml
@@ -0,0 +1,6 @@
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<title>Move node during parse</title>
+</head>
+<body>
+<iframe src="child592366-1.xhtml"></iframe>After iframe
+</body></html>
diff --git a/dom/tests/reftest/bug592366-2.html b/dom/tests/reftest/bug592366-2.html
new file mode 100644
index 0000000000..42e2971542
--- /dev/null
+++ b/dom/tests/reftest/bug592366-2.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html><head>
+<title>Move node during parse</title>
+</head>
+<body>
+<iframe src=child592366-1.html></iframe>After iframe
+</body></html>
diff --git a/dom/tests/reftest/bug592366-2.xhtml b/dom/tests/reftest/bug592366-2.xhtml
new file mode 100644
index 0000000000..db08a195a0
--- /dev/null
+++ b/dom/tests/reftest/bug592366-2.xhtml
@@ -0,0 +1,6 @@
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<title>Move node during parse</title>
+</head>
+<body>
+<iframe src="child592366-1.html"></iframe>After iframe
+</body></html>
diff --git a/dom/tests/reftest/bug592366-ref.html b/dom/tests/reftest/bug592366-ref.html
new file mode 100644
index 0000000000..7e1ee242c4
--- /dev/null
+++ b/dom/tests/reftest/bug592366-ref.html
@@ -0,0 +1,9 @@
+<html><head>
+<title>Move node during parse</title>
+</head>
+<body>
+<iframe></iframe>After iframe
+<div><p>This text should not show inside the iframe. It should show inside the parent. Furthermore, there should be text saying "Middle of Page" and then "End of Page" below (also in the parent).</p>
+<p>Middle of Page</p>
+<p>End of Page</p>
+</div></body></html>
diff --git a/dom/tests/reftest/bug592366-ref.xhtml b/dom/tests/reftest/bug592366-ref.xhtml
new file mode 100644
index 0000000000..a75444d694
--- /dev/null
+++ b/dom/tests/reftest/bug592366-ref.xhtml
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<title>Move node during parse</title>
+</head>
+<body>
+<iframe></iframe>After iframe
+<div><p>This text should not show inside the iframe. It should show inside the parent. Furthermore, there should be text saying "Middle of Page" and then "End of Page" below (also in the parent).</p>
+<p>Middle of Page</p>
+<p>End of Page</p>
+</div></body></html>
diff --git a/dom/tests/reftest/bug798068-ref.xhtml b/dom/tests/reftest/bug798068-ref.xhtml
new file mode 100644
index 0000000000..eaa2772c74
--- /dev/null
+++ b/dom/tests/reftest/bug798068-ref.xhtml
@@ -0,0 +1,18 @@
+<?xml version = '1.0' encoding = 'utf-8'?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <script>
+ function doTest() {
+ var defaultZoom = {}, allowZoom = {}, minZoom = {}, maxZoom ={}, width = {}, height = {}, autoSize = {};
+ var windowUtils = window.windowUtils;
+ windowUtils.getViewportInfo(1, 1, defaultZoom, allowZoom, minZoom, maxZoom, width, height, autoSize);
+ document.getElementById("minZoom").innerHTML = minZoom.value.toPrecision(10);
+ document.getElementById("maxZoom").innerHTML = maxZoom.value.toPrecision(10);
+ }
+ </script>
+ </head>
+ <body onload="doTest();">
+ MinZoom: <span id="minZoom"></span><br />
+ MaxZoom: <span id="maxZoom"></span>
+ </body>
+</html>
diff --git a/dom/tests/reftest/bug798068.xhtml b/dom/tests/reftest/bug798068.xhtml
new file mode 100644
index 0000000000..7fe0aea245
--- /dev/null
+++ b/dom/tests/reftest/bug798068.xhtml
@@ -0,0 +1,19 @@
+<?xml version = '1.0' encoding = 'utf-8'?>
+<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <script>
+ function doTest() {
+ var defaultZoom = {}, allowZoom = {}, minZoom = {}, maxZoom ={}, width = {}, height = {}, autoSize = {};
+ var windowUtils = window.windowUtils;
+ windowUtils.getViewportInfo(1, 1, defaultZoom, allowZoom, minZoom, maxZoom, width, height, autoSize);
+ document.getElementById("minZoom").innerHTML = minZoom.value.toPrecision(10);
+ document.getElementById("maxZoom").innerHTML = maxZoom.value.toPrecision(10);
+ }
+ </script>
+ </head>
+ <body onload="doTest();">
+ MinZoom: <span id="minZoom"></span><br />
+ MaxZoom: <span id="maxZoom"></span>
+ </body>
+</html>
diff --git a/dom/tests/reftest/child592366-1.html b/dom/tests/reftest/child592366-1.html
new file mode 100644
index 0000000000..acd123571d
--- /dev/null
+++ b/dom/tests/reftest/child592366-1.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Move node during parse</title>
+</head>
+<body>
+<div>
+<p>This text should not show inside the iframe. It should show inside the parent. Furthermore, there should be text saying "Middle of Page" and then "End of Page" below (also in the parent).</p>
+<script>
+parent.document.documentElement.lastChild.appendChild(document.getElementsByTagName("div")[0]);
+</script>
+<p>Middle of Page</p>
+<script>
+document.body.insertBefore(document.createTextNode("FAIL"), document.body.firstChild);
+</script>
+<p>End of Page</p>
+</div>
+</body>
+</html>
diff --git a/dom/tests/reftest/child592366-1.xhtml b/dom/tests/reftest/child592366-1.xhtml
new file mode 100644
index 0000000000..0193e4cea4
--- /dev/null
+++ b/dom/tests/reftest/child592366-1.xhtml
@@ -0,0 +1,18 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Move node during parse</title>
+</head>
+<body>
+<div>
+<p>This text should not show inside the iframe. It should show inside the parent. Furthermore, there should be text saying "Middle of Page" and then "End of Page" below (also in the parent).</p>
+<script>
+parent.document.documentElement.lastChild.appendChild(document.getElementsByTagName("div")[0]);
+</script>
+<p>Middle of Page</p>
+<script>
+document.body.insertBefore(document.createTextNode("FAIL"), document.body.firstChild);
+</script>
+<p>End of Page</p>
+</div>
+</body>
+</html>
diff --git a/dom/tests/reftest/child592366-2.html b/dom/tests/reftest/child592366-2.html
new file mode 100644
index 0000000000..e2e6c3a651
--- /dev/null
+++ b/dom/tests/reftest/child592366-2.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Move node during parse</title>
+</head>
+<body>
+<div>
+<p>This text should not show inside the iframe. It should show inside the parent. Furthermore, there should be text saying "Middle of Page" and then "End of Page" below (also in the parent).</p>
+<script>
+parent.document.documentElement.lastChild.appendChild(document.getElementsByTagName("div")[0]);
+</script>
+<p>Middle of Page</p>
+<script src="script592366-2.js"></script>
+<p>End of Page</p>
+</div>
+</body>
+</html>
diff --git a/dom/tests/reftest/child592366-2.xhtml b/dom/tests/reftest/child592366-2.xhtml
new file mode 100644
index 0000000000..a64dc83ae0
--- /dev/null
+++ b/dom/tests/reftest/child592366-2.xhtml
@@ -0,0 +1,16 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Move node during parse</title>
+</head>
+<body>
+<div>
+<p>This text should not show inside the iframe. It should show inside the parent. Furthermore, there should be text saying "Middle of Page" and then "End of Page" below (also in the parent).</p>
+<script>
+parent.document.documentElement.lastChild.appendChild(document.getElementsByTagName("div")[0]);
+</script>
+<p>Middle of Page</p>
+<script src="script592366-2.js"></script>
+<p>End of Page</p>
+</div>
+</body>
+</html>
diff --git a/dom/tests/reftest/optiontext-ref.html b/dom/tests/reftest/optiontext-ref.html
new file mode 100644
index 0000000000..6250c1fb27
--- /dev/null
+++ b/dom/tests/reftest/optiontext-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<body>
+<form name="f">
+<select name="s">
+<option name="o1">ok</option>
+</select>
+</form>
+</body>
diff --git a/dom/tests/reftest/optiontext.html b/dom/tests/reftest/optiontext.html
new file mode 100644
index 0000000000..5297e6caa3
--- /dev/null
+++ b/dom/tests/reftest/optiontext.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<body onload="document.forms.f.s.options[0].text = 'ok';">
+<form name="f">
+<select name="s">
+<option name="o1">-</option>
+</select>
+</form>
+</body>
diff --git a/dom/tests/reftest/reftest.list b/dom/tests/reftest/reftest.list
new file mode 100644
index 0000000000..ee7069e2af
--- /dev/null
+++ b/dom/tests/reftest/reftest.list
@@ -0,0 +1,14 @@
+fuzzy-if(Android,0-4,0-1) == bug453105.html bug453105-ref.html # bug 1600534
+fuzzy-if(Android,0-4,0-1) == optiontext.html optiontext-ref.html
+== bug456008.xhtml bug456008-ref.html
+fuzzy(0-2,0-3) == bug439965.html bug439965-ref.html
+== bug427779.xml bug427779-ref.xml
+fuzzy(0-1,0-5) == bug559996.html bug559996-ref.html
+== bug591981-1.html bug591981-ref.html
+== bug591981-2.html bug591981-ref.html
+== bug592366-1.html bug592366-ref.html
+== bug592366-2.html bug592366-ref.html
+== bug592366-1.xhtml bug592366-ref.xhtml
+== bug592366-2.xhtml bug592366-ref.xhtml
+== bug798068.xhtml bug798068-ref.xhtml
+== bug1389406.xml bug1389406-ref.xml
diff --git a/dom/tests/reftest/script592366-2.js b/dom/tests/reftest/script592366-2.js
new file mode 100644
index 0000000000..c3c8e143e3
--- /dev/null
+++ b/dom/tests/reftest/script592366-2.js
@@ -0,0 +1,2 @@
+document.body.insertBefore(document.createTextNode("FAIL"), document.body.firstChild);
+
diff --git a/dom/tests/reftest/xml-stylesheet/css_relative_href.xml b/dom/tests/reftest/xml-stylesheet/css_relative_href.xml
new file mode 100644
index 0000000000..8576e56d8f
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/css_relative_href.xml
@@ -0,0 +1,2 @@
+<?xml-stylesheet type="text/css" href="passer.css"?>
+<element/>
diff --git a/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml
new file mode 100644
index 0000000000..8576e56d8f
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml
@@ -0,0 +1,2 @@
+<?xml-stylesheet type="text/css" href="passer.css"?>
+<element/>
diff --git a/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml^headers^ b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml^headers^
new file mode 100644
index 0000000000..581aae3439
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external.xml^headers^
@@ -0,0 +1 @@
+Link: <failer.css>;rel="stylesheet";type="text/css"
diff --git a/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml
new file mode 100644
index 0000000000..7859e6078c
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml
@@ -0,0 +1,2 @@
+<?xml-stylesheet type="text/css" href="failer.css"?>
+<element/>
diff --git a/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml^headers^ b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml^headers^
new file mode 100644
index 0000000000..f9e96867b6
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/css_relative_href_also_external_override.xml^headers^
@@ -0,0 +1 @@
+Link: <passer_override.css>;rel="stylesheet";type="text/css"
diff --git a/dom/tests/reftest/xml-stylesheet/embedded_dtd_id.svg b/dom/tests/reftest/xml-stylesheet/embedded_dtd_id.svg
new file mode 100644
index 0000000000..dee0d44f0d
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/embedded_dtd_id.svg
@@ -0,0 +1,20 @@
+<!DOCTYPE svg:svg [<!ATTLIST transform id ID #IMPLIED>]>
+<?xml-stylesheet type="application/xml" href="#transform"?>
+<svg:svg xmlns="http://www.w3.org/1999/XSL/Transform"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <svg:defs>
+ <transform id="transform" version="1.0">
+ <template match="node()|@*">
+ <copy>
+ <apply-templates select="@*"/>
+ <apply-templates/>
+ </copy>
+ </template>
+ <template match="svg:defs"/>
+ <template match="@fill">
+ <attribute name="fill">lime</attribute>
+ </template>
+ </transform>
+ </svg:defs>
+ <svg:rect width="100%" height="100%" fill="red"/>
+</svg:svg>
diff --git a/dom/tests/reftest/xml-stylesheet/error_no_href.svg b/dom/tests/reftest/xml-stylesheet/error_no_href.svg
new file mode 100644
index 0000000000..63719f9302
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/error_no_href.svg
@@ -0,0 +1,8 @@
+<?xml-stylesheet type="application/xml"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+ xslt:version="1.0">
+ <rect width="100%" height="100%" fill="lime">
+ <xslt:attribute name="fill">red</xslt:attribute>
+ </rect>
+</svg>
diff --git a/dom/tests/reftest/xml-stylesheet/fail.svg b/dom/tests/reftest/xml-stylesheet/fail.svg
new file mode 100644
index 0000000000..fcffde5235
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/fail.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <desc>Fail</desc>
+ <rect width="100%" height="100%" fill="red"/>
+</svg>
diff --git a/dom/tests/reftest/xml-stylesheet/failer.css b/dom/tests/reftest/xml-stylesheet/failer.css
new file mode 100644
index 0000000000..08f46a7a8f
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/failer.css
@@ -0,0 +1 @@
+:root { background: red; }
diff --git a/dom/tests/reftest/xml-stylesheet/lreas_selflink_dtd_id.svg b/dom/tests/reftest/xml-stylesheet/lreas_selflink_dtd_id.svg
new file mode 100644
index 0000000000..8c05fc8b5b
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/lreas_selflink_dtd_id.svg
@@ -0,0 +1,9 @@
+<!DOCTYPE svg [<!ATTLIST svg id ID #IMPLIED>]>
+<?xml-stylesheet type="application/xml" href="#transform"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+ id="transform" xslt:version="1.0">
+ <rect width="100%" height="100%" fill="red">
+ <xslt:attribute name="fill">lime</xslt:attribute>
+ </rect>
+</svg>
diff --git a/dom/tests/reftest/xml-stylesheet/lreas_selflink_empty_href.svg b/dom/tests/reftest/xml-stylesheet/lreas_selflink_empty_href.svg
new file mode 100644
index 0000000000..5a995697b4
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/lreas_selflink_empty_href.svg
@@ -0,0 +1,8 @@
+<?xml-stylesheet type="application/xml" href=""?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+ xslt:version="1.0">
+ <rect width="100%" height="100%" fill="red">
+ <xslt:attribute name="fill">lime</xslt:attribute>
+ </rect>
+</svg>
diff --git a/dom/tests/reftest/xml-stylesheet/lreas_selflink_relative_href.svg b/dom/tests/reftest/xml-stylesheet/lreas_selflink_relative_href.svg
new file mode 100644
index 0000000000..e8d62584f9
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/lreas_selflink_relative_href.svg
@@ -0,0 +1,9 @@
+<?xml-stylesheet type="application/xml"
+ href="lreas_selflink_relative_href.svg"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+ xslt:version="1.0">
+ <rect width="100%" height="100%" fill="red">
+ <xslt:attribute name="fill">lime</xslt:attribute>
+ </rect>
+</svg>
diff --git a/dom/tests/reftest/xml-stylesheet/pass.svg b/dom/tests/reftest/xml-stylesheet/pass.svg
new file mode 100644
index 0000000000..65780d0f02
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/pass.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <desc>Pass</desc>
+ <rect width="100%" height="100%" fill="lime"/>
+</svg>
diff --git a/dom/tests/reftest/xml-stylesheet/passer.css b/dom/tests/reftest/xml-stylesheet/passer.css
new file mode 100644
index 0000000000..642b7cc108
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/passer.css
@@ -0,0 +1 @@
+:root { background: lime; }
diff --git a/dom/tests/reftest/xml-stylesheet/passer_override.css b/dom/tests/reftest/xml-stylesheet/passer_override.css
new file mode 100644
index 0000000000..671e9e47bd
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/passer_override.css
@@ -0,0 +1 @@
+:root { background: lime !important; }
diff --git a/dom/tests/reftest/xml-stylesheet/reftest.list b/dom/tests/reftest/xml-stylesheet/reftest.list
new file mode 100644
index 0000000000..caf3920cb1
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/reftest.list
@@ -0,0 +1,12 @@
+== css_relative_href.xml pass.svg
+HTTP == css_relative_href_also_external.xml pass.svg
+HTTP == css_relative_href_also_external_override.xml pass.svg
+== embedded_dtd_id.svg pass.svg
+!= error_no_href.svg fail.svg
+fails == lreas_selflink_dtd_id.svg pass.svg # fails after bug 631575
+== lreas_selflink_empty_href.svg pass.svg
+== lreas_selflink_relative_href.svg pass.svg
+== xslt_relative_href.svg pass.svg
+== xslt_selflink_dtd_id.xml pass.svg
+== xslt_selflink_empty_href.xml pass.svg
+== xslt_selflink_relative_href.xml pass.svg
diff --git a/dom/tests/reftest/xml-stylesheet/svg_passer.xslt b/dom/tests/reftest/xml-stylesheet/svg_passer.xslt
new file mode 100644
index 0000000000..392127cee5
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/svg_passer.xslt
@@ -0,0 +1,11 @@
+<transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <template match="node()|@*">
+ <copy>
+ <apply-templates select="@*"/>
+ <apply-templates/>
+ </copy>
+ </template>
+ <template match="@fill">
+ <attribute name="fill">lime</attribute>
+ </template>
+</transform>
diff --git a/dom/tests/reftest/xml-stylesheet/xslt_relative_href.svg b/dom/tests/reftest/xml-stylesheet/xslt_relative_href.svg
new file mode 100644
index 0000000000..33231847f7
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/xslt_relative_href.svg
@@ -0,0 +1,4 @@
+<?xml-stylesheet type="application/xml" href="svg_passer.xslt"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <rect width="100%" height="100%" fill="red"/>
+</svg>
diff --git a/dom/tests/reftest/xml-stylesheet/xslt_selflink_dtd_id.xml b/dom/tests/reftest/xml-stylesheet/xslt_selflink_dtd_id.xml
new file mode 100644
index 0000000000..626738b1b4
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/xslt_selflink_dtd_id.xml
@@ -0,0 +1,11 @@
+<!DOCTYPE xslt:transform [<!ATTLIST xslt:transform id ID #IMPLIED>]>
+<?xml-stylesheet type="application/xml" href="#transform"?>
+<xslt:transform xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/2000/svg"
+ id="transform" version="1.0">
+ <xslt:template match="/xslt:transform">
+ <svg>
+ <rect width="100%" height="100%" fill="lime"/>
+ </svg>
+ </xslt:template>
+</xslt:transform>
diff --git a/dom/tests/reftest/xml-stylesheet/xslt_selflink_empty_href.xml b/dom/tests/reftest/xml-stylesheet/xslt_selflink_empty_href.xml
new file mode 100644
index 0000000000..9e0834b7ed
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/xslt_selflink_empty_href.xml
@@ -0,0 +1,10 @@
+<?xml-stylesheet type="application/xml" href=""?>
+<xslt:transform xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0">
+ <xslt:template match="/xslt:transform">
+ <svg>
+ <rect width="100%" height="100%" fill="lime"/>
+ </svg>
+ </xslt:template>
+</xslt:transform>
diff --git a/dom/tests/reftest/xml-stylesheet/xslt_selflink_relative_href.xml b/dom/tests/reftest/xml-stylesheet/xslt_selflink_relative_href.xml
new file mode 100644
index 0000000000..88d06a7296
--- /dev/null
+++ b/dom/tests/reftest/xml-stylesheet/xslt_selflink_relative_href.xml
@@ -0,0 +1,11 @@
+<?xml-stylesheet type="application/xml"
+ href="xslt_selflink_relative_href.xml"?>
+<xslt:transform xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0">
+ <xslt:template match="/xslt:transform">
+ <svg>
+ <rect width="100%" height="100%" fill="lime"/>
+ </svg>
+ </xslt:template>
+</xslt:transform>
diff --git a/dom/tests/unit/test_Fetch.js b/dom/tests/unit/test_Fetch.js
new file mode 100644
index 0000000000..c19f4e7ece
--- /dev/null
+++ b/dom/tests/unit/test_Fetch.js
@@ -0,0 +1,366 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+Cu.importGlobalProperties(["fetch"]);
+const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
+
+const BinaryInputStream = Components.Constructor(
+ "@mozilla.org/binaryinputstream;1",
+ "nsIBinaryInputStream",
+ "setInputStream"
+);
+
+var server;
+
+function getBaseUrl() {
+ return "http://localhost:" + server.identity.primaryPort;
+}
+
+// a way to create some test defaults
+function createTestData(testPath) {
+ return {
+ testPath,
+ request: {
+ headers: {},
+ contentType: "application/json",
+ },
+ response: {
+ headers: {},
+ contentType: "application/json",
+ body: '{"Look": "Success!"}',
+ status: 200,
+ statusText: "OK",
+ },
+ };
+}
+
+// read body and content type information from a request
+function readDataFromRequest(aRequest) {
+ let requestData = {};
+ if (aRequest.method == "POST" || aRequest.method == "PUT") {
+ if (aRequest.bodyInputStream) {
+ let inputStream = new BinaryInputStream(aRequest.bodyInputStream);
+ let bytes = [];
+ let available;
+
+ while ((available = inputStream.available()) > 0) {
+ Array.prototype.push.apply(bytes, inputStream.readByteArray(available));
+ }
+
+ requestData.body = String.fromCharCode.apply(null, bytes);
+ requestData.contentType = aRequest.getHeader("Content-Type");
+ }
+ }
+ return requestData;
+}
+
+// write status information, content type information and body to a response
+function writeDataToResponse(aData, aResponse) {
+ aResponse.setStatusLine(null, aData.status, aData.statusText);
+ aResponse.setHeader("Content-Type", aData.contentType);
+ for (let header in aData.headers) {
+ aResponse.setHeader(header, aData.headers[header]);
+ }
+ aResponse.write(aData.body);
+}
+
+// test some GET functionality
+add_test(function test_GetData() {
+ do_test_pending();
+
+ let testData = createTestData("/getData");
+
+ // set up some headers to test
+ let headerNames = ["x-test-header", "x-other-test-header"];
+ for (let headerName of headerNames) {
+ testData.request.headers[headerName] = "test-value-for-" + headerName;
+ }
+
+ server.registerPathHandler(testData.testPath, function (aRequest, aResponse) {
+ try {
+ // check our request headers made it OK
+ for (let headerName of headerNames) {
+ Assert.equal(
+ testData.request.headers[headerName],
+ aRequest.getHeader(headerName)
+ );
+ }
+
+ // send a response
+ writeDataToResponse(testData.response, aResponse);
+ } catch (e) {
+ do_report_unexpected_exception(e);
+ }
+ });
+
+ // fetch, via GET, with some request headers set
+ fetch(getBaseUrl() + testData.testPath, { headers: testData.request.headers })
+ .then(function (response) {
+ // check response looks as expected
+ Assert.ok(response.ok);
+ Assert.equal(response.status, testData.response.status);
+ Assert.equal(response.statusText, testData.response.statusText);
+
+ // check a response header looks OK:
+ Assert.equal(
+ response.headers.get("Content-Type"),
+ testData.response.contentType
+ );
+
+ // ... and again to check header names are case insensitive
+ Assert.equal(
+ response.headers.get("content-type"),
+ testData.response.contentType
+ );
+
+ // ensure response.text() returns a promise that resolves appropriately
+ response.text().then(function (text) {
+ Assert.equal(text, testData.response.body);
+ do_test_finished();
+ run_next_test();
+ });
+ })
+ .catch(function (e) {
+ do_report_unexpected_exception(e);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+// test a GET with no init
+add_test(function test_GetDataNoInit() {
+ do_test_pending();
+
+ let testData = createTestData("/getData");
+
+ server.registerPathHandler(testData.testPath, function (aRequest, aResponse) {
+ try {
+ // send a response
+ writeDataToResponse(testData.response, aResponse);
+ } catch (e) {
+ do_report_unexpected_exception(e);
+ }
+ });
+
+ fetch(getBaseUrl() + testData.testPath, { headers: testData.request.headers })
+ .then(function (response) {
+ // check response looks as expected
+ Assert.ok(response.ok);
+ Assert.equal(response.status, testData.response.status);
+
+ // ensure response.text() returns a promise that resolves appropriately
+ response.text().then(function (text) {
+ Assert.equal(text, testData.response.body);
+ do_test_finished();
+ run_next_test();
+ });
+ })
+ .catch(function (e) {
+ do_report_unexpected_exception(e);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+// test some error responses
+add_test(function test_get40x() {
+ do_test_pending();
+
+ // prepare a response with some 40x error - a 404 will do
+ let notFoundData = createTestData("/getNotFound");
+ notFoundData.response.status = 404;
+ notFoundData.response.statusText = "Not found";
+ notFoundData.response.body = null;
+
+ // No need to register a path handler - httpd will return 404 anyway.
+ // Fetch, via GET, the resource that doesn't exist
+ fetch(getBaseUrl() + notFoundData.testPath).then(function (response) {
+ Assert.equal(response.status, 404);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+add_test(function test_get50x() {
+ do_test_pending();
+
+ // prepare a response with some server error - a 500 will do
+ let serverErrorData = createTestData("/serverError");
+ serverErrorData.response.status = 500;
+ serverErrorData.response.statusText = "The server broke";
+ serverErrorData.response.body = null;
+
+ server.registerPathHandler(
+ serverErrorData.testPath,
+ function (aRequest, aResponse) {
+ try {
+ // send the error response
+ writeDataToResponse(serverErrorData.response, aResponse);
+ } catch (e) {
+ do_report_unexpected_exception(e);
+ }
+ }
+ );
+
+ // fetch, via GET, the resource that creates a server error
+ fetch(getBaseUrl() + serverErrorData.testPath).then(function (response) {
+ Assert.equal(response.status, 500);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+// test a failure to connect
+add_test(function test_getTestFailedConnect() {
+ do_test_pending();
+ // try a server that's not there
+ fetch("http://localhost:4/should/fail")
+ .then(response => {
+ do_throw("Request should not succeed");
+ })
+ .catch(err => {
+ Assert.equal(true, err instanceof TypeError);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+add_test(function test_mozError() {
+ do_test_pending();
+ // try a server that's not there
+ fetch("http://localhost:4/should/fail", { mozErrors: true })
+ .then(response => {
+ do_throw("Request should not succeed");
+ })
+ .catch(err => {
+ Assert.equal(err.result, Cr.NS_ERROR_CONNECTION_REFUSED);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+add_test(function test_request_mozError() {
+ do_test_pending();
+ // try a server that's not there
+ const r = new Request("http://localhost:4/should/fail", { mozErrors: true });
+ fetch(r)
+ .then(response => {
+ do_throw("Request should not succeed");
+ })
+ .catch(err => {
+ Assert.equal(err.result, Cr.NS_ERROR_CONNECTION_REFUSED);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+// test POSTing some JSON data
+add_test(function test_PostJSONData() {
+ do_test_pending();
+
+ let testData = createTestData("/postJSONData");
+ testData.request.body = '{"foo": "bar"}';
+
+ server.registerPathHandler(testData.testPath, function (aRequest, aResponse) {
+ try {
+ let requestData = readDataFromRequest(aRequest);
+
+ // Check the request body is OK
+ Assert.equal(requestData.body, testData.request.body);
+
+ // Check the content type is as expected
+ Assert.equal(requestData.contentType, testData.request.contentType);
+
+ writeDataToResponse(testData.response, aResponse);
+ } catch (e) {
+ Assert.ok(false);
+ }
+ });
+
+ fetch(getBaseUrl() + testData.testPath, {
+ method: "POST",
+ body: testData.request.body,
+ headers: {
+ "Content-Type": "application/json",
+ },
+ })
+ .then(function (aResponse) {
+ Assert.ok(aResponse.ok);
+ Assert.equal(aResponse.status, testData.response.status);
+ Assert.equal(aResponse.statusText, testData.response.statusText);
+
+ do_test_finished();
+ run_next_test();
+ })
+ .catch(function (e) {
+ do_report_unexpected_exception(e);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+// test POSTing some text
+add_test(function test_PostTextData() {
+ do_test_pending();
+
+ let testData = createTestData("/postTextData");
+ testData.request.body = "A plain text body";
+ testData.request.contentType = "text/plain";
+ let responseHeaderName = "some-response-header";
+ testData.response.headers[responseHeaderName] = "some header value";
+
+ server.registerPathHandler(testData.testPath, function (aRequest, aResponse) {
+ try {
+ let requestData = readDataFromRequest(aRequest);
+
+ // Check the request body is OK
+ Assert.equal(requestData.body, testData.request.body);
+
+ // Check the content type is as expected
+ Assert.equal(requestData.contentType, testData.request.contentType);
+
+ writeDataToResponse(testData.response, aResponse);
+ } catch (e) {
+ Assert.ok(false);
+ }
+ });
+
+ fetch(getBaseUrl() + testData.testPath, {
+ method: "POST",
+ body: testData.request.body,
+ headers: {
+ "Content-Type": testData.request.contentType,
+ },
+ })
+ .then(function (aResponse) {
+ Assert.ok(aResponse.ok);
+ Assert.equal(aResponse.status, testData.response.status);
+ Assert.equal(aResponse.statusText, testData.response.statusText);
+
+ // check the response header is set OK
+ Assert.equal(
+ aResponse.headers.get(responseHeaderName),
+ testData.response.headers[responseHeaderName]
+ );
+
+ do_test_finished();
+ run_next_test();
+ })
+ .catch(function (e) {
+ do_report_unexpected_exception(e);
+ do_test_finished();
+ run_next_test();
+ });
+});
+
+function run_test() {
+ // Set up an HTTP Server
+ server = new HttpServer();
+ server.start(-1);
+
+ run_next_test();
+
+ registerCleanupFunction(function () {
+ server.stop(function () {});
+ });
+}
diff --git a/dom/tests/unit/test_PromiseDebugging.js b/dom/tests/unit/test_PromiseDebugging.js
new file mode 100644
index 0000000000..2262d60d61
--- /dev/null
+++ b/dom/tests/unit/test_PromiseDebugging.js
@@ -0,0 +1,21 @@
+function run_test() {
+ // Hack around Promise.jsm being stuck on my global
+ Assert.equal(false, PromiseDebugging === undefined);
+ var res;
+ var p = new Promise(function (resolve, reject) {
+ res = resolve;
+ });
+ var state = PromiseDebugging.getState(p);
+ Assert.equal(state.state, "pending");
+
+ do_test_pending();
+
+ p.then(function () {
+ var state2 = PromiseDebugging.getState(p);
+ Assert.equal(state2.state, "fulfilled");
+ Assert.equal(state2.value, 5);
+ do_test_finished();
+ });
+
+ res(5);
+}
diff --git a/dom/tests/unit/test_bug319968.js b/dom/tests/unit/test_bug319968.js
new file mode 100644
index 0000000000..efde6843f0
--- /dev/null
+++ b/dom/tests/unit/test_bug319968.js
@@ -0,0 +1,19 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+function run_test() {
+ var domParser = new DOMParser();
+ var aDom = domParser.parseFromString(
+ "<root><feed><entry/><entry/></feed></root>",
+ "application/xml"
+ );
+ var feedList = aDom.getElementsByTagName("feed");
+ Assert.notEqual(feedList, null);
+ Assert.equal(feedList.length, 1);
+ Assert.notEqual(feedList[0], null);
+ Assert.equal(feedList[0].tagName, "feed");
+ var entry = feedList[0].getElementsByTagName("entry");
+ Assert.notEqual(entry, null);
+}
diff --git a/dom/tests/unit/test_bug465752.js b/dom/tests/unit/test_bug465752.js
new file mode 100644
index 0000000000..19c03a0e4d
--- /dev/null
+++ b/dom/tests/unit/test_bug465752.js
@@ -0,0 +1,26 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+function run_test() {
+ const str = "javascript:10";
+ var uri = Services.io.newURI(str);
+ var uri2 = Services.io.newURI(str);
+ const str2 = "http://example.org";
+ var uri3 = Services.io.newURI(str2);
+ Assert.ok(uri.equals(uri));
+ Assert.ok(uri.equals(uri2));
+ Assert.ok(uri2.equals(uri));
+ Assert.ok(uri2.equals(uri2));
+ Assert.ok(!uri3.equals(uri2));
+ Assert.ok(!uri2.equals(uri3));
+
+ var simple = Cc["@mozilla.org/network/simple-uri-mutator;1"]
+ .createInstance(Ci.nsIURIMutator)
+ .setSpec(str)
+ .finalize();
+ Assert.equal(simple.spec, uri.spec);
+ Assert.ok(!simple.equals(uri));
+ Assert.ok(!uri.equals(simple));
+}
diff --git a/dom/tests/unit/test_geolocation_monitor.js b/dom/tests/unit/test_geolocation_monitor.js
new file mode 100644
index 0000000000..161a017b35
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_monitor.js
@@ -0,0 +1,97 @@
+const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
+
+let geolocation = null;
+let locations = [
+ [1, 2],
+ [3, 4],
+ [5, 6],
+];
+
+function geoHandler(metadata, response) {
+ let [lat, lng] = locations.shift();
+ response.setStatusLine("1.0", 200, "OK");
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "application/x-javascript", false);
+ response.write(
+ JSON.stringify({
+ status: "OK",
+ location: { lat, lng },
+ accuracy: 42,
+ })
+ );
+}
+
+function toJSON(pos) {
+ return { lat: pos.coords.latitude, lng: pos.coords.longitude };
+}
+
+function getPosition() {
+ return new Promise(function (resolve, reject) {
+ geolocation.getCurrentPosition(resolve, reject);
+ });
+}
+
+function watchPosition() {
+ let seen = 0;
+ return new Promise(function (resolve, reject) {
+ let id = geolocation.watchPosition(position => {
+ seen++;
+ if (seen === 1) {
+ Assert.deepEqual(toJSON(position), { lat: 3, lng: 4 });
+ Assert.deepEqual(observer._lastData, { lat: 3, lng: 4 });
+ Assert.equal(observer._countEvents, 2);
+ } else if (seen === 2) {
+ Assert.deepEqual(toJSON(position), { lat: 5, lng: 6 });
+ Assert.deepEqual(observer._lastData, { lat: 5, lng: 6 });
+ Assert.equal(observer._countEvents, 3);
+ geolocation.clearWatch(id);
+ resolve();
+ }
+ }, reject);
+ });
+}
+
+let observer = {
+ QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
+
+ observe(subject, topic, data) {
+ Assert.equal(topic, "geolocation-position-events");
+ observer._countEvents++;
+ observer._lastData = toJSON(subject);
+ },
+
+ _lastData: null,
+ _countEvents: 0,
+};
+
+add_task(async function test_resetClient() {
+ do_get_profile();
+ geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
+
+ let server = new HttpServer();
+ server.registerPathHandler("/geo", geoHandler);
+ server.start(-1);
+
+ Services.prefs.setCharPref(
+ "geo.provider.network.url",
+ "http://localhost:" + server.identity.primaryPort + "/geo"
+ );
+ Services.prefs.setBoolPref(
+ "geo.provider.network.debug.requestCache.enabled",
+ false
+ );
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+
+ var obs = Cc["@mozilla.org/observer-service;1"].getService();
+ obs = obs.QueryInterface(Ci.nsIObserverService);
+ obs.addObserver(observer, "geolocation-position-events");
+
+ let position = await getPosition();
+ Assert.deepEqual(toJSON(position), { lat: 1, lng: 2 });
+ Assert.equal(observer._countEvents, 1);
+ Assert.deepEqual(observer._lastData, { lat: 1, lng: 2 });
+
+ await watchPosition();
+
+ await new Promise(resolve => server.stop(resolve));
+});
diff --git a/dom/tests/unit/test_geolocation_position_unavailable.js b/dom/tests/unit/test_geolocation_position_unavailable.js
new file mode 100644
index 0000000000..667a84f050
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_position_unavailable.js
@@ -0,0 +1,28 @@
+function successCallback() {
+ Assert.ok(false);
+ do_test_finished();
+}
+
+function errorCallback(err) {
+ // GeolocationPositionError has no interface object, so we can't get constants off that.
+ Assert.equal(err.POSITION_UNAVAILABLE, err.code);
+ Assert.equal(2, err.code);
+ do_test_finished();
+}
+
+function run_test() {
+ do_test_pending();
+
+ if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
+ // XPCShell does not get a profile by default. The geolocation service
+ // depends on the settings service which uses IndexedDB and IndexedDB
+ // needs a place where it can store databases.
+ do_get_profile();
+
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+ Services.prefs.setCharPref("geo.provider.network.url", "UrlNotUsedHere:");
+ }
+
+ var geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
+ geolocation.getCurrentPosition(successCallback, errorCallback);
+}
diff --git a/dom/tests/unit/test_geolocation_position_unavailable_wrap.js b/dom/tests/unit/test_geolocation_position_unavailable_wrap.js
new file mode 100644
index 0000000000..ca80fdb83a
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_position_unavailable_wrap.js
@@ -0,0 +1,6 @@
+function run_test() {
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+
+ Services.prefs.setCharPref("geo.provider.network.url", "UrlNotUsedHere");
+ run_test_in_child("./test_geolocation_position_unavailable.js");
+}
diff --git a/dom/tests/unit/test_geolocation_provider.js b/dom/tests/unit/test_geolocation_provider.js
new file mode 100644
index 0000000000..7dd072cf43
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_provider.js
@@ -0,0 +1,83 @@
+const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
+
+var httpserver = null;
+var geolocation = null;
+var success = false;
+var watchID = -1;
+
+function terminate(succ) {
+ success = succ;
+ geolocation.clearWatch(watchID);
+}
+
+function successCallback(pos) {
+ terminate(true);
+}
+function errorCallback(pos) {
+ terminate(false);
+}
+
+var observer = {
+ QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
+
+ observe(subject, topic, data) {
+ if (data == "shutdown") {
+ Assert.ok(1);
+ this._numProviders--;
+ if (!this._numProviders) {
+ httpserver.stop(function () {
+ Assert.ok(success);
+ do_test_finished();
+ });
+ }
+ } else if (data == "starting") {
+ Assert.ok(1);
+ this._numProviders++;
+ }
+ },
+
+ _numProviders: 0,
+};
+
+function geoHandler(metadata, response) {
+ var georesponse = {
+ status: "OK",
+ location: {
+ lat: 42,
+ lng: 42,
+ },
+ accuracy: 42,
+ };
+ var position = JSON.stringify(georesponse);
+ response.setStatusLine("1.0", 200, "OK");
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "aplication/x-javascript", false);
+ response.write(position);
+}
+
+function run_test() {
+ // XPCShell does not get a profile by default. The geolocation service
+ // depends on the settings service which uses IndexedDB and IndexedDB
+ // needs a place where it can store databases.
+ do_get_profile();
+
+ // only kill this test when shutdown is called on the provider.
+ do_test_pending();
+
+ httpserver = new HttpServer();
+ httpserver.registerPathHandler("/geo", geoHandler);
+ httpserver.start(-1);
+
+ Services.prefs.setCharPref(
+ "geo.provider.network.url",
+ "http://localhost:" + httpserver.identity.primaryPort + "/geo"
+ );
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+
+ var obs = Cc["@mozilla.org/observer-service;1"].getService();
+ obs = obs.QueryInterface(Ci.nsIObserverService);
+ obs.addObserver(observer, "geolocation-device-events");
+
+ geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
+ watchID = geolocation.watchPosition(successCallback, errorCallback);
+}
diff --git a/dom/tests/unit/test_geolocation_provider_timeout.js b/dom/tests/unit/test_geolocation_provider_timeout.js
new file mode 100644
index 0000000000..6f311a5aa8
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_provider_timeout.js
@@ -0,0 +1,43 @@
+const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
+
+var httpserver = null;
+var geolocation = null;
+
+function geoHandler(metadata, response) {
+ response.processAsync();
+}
+
+function successCallback() {
+ // The call shouldn't be sucessful.
+ Assert.ok(false);
+ do_test_finished();
+}
+
+function errorCallback() {
+ Assert.ok(true);
+ do_test_finished();
+}
+
+function run_test() {
+ do_test_pending();
+
+ // XPCShell does not get a profile by default. The geolocation service
+ // depends on the settings service which uses IndexedDB and IndexedDB
+ // needs a place where it can store databases.
+ do_get_profile();
+
+ httpserver = new HttpServer();
+ httpserver.registerPathHandler("/geo", geoHandler);
+ httpserver.start(-1);
+ Services.prefs.setCharPref(
+ "geo.provider.network.url",
+ "http://localhost:" + httpserver.identity.primaryPort + "/geo"
+ );
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+
+ // Setting timeout to a very low value to ensure time out will happen.
+ Services.prefs.setIntPref("geo.provider.network.timeout", 5);
+
+ geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
+ geolocation.getCurrentPosition(successCallback, errorCallback);
+}
diff --git a/dom/tests/unit/test_geolocation_reset_accuracy.js b/dom/tests/unit/test_geolocation_reset_accuracy.js
new file mode 100644
index 0000000000..3cb3374e09
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_reset_accuracy.js
@@ -0,0 +1,93 @@
+const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
+const providerContract = "@mozilla.org/geolocation/provider;1";
+
+const categoryName = "geolocation-provider";
+
+var provider = {
+ QueryInterface: ChromeUtils.generateQI([
+ "nsIFactory",
+ "nsIGeolocationProvider",
+ ]),
+ createInstance: function eventsink_ci(iid) {
+ return this.QueryInterface(iid);
+ },
+ startup() {},
+ watch() {},
+ shutdown() {},
+ setHighAccuracy(enable) {
+ this._isHigh = enable;
+ if (enable) {
+ this._seenHigh = true;
+ executeSoon(stop_high_accuracy_watch);
+ }
+ },
+ _isHigh: false,
+ _seenHigh: false,
+};
+
+function successCallback() {
+ Assert.ok(false);
+ do_test_finished();
+}
+
+function errorCallback() {
+ Assert.ok(false);
+ do_test_finished();
+}
+
+var geolocation;
+var watchID2;
+
+function run_test() {
+ if (runningInParent) {
+ // XPCShell does not get a profile by default. The geolocation service
+ // depends on the settings service which uses IndexedDB and IndexedDB
+ // needs a place where it can store databases.
+ do_get_profile();
+
+ Components.manager.nsIComponentRegistrar.registerFactory(
+ providerCID,
+ "Unit test geo provider",
+ providerContract,
+ provider
+ );
+
+ Services.catMan.addCategoryEntry(
+ categoryName,
+ "unit test",
+ providerContract,
+ false,
+ true
+ );
+
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+ }
+
+ do_test_pending();
+
+ geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports);
+ geolocation.watchPosition(successCallback, errorCallback);
+ watchID2 = geolocation.watchPosition(successCallback, errorCallback, {
+ enableHighAccuracy: true,
+ });
+
+ if (!runningInParent) {
+ do_await_remote_message("high_acc_enabled", stop_high_accuracy_watch);
+ }
+}
+
+function stop_high_accuracy_watch() {
+ geolocation.clearWatch(watchID2);
+ check_results();
+ do_test_finished();
+}
+
+function check_results() {
+ if (runningInParent) {
+ // check the provider was set to high accuracy during the test
+ Assert.ok(provider._seenHigh);
+ // check the provider is not currently set to high accuracy
+ Assert.ok(!provider._isHigh);
+ }
+ do_test_finished();
+}
diff --git a/dom/tests/unit/test_geolocation_reset_accuracy_wrap.js b/dom/tests/unit/test_geolocation_reset_accuracy_wrap.js
new file mode 100644
index 0000000000..4160fda14a
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_reset_accuracy_wrap.js
@@ -0,0 +1,61 @@
+const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
+const providerContract = "@mozilla.org/geolocation/provider;1";
+
+const categoryName = "geolocation-provider";
+
+var provider = {
+ QueryInterface: ChromeUtils.generateQI([
+ "nsIFactory",
+ "nsIGeolocationProvider",
+ ]),
+ createInstance: function eventsink_ci(iid) {
+ return this.QueryInterface(iid);
+ },
+ startup() {},
+ watch() {},
+ shutdown() {},
+ setHighAccuracy(enable) {
+ this._isHigh = enable;
+ if (enable) {
+ this._seenHigh = true;
+ do_send_remote_message("high_acc_enabled");
+ }
+ },
+ _isHigh: false,
+ _seenHigh: false,
+};
+
+function run_test() {
+ // XPCShell does not get a profile by default. The geolocation service
+ // depends on the settings service which uses IndexedDB and IndexedDB
+ // needs a place where it can store databases.
+ do_get_profile();
+
+ Components.manager.nsIComponentRegistrar.registerFactory(
+ providerCID,
+ "Unit test geo provider",
+ providerContract,
+ provider
+ );
+
+ Services.catMan.addCategoryEntry(
+ categoryName,
+ "unit test",
+ providerContract,
+ false,
+ true
+ );
+
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+
+ run_test_in_child("test_geolocation_reset_accuracy.js", check_results);
+}
+
+function check_results() {
+ // check the provider was set to high accuracy during the test
+ Assert.ok(provider._seenHigh);
+ // check the provider is not currently set to high accuracy
+ Assert.ok(!provider._isHigh);
+
+ do_test_finished();
+}
diff --git a/dom/tests/unit/test_geolocation_timeout.js b/dom/tests/unit/test_geolocation_timeout.js
new file mode 100644
index 0000000000..07d590a694
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_timeout.js
@@ -0,0 +1,59 @@
+const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
+
+var httpserver = null;
+var geolocation = null;
+
+function geoHandler(metadata, response) {
+ var georesponse = {
+ status: "OK",
+ location: {
+ lat: 42,
+ lng: 42,
+ },
+ accuracy: 42,
+ };
+ var position = JSON.stringify(georesponse);
+ response.processAsync();
+ response.setStatusLine("1.0", 200, "OK");
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "aplication/x-javascript", false);
+ do_timeout(5000, function () {
+ response.write(position);
+ response.finish();
+ });
+}
+
+function successCallback() {
+ Assert.ok(false);
+ do_test_finished();
+}
+
+function errorCallback() {
+ Assert.ok(true);
+ do_test_finished();
+}
+
+function run_test() {
+ do_test_pending();
+
+ if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
+ // XPCShell does not get a profile by default. The geolocation service
+ // depends on the settings service which uses IndexedDB and IndexedDB
+ // needs a place where it can store databases.
+ do_get_profile();
+
+ httpserver = new HttpServer();
+ httpserver.registerPathHandler("/geo", geoHandler);
+ httpserver.start(-1);
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+ Services.prefs.setCharPref(
+ "geo.provider.network.url",
+ "http://localhost:" + httpserver.identity.primaryPort + "/geo"
+ );
+ }
+
+ geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
+ geolocation.getCurrentPosition(successCallback, errorCallback, {
+ timeout: 2000,
+ });
+}
diff --git a/dom/tests/unit/test_geolocation_timeout_wrap.js b/dom/tests/unit/test_geolocation_timeout_wrap.js
new file mode 100644
index 0000000000..cdde9543bd
--- /dev/null
+++ b/dom/tests/unit/test_geolocation_timeout_wrap.js
@@ -0,0 +1,15 @@
+const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
+
+var httpserver = null;
+
+function run_test() {
+ Services.prefs.setBoolPref("geo.provider.network.scan", false);
+
+ httpserver = new HttpServer();
+ httpserver.start(-1);
+ Services.prefs.setCharPref(
+ "geo.provider.network.url",
+ "http://localhost:" + httpserver.identity.primaryPort + "/geo"
+ );
+ run_test_in_child("./test_geolocation_timeout.js");
+}
diff --git a/dom/tests/unit/test_xhr_init.js b/dom/tests/unit/test_xhr_init.js
new file mode 100644
index 0000000000..a2eaf2b4d7
--- /dev/null
+++ b/dom/tests/unit/test_xhr_init.js
@@ -0,0 +1,13 @@
+function run_test() {
+ var x = new XMLHttpRequest({ mozAnon: true, mozSystem: false });
+ Assert.ok(x.mozAnon);
+ Assert.ok(x.mozSystem); // Because we're system principal
+
+ x = new XMLHttpRequest({ mozAnon: true });
+ Assert.ok(x.mozAnon);
+ Assert.ok(x.mozSystem);
+
+ x = new XMLHttpRequest();
+ Assert.ok(!x.mozAnon);
+ Assert.ok(x.mozSystem);
+}
diff --git a/dom/tests/unit/xpcshell.ini b/dom/tests/unit/xpcshell.ini
new file mode 100644
index 0000000000..1921621c0f
--- /dev/null
+++ b/dom/tests/unit/xpcshell.ini
@@ -0,0 +1,24 @@
+[DEFAULT]
+head =
+
+[test_bug319968.js]
+[test_bug465752.js]
+[test_Fetch.js]
+[test_geolocation_provider.js]
+[test_geolocation_monitor.js]
+[test_geolocation_timeout.js]
+[test_geolocation_timeout_wrap.js]
+skip-if = os == "mac"
+ os == "android"
+[test_geolocation_reset_accuracy.js]
+[test_geolocation_reset_accuracy_wrap.js]
+skip-if =
+ os == "mac"
+ os == "android"
+[test_geolocation_position_unavailable.js]
+[test_geolocation_position_unavailable_wrap.js]
+skip-if = os == "mac"
+ os == "android"
+[test_PromiseDebugging.js]
+[test_xhr_init.js]
+[test_geolocation_provider_timeout.js]